summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-08-27 15:13:44 -0400
committerirungentoo <irungentoo@gmail.com>2014-08-27 15:13:44 -0400
commit30524bf41513a334f0e32117b85aad2f661eed2b (patch)
tree44c0acbaf2daf6b41330f5ead3838be9f1e85ec6 /toxcore/Messenger.h
parentff02d5a607362df1382eeb4d7ef146eaab1c8dd1 (diff)
Changed how receipts work.
Messages now have a maximum length of 1372. Receipt packets have been removed, instead net_crypto tells us if the other peer has received the packets or not.
Diffstat (limited to 'toxcore/Messenger.h')
-rw-r--r--toxcore/Messenger.h25
1 files changed, 10 insertions, 15 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h
index c45eaff9..c9f3cf88 100644
--- a/toxcore/Messenger.h
+++ b/toxcore/Messenger.h
@@ -46,7 +46,6 @@
46#define PACKET_ID_STATUSMESSAGE 49 46#define PACKET_ID_STATUSMESSAGE 49
47#define PACKET_ID_USERSTATUS 50 47#define PACKET_ID_USERSTATUS 50
48#define PACKET_ID_TYPING 51 48#define PACKET_ID_TYPING 51
49#define PACKET_ID_RECEIPT 63
50#define PACKET_ID_MESSAGE 64 49#define PACKET_ID_MESSAGE 64
51#define PACKET_ID_ACTION 65 50#define PACKET_ID_ACTION 65
52#define PACKET_ID_MSI 69 51#define PACKET_ID_MSI 69
@@ -74,6 +73,13 @@ typedef struct {
74 TCP_Proxy_Info proxy_info; 73 TCP_Proxy_Info proxy_info;
75} Messenger_Options; 74} Messenger_Options;
76 75
76
77struct Receipts {
78 uint32_t packet_num;
79 uint32_t msg_id;
80 struct Receipts *next;
81};
82
77/* Status definitions. */ 83/* Status definitions. */
78enum { 84enum {
79 NOFRIEND, 85 NOFRIEND,
@@ -168,7 +174,6 @@ typedef struct {
168 uint8_t is_typing; 174 uint8_t is_typing;
169 uint16_t info_size; // Length of the info. 175 uint16_t info_size; // Length of the info.
170 uint32_t message_id; // a semi-unique id used in read receipts. 176 uint32_t message_id; // a semi-unique id used in read receipts.
171 uint8_t receives_read_receipts; // shall we send read receipts to this person?
172 uint32_t friendrequest_nospam; // The nospam number used in the friend request. 177 uint32_t friendrequest_nospam; // The nospam number used in the friend request.
173 uint64_t ping_lastrecv; 178 uint64_t ping_lastrecv;
174 uint64_t ping_lastsent; 179 uint64_t ping_lastsent;
@@ -187,6 +192,9 @@ typedef struct {
187 int (*function)(void *object, const uint8_t *data, uint32_t len); 192 int (*function)(void *object, const uint8_t *data, uint32_t len);
188 void *object; 193 void *object;
189 } lossless_packethandlers[PACKET_ID_LOSSLESS_RANGE_SIZE]; 194 } lossless_packethandlers[PACKET_ID_LOSSLESS_RANGE_SIZE];
195
196 struct Receipts *receipts_start;
197 struct Receipts *receipts_end;
190} Friend; 198} Friend;
191 199
192 200
@@ -335,12 +343,8 @@ int m_friend_exists(const Messenger *m, int32_t friendnumber);
335 * 343 *
336 * You will want to retain the return value, it will be passed to your read_receipt callback 344 * You will want to retain the return value, it will be passed to your read_receipt callback
337 * if one is received. 345 * if one is received.
338 * m_sendmessage_withid will send a message with the id of your choosing,
339 * however we can generate an id for you by calling plain m_sendmessage.
340 */ 346 */
341uint32_t m_sendmessage(Messenger *m, int32_t friendnumber, const uint8_t *message, uint32_t length); 347uint32_t m_sendmessage(Messenger *m, int32_t friendnumber, const uint8_t *message, uint32_t length);
342uint32_t m_sendmessage_withid(Messenger *m, int32_t friendnumber, uint32_t theid, const uint8_t *message,
343 uint32_t length);
344 348
345/* Send an action to an online friend. 349/* Send an action to an online friend.
346 * 350 *
@@ -349,12 +353,8 @@ uint32_t m_sendmessage_withid(Messenger *m, int32_t friendnumber, uint32_t theid
349 * 353 *
350 * You will want to retain the return value, it will be passed to your read_receipt callback 354 * You will want to retain the return value, it will be passed to your read_receipt callback
351 * if one is received. 355 * if one is received.
352 * m_sendaction_withid will send an action message with the id of your choosing,
353 * however we can generate an id for you by calling plain m_sendaction.
354 */ 356 */
355uint32_t m_sendaction(Messenger *m, int32_t friendnumber, const uint8_t *action, uint32_t length); 357uint32_t m_sendaction(Messenger *m, int32_t friendnumber, const uint8_t *action, uint32_t length);
356uint32_t m_sendaction_withid(const Messenger *m, int32_t friendnumber, uint32_t theid, const uint8_t *action,
357 uint32_t length);
358 358
359/* Set the name and name_length of a friend. 359/* Set the name and name_length of a friend.
360 * name must be a string of maximum MAX_NAME_LENGTH length. 360 * name must be a string of maximum MAX_NAME_LENGTH length.
@@ -453,11 +453,6 @@ int m_set_usertyping(Messenger *m, int32_t friendnumber, uint8_t is_typing);
453 */ 453 */
454uint8_t m_get_istyping(const Messenger *m, int32_t friendnumber); 454uint8_t m_get_istyping(const Messenger *m, int32_t friendnumber);
455 455
456/* Sets whether we send read receipts for friendnumber.
457 * This function is not lazy, and it will fail if yesno is not (0 or 1).
458 */
459void m_set_sends_receipts(Messenger *m, int32_t friendnumber, int yesno);
460
461/* Set the function that will be executed when a friend request is received. 456/* Set the function that will be executed when a friend request is received.
462 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) 457 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length)
463 */ 458 */