mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
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.
This commit is contained in:
parent
e85e9dbb99
commit
56079c92c3
|
@ -254,8 +254,12 @@ static int delpeer(Group_Chat *chat, int peernum)
|
|||
|
||||
chat->group = temp;
|
||||
|
||||
if (chat->peer_namelistchange != NULL)
|
||||
(*chat->peer_namelistchange)(chat, peernum, CHAT_CHANGE_PEER_DEL, chat->group_namelistchange_userdata);
|
||||
if (chat->peer_namelistchange != NULL) {
|
||||
(*chat->peer_namelistchange)(chat, chat->numpeers, CHAT_CHANGE_PEER_DEL, chat->group_namelistchange_userdata);
|
||||
|
||||
if (chat->numpeers != (uint32_t)peernum)
|
||||
(*chat->peer_namelistchange)(chat, peernum, CHAT_CHANGE_PEER_NAME, chat->group_namelistchange_userdata);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -290,6 +294,7 @@ static void setnick(Group_Chat *chat, int peernum, uint8_t *contents, uint16_t c
|
|||
/* Force null termination */
|
||||
chat->group[peernum].nick[contents_len - 1] = 0;
|
||||
chat->group[peernum].nick_len = contents_len;
|
||||
|
||||
if (chat->peer_namelistchange != NULL)
|
||||
(*chat->peer_namelistchange)(chat, peernum, CHAT_CHANGE_PEER_NAME, chat->group_namelistchange_userdata);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user