Added group chat join/part/name change messages.
This commit is contained in:
parent
6ef6a90c52
commit
3ccc1be67f
@ -334,11 +334,14 @@ twc_group_namelist_change_callback(Tox *tox,
|
|||||||
|
|
||||||
struct t_gui_nick *nick;
|
struct t_gui_nick *nick;
|
||||||
char *name = twc_get_peer_name_nt(profile->tox, group_number, peer_number);
|
char *name = twc_get_peer_name_nt(profile->tox, group_number, peer_number);
|
||||||
|
char *prev_name = NULL;
|
||||||
|
|
||||||
if (change_type == TOX_CHAT_CHANGE_PEER_DEL
|
if (change_type == TOX_CHAT_CHANGE_PEER_DEL
|
||||||
|| change_type == TOX_CHAT_CHANGE_PEER_NAME)
|
|| change_type == TOX_CHAT_CHANGE_PEER_NAME)
|
||||||
{
|
{
|
||||||
nick = weechat_hashtable_get(chat->nicks, &peer_number);
|
nick = weechat_hashtable_get(chat->nicks, &peer_number);
|
||||||
|
prev_name = strdup(weechat_nicklist_nick_get_string(chat->buffer,
|
||||||
|
nick, "name"));
|
||||||
weechat_nicklist_remove_nick(chat->buffer, nick);
|
weechat_nicklist_remove_nick(chat->buffer, nick);
|
||||||
weechat_hashtable_remove(chat->nicks, &peer_number);
|
weechat_hashtable_remove(chat->nicks, &peer_number);
|
||||||
}
|
}
|
||||||
@ -350,5 +353,21 @@ twc_group_namelist_change_callback(Tox *tox,
|
|||||||
name, NULL, NULL, NULL, 1);
|
name, NULL, NULL, NULL, 1);
|
||||||
weechat_hashtable_set(chat->nicks, &peer_number, nick);
|
weechat_hashtable_set(chat->nicks, &peer_number, nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (change_type)
|
||||||
|
{
|
||||||
|
case TOX_CHAT_CHANGE_PEER_NAME:
|
||||||
|
weechat_printf(chat->buffer, "%s%s is now known as %s",
|
||||||
|
weechat_prefix("network"), prev_name, name);
|
||||||
|
break;
|
||||||
|
case TOX_CHAT_CHANGE_PEER_ADD:
|
||||||
|
weechat_printf(chat->buffer, "%s%s just joined the group chat",
|
||||||
|
weechat_prefix("join"), name);
|
||||||
|
break;
|
||||||
|
case TOX_CHAT_CHANGE_PEER_DEL:
|
||||||
|
weechat_printf(chat->buffer, "%s%s just left the group chat",
|
||||||
|
weechat_prefix("quit"), name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user