summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.h
AgeCommit message (Collapse)Author
2016-08-20Make the friend message callback statelessGregory Mullen (grayhatter)
2016-08-19Make Typing change callback statelessGregory Mullen (grayhatter)
Moved a few #defines to the top of the header for better readability
2016-08-18Make friend_status_message callback stateless.iphydf
See #40 for details.
2016-08-18Make tox_callback_friend_name stateless.iphydf
See #27 and #40 for details.
2016-08-17Make self_connection_status callback stateless.iphydf
**What are we doing?** We are moving towards stateless callbacks. This means that when registering a callback, you no longer pass a user data pointer. Instead, you pass a user data pointer to tox_iterate. This pointer is threaded through the code, passed to each callback. The callback can modify the data pointed at. An extra indirection will be needed if the pointer itself can change. **Why?** Currently, callbacks are registered with a user data pointer. This means the library has N pointers for N different callbacks. These pointers need to be managed by the client code. Managing the lifetime of the pointee can be difficult. In C++, it takes special effort to ensure that the lifetime of user data extends at least beyond the lifetime of the Tox instance. For other languages, the situation is much worse. Java and other garbage collected languages may move objects in memory, so the pointers are not stable. Tox4j goes through a lot of effort to make the Java/Scala user experience a pleasant one by keeping a global array of Tox+userdata on the C++ side, and communicating via protobufs. A Haskell FFI would have to do similarly complex tricks. Stateless callbacks ensure that a user data pointer only needs to live during a single function call. This means that the user code (or language runtime) can move the data around at will, as long as it sets the new location in the callback. **How?** We are doing this change one callback at a time. After each callback, we ensure that everything still works as expected. This means the toxcore change will require 15 Pull Requests.
2015-05-08Added basic TCP server hosting to tox.h api.irungentoo
TODO: tell friends we are hosting a relay and prioritize using relays hosted by friends over bootstrap ones.
2015-05-03Removed useless code.irungentoo
2015-04-30Fixed some warnings.irungentoo
Removed useless include.
2015-04-27Move LAN discovery from Messenger to friend_connection.irungentoo
2015-04-24Fixed a couple possible issues with the friend connection callback.irungentoo
A TCP callback could be received when only a UDP connection was present. Increased a UDP timeout to make it less likely to time out and switch to TCP.
2015-04-21Move the send tcp relay packet from Messenger to friend connection.irungentoo
2015-04-16Properly share connected relays and connect to the friend correctlyirungentoo
with them.
2015-04-02API function to get last seen timestamp of friendJfreegman
also removed remnants of the no longer used variable ping_lastrecv
2015-03-23Changed the share relay packet id.irungentoo
2015-03-21Transfers with filelength == 0 now behave exactly like transfers of everyirungentoo
other size (except streaming of course).
2015-03-20Allow sending of file transfer requests with length 0 but don't allocateirungentoo
any file number for them in core. These can be used to tell friends we don't have an avatar set or to unset a set avatar.
2015-03-18Merged normal message function and send action function into oneirungentoo
messaging function. This removes code duplication and allows us to easily add new message types to the api without having to add new functions.
2015-03-17Added tox_file_send_seek() function to api.irungentoo
This function can be used to seek an incoming file tranfer right before accepting it. It is meant to be used to resume incomplete file tranfers by clients.
2015-03-17Added and implemented file_id parameter to file tranfers.irungentoo
file_id is a 32byte identifier that can be used by users to identify file tranfers across core/client restarts in order to resume broken file tranfers. In avatar tranfers it corresponds to the hash of the avatar. Added tox_file_get_file_id() function to api to obtain the file_id of an ongoing file transfer. If not set, core will generate a random one.
2015-03-15Avatar hash is now the filename of the file transfer instead of theirungentoo
first 32 bytes. Enforce length of filename in core when transfer is an avatar type transfer to make things more safe.
2015-03-13File kind is now a uint32_t.irungentoo
This allows clients to agree on what numbers mean what without having it be set in core.
2015-03-13tox_file_send_chunk() must now send data the same length as requestedirungentoo
in the requested chunk callback. For zero size transfers if the data sent is not the same length, the file is assumed to be done.
2015-03-12Don't assume tox_file_send_chunk() is called in the request chunkirungentoo
callback.
2015-03-12Added position parameter to tox_file_send_chunk().irungentoo
This is done so that the function now has the same parameters as the request chunk callback.
2015-03-12tox_new now sets error to TOX_ERR_NEW_PORT_ALLOC when binding to port fails.irungentoo
2015-03-11tox_callback_connection_status() implemented.irungentoo
Attempted fix of connection checking to make it more stable.
2015-03-10Implementation of new api file transfers.irungentoo
Everything should work except resuming.
2015-03-09Updated new_filesender function in Messenger.cirungentoo
2015-03-06Updated File request packet to new format.irungentoo
[uint8_t packet_id (PACKET_ID_FILE_SENDREQUEST)][uint8_t file_number] [uint32_t type][uint64_t file_size][filename (currently max 255 bytes)] recv file numbers are << by 16 to distinguish them from sending files.
2015-03-05enums are no longer typedefed to uint8_t.irungentoo
2015-03-05Code cleanups.irungentoo
Fixed wrong variable used, removed useless elements of struct.
2015-03-02Merge branch 'port_range_option' of https://github.com/saneki/toxcore into ↵irungentoo
new_api
2015-02-27Removed backwards compatibility code from core.irungentoo
That function should be static.
2015-02-27Allow for specifying the port range to use in Tox_Optionssaneki
2015-02-26Added different error codes for custom packet functions in Messenger.irungentoo
2015-02-26Changes to custom packet functions in Messenger.irungentoo
Added function for rtp A/V packets, modified functions to behave correctly for the new api.
2015-02-24Remove avatar stuff from Messenger.irungentoo
The new api sees avatars as a different type of file transfer.
2015-02-20Implemented message send functions in public api.irungentoo
Internal message functions now return better error codes.
2015-02-20Merge branch 'fixed-receipts' into new_apiirungentoo
2015-02-19Tox connection function and callback should now work as expected.irungentoo
Changes in Messenger to call the callback every time the connection type changes from TCP to UDP.
2015-02-19Typing and status functions implemented.irungentoo
2015-02-18use bool in is typing callback.irungentoo
2015-02-17Updated types in Messenger callbacks to fit with the ones in the new api.irungentoo
Friend number changed from int32_t to uint32_t. Some lengths changed to size_t.
2015-02-17Messenger add friends functions error code fixes.irungentoo
Removed unknown error. norequest function now returns proper error codes.
2015-02-16More new api work done.irungentoo
m_copy_self_statusmessage no longer takes a buffer length argument.
2015-02-16Allow empty names and status messages.irungentoo
2015-02-15New api progress.irungentoo
2015-01-27client_id is a bad name for the long term public key.irungentoo
2014-12-21Some refactoring of proxy codeMaxim Biro
2014-12-09Merge branch 'more_consistent_custom_packet_handlers' of ↵irungentoo
https://github.com/wrouesnel/toxcore