diff options
-rw-r--r-- | toxav/toxav_old.c | 10 | ||||
-rw-r--r-- | toxcore/Messenger.c | 21 | ||||
-rw-r--r-- | toxcore/Messenger.h | 23 | ||||
-rw-r--r-- | toxcore/group.c | 40 | ||||
-rw-r--r-- | toxcore/tox.c | 48 |
5 files changed, 72 insertions, 70 deletions
diff --git a/toxav/toxav_old.c b/toxav/toxav_old.c index 63f81f96..d3e2f30d 100644 --- a/toxav/toxav_old.c +++ b/toxav/toxav_old.c | |||
@@ -40,7 +40,7 @@ int toxav_add_av_groupchat(struct Tox *tox, void (*audio_callback)(void *, int, | |||
40 | uint8_t, unsigned int, void *), void *userdata) | 40 | uint8_t, unsigned int, void *), void *userdata) |
41 | { | 41 | { |
42 | Messenger *m = (Messenger *)tox; | 42 | Messenger *m = (Messenger *)tox; |
43 | return add_av_groupchat(m->log, (Group_Chats *)m->group_chat_object, | 43 | return add_av_groupchat(m->log, (Group_Chats *)m->conferences_object, |
44 | (void (*)(Messenger *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *))audio_callback, | 44 | (void (*)(Messenger *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *))audio_callback, |
45 | userdata); | 45 | userdata); |
46 | } | 46 | } |
@@ -60,9 +60,9 @@ int toxav_join_av_groupchat(struct Tox *tox, int32_t friendnumber, const uint8_t | |||
60 | void *userdata) | 60 | void *userdata) |
61 | { | 61 | { |
62 | Messenger *m = (Messenger *)tox; | 62 | Messenger *m = (Messenger *)tox; |
63 | return join_av_groupchat(m->log, (Group_Chats *)m->group_chat_object, friendnumber, data, length, (void (*)(Messenger *, | 63 | return join_av_groupchat(m->log, (Group_Chats *)m->conferences_object, friendnumber, data, length, |
64 | int, int, | 64 | (void (*)(Messenger *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *))audio_callback, |
65 | const int16_t *, unsigned int, uint8_t, unsigned int, void *))audio_callback, userdata); | 65 | userdata); |
66 | } | 66 | } |
67 | 67 | ||
68 | /* Send audio to the group chat. | 68 | /* Send audio to the group chat. |
@@ -82,5 +82,5 @@ int toxav_group_send_audio(struct Tox *tox, int groupnumber, const int16_t *pcm, | |||
82 | unsigned int sample_rate) | 82 | unsigned int sample_rate) |
83 | { | 83 | { |
84 | Messenger *m = (Messenger *)tox; | 84 | Messenger *m = (Messenger *)tox; |
85 | return group_send_audio((Group_Chats *)m->group_chat_object, groupnumber, pcm, samples, channels, sample_rate); | 85 | return group_send_audio((Group_Chats *)m->conferences_object, groupnumber, pcm, samples, channels, sample_rate); |
86 | } | 86 | } |
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 26c963db..e26ea795 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -979,27 +979,28 @@ static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_ | |||
979 | m->friendlist[friendnumber].friendcon_id), packet, length + 1, congestion_control) != -1; | 979 | m->friendlist[friendnumber].friendcon_id), packet, length + 1, congestion_control) != -1; |
980 | } | 980 | } |
981 | 981 | ||
982 | /**********GROUP CHATS************/ | 982 | /**********CONFERENCES************/ |
983 | 983 | ||
984 | 984 | ||
985 | /* Set the callback for group invites. | 985 | /* Set the callback for conference invites. |
986 | * | 986 | * |
987 | * Function(Messenger *m, uint32_t friendnumber, uint8_t *data, uint16_t length, void *userdata) | 987 | * Function(Messenger *m, uint32_t friendnumber, uint8_t *data, uint16_t length, void *userdata) |
988 | */ | 988 | */ |
989 | void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t, void *)) | 989 | void m_callback_conference_invite(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t, |
990 | void *)) | ||
990 | { | 991 | { |
991 | m->group_invite = function; | 992 | m->conference_invite = function; |
992 | } | 993 | } |
993 | 994 | ||
994 | 995 | ||
995 | /* Send a group invite packet. | 996 | /* Send a conference invite packet. |
996 | * | 997 | * |
997 | * return 1 on success | 998 | * return 1 on success |
998 | * return 0 on failure | 999 | * return 0 on failure |
999 | */ | 1000 | */ |
1000 | int send_group_invite_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length) | 1001 | int send_conference_invite_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length) |
1001 | { | 1002 | { |
1002 | return write_cryptpacket_id(m, friendnumber, PACKET_ID_INVITE_GROUPCHAT, data, length, 0); | 1003 | return write_cryptpacket_id(m, friendnumber, PACKET_ID_INVITE_CONFERENCE, data, length, 0); |
1003 | } | 1004 | } |
1004 | 1005 | ||
1005 | /****************FILE SENDING*****************/ | 1006 | /****************FILE SENDING*****************/ |
@@ -2175,13 +2176,13 @@ static int handle_packet(void *object, int i, const uint8_t *temp, uint16_t len, | |||
2175 | break; | 2176 | break; |
2176 | } | 2177 | } |
2177 | 2178 | ||
2178 | case PACKET_ID_INVITE_GROUPCHAT: { | 2179 | case PACKET_ID_INVITE_CONFERENCE: { |
2179 | if (data_length == 0) { | 2180 | if (data_length == 0) { |
2180 | break; | 2181 | break; |
2181 | } | 2182 | } |
2182 | 2183 | ||
2183 | if (m->group_invite) { | 2184 | if (m->conference_invite) { |
2184 | (*m->group_invite)(m, i, data, data_length, userdata); | 2185 | (*m->conference_invite)(m, i, data, data_length, userdata); |
2185 | } | 2186 | } |
2186 | 2187 | ||
2187 | break; | 2188 | break; |
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 0744ae58..4bcd618f 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -59,11 +59,11 @@ enum { | |||
59 | #define PACKET_ID_FILE_SENDREQUEST 80 | 59 | #define PACKET_ID_FILE_SENDREQUEST 80 |
60 | #define PACKET_ID_FILE_CONTROL 81 | 60 | #define PACKET_ID_FILE_CONTROL 81 |
61 | #define PACKET_ID_FILE_DATA 82 | 61 | #define PACKET_ID_FILE_DATA 82 |
62 | #define PACKET_ID_INVITE_GROUPCHAT 96 | 62 | #define PACKET_ID_INVITE_CONFERENCE 96 |
63 | #define PACKET_ID_ONLINE_PACKET 97 | 63 | #define PACKET_ID_ONLINE_PACKET 97 |
64 | #define PACKET_ID_DIRECT_GROUPCHAT 98 | 64 | #define PACKET_ID_DIRECT_CONFERENCE 98 |
65 | #define PACKET_ID_MESSAGE_GROUPCHAT 99 | 65 | #define PACKET_ID_MESSAGE_CONFERENCE 99 |
66 | #define PACKET_ID_LOSSY_GROUPCHAT 199 | 66 | #define PACKET_ID_LOSSY_CONFERENCE 199 |
67 | 67 | ||
68 | /* All packets starting with a byte in this range can be used for anything. */ | 68 | /* All packets starting with a byte in this range can be used for anything. */ |
69 | #define PACKET_ID_LOSSLESS_RANGE_START 160 | 69 | #define PACKET_ID_LOSSLESS_RANGE_START 160 |
@@ -248,8 +248,8 @@ struct Messenger { | |||
248 | void (*friend_connectionstatuschange_internal)(struct Messenger *m, uint32_t, uint8_t, void *); | 248 | void (*friend_connectionstatuschange_internal)(struct Messenger *m, uint32_t, uint8_t, void *); |
249 | void *friend_connectionstatuschange_internal_userdata; | 249 | void *friend_connectionstatuschange_internal_userdata; |
250 | 250 | ||
251 | void *group_chat_object; /* Set by new_groupchats()*/ | 251 | void *conferences_object; /* Set by new_groupchats()*/ |
252 | void (*group_invite)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t, void *); | 252 | void (*conference_invite)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t, void *); |
253 | 253 | ||
254 | void (*file_sendrequest)(struct Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t, const uint8_t *, size_t, | 254 | void (*file_sendrequest)(struct Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t, const uint8_t *, size_t, |
255 | void *); | 255 | void *); |
@@ -531,20 +531,21 @@ void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Mess | |||
531 | */ | 531 | */ |
532 | void m_callback_core_connection(Messenger *m, void (*function)(Messenger *m, unsigned int, void *)); | 532 | void m_callback_core_connection(Messenger *m, void (*function)(Messenger *m, unsigned int, void *)); |
533 | 533 | ||
534 | /**********GROUP CHATS************/ | 534 | /**********CONFERENCES************/ |
535 | 535 | ||
536 | /* Set the callback for group invites. | 536 | /* Set the callback for conference invites. |
537 | * | 537 | * |
538 | * Function(Messenger *m, uint32_t friendnumber, uint8_t *data, uint16_t length, void *userdata) | 538 | * Function(Messenger *m, uint32_t friendnumber, uint8_t *data, uint16_t length, void *userdata) |
539 | */ | 539 | */ |
540 | void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t, void *)); | 540 | void m_callback_conference_invite(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t, |
541 | void *)); | ||
541 | 542 | ||
542 | /* Send a group invite packet. | 543 | /* Send a conference invite packet. |
543 | * | 544 | * |
544 | * return 1 on success | 545 | * return 1 on success |
545 | * return 0 on failure | 546 | * return 0 on failure |
546 | */ | 547 | */ |
547 | int send_group_invite_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length); | 548 | int send_conference_invite_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length); |
548 | 549 | ||
549 | /****************FILE SENDING*****************/ | 550 | /****************FILE SENDING*****************/ |
550 | 551 | ||
diff --git a/toxcore/group.c b/toxcore/group.c index d56301cf..f1c160c9 100644 --- a/toxcore/group.c +++ b/toxcore/group.c | |||
@@ -1024,7 +1024,7 @@ int invite_friend(Group_Chats *g_c, int32_t friendnumber, int groupnumber) | |||
1024 | memcpy(invite + 1, &groupchat_num, sizeof(groupchat_num)); | 1024 | memcpy(invite + 1, &groupchat_num, sizeof(groupchat_num)); |
1025 | memcpy(invite + 1 + sizeof(groupchat_num), g->identifier, GROUP_IDENTIFIER_LENGTH); | 1025 | memcpy(invite + 1 + sizeof(groupchat_num), g->identifier, GROUP_IDENTIFIER_LENGTH); |
1026 | 1026 | ||
1027 | if (send_group_invite_packet(g_c->m, friendnumber, invite, sizeof(invite))) { | 1027 | if (send_conference_invite_packet(g_c->m, friendnumber, invite, sizeof(invite))) { |
1028 | return 0; | 1028 | return 0; |
1029 | } | 1029 | } |
1030 | 1030 | ||
@@ -1084,7 +1084,7 @@ int join_groupchat(Group_Chats *g_c, int32_t friendnumber, uint8_t expected_type | |||
1084 | memcpy(response + 1, &group_num, sizeof(uint16_t)); | 1084 | memcpy(response + 1, &group_num, sizeof(uint16_t)); |
1085 | memcpy(response + 1 + sizeof(uint16_t), data, sizeof(uint16_t) + GROUP_IDENTIFIER_LENGTH); | 1085 | memcpy(response + 1 + sizeof(uint16_t), data, sizeof(uint16_t) + GROUP_IDENTIFIER_LENGTH); |
1086 | 1086 | ||
1087 | if (send_group_invite_packet(g_c->m, friendnumber, response, sizeof(response))) { | 1087 | if (send_conference_invite_packet(g_c->m, friendnumber, response, sizeof(response))) { |
1088 | uint16_t other_groupnum; | 1088 | uint16_t other_groupnum; |
1089 | memcpy(&other_groupnum, data, sizeof(other_groupnum)); | 1089 | memcpy(&other_groupnum, data, sizeof(other_groupnum)); |
1090 | other_groupnum = ntohs(other_groupnum); | 1090 | other_groupnum = ntohs(other_groupnum); |
@@ -1377,7 +1377,7 @@ int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title) | |||
1377 | static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint16_t length, | 1377 | static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint16_t length, |
1378 | void *userdata) | 1378 | void *userdata) |
1379 | { | 1379 | { |
1380 | Group_Chats *g_c = (Group_Chats *)m->group_chat_object; | 1380 | Group_Chats *g_c = (Group_Chats *)m->conferences_object; |
1381 | 1381 | ||
1382 | if (length <= 1) { | 1382 | if (length <= 1) { |
1383 | return; | 1383 | return; |
@@ -1583,7 +1583,7 @@ static unsigned int send_peer_kill(Group_Chats *g_c, int friendcon_id, uint16_t | |||
1583 | { | 1583 | { |
1584 | uint8_t packet[1]; | 1584 | uint8_t packet[1]; |
1585 | packet[0] = PEER_KILL_ID; | 1585 | packet[0] = PEER_KILL_ID; |
1586 | return send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_GROUPCHAT, group_num, packet, sizeof(packet)); | 1586 | return send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_CONFERENCE, group_num, packet, sizeof(packet)); |
1587 | } | 1587 | } |
1588 | 1588 | ||
1589 | 1589 | ||
@@ -1594,7 +1594,7 @@ static unsigned int send_peer_query(Group_Chats *g_c, int friendcon_id, uint16_t | |||
1594 | { | 1594 | { |
1595 | uint8_t packet[1]; | 1595 | uint8_t packet[1]; |
1596 | packet[0] = PEER_QUERY_ID; | 1596 | packet[0] = PEER_QUERY_ID; |
1597 | return send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_GROUPCHAT, group_num, packet, sizeof(packet)); | 1597 | return send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_CONFERENCE, group_num, packet, sizeof(packet)); |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | /* return number of peers sent on success. | 1600 | /* return number of peers sent on success. |
@@ -1617,7 +1617,7 @@ static unsigned int send_peers(Group_Chats *g_c, int groupnumber, int friendcon_ | |||
1617 | 1617 | ||
1618 | for (i = 0; i < g->numpeers; ++i) { | 1618 | for (i = 0; i < g->numpeers; ++i) { |
1619 | if ((p - packet) + sizeof(uint16_t) + crypto_box_PUBLICKEYBYTES * 2 + 1 + g->group[i].nick_len > sizeof(packet)) { | 1619 | if ((p - packet) + sizeof(uint16_t) + crypto_box_PUBLICKEYBYTES * 2 + 1 + g->group[i].nick_len > sizeof(packet)) { |
1620 | if (send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_GROUPCHAT, group_num, packet, (p - packet))) { | 1620 | if (send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_CONFERENCE, group_num, packet, (p - packet))) { |
1621 | sent = i; | 1621 | sent = i; |
1622 | } else { | 1622 | } else { |
1623 | return sent; | 1623 | return sent; |
@@ -1640,7 +1640,7 @@ static unsigned int send_peers(Group_Chats *g_c, int groupnumber, int friendcon_ | |||
1640 | } | 1640 | } |
1641 | 1641 | ||
1642 | if (sent != i) { | 1642 | if (sent != i) { |
1643 | if (send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_GROUPCHAT, group_num, packet, (p - packet))) { | 1643 | if (send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_CONFERENCE, group_num, packet, (p - packet))) { |
1644 | sent = i; | 1644 | sent = i; |
1645 | } | 1645 | } |
1646 | } | 1646 | } |
@@ -1649,7 +1649,7 @@ static unsigned int send_peers(Group_Chats *g_c, int groupnumber, int friendcon_ | |||
1649 | uint8_t Packet[1 + g->title_len]; | 1649 | uint8_t Packet[1 + g->title_len]; |
1650 | Packet[0] = PEER_TITLE_ID; | 1650 | Packet[0] = PEER_TITLE_ID; |
1651 | memcpy(Packet + 1, g->title, g->title_len); | 1651 | memcpy(Packet + 1, g->title, g->title_len); |
1652 | send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_GROUPCHAT, group_num, Packet, sizeof(Packet)); | 1652 | send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_CONFERENCE, group_num, Packet, sizeof(Packet)); |
1653 | } | 1653 | } |
1654 | 1654 | ||
1655 | return sent; | 1655 | return sent; |
@@ -1778,7 +1778,7 @@ static unsigned int send_message_all_close(const Group_Chats *g_c, int groupnumb | |||
1778 | continue; | 1778 | continue; |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | if (send_packet_group_peer(g_c->fr_c, g->close[i].number, PACKET_ID_MESSAGE_GROUPCHAT, g->close[i].group_number, data, | 1781 | if (send_packet_group_peer(g_c->fr_c, g->close[i].number, PACKET_ID_MESSAGE_CONFERENCE, g->close[i].group_number, data, |
1782 | length)) { | 1782 | length)) { |
1783 | ++sent; | 1783 | ++sent; |
1784 | } | 1784 | } |
@@ -1818,7 +1818,7 @@ static unsigned int send_lossy_all_close(const Group_Chats *g_c, int groupnumber | |||
1818 | continue; | 1818 | continue; |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | if (send_lossy_group_peer(g_c->fr_c, g->close[i].number, PACKET_ID_LOSSY_GROUPCHAT, g->close[i].group_number, data, | 1821 | if (send_lossy_group_peer(g_c->fr_c, g->close[i].number, PACKET_ID_LOSSY_CONFERENCE, g->close[i].group_number, data, |
1822 | length)) { | 1822 | length)) { |
1823 | ++sent; | 1823 | ++sent; |
1824 | } | 1824 | } |
@@ -1843,7 +1843,7 @@ static unsigned int send_lossy_all_close(const Group_Chats *g_c, int groupnumber | |||
1843 | } | 1843 | } |
1844 | } | 1844 | } |
1845 | 1845 | ||
1846 | if (send_lossy_group_peer(g_c->fr_c, g->close[to_send].number, PACKET_ID_LOSSY_GROUPCHAT, | 1846 | if (send_lossy_group_peer(g_c->fr_c, g->close[to_send].number, PACKET_ID_LOSSY_CONFERENCE, |
1847 | g->close[to_send].group_number, data, length)) { | 1847 | g->close[to_send].group_number, data, length)) { |
1848 | ++sent; | 1848 | ++sent; |
1849 | } | 1849 | } |
@@ -1867,7 +1867,7 @@ static unsigned int send_lossy_all_close(const Group_Chats *g_c, int groupnumber | |||
1867 | return sent; | 1867 | return sent; |
1868 | } | 1868 | } |
1869 | 1869 | ||
1870 | if (send_lossy_group_peer(g_c->fr_c, g->close[to_send_other].number, PACKET_ID_LOSSY_GROUPCHAT, | 1870 | if (send_lossy_group_peer(g_c->fr_c, g->close[to_send_other].number, PACKET_ID_LOSSY_CONFERENCE, |
1871 | g->close[to_send_other].group_number, data, length)) { | 1871 | g->close[to_send_other].group_number, data, length)) { |
1872 | ++sent; | 1872 | ++sent; |
1873 | } | 1873 | } |
@@ -2136,7 +2136,7 @@ static int handle_packet(void *object, int friendcon_id, const uint8_t *data, ui | |||
2136 | return handle_packet_online(g_c, friendcon_id, data + 1, length - 1); | 2136 | return handle_packet_online(g_c, friendcon_id, data + 1, length - 1); |
2137 | } | 2137 | } |
2138 | 2138 | ||
2139 | if (data[0] != PACKET_ID_DIRECT_GROUPCHAT && data[0] != PACKET_ID_MESSAGE_GROUPCHAT) { | 2139 | if (data[0] != PACKET_ID_DIRECT_CONFERENCE && data[0] != PACKET_ID_MESSAGE_CONFERENCE) { |
2140 | return -1; | 2140 | return -1; |
2141 | } | 2141 | } |
2142 | 2142 | ||
@@ -2156,12 +2156,12 @@ static int handle_packet(void *object, int friendcon_id, const uint8_t *data, ui | |||
2156 | } | 2156 | } |
2157 | 2157 | ||
2158 | switch (data[0]) { | 2158 | switch (data[0]) { |
2159 | case PACKET_ID_DIRECT_GROUPCHAT: { | 2159 | case PACKET_ID_DIRECT_CONFERENCE: { |
2160 | handle_direct_packet(g_c, groupnumber, data + 1 + sizeof(uint16_t), length - (1 + sizeof(uint16_t)), index, userdata); | 2160 | handle_direct_packet(g_c, groupnumber, data + 1 + sizeof(uint16_t), length - (1 + sizeof(uint16_t)), index, userdata); |
2161 | break; | 2161 | break; |
2162 | } | 2162 | } |
2163 | 2163 | ||
2164 | case PACKET_ID_MESSAGE_GROUPCHAT: { | 2164 | case PACKET_ID_MESSAGE_CONFERENCE: { |
2165 | handle_message_packet_group(g_c, groupnumber, data + 1 + sizeof(uint16_t), length - (1 + sizeof(uint16_t)), index, | 2165 | handle_message_packet_group(g_c, groupnumber, data + 1 + sizeof(uint16_t), length - (1 + sizeof(uint16_t)), index, |
2166 | userdata); | 2166 | userdata); |
2167 | break; | 2167 | break; |
@@ -2244,7 +2244,7 @@ static int handle_lossy(void *object, int friendcon_id, const uint8_t *data, uin | |||
2244 | return -1; | 2244 | return -1; |
2245 | } | 2245 | } |
2246 | 2246 | ||
2247 | if (data[0] != PACKET_ID_LOSSY_GROUPCHAT) { | 2247 | if (data[0] != PACKET_ID_LOSSY_CONFERENCE) { |
2248 | return -1; | 2248 | return -1; |
2249 | } | 2249 | } |
2250 | 2250 | ||
@@ -2452,8 +2452,8 @@ Group_Chats *new_groupchats(Messenger *m) | |||
2452 | 2452 | ||
2453 | temp->m = m; | 2453 | temp->m = m; |
2454 | temp->fr_c = m->fr_c; | 2454 | temp->fr_c = m->fr_c; |
2455 | m->group_chat_object = temp; | 2455 | m->conferences_object = temp; |
2456 | m_callback_group_invite(m, &handle_friend_invite_packet); | 2456 | m_callback_conference_invite(m, &handle_friend_invite_packet); |
2457 | 2457 | ||
2458 | return temp; | 2458 | return temp; |
2459 | } | 2459 | } |
@@ -2489,8 +2489,8 @@ void kill_groupchats(Group_Chats *g_c) | |||
2489 | del_groupchat(g_c, i); | 2489 | del_groupchat(g_c, i); |
2490 | } | 2490 | } |
2491 | 2491 | ||
2492 | m_callback_group_invite(g_c->m, NULL); | 2492 | m_callback_conference_invite(g_c->m, NULL); |
2493 | g_c->m->group_chat_object = 0; | 2493 | g_c->m->conferences_object = NULL; |
2494 | free(g_c); | 2494 | free(g_c); |
2495 | } | 2495 | } |
2496 | 2496 | ||
diff --git a/toxcore/tox.c b/toxcore/tox.c index fccf3480..29bbfba0 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -303,7 +303,7 @@ void tox_kill(Tox *tox) | |||
303 | 303 | ||
304 | Messenger *m = tox; | 304 | Messenger *m = tox; |
305 | Logger *log = m->log; | 305 | Logger *log = m->log; |
306 | kill_groupchats((Group_Chats *)m->group_chat_object); | 306 | kill_groupchats((Group_Chats *)m->conferences_object); |
307 | kill_messenger(m); | 307 | kill_messenger(m); |
308 | logger_kill(log); | 308 | logger_kill(log); |
309 | } | 309 | } |
@@ -476,7 +476,7 @@ void tox_iterate(Tox *tox, void *user_data) | |||
476 | { | 476 | { |
477 | Messenger *m = tox; | 477 | Messenger *m = tox; |
478 | do_messenger(m, user_data); | 478 | do_messenger(m, user_data); |
479 | do_groupchats((Group_Chats *)m->group_chat_object, user_data); | 479 | do_groupchats((Group_Chats *)m->conferences_object, user_data); |
480 | } | 480 | } |
481 | 481 | ||
482 | void tox_self_get_address(const Tox *tox, uint8_t *address) | 482 | void tox_self_get_address(const Tox *tox, uint8_t *address) |
@@ -528,7 +528,7 @@ bool tox_self_set_name(Tox *tox, const uint8_t *name, size_t length, TOX_ERR_SET | |||
528 | 528 | ||
529 | if (setname(m, name, length) == 0) { | 529 | if (setname(m, name, length) == 0) { |
530 | // TODO(irungentoo): function to set different per group names? | 530 | // TODO(irungentoo): function to set different per group names? |
531 | send_name_all_groups((Group_Chats *)m->group_chat_object); | 531 | send_name_all_groups((Group_Chats *)m->conferences_object); |
532 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_OK); | 532 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_OK); |
533 | return 1; | 533 | return 1; |
534 | } | 534 | } |
@@ -1219,7 +1219,7 @@ void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *callback) | |||
1219 | void tox_callback_conference_invite(Tox *tox, tox_conference_invite_cb *callback) | 1219 | void tox_callback_conference_invite(Tox *tox, tox_conference_invite_cb *callback) |
1220 | { | 1220 | { |
1221 | Messenger *m = tox; | 1221 | Messenger *m = tox; |
1222 | g_callback_group_invite((Group_Chats *)m->group_chat_object, (void (*)(Messenger * m, uint32_t, int, const uint8_t *, | 1222 | g_callback_group_invite((Group_Chats *)m->conferences_object, (void (*)(Messenger * m, uint32_t, int, const uint8_t *, |
1223 | size_t, | 1223 | size_t, |
1224 | void *))callback); | 1224 | void *))callback); |
1225 | } | 1225 | } |
@@ -1227,7 +1227,7 @@ void tox_callback_conference_invite(Tox *tox, tox_conference_invite_cb *callback | |||
1227 | void tox_callback_conference_message(Tox *tox, tox_conference_message_cb *callback) | 1227 | void tox_callback_conference_message(Tox *tox, tox_conference_message_cb *callback) |
1228 | { | 1228 | { |
1229 | Messenger *m = tox; | 1229 | Messenger *m = tox; |
1230 | g_callback_group_message((Group_Chats *)m->group_chat_object, (void (*)(Messenger * m, uint32_t, uint32_t, int, | 1230 | g_callback_group_message((Group_Chats *)m->conferences_object, (void (*)(Messenger * m, uint32_t, uint32_t, int, |
1231 | const uint8_t *, | 1231 | const uint8_t *, |
1232 | size_t, void *))callback); | 1232 | size_t, void *))callback); |
1233 | } | 1233 | } |
@@ -1235,20 +1235,20 @@ void tox_callback_conference_message(Tox *tox, tox_conference_message_cb *callba | |||
1235 | void tox_callback_conference_title(Tox *tox, tox_conference_title_cb *callback) | 1235 | void tox_callback_conference_title(Tox *tox, tox_conference_title_cb *callback) |
1236 | { | 1236 | { |
1237 | Messenger *m = tox; | 1237 | Messenger *m = tox; |
1238 | g_callback_group_title((Group_Chats *)m->group_chat_object, callback); | 1238 | g_callback_group_title((Group_Chats *)m->conferences_object, callback); |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | void tox_callback_conference_namelist_change(Tox *tox, tox_conference_namelist_change_cb *callback) | 1241 | void tox_callback_conference_namelist_change(Tox *tox, tox_conference_namelist_change_cb *callback) |
1242 | { | 1242 | { |
1243 | Messenger *m = tox; | 1243 | Messenger *m = tox; |
1244 | g_callback_group_namelistchange((Group_Chats *)m->group_chat_object, (void (*)(struct Messenger *, int, int, uint8_t, | 1244 | g_callback_group_namelistchange((Group_Chats *)m->conferences_object, (void (*)(struct Messenger *, int, int, uint8_t, |
1245 | void *))callback); | 1245 | void *))callback); |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | uint32_t tox_conference_new(Tox *tox, TOX_ERR_CONFERENCE_NEW *error) | 1248 | uint32_t tox_conference_new(Tox *tox, TOX_ERR_CONFERENCE_NEW *error) |
1249 | { | 1249 | { |
1250 | Messenger *m = tox; | 1250 | Messenger *m = tox; |
1251 | int ret = add_groupchat((Group_Chats *)m->group_chat_object, GROUPCHAT_TYPE_TEXT); | 1251 | int ret = add_groupchat((Group_Chats *)m->conferences_object, GROUPCHAT_TYPE_TEXT); |
1252 | 1252 | ||
1253 | if (ret == -1) { | 1253 | if (ret == -1) { |
1254 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_NEW_INIT); | 1254 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_NEW_INIT); |
@@ -1262,7 +1262,7 @@ uint32_t tox_conference_new(Tox *tox, TOX_ERR_CONFERENCE_NEW *error) | |||
1262 | bool tox_conference_delete(Tox *tox, uint32_t conference_number, TOX_ERR_CONFERENCE_DELETE *error) | 1262 | bool tox_conference_delete(Tox *tox, uint32_t conference_number, TOX_ERR_CONFERENCE_DELETE *error) |
1263 | { | 1263 | { |
1264 | Messenger *m = tox; | 1264 | Messenger *m = tox; |
1265 | int ret = del_groupchat((Group_Chats *)m->group_chat_object, conference_number); | 1265 | int ret = del_groupchat((Group_Chats *)m->conferences_object, conference_number); |
1266 | 1266 | ||
1267 | if (ret == -1) { | 1267 | if (ret == -1) { |
1268 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_DELETE_CONFERENCE_NOT_FOUND); | 1268 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_DELETE_CONFERENCE_NOT_FOUND); |
@@ -1276,7 +1276,7 @@ bool tox_conference_delete(Tox *tox, uint32_t conference_number, TOX_ERR_CONFERE | |||
1276 | uint32_t tox_conference_peer_count(const Tox *tox, uint32_t conference_number, TOX_ERR_CONFERENCE_PEER_QUERY *error) | 1276 | uint32_t tox_conference_peer_count(const Tox *tox, uint32_t conference_number, TOX_ERR_CONFERENCE_PEER_QUERY *error) |
1277 | { | 1277 | { |
1278 | const Messenger *m = tox; | 1278 | const Messenger *m = tox; |
1279 | int ret = group_number_peers((Group_Chats *)m->group_chat_object, conference_number); | 1279 | int ret = group_number_peers((Group_Chats *)m->conferences_object, conference_number); |
1280 | 1280 | ||
1281 | if (ret == -1) { | 1281 | if (ret == -1) { |
1282 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_PEER_QUERY_CONFERENCE_NOT_FOUND); | 1282 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_PEER_QUERY_CONFERENCE_NOT_FOUND); |
@@ -1291,7 +1291,7 @@ size_t tox_conference_peer_get_name_size(const Tox *tox, uint32_t conference_num | |||
1291 | TOX_ERR_CONFERENCE_PEER_QUERY *error) | 1291 | TOX_ERR_CONFERENCE_PEER_QUERY *error) |
1292 | { | 1292 | { |
1293 | const Messenger *m = tox; | 1293 | const Messenger *m = tox; |
1294 | int ret = group_peername_size((Group_Chats *)m->group_chat_object, conference_number, peer_number); | 1294 | int ret = group_peername_size((Group_Chats *)m->conferences_object, conference_number, peer_number); |
1295 | 1295 | ||
1296 | switch (ret) { | 1296 | switch (ret) { |
1297 | case -1: | 1297 | case -1: |
@@ -1311,7 +1311,7 @@ bool tox_conference_peer_get_name(const Tox *tox, uint32_t conference_number, ui | |||
1311 | TOX_ERR_CONFERENCE_PEER_QUERY *error) | 1311 | TOX_ERR_CONFERENCE_PEER_QUERY *error) |
1312 | { | 1312 | { |
1313 | const Messenger *m = tox; | 1313 | const Messenger *m = tox; |
1314 | int ret = group_peername((Group_Chats *)m->group_chat_object, conference_number, peer_number, name); | 1314 | int ret = group_peername((Group_Chats *)m->conferences_object, conference_number, peer_number, name); |
1315 | 1315 | ||
1316 | switch (ret) { | 1316 | switch (ret) { |
1317 | case -1: | 1317 | case -1: |
@@ -1331,7 +1331,7 @@ bool tox_conference_peer_get_public_key(const Tox *tox, uint32_t conference_numb | |||
1331 | uint8_t *public_key, TOX_ERR_CONFERENCE_PEER_QUERY *error) | 1331 | uint8_t *public_key, TOX_ERR_CONFERENCE_PEER_QUERY *error) |
1332 | { | 1332 | { |
1333 | const Messenger *m = tox; | 1333 | const Messenger *m = tox; |
1334 | int ret = group_peer_pubkey((Group_Chats *)m->group_chat_object, conference_number, peer_number, public_key); | 1334 | int ret = group_peer_pubkey((Group_Chats *)m->conferences_object, conference_number, peer_number, public_key); |
1335 | 1335 | ||
1336 | switch (ret) { | 1336 | switch (ret) { |
1337 | case -1: | 1337 | case -1: |
@@ -1351,7 +1351,7 @@ bool tox_conference_peer_number_is_ours(const Tox *tox, uint32_t conference_numb | |||
1351 | TOX_ERR_CONFERENCE_PEER_QUERY *error) | 1351 | TOX_ERR_CONFERENCE_PEER_QUERY *error) |
1352 | { | 1352 | { |
1353 | const Messenger *m = tox; | 1353 | const Messenger *m = tox; |
1354 | int ret = group_peernumber_is_ours((Group_Chats *)m->group_chat_object, conference_number, peer_number); | 1354 | int ret = group_peernumber_is_ours((Group_Chats *)m->conferences_object, conference_number, peer_number); |
1355 | 1355 | ||
1356 | switch (ret) { | 1356 | switch (ret) { |
1357 | case -1: | 1357 | case -1: |
@@ -1375,7 +1375,7 @@ bool tox_conference_invite(Tox *tox, uint32_t friend_number, uint32_t conference | |||
1375 | TOX_ERR_CONFERENCE_INVITE *error) | 1375 | TOX_ERR_CONFERENCE_INVITE *error) |
1376 | { | 1376 | { |
1377 | Messenger *m = tox; | 1377 | Messenger *m = tox; |
1378 | int ret = invite_friend((Group_Chats *)m->group_chat_object, friend_number, conference_number); | 1378 | int ret = invite_friend((Group_Chats *)m->conferences_object, friend_number, conference_number); |
1379 | 1379 | ||
1380 | switch (ret) { | 1380 | switch (ret) { |
1381 | case -1: | 1381 | case -1: |
@@ -1395,7 +1395,7 @@ uint32_t tox_conference_join(Tox *tox, uint32_t friend_number, const uint8_t *co | |||
1395 | TOX_ERR_CONFERENCE_JOIN *error) | 1395 | TOX_ERR_CONFERENCE_JOIN *error) |
1396 | { | 1396 | { |
1397 | Messenger *m = tox; | 1397 | Messenger *m = tox; |
1398 | int ret = join_groupchat((Group_Chats *)m->group_chat_object, friend_number, GROUPCHAT_TYPE_TEXT, cookie, length); | 1398 | int ret = join_groupchat((Group_Chats *)m->conferences_object, friend_number, GROUPCHAT_TYPE_TEXT, cookie, length); |
1399 | 1399 | ||
1400 | switch (ret) { | 1400 | switch (ret) { |
1401 | case -1: | 1401 | case -1: |
@@ -1434,9 +1434,9 @@ bool tox_conference_send_message(Tox *tox, uint32_t conference_number, TOX_MESSA | |||
1434 | int ret = 0; | 1434 | int ret = 0; |
1435 | 1435 | ||
1436 | if (type == TOX_MESSAGE_TYPE_NORMAL) { | 1436 | if (type == TOX_MESSAGE_TYPE_NORMAL) { |
1437 | ret = group_message_send((Group_Chats *)m->group_chat_object, conference_number, message, length); | 1437 | ret = group_message_send((Group_Chats *)m->conferences_object, conference_number, message, length); |
1438 | } else { | 1438 | } else { |
1439 | ret = group_action_send((Group_Chats *)m->group_chat_object, conference_number, message, length); | 1439 | ret = group_action_send((Group_Chats *)m->conferences_object, conference_number, message, length); |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | switch (ret) { | 1442 | switch (ret) { |
@@ -1464,7 +1464,7 @@ bool tox_conference_send_message(Tox *tox, uint32_t conference_number, TOX_MESSA | |||
1464 | size_t tox_conference_get_title_size(const Tox *tox, uint32_t conference_number, TOX_ERR_CONFERENCE_TITLE *error) | 1464 | size_t tox_conference_get_title_size(const Tox *tox, uint32_t conference_number, TOX_ERR_CONFERENCE_TITLE *error) |
1465 | { | 1465 | { |
1466 | const Messenger *m = tox; | 1466 | const Messenger *m = tox; |
1467 | int ret = group_title_get_size((Group_Chats *)m->group_chat_object, conference_number); | 1467 | int ret = group_title_get_size((Group_Chats *)m->conferences_object, conference_number); |
1468 | 1468 | ||
1469 | switch (ret) { | 1469 | switch (ret) { |
1470 | case -1: | 1470 | case -1: |
@@ -1484,7 +1484,7 @@ bool tox_conference_get_title(const Tox *tox, uint32_t conference_number, uint8_ | |||
1484 | TOX_ERR_CONFERENCE_TITLE *error) | 1484 | TOX_ERR_CONFERENCE_TITLE *error) |
1485 | { | 1485 | { |
1486 | const Messenger *m = tox; | 1486 | const Messenger *m = tox; |
1487 | int ret = group_title_get((Group_Chats *)m->group_chat_object, conference_number, title); | 1487 | int ret = group_title_get((Group_Chats *)m->conferences_object, conference_number, title); |
1488 | 1488 | ||
1489 | switch (ret) { | 1489 | switch (ret) { |
1490 | case -1: | 1490 | case -1: |
@@ -1504,7 +1504,7 @@ bool tox_conference_set_title(Tox *tox, uint32_t conference_number, const uint8_ | |||
1504 | TOX_ERR_CONFERENCE_TITLE *error) | 1504 | TOX_ERR_CONFERENCE_TITLE *error) |
1505 | { | 1505 | { |
1506 | Messenger *m = tox; | 1506 | Messenger *m = tox; |
1507 | int ret = group_title_send((Group_Chats *)m->group_chat_object, conference_number, title, length); | 1507 | int ret = group_title_send((Group_Chats *)m->conferences_object, conference_number, title, length); |
1508 | 1508 | ||
1509 | switch (ret) { | 1509 | switch (ret) { |
1510 | case -1: | 1510 | case -1: |
@@ -1527,21 +1527,21 @@ bool tox_conference_set_title(Tox *tox, uint32_t conference_number, const uint8_ | |||
1527 | size_t tox_conference_get_chatlist_size(const Tox *tox) | 1527 | size_t tox_conference_get_chatlist_size(const Tox *tox) |
1528 | { | 1528 | { |
1529 | const Messenger *m = tox; | 1529 | const Messenger *m = tox; |
1530 | return count_chatlist((Group_Chats *)m->group_chat_object); | 1530 | return count_chatlist((Group_Chats *)m->conferences_object); |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | void tox_conference_get_chatlist(const Tox *tox, uint32_t *chatlist) | 1533 | void tox_conference_get_chatlist(const Tox *tox, uint32_t *chatlist) |
1534 | { | 1534 | { |
1535 | const Messenger *m = tox; | 1535 | const Messenger *m = tox; |
1536 | size_t list_size = tox_conference_get_chatlist_size(tox); | 1536 | size_t list_size = tox_conference_get_chatlist_size(tox); |
1537 | copy_chatlist((Group_Chats *)m->group_chat_object, chatlist, list_size); | 1537 | copy_chatlist((Group_Chats *)m->conferences_object, chatlist, list_size); |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | TOX_CONFERENCE_TYPE tox_conference_get_type(const Tox *tox, uint32_t conference_number, | 1540 | TOX_CONFERENCE_TYPE tox_conference_get_type(const Tox *tox, uint32_t conference_number, |
1541 | TOX_ERR_CONFERENCE_GET_TYPE *error) | 1541 | TOX_ERR_CONFERENCE_GET_TYPE *error) |
1542 | { | 1542 | { |
1543 | const Messenger *m = tox; | 1543 | const Messenger *m = tox; |
1544 | int ret = group_get_type((Group_Chats *)m->group_chat_object, conference_number); | 1544 | int ret = group_get_type((Group_Chats *)m->conferences_object, conference_number); |
1545 | 1545 | ||
1546 | if (ret == -1) { | 1546 | if (ret == -1) { |
1547 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_GET_TYPE_CONFERENCE_NOT_FOUND); | 1547 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_GET_TYPE_CONFERENCE_NOT_FOUND); |