From 30524bf41513a334f0e32117b85aad2f661eed2b Mon Sep 17 00:00:00 2001 From: irungentoo Date: Wed, 27 Aug 2014 15:13:44 -0400 Subject: 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. --- toxcore/Messenger.h | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'toxcore/Messenger.h') 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 @@ #define PACKET_ID_STATUSMESSAGE 49 #define PACKET_ID_USERSTATUS 50 #define PACKET_ID_TYPING 51 -#define PACKET_ID_RECEIPT 63 #define PACKET_ID_MESSAGE 64 #define PACKET_ID_ACTION 65 #define PACKET_ID_MSI 69 @@ -74,6 +73,13 @@ typedef struct { TCP_Proxy_Info proxy_info; } Messenger_Options; + +struct Receipts { + uint32_t packet_num; + uint32_t msg_id; + struct Receipts *next; +}; + /* Status definitions. */ enum { NOFRIEND, @@ -168,7 +174,6 @@ typedef struct { uint8_t is_typing; uint16_t info_size; // Length of the info. uint32_t message_id; // a semi-unique id used in read receipts. - uint8_t receives_read_receipts; // shall we send read receipts to this person? uint32_t friendrequest_nospam; // The nospam number used in the friend request. uint64_t ping_lastrecv; uint64_t ping_lastsent; @@ -187,6 +192,9 @@ typedef struct { int (*function)(void *object, const uint8_t *data, uint32_t len); void *object; } lossless_packethandlers[PACKET_ID_LOSSLESS_RANGE_SIZE]; + + struct Receipts *receipts_start; + struct Receipts *receipts_end; } Friend; @@ -335,12 +343,8 @@ int m_friend_exists(const Messenger *m, int32_t friendnumber); * * You will want to retain the return value, it will be passed to your read_receipt callback * if one is received. - * m_sendmessage_withid will send a message with the id of your choosing, - * however we can generate an id for you by calling plain m_sendmessage. */ uint32_t m_sendmessage(Messenger *m, int32_t friendnumber, const uint8_t *message, uint32_t length); -uint32_t m_sendmessage_withid(Messenger *m, int32_t friendnumber, uint32_t theid, const uint8_t *message, - uint32_t length); /* Send an action to an online friend. * @@ -349,12 +353,8 @@ uint32_t m_sendmessage_withid(Messenger *m, int32_t friendnumber, uint32_t theid * * You will want to retain the return value, it will be passed to your read_receipt callback * if one is received. - * m_sendaction_withid will send an action message with the id of your choosing, - * however we can generate an id for you by calling plain m_sendaction. */ uint32_t m_sendaction(Messenger *m, int32_t friendnumber, const uint8_t *action, uint32_t length); -uint32_t m_sendaction_withid(const Messenger *m, int32_t friendnumber, uint32_t theid, const uint8_t *action, - uint32_t length); /* Set the name and name_length of a friend. * 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); */ uint8_t m_get_istyping(const Messenger *m, int32_t friendnumber); -/* Sets whether we send read receipts for friendnumber. - * This function is not lazy, and it will fail if yesno is not (0 or 1). - */ -void m_set_sends_receipts(Messenger *m, int32_t friendnumber, int yesno); - /* Set the function that will be executed when a friend request is received. * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) */ -- cgit v1.2.3