summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
AgeCommit message (Collapse)Author
2017-01-10Always kill invalid file transfers when receiving file controls.iphydf
Previously, toxcore would send a kill control to the friend only if the file control was valid. Determining which file transfer is used does not depend on the specific file control. We can always kill it in that case. Also, added some logging for file control logic, since there is no other feedback on error (failure of the file control handler is swallowed).
2017-01-10Minor simplification in `file_seek` code.iphydf
Details in comments.
2016-12-22Wrap all sodium/nacl functions in crypto_core.c.iphydf
2016-12-20Avoid array out of bounds read in friend saving.iphydf
Fixes #345.
2016-12-14Add option to disable local peer discoveryMaxim Biro
2016-12-13Fix padding in SAVED_FRIEND struct and add test.Robin Lindén
Test covers saving and loading of a Tox instance with a friend added.
2016-12-12Conditionally enable non-portable assert on LP64.iphydf
This only works on LP64. It may fail on Windows, which can be LLP64 (IL32P64).
2016-12-10Fix off by one error in saving our own status message.iphydf
2016-12-03rename messenger function, prepend m_Gregory Mullen (grayhatter)
2016-11-24add NAT hole punching level to Tox APIGregory Mullen (grayhatter)
2016-11-21Made saveformat platform-independent.Robin Lindén
Fixes #215.
2016-11-14new_messenger(options ... ) must never be nullGregory Mullen (grayhatter)
2016-11-06Move log callback to options.iphydf
Previously, all log messages generated by tox_new (which is quite a lot) were dropped, because client code had no chance to register a logging callback, yet. This change allows setting the log callback from the beginning and removes the ability to unset it. Since the log callback is forever special, since it can't be stateless, we don't necessarily need to treat it uniformly (with `event`).
2016-11-06Remove assocendoffile78
2016-10-29Rename some internal "group chat" things to "conference".iphydf
This is to allow new group chats to coexist with old group chats. We do not rename everything in group.[ch] to conference, yet, because it's not currently necessary, and a general internal API overhaul is due at some point anyway.
2016-09-30Add the 'Tox' context object to the logger.iphydf
We don't currently support callbacks without context object.
2016-09-24Make toxcore code C++ compatible.iphydf
It is still C code, so still compatible with C compilers as well. This change lets us see more clearly where implicit conversions occur by making them explicit.
2016-09-24Minor cleanups: unused vars, unreachable code, static globals.iphydf
- All global variables should be static unless they have an explicit extern declaration in a header file. - `to_compare` was not used in encryptsave and toxav tests. - `break` in switch cases is not required directly after `return`, `goto`, or a noreturn function like `abort`.
2016-09-22Make TCP_Server opaque.iphydf
We should aim to make as many structures module-private as possible.
2016-09-21Make group callbacks statelessJfreegman
2016-09-19Revert "Make ToxAV stateless"iphydf
This reverts commit 21f8db12c45bd56293262cd4abfb73cd9abec821. It is currently broken. Incoming call callbacks are not invoked, and instead the client goes offline immediately.
2016-09-18Added UB comment r/t deleting a friend w/ active callGregory Mullen (grayhatter)
2016-09-17Make ToxAV statelessGregory Mullen (grayhatter)
2016-09-16Ensure that all TODOs have an owner.iphydf
In the future, all TODOs added either need a bug number (TODO(#NN)) or a person's github user name. By default, I made irungentoo the owner of all toxcore TODOs, mannol the owner of toxav TODOs, and myself the owner of API TODOs.
2016-09-13Use <stdbool.h> and replace _Bool with bool.iphydf
This header is a requirement for the public API, therefore is assumed to exist. It is a C99 standard library header, and _Bool is not intended to be used directly, except in legacy code that defines bool (and true/false) itself. We don't use or depend on such code. None of our client code uses or depends on such code. There is no reason to not use bool.
2016-09-13Add some astyle options to make it do more.iphydf
It now enforces a bit more formatting. In particular, padding inside parentheses is removed. I would like it to remove padding after unary operators, but there seems to be no option for that.
2016-09-13Group #include directives in 3-4 groups.iphydf
1. Current module (if C file). 2. Headers from current library. 3. Headers from other library (e.g. toxcore includes in toxav). 4. System headers.
2016-09-10make the majority of the callbacks stateless and add some status to a testcasemichael bishop
2016-09-08Fix potential null pointer dereference.iphydf
This used to not be an issue, but now that the logger is no longer global, not all source locations may have access to it.
2016-09-07Comment intentional switch fallthroughsJfreegman
2016-09-06Improve static and const correctness.iphydf
- Any non-externally-visible declarations should be `static`. - Casting away the `const` qualifier from pointers-to-const is dangerous. All but one instance of this are now correct. The one instance where we can't keep `const` is one where toxav code actually writes to a chunk of memory marked as `const`. This code also assumes 4 byte alignment of data packets. I don't know whether that is a valid assumption, but it's likely unportable, and *not* obviously correct. - Replaced empty parameter lists with `(void)` to avoid passing parameters to it. Empty parameter lists are old style declarations for unknown number and type of arguments. - Commented out (as `#if DHT_HARDENING` block) the hardening code that was never executed. - Minor style fix: don't use `default` in enum-switches unless the number of enumerators in the default case is very large. In this case, it was 2, so we want to list them both explicitly to be warned about missing one if we add one in the future. - Removed the only two function declarations from nTox.h and put them into nTox.c. They are not used outside and nTox is not a library.
2016-09-06Make friend requests statelessGregory Mullen (grayhatter)
Messenger is slightly twisty when it comes to sending connection status callbacks It will very likely need at the very least a partial refactor to clean it up a bit. Toxcore shouldn't need void *userdata as deep as is currently does. (amend 1) Because of the nature of toxcore connection callbacks, I decided to change this commit from statelessness for connections changes to statelessness for friend requests. It's simpler this was and doesn't include doing anything foolish in the time between commits. group fixup because grayhatter doesn't want to do it "arguably correct" is not how you write security sensitive code Clear a compiler warning about types within a function.
2016-09-05Make packet data a ptr-to-const.iphydf
Ensure that nobody inadvertly modifies the temporary packet data buffer.
2016-09-02Do not use `else` after `return`.iphydf
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-01Sort #includes in all source files.iphydf
2016-08-31Add newlines because astyle wants them.iphydf
We'll revert this once we move to clang-format.
2016-08-31Add braces to all if statements.iphydf
2016-08-27Move logging to a callback.iphydf
This removes the global logger (which by the way was deleted when the first tox was killed, so other toxes would then stop logging). Various bits of the code now carry a logger or pass it around. It's a bit less transparent now, but now there is no need to have a global logger, and clients can decide what to log and where.
2016-08-22Make Message received receipts statelessGregory Mullen (grayhatter)
2016-08-22Make Friend User Status statelessGregory Mullen (grayhatter)
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-17Add missing DHT_bootstrap to CMakeLists.txt.iphydf
- This PR also adds a DEBUG cmake option that enables -DTOX_DEBUG. - We also remove `-Wall`, because there are too many warnings, and nobody really looks at them at the moment. We'll see about fixing them soon. We'll also want to enable `-Werror` at some point. - Finally, this PR enables `-O3` to make sure toxcore still works correctly under heavy compiler optimisations.
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.
2016-01-27 fix: compare sensitive data with sodium_memcmpRoman Proskuryakov
fix: make increment_nonce & increment_nonce_number independent of user-controlled input fix: make crypto_core more stable agains null ptr dereference
2015-10-23Prevent seek equal to size of file transfer so that toxcore respects what ↵irungentoo
the docs say.
2015-10-23Fix PACKET_ID_OFFLINE fallinthrough PACKET_ID_NICKNAMEtux3
This fixes the PACKET_ID_OFFLINE handling code incorrectly falling through to the PACKET_ID_NICKNAME handling code This bug resulted in a friend B's name being wiped on friend A's client after B removes A Fixes tux3/qTox#1967 Fixes #1426
2015-10-10New Adaptive BR algorithm, cleanups and fixesEniz Vukovic