diff options
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 66faa4db..6ec54587 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -435,6 +435,9 @@ int setname(Messenger *m, uint8_t *name, uint16_t length) | |||
435 | for (i = 0; i < m->numfriends; ++i) | 435 | for (i = 0; i < m->numfriends; ++i) |
436 | m->friendlist[i].name_sent = 0; | 436 | m->friendlist[i].name_sent = 0; |
437 | 437 | ||
438 | for (i = 0; i < m->numchats; i++) | ||
439 | m->chats[i]->last_sent_nick = 0; /* or send the new name right away? */ | ||
440 | |||
438 | return 0; | 441 | return 0; |
439 | } | 442 | } |
440 | 443 | ||
@@ -969,6 +972,17 @@ int group_message_send(Messenger *m, int groupnumber, uint8_t *message, uint32_t | |||
969 | if (m->chats[groupnumber] == NULL) | 972 | if (m->chats[groupnumber] == NULL) |
970 | return -1; | 973 | return -1; |
971 | 974 | ||
975 | /* send own nick from time to time, to let newly added peers be informed | ||
976 | * first time only: use a shorter timeframe, because we might not be in our own | ||
977 | * peer list yet */ | ||
978 | if (is_timeout(m->chats[groupnumber]->last_sent_nick, 180)) | ||
979 | if (group_send_nick(m->chats[groupnumber], m->chats[groupnumber]->self_public_key, m->name, m->name_length) > 0) { | ||
980 | if (!m->chats[groupnumber]->last_sent_nick) | ||
981 | m->chats[groupnumber]->last_sent_nick = unix_time() - 150; | ||
982 | else | ||
983 | m->chats[groupnumber]->last_sent_nick = unix_time(); | ||
984 | } | ||
985 | |||
972 | if (group_sendmessage(m->chats[groupnumber], message, length) > 0) | 986 | if (group_sendmessage(m->chats[groupnumber], message, length) > 0) |
973 | return 0; | 987 | return 0; |
974 | 988 | ||