summaryrefslogtreecommitdiff
path: root/toxcore/group.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/group.c')
-rw-r--r--toxcore/group.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/toxcore/group.c b/toxcore/group.c
index a85b7320..730378ea 100644
--- a/toxcore/group.c
+++ b/toxcore/group.c
@@ -144,7 +144,7 @@ static Group_c *get_group_c(const Group_Chats *g_c, int groupnumber)
144 * return peer index if peer is in chat. 144 * return peer index if peer is in chat.
145 * return -1 if peer is not in chat. 145 * return -1 if peer is not in chat.
146 * 146 *
147 * TODO: make this more efficient. 147 * TODO(irungentoo): make this more efficient.
148 */ 148 */
149 149
150static int peer_in_chat(const Group_c *chat, const uint8_t *real_pk) 150static int peer_in_chat(const Group_c *chat, const uint8_t *real_pk)
@@ -166,7 +166,7 @@ static int peer_in_chat(const Group_c *chat, const uint8_t *real_pk)
166 * return group number if peer is in list. 166 * return group number if peer is in list.
167 * return -1 if group is not in list. 167 * return -1 if group is not in list.
168 * 168 *
169 * TODO: make this more efficient and maybe use constant time comparisons? 169 * TODO(irungentoo): make this more efficient and maybe use constant time comparisons?
170 */ 170 */
171static int get_group_num(const Group_Chats *g_c, const uint8_t *identifier) 171static int get_group_num(const Group_Chats *g_c, const uint8_t *identifier)
172{ 172{
@@ -187,7 +187,7 @@ static int get_group_num(const Group_Chats *g_c, const uint8_t *identifier)
187 * return peer number if peer is in chat. 187 * return peer number if peer is in chat.
188 * return -1 if peer is not in chat. 188 * return -1 if peer is not in chat.
189 * 189 *
190 * TODO: make this more efficient. 190 * TODO(irungentoo): make this more efficient.
191 */ 191 */
192static int get_peer_index(Group_c *g, uint16_t peer_number) 192static int get_peer_index(Group_c *g, uint16_t peer_number)
193{ 193{
@@ -414,7 +414,7 @@ static int addpeer(Group_Chats *g_c, int groupnumber, const uint8_t *real_pk, co
414 return -1; 414 return -1;
415 } 415 }
416 416
417 //TODO 417 // TODO(irungentoo):
418 int peer_index = peer_in_chat(g, real_pk); 418 int peer_index = peer_in_chat(g, real_pk);
419 419
420 if (peer_index != -1) { 420 if (peer_index != -1) {
@@ -656,7 +656,7 @@ static int handle_status(void *object, int friendcon_id, uint8_t status, void *u
656 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_ONLINE); 656 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_ONLINE);
657 } else { /* Went offline */ 657 } else { /* Went offline */
658 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_CONNECTION); 658 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_CONNECTION);
659 //TODO remove timedout connections? 659 // TODO(irungentoo): remove timedout connections?
660 } 660 }
661 661
662 return 0; 662 return 0;
@@ -703,7 +703,7 @@ static int add_conn_to_groupchat(Group_Chats *g_c, int friendcon_id, int groupnu
703 g->close[ind].type = GROUPCHAT_CLOSE_CONNECTION; 703 g->close[ind].type = GROUPCHAT_CLOSE_CONNECTION;
704 g->close[ind].number = friendcon_id; 704 g->close[ind].number = friendcon_id;
705 g->close[ind].closest = closest; 705 g->close[ind].closest = closest;
706 //TODO 706 // TODO(irungentoo):
707 friend_connection_callbacks(g_c->m->fr_c, friendcon_id, GROUPCHAT_CALLBACK_INDEX, &handle_status, &handle_packet, 707 friend_connection_callbacks(g_c->m->fr_c, friendcon_id, GROUPCHAT_CALLBACK_INDEX, &handle_status, &handle_packet,
708 &handle_lossy, g_c, friendcon_id); 708 &handle_lossy, g_c, friendcon_id);
709 709
@@ -1374,8 +1374,9 @@ static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, con
1374 return; 1374 return;
1375 } 1375 }
1376 1376
1377 uint16_t peer_number = rand(); /* TODO: what if two people enter the group at the same time and 1377 /* TODO(irungentoo): what if two people enter the group at the same time and
1378 are given the same peer_number by different nodes? */ 1378 are given the same peer_number by different nodes? */
1379 uint16_t peer_number = rand();
1379 1380
1380 unsigned int tries = 0; 1381 unsigned int tries = 0;
1381 1382
@@ -1903,7 +1904,7 @@ int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *ac
1903 */ 1904 */
1904int send_group_lossy_packet(const Group_Chats *g_c, int groupnumber, const uint8_t *data, uint16_t length) 1905int send_group_lossy_packet(const Group_Chats *g_c, int groupnumber, const uint8_t *data, uint16_t length)
1905{ 1906{
1906 //TODO: length check here? 1907 // TODO(irungentoo): length check here?
1907 Group_c *g = get_group_c(g_c, groupnumber); 1908 Group_c *g = get_group_c(g_c, groupnumber);
1908 1909
1909 if (!g) { 1910 if (!g) {
@@ -2004,7 +2005,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2004 delpeer(g_c, groupnumber, index); 2005 delpeer(g_c, groupnumber, index);
2005 } else { 2006 } else {
2006 return; 2007 return;
2007 //TODO 2008 // TODO(irungentoo):
2008 } 2009 }
2009 } 2010 }
2010 break; 2011 break;
@@ -2032,7 +2033,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2032 memcpy(newmsg, msg_data, msg_data_len); 2033 memcpy(newmsg, msg_data, msg_data_len);
2033 newmsg[msg_data_len] = 0; 2034 newmsg[msg_data_len] = 0;
2034 2035
2035 //TODO 2036 // TODO(irungentoo):
2036 if (g_c->message_callback) { 2037 if (g_c->message_callback) {
2037 g_c->message_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->message_callback_userdata); 2038 g_c->message_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->message_callback_userdata);
2038 } 2039 }
@@ -2049,7 +2050,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2049 memcpy(newmsg, msg_data, msg_data_len); 2050 memcpy(newmsg, msg_data, msg_data_len);
2050 newmsg[msg_data_len] = 0; 2051 newmsg[msg_data_len] = 0;
2051 2052
2052 //TODO 2053 // TODO(irungentoo):
2053 if (g_c->action_callback) { 2054 if (g_c->action_callback) {
2054 g_c->action_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->action_callback_userdata); 2055 g_c->action_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->action_callback_userdata);
2055 } 2056 }
@@ -2061,7 +2062,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2061 return; 2062 return;
2062 } 2063 }
2063 2064
2064 send_message_all_close(g_c, groupnumber, data, length, -1/*TODO close_index*/); 2065 send_message_all_close(g_c, groupnumber, data, length, -1/* TODO(irungentoo) close_index */);
2065} 2066}
2066 2067
2067static int handle_packet(void *object, int friendcon_id, const uint8_t *data, uint16_t length, void *userdata) 2068static int handle_packet(void *object, int friendcon_id, const uint8_t *data, uint16_t length, void *userdata)
@@ -2120,7 +2121,7 @@ static int handle_packet(void *object, int friendcon_id, const uint8_t *data, ui
2120 * return 0 if packet was not received. 2121 * return 0 if packet was not received.
2121 * return 1 if packet was received. 2122 * return 1 if packet was received.
2122 * 2123 *
2123 * TODO: test this 2124 * TODO(irungentoo): test this
2124 */ 2125 */
2125static unsigned int lossy_packet_not_received(Group_c *g, int peer_index, uint16_t message_number) 2126static unsigned int lossy_packet_not_received(Group_c *g, int peer_index, uint16_t message_number)
2126{ 2127{
@@ -2416,7 +2417,7 @@ void do_groupchats(Group_Chats *g_c, void *userdata)
2416 } 2417 }
2417 } 2418 }
2418 2419
2419 //TODO 2420 // TODO(irungentoo):
2420} 2421}
2421 2422
2422/* Free everything related with group chats. */ 2423/* Free everything related with group chats. */