diff options
author | Gregory Mullen (grayhatter) <greg@grayhatter.com> | 2016-08-19 16:13:23 -0700 |
---|---|---|
committer | Gregory Mullen (grayhatter) <greg@grayhatter.com> | 2016-08-19 16:13:23 -0700 |
commit | 0e18966a2703d67ac4647832fca595286d8e3568 (patch) | |
tree | 42920a5c4c26df8cd0afe72944250920008d257e /toxcore/Messenger.h | |
parent | 83d4857f080f6393ada976f3151bce5db2f96e23 (diff) |
Make Typing change callback stateless
Moved a few #defines to the top of the header for better readability
Diffstat (limited to 'toxcore/Messenger.h')
-rw-r--r-- | toxcore/Messenger.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 9dae8446..113df796 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -32,6 +32,10 @@ | |||
32 | #define MAX_NAME_LENGTH 128 | 32 | #define MAX_NAME_LENGTH 128 |
33 | /* TODO: this must depend on other variable. */ | 33 | /* TODO: this must depend on other variable. */ |
34 | #define MAX_STATUSMESSAGE_LENGTH 1007 | 34 | #define MAX_STATUSMESSAGE_LENGTH 1007 |
35 | /* Used for TCP relays in Messenger struct (may need to be % 2 == 0)*/ | ||
36 | #define NUM_SAVED_TCP_RELAYS 8 | ||
37 | /* This cannot be bigger than 256 */ | ||
38 | #define MAX_CONCURRENT_FILE_PIPES 256 | ||
35 | 39 | ||
36 | 40 | ||
37 | #define FRIEND_ADDRESS_SIZE (crypto_box_PUBLICKEYBYTES + sizeof(uint32_t) + sizeof(uint16_t)) | 41 | #define FRIEND_ADDRESS_SIZE (crypto_box_PUBLICKEYBYTES + sizeof(uint32_t) + sizeof(uint16_t)) |
@@ -152,9 +156,6 @@ enum { | |||
152 | FILE_PAUSE_BOTH | 156 | FILE_PAUSE_BOTH |
153 | }; | 157 | }; |
154 | 158 | ||
155 | /* This cannot be bigger than 256 */ | ||
156 | #define MAX_CONCURRENT_FILE_PIPES 256 | ||
157 | |||
158 | enum { | 159 | enum { |
159 | FILECONTROL_ACCEPT, | 160 | FILECONTROL_ACCEPT, |
160 | FILECONTROL_PAUSE, | 161 | FILECONTROL_PAUSE, |
@@ -207,7 +208,6 @@ typedef struct { | |||
207 | struct Receipts *receipts_end; | 208 | struct Receipts *receipts_end; |
208 | } Friend; | 209 | } Friend; |
209 | 210 | ||
210 | |||
211 | struct Messenger { | 211 | struct Messenger { |
212 | 212 | ||
213 | Networking_Core *net; | 213 | Networking_Core *net; |
@@ -233,7 +233,6 @@ struct Messenger { | |||
233 | Friend *friendlist; | 233 | Friend *friendlist; |
234 | uint32_t numfriends; | 234 | uint32_t numfriends; |
235 | 235 | ||
236 | #define NUM_SAVED_TCP_RELAYS 8 | ||
237 | uint8_t has_added_relays; // If the first connection has occurred in do_messenger | 236 | uint8_t has_added_relays; // If the first connection has occurred in do_messenger |
238 | Node_format loaded_relays[NUM_SAVED_TCP_RELAYS]; // Relays loaded from config | 237 | Node_format loaded_relays[NUM_SAVED_TCP_RELAYS]; // Relays loaded from config |
239 | 238 | ||
@@ -244,7 +243,6 @@ struct Messenger { | |||
244 | void (*friend_userstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *); | 243 | void (*friend_userstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *); |
245 | void *friend_userstatuschange_userdata; | 244 | void *friend_userstatuschange_userdata; |
246 | void (*friend_typingchange)(struct Messenger *m, uint32_t, _Bool, void *); | 245 | void (*friend_typingchange)(struct Messenger *m, uint32_t, _Bool, void *); |
247 | void *friend_typingchange_userdata; | ||
248 | void (*read_receipt)(struct Messenger *m, uint32_t, uint32_t, void *); | 246 | void (*read_receipt)(struct Messenger *m, uint32_t, uint32_t, void *); |
249 | void *read_receipt_userdata; | 247 | void *read_receipt_userdata; |
250 | void (*friend_connectionstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *); | 248 | void (*friend_connectionstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *); |
@@ -501,7 +499,7 @@ void m_callback_userstatus(Messenger *m, void (*function)(Messenger *m, uint32_t | |||
501 | /* Set the callback for typing changes. | 499 | /* Set the callback for typing changes. |
502 | * Function(uint32_t friendnumber, uint8_t is_typing) | 500 | * Function(uint32_t friendnumber, uint8_t is_typing) |
503 | */ | 501 | */ |
504 | void m_callback_typingchange(Messenger *m, void(*function)(Messenger *m, uint32_t, _Bool, void *), void *userdata); | 502 | void m_callback_typingchange(Messenger *m, void(*function)(Messenger *m, uint32_t, _Bool, void *)); |
505 | 503 | ||
506 | /* Set the callback for read receipts. | 504 | /* Set the callback for read receipts. |
507 | * Function(uint32_t friendnumber, uint32_t receipt) | 505 | * Function(uint32_t friendnumber, uint32_t receipt) |
@@ -527,6 +525,7 @@ void m_callback_read_receipt(Messenger *m, void (*function)(Messenger *m, uint32 | |||
527 | */ | 525 | */ |
528 | void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, void *), | 526 | void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, void *), |
529 | void *userdata); | 527 | void *userdata); |
528 | |||
530 | /* Same as previous but for internal A/V core usage only */ | 529 | /* Same as previous but for internal A/V core usage only */ |
531 | void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *), | 530 | void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *), |
532 | void *userdata); | 531 | void *userdata); |