summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-11-16 20:14:01 -0500
committerirungentoo <irungentoo@gmail.com>2013-11-16 20:14:01 -0500
commitd83abccf0ed7cb09b2070b7a68bca5b011f4d333 (patch)
tree6fca5947624cb39f891aa040aab5885a4b7978e1 /toxcore
parentda21a8f84483602dcaed09be615ce97c878d847b (diff)
Send our name when someone new joins the group chat.
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/group_chats.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c
index 5376713c..5a68bc1a 100644
--- a/toxcore/group_chats.c
+++ b/toxcore/group_chats.c
@@ -393,6 +393,7 @@ static int handle_sendnodes(Group_Chat *chat, IP_Port source, int peernum, uint8
393} 393}
394 394
395#define GROUP_DATA_MIN_SIZE (crypto_box_PUBLICKEYBYTES + sizeof(uint32_t) + 1) 395#define GROUP_DATA_MIN_SIZE (crypto_box_PUBLICKEYBYTES + sizeof(uint32_t) + 1)
396static void send_names_new_peer(Group_Chat *chat);
396 397
397static int handle_data(Group_Chat *chat, uint8_t *data, uint32_t len) 398static int handle_data(Group_Chat *chat, uint8_t *data, uint32_t len)
398{ 399{
@@ -445,6 +446,7 @@ static int handle_data(Group_Chat *chat, uint8_t *data, uint32_t len)
445 return 1; 446 return 1;
446 447
447 addpeer(chat, contents); 448 addpeer(chat, contents);
449 send_names_new_peer(chat);
448 break; 450 break;
449 451
450 case GROUP_CHAT_PEER_NICK: 452 case GROUP_CHAT_PEER_NICK:
@@ -638,7 +640,11 @@ static void del_dead_peers(Group_Chat *chat)
638} 640}
639 641
640#define NICK_SEND_INTERVAL 180 642#define NICK_SEND_INTERVAL 180
641 643static void send_names_new_peer(Group_Chat *chat)
644{
645 group_send_nick(chat, chat->nick, chat->nick_len);
646 chat->last_sent_nick = (unix_time() - NICK_SEND_INTERVAL) + 10;
647}
642static void send_names(Group_Chat *chat) 648static void send_names(Group_Chat *chat)
643{ 649{
644 /* send own nick from time to time, to let newly added peers be informed 650 /* send own nick from time to time, to let newly added peers be informed