diff options
author | mannol <eniz_vukovic@hotmail.com> | 2014-02-15 20:44:33 +0100 |
---|---|---|
committer | mannol <eniz_vukovic@hotmail.com> | 2014-02-16 19:11:55 -0500 |
commit | 393433ce9910c3dffed9090c7965654f23a8e7a8 (patch) | |
tree | b96e08543fa3a647099cb6f3a9e55836453f51bc /toxcore/Messenger.h | |
parent | 292708c33634ee0b9a2243a2181018565558bc5c (diff) |
Public header ready to go
Diffstat (limited to 'toxcore/Messenger.h')
-rw-r--r-- | toxcore/Messenger.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index e09b2f30..ccca8fba 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 | ||
162 | typedef struct { | ||
163 | uint32_t friend_num; | ||
164 | IP_Port ip_port; | ||
165 | } Online_Friend; | ||
166 | |||
160 | typedef struct Messenger { | 167 | typedef struct Messenger { |
161 | 168 | ||
162 | Networking_Core *net; | 169 | Networking_Core *net; |
@@ -179,6 +186,9 @@ typedef struct Messenger { | |||
179 | Friend *friendlist; | 186 | Friend *friendlist; |
180 | uint32_t numfriends; | 187 | uint32_t numfriends; |
181 | 188 | ||
189 | Online_Friend *online_friendlist; | ||
190 | uint32_t numonline_friends; | ||
191 | |||
182 | Group_Chat **chats; | 192 | Group_Chat **chats; |
183 | uint32_t numchats; | 193 | uint32_t numchats; |
184 | 194 | ||
@@ -200,6 +210,8 @@ typedef struct Messenger { | |||
200 | void *friend_statuschange_userdata; | 210 | void *friend_statuschange_userdata; |
201 | void (*friend_connectionstatuschange)(struct Messenger *m, int, uint8_t, void *); | 211 | void (*friend_connectionstatuschange)(struct Messenger *m, int, uint8_t, void *); |
202 | void *friend_connectionstatuschange_userdata; | 212 | void *friend_connectionstatuschange_userdata; |
213 | void (*friend_connectionstatuschange_internal)(struct Messenger *m, int, uint8_t, void *); | ||
214 | void *friend_connectionstatuschange_internal_userdata; | ||
203 | 215 | ||
204 | void (*group_invite)(struct Messenger *m, int, uint8_t *, void *); | 216 | void (*group_invite)(struct Messenger *m, int, uint8_t *, void *); |
205 | void *group_invite_userdata; | 217 | void *group_invite_userdata; |
@@ -450,6 +462,9 @@ void m_callback_read_receipt(Messenger *m, void (*function)(Messenger *m, int, u | |||
450 | * It's assumed that when adding friends, their connection status is offline. | 462 | * It's assumed that when adding friends, their connection status is offline. |
451 | */ | 463 | */ |
452 | void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, int, uint8_t, void *), void *userdata); | 464 | void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, int, uint8_t, void *), void *userdata); |
465 | /* Same as previous but for internal A/V core usage only */ | ||
466 | void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Messenger *m, int, uint8_t, void *), | ||
467 | void *userdata); | ||
453 | 468 | ||
454 | /**********GROUP CHATS************/ | 469 | /**********GROUP CHATS************/ |
455 | 470 | ||
@@ -627,6 +642,22 @@ int m_msi_packet(Messenger *m, int friendnumber, uint8_t *data, uint16_t length) | |||
627 | 642 | ||
628 | /**********************************************/ | 643 | /**********************************************/ |
629 | 644 | ||
645 | /* Set handlers for custom user packets (RTP packets for example.) | ||
646 | * | ||
647 | * return -1 on failure. | ||
648 | * return 0 on success. | ||
649 | */ | ||
650 | int custom_user_packet_registerhandler(Messenger *m, int friendnumber, uint8_t byte, packet_handler_callback cb, | ||
651 | void *object); | ||
652 | |||
653 | /* High level function to send custom user packets. | ||
654 | * | ||
655 | * return -1 on failure. | ||
656 | * return number of bytes sent on success. | ||
657 | */ | ||
658 | int send_custom_user_packet(Messenger *m, int friendnumber, uint8_t *data, uint32_t length); | ||
659 | |||
660 | /**********************************************/ | ||
630 | /* Run this at startup. | 661 | /* Run this at startup. |
631 | * return allocated instance of Messenger on success. | 662 | * return allocated instance of Messenger on success. |
632 | * return 0 if there are problems. | 663 | * return 0 if there are problems. |
@@ -682,6 +713,9 @@ int messenger_load_encrypted(Messenger *m, uint8_t *data, uint32_t length, uint8 | |||
682 | * for copy_friendlist. */ | 713 | * for copy_friendlist. */ |
683 | uint32_t count_friendlist(Messenger *m); | 714 | uint32_t count_friendlist(Messenger *m); |
684 | 715 | ||
716 | /* Return the number of online friends in the instance m. */ | ||
717 | uint32_t get_num_online_friends(Messenger *m); | ||
718 | |||
685 | /* Copy a list of valid friend IDs into the array out_list. | 719 | /* Copy a list of valid friend IDs into the array out_list. |
686 | * If out_list is NULL, returns 0. | 720 | * If out_list is NULL, returns 0. |
687 | * Otherwise, returns the number of elements copied. | 721 | * Otherwise, returns the number of elements copied. |