diff options
author | Coren[m] <Break@Ocean> | 2013-11-25 19:18:11 +0100 |
---|---|---|
committer | Coren[m] <Break@Ocean> | 2013-11-25 19:18:40 +0100 |
commit | 0b0848d9aca9e2587a3c294477cae820777b1d60 (patch) | |
tree | 32da1a06d1e5e5635ea22d9b51c111e331a3707b /toxcore | |
parent | 56079c92c3647299c74ffc0d1271fe1135a86b9d (diff) |
setnick(): don't callback when an identical nickname is set again
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/group_chats.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c index 8c3fe210..d1782c71 100644 --- a/toxcore/group_chats.c +++ b/toxcore/group_chats.c | |||
@@ -290,6 +290,11 @@ static void setnick(Group_Chat *chat, int peernum, uint8_t *contents, uint16_t c | |||
290 | if (contents_len > MAX_NICK_BYTES || contents_len == 0) | 290 | if (contents_len > MAX_NICK_BYTES || contents_len == 0) |
291 | return; | 291 | return; |
292 | 292 | ||
293 | /* same name as already stored? */ | ||
294 | if ((chat->group[peernum].nick_len == contents_len) && | ||
295 | !memcmp(chat->group[peernum].nick, contents, contents_len)) | ||
296 | return; | ||
297 | |||
293 | memcpy(chat->group[peernum].nick, contents, contents_len); | 298 | memcpy(chat->group[peernum].nick, contents, contents_len); |
294 | /* Force null termination */ | 299 | /* Force null termination */ |
295 | chat->group[peernum].nick[contents_len - 1] = 0; | 300 | chat->group[peernum].nick[contents_len - 1] = 0; |