summaryrefslogtreecommitdiff
path: root/toxcore/friend_requests.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-05 10:31:29 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-05 23:09:28 +0000
commit8739f7fccb7cafc54ca0f5fa074c9a740f7048ba (patch)
tree88e9f53fa6e734cd8095487d1896c56f844c782c /toxcore/friend_requests.h
parent64d0297acc7d6a1697683052e15cc76383312c38 (diff)
Make tox.c unambiguously parseable.
Rules: 1. Constants are uppercase names: THE_CONSTANT. 2. SUE[1] types start with an uppercase letter and have at least one lowercase letter in it: The_Type, THE_Type. 3. Function types end in "_cb": tox_friend_connection_cb. 4. Variable and function names are all lowercase: the_function. This makes it easier for humans reading the code to determine what an identifier means. I'm not convinced by the enum type name change, but I don't know a better rule. Currently, a lot of enum types are spelled like constants, which is confusing. [1] struct/union/enum
Diffstat (limited to 'toxcore/friend_requests.h')
-rw-r--r--toxcore/friend_requests.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/toxcore/friend_requests.h b/toxcore/friend_requests.h
index e6948b6c..91571775 100644
--- a/toxcore/friend_requests.h
+++ b/toxcore/friend_requests.h
@@ -41,11 +41,12 @@ uint32_t get_nospam(const Friend_Requests *fr);
41 */ 41 */
42int remove_request_received(Friend_Requests *fr, const uint8_t *real_pk); 42int remove_request_received(Friend_Requests *fr, const uint8_t *real_pk);
43 43
44typedef void fr_friend_request_cb(void *, const uint8_t *, const uint8_t *, size_t, void *);
45
44/* Set the function that will be executed when a friend request for us is received. 46/* Set the function that will be executed when a friend request for us is received.
45 * Function format is function(uint8_t * public_key, uint8_t * data, size_t length, void * userdata) 47 * Function format is function(uint8_t * public_key, uint8_t * data, size_t length, void * userdata)
46 */ 48 */
47void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, size_t, 49void callback_friendrequest(Friend_Requests *fr, fr_friend_request_cb *function, void *object);
48 void *), void *object);
49 50
50/* Set the function used to check if a friend request should be displayed to the user or not. 51/* Set the function used to check if a friend request should be displayed to the user or not.
51 * Function format is int function(uint8_t * public_key, void * userdata) 52 * Function format is int function(uint8_t * public_key, void * userdata)