Merge pull request #665 from FullName/peerdel-ntox-feedback

Print a more detailed message on CHAT_CHANGE_PEER_DEL, so a user isn't confounded...
This commit is contained in:
irungentoo 2013-11-26 17:20:13 -08:00
commit 3fe7e08791

View File

@ -1068,9 +1068,27 @@ void print_groupnamelistchange(Tox *m, int groupnumber, int peernumber, uint8_t
sprintf(msg, "[g] #%i: New peer %i.", groupnumber, peernumber);
new_lines(msg);
} else if (change == TOX_CHAT_CHANGE_PEER_DEL) {
sprintf(msg, "[g] #%i: Peer %i left. Name list is now:", groupnumber, peernumber);
new_lines(msg);
print_groupchatpeers(m, groupnumber);
/* if peer was the last in list, it simply dropped,
* otherwise it was overwritten by the last peer
*
* adjust output
*/
int peers_total = tox_group_number_peers(m, groupnumber);
if (peers_total == peernumber) {
sprintf(msg, "[g] #%i: Peer %i left.", groupnumber, peernumber);
new_lines(msg);
} else {
uint8_t peername[TOX_MAX_NAME_LENGTH];
int len = tox_group_peername(m, groupnumber, peernumber, peername);
if (len <= 0)
peername[0] = 0;
sprintf(msg, "[g] #%i: Peer %i left. Former peer [%i: <%s>] is now peer %i.", groupnumber, peernumber,
peers_total, peername, peernumber);
new_lines(msg);
}
} else if (change == TOX_CHAT_CHANGE_PEER_NAME) {
uint8_t peername[TOX_MAX_NAME_LENGTH];
int len = tox_group_peername(m, groupnumber, peernumber, peername);