diff options
author | Coren[m] <Break@Ocean> | 2013-11-25 19:01:13 +0100 |
---|---|---|
committer | Coren[m] <Break@Ocean> | 2013-11-25 19:01:13 +0100 |
commit | 56079c92c3647299c74ffc0d1271fe1135a86b9d (patch) | |
tree | 6d47742c970cf79c03d6604925c623098a1f0f68 /toxcore | |
parent | e85e9dbb999f1fccd2083224cc52eebe29915bfe (diff) |
Mimic more exactly what delpeer() does in the callback.
If the deleted peer wasn't last, send a name-change update for the overwritten peer.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/group_chats.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c index a20ec555..8c3fe210 100644 --- a/toxcore/group_chats.c +++ b/toxcore/group_chats.c | |||
@@ -254,8 +254,12 @@ static int delpeer(Group_Chat *chat, int peernum) | |||
254 | 254 | ||
255 | chat->group = temp; | 255 | chat->group = temp; |
256 | 256 | ||
257 | if (chat->peer_namelistchange != NULL) | 257 | if (chat->peer_namelistchange != NULL) { |
258 | (*chat->peer_namelistchange)(chat, peernum, CHAT_CHANGE_PEER_DEL, chat->group_namelistchange_userdata); | 258 | (*chat->peer_namelistchange)(chat, chat->numpeers, CHAT_CHANGE_PEER_DEL, chat->group_namelistchange_userdata); |
259 | |||
260 | if (chat->numpeers != (uint32_t)peernum) | ||
261 | (*chat->peer_namelistchange)(chat, peernum, CHAT_CHANGE_PEER_NAME, chat->group_namelistchange_userdata); | ||
262 | } | ||
259 | 263 | ||
260 | return 0; | 264 | return 0; |
261 | } | 265 | } |
@@ -290,6 +294,7 @@ static void setnick(Group_Chat *chat, int peernum, uint8_t *contents, uint16_t c | |||
290 | /* Force null termination */ | 294 | /* Force null termination */ |
291 | chat->group[peernum].nick[contents_len - 1] = 0; | 295 | chat->group[peernum].nick[contents_len - 1] = 0; |
292 | chat->group[peernum].nick_len = contents_len; | 296 | chat->group[peernum].nick_len = contents_len; |
297 | |||
293 | if (chat->peer_namelistchange != NULL) | 298 | if (chat->peer_namelistchange != NULL) |
294 | (*chat->peer_namelistchange)(chat, peernum, CHAT_CHANGE_PEER_NAME, chat->group_namelistchange_userdata); | 299 | (*chat->peer_namelistchange)(chat, peernum, CHAT_CHANGE_PEER_NAME, chat->group_namelistchange_userdata); |
295 | } | 300 | } |