summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 04830260..c3f85beb 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -999,14 +999,6 @@ void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, int32_
999 m->group_invite = function; 999 m->group_invite = function;
1000} 1000}
1001 1001
1002/* Set the callback for group messages.
1003 *
1004 * Function(Messenger *m, int32_t friendnumber, uint8_t *data, uint16_t length)
1005 */
1006void m_callback_group_message(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t))
1007{
1008 m->group_message = function;
1009}
1010 1002
1011/* Send a group invite packet. 1003/* Send a group invite packet.
1012 * 1004 *
@@ -1018,17 +1010,6 @@ int send_group_invite_packet(const Messenger *m, int32_t friendnumber, const uin
1018 return write_cryptpacket_id(m, friendnumber, PACKET_ID_INVITE_GROUPCHAT, data, length, 0); 1010 return write_cryptpacket_id(m, friendnumber, PACKET_ID_INVITE_GROUPCHAT, data, length, 0);
1019} 1011}
1020 1012
1021/* Send a group message packet.
1022 *
1023 * return 1 on success
1024 * return 0 on failure
1025 */
1026int send_group_message_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length)
1027{
1028 return write_cryptpacket_id(m, friendnumber, PACKET_ID_MESSAGE_GROUPCHAT, data, length, 0);
1029}
1030
1031
1032/****************FILE SENDING*****************/ 1013/****************FILE SENDING*****************/
1033 1014
1034 1015
@@ -1230,7 +1211,8 @@ int file_data(const Messenger *m, int32_t friendnumber, uint8_t filenumber, cons
1230 return -1; 1211 return -1;
1231 1212
1232 /* Prevent file sending from filling up the entire buffer preventing messages from being sent. TODO: remove */ 1213 /* Prevent file sending from filling up the entire buffer preventing messages from being sent. TODO: remove */
1233 if (crypto_num_free_sendqueue_slots(m->net_crypto, friend_connection_crypt_connection_id(m->fr_c, m->friendlist[friendnumber].friendcon_id)) < MIN_SLOTS_FREE) 1214 if (crypto_num_free_sendqueue_slots(m->net_crypto, friend_connection_crypt_connection_id(m->fr_c,
1215 m->friendlist[friendnumber].friendcon_id)) < MIN_SLOTS_FREE)
1234 return -1; 1216 return -1;
1235 1217
1236 uint8_t packet[MAX_CRYPTO_DATA_SIZE]; 1218 uint8_t packet[MAX_CRYPTO_DATA_SIZE];
@@ -2125,16 +2107,6 @@ static int handle_packet(void *object, int i, uint8_t *temp, uint16_t len)
2125 break; 2107 break;
2126 } 2108 }
2127 2109
2128 case PACKET_ID_MESSAGE_GROUPCHAT: {
2129 if (data_length == 0)
2130 break;
2131
2132 if (m->group_message)
2133 (*m->group_message)(m, i, data, data_length);
2134
2135 break;
2136 }
2137
2138 case PACKET_ID_FILE_SENDREQUEST: { 2110 case PACKET_ID_FILE_SENDREQUEST: {
2139 if (data_length < 1 + sizeof(uint64_t) + 1) 2111 if (data_length < 1 + sizeof(uint64_t) + 1)
2140 break; 2112 break;