mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Print a more detailed message on CHAT_CHANGE_PEER_DEL, so a user isn't confounded by the change of peer numbers.
On deleting the last peer, it's just a delete. On deleting any other peer, the last peer is moved into that space, gaining a different number. Print that detail where appropriate.
This commit is contained in:
parent
bc06c7b2b0
commit
a204b95c51
|
@ -1068,9 +1068,27 @@ void print_groupnamelistchange(Tox *m, int groupnumber, int peernumber, uint8_t
|
||||||
sprintf(msg, "[g] #%i: New peer %i.", groupnumber, peernumber);
|
sprintf(msg, "[g] #%i: New peer %i.", groupnumber, peernumber);
|
||||||
new_lines(msg);
|
new_lines(msg);
|
||||||
} else if (change == TOX_CHAT_CHANGE_PEER_DEL) {
|
} else if (change == TOX_CHAT_CHANGE_PEER_DEL) {
|
||||||
sprintf(msg, "[g] #%i: Peer %i left. Name list is now:", groupnumber, peernumber);
|
/* 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);
|
new_lines(msg);
|
||||||
print_groupchatpeers(m, groupnumber);
|
} 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) {
|
} else if (change == TOX_CHAT_CHANGE_PEER_NAME) {
|
||||||
uint8_t peername[TOX_MAX_NAME_LENGTH];
|
uint8_t peername[TOX_MAX_NAME_LENGTH];
|
||||||
int len = tox_group_peername(m, groupnumber, peernumber, peername);
|
int len = tox_group_peername(m, groupnumber, peernumber, peername);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user