summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/Messenger.h')
-rw-r--r--toxcore/Messenger.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h
index 40e857d1..375e2025 100644
--- a/toxcore/Messenger.h
+++ b/toxcore/Messenger.h
@@ -155,8 +155,15 @@ typedef struct {
155 struct File_Transfers file_receiving[MAX_CONCURRENT_FILE_PIPES]; 155 struct File_Transfers file_receiving[MAX_CONCURRENT_FILE_PIPES];
156 int invited_groups[MAX_INVITED_GROUPS]; 156 int invited_groups[MAX_INVITED_GROUPS];
157 uint16_t invited_groups_num; 157 uint16_t invited_groups_num;
158
159 Packet_Handles packethandlers[TOTAL_USERPACKETS];
158} Friend; 160} Friend;
159 161
162typedef struct {
163 uint32_t friend_num;
164 IP_Port ip_port;
165} Online_Friend;
166
160typedef struct Messenger { 167typedef struct Messenger {
161 168
162 Networking_Core *net; 169 Networking_Core *net;
@@ -178,6 +185,8 @@ typedef struct Messenger {
178 185
179 Friend *friendlist; 186 Friend *friendlist;
180 uint32_t numfriends; 187 uint32_t numfriends;
188
189 Online_Friend *online_friendlist;
181 uint32_t numonline_friends; 190 uint32_t numonline_friends;
182 191
183 Group_Chat **chats; 192 Group_Chat **chats;
@@ -628,6 +637,22 @@ int m_msi_packet(Messenger *m, int friendnumber, uint8_t *data, uint16_t length)
628 637
629/**********************************************/ 638/**********************************************/
630 639
640/* Set handlers for custom user packets (RTP packets for example.)
641 *
642 * return -1 on failure.
643 * return 0 on success.
644 */
645int custom_user_packet_registerhandler(Messenger *m, int friendnumber, uint8_t byte, packet_handler_callback cb,
646 void *object);
647
648/* High level function to send custom user packets.
649 *
650 * return -1 on failure.
651 * return number of bytes sent on success.
652 */
653int send_custom_user_packet(Messenger *m, int friendnumber, uint8_t *data, uint32_t length);
654
655/**********************************************/
631/* Run this at startup. 656/* Run this at startup.
632 * return allocated instance of Messenger on success. 657 * return allocated instance of Messenger on success.
633 * return 0 if there are problems. 658 * return 0 if there are problems.