nicklist added to proflie buffer to show online friends
This commit is contained in:
parent
043784e91d
commit
8501d36ee9
@ -285,6 +285,10 @@ twc_profile_load(struct t_twc_profile *profile)
|
|||||||
profile, NULL);
|
profile, NULL);
|
||||||
if (!(profile->buffer))
|
if (!(profile->buffer))
|
||||||
return TWC_RC_ERROR;
|
return TWC_RC_ERROR;
|
||||||
|
|
||||||
|
profile->nicklist_group = weechat_nicklist_add_group(profile->buffer, NULL,
|
||||||
|
NULL, NULL, true);
|
||||||
|
weechat_buffer_set(profile->buffer, "nicklist", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
weechat_printf(profile->buffer,
|
weechat_printf(profile->buffer,
|
||||||
|
@ -51,6 +51,7 @@ struct t_twc_profile
|
|||||||
int tox_online;
|
int tox_online;
|
||||||
|
|
||||||
struct t_gui_buffer *buffer;
|
struct t_gui_buffer *buffer;
|
||||||
|
struct t_gui_nick_group *nicklist_group;
|
||||||
struct t_hook *tox_do_timer;
|
struct t_hook *tox_do_timer;
|
||||||
|
|
||||||
struct t_twc_list *chats;
|
struct t_twc_list *chats;
|
||||||
|
@ -84,6 +84,7 @@ twc_connection_status_callback(Tox *tox, uint32_t friend_number,
|
|||||||
{
|
{
|
||||||
struct t_twc_profile *profile = data;
|
struct t_twc_profile *profile = data;
|
||||||
char *name = twc_get_name_nt(profile->tox, friend_number);
|
char *name = twc_get_name_nt(profile->tox, friend_number);
|
||||||
|
struct t_gui_nick *nick = NULL;
|
||||||
struct t_twc_chat *chat = twc_chat_search_friend(profile,
|
struct t_twc_chat *chat = twc_chat_search_friend(profile,
|
||||||
friend_number,
|
friend_number,
|
||||||
false);
|
false);
|
||||||
@ -91,6 +92,11 @@ twc_connection_status_callback(Tox *tox, uint32_t friend_number,
|
|||||||
// TODO: print in friend's buffer if it exists
|
// TODO: print in friend's buffer if it exists
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
{
|
{
|
||||||
|
nick = weechat_nicklist_search_nick(profile->buffer,
|
||||||
|
profile->nicklist_group, name);
|
||||||
|
if (nick)
|
||||||
|
weechat_nicklist_remove_nick(profile->buffer, nick);
|
||||||
|
|
||||||
weechat_printf(profile->buffer,
|
weechat_printf(profile->buffer,
|
||||||
"%s%s just went offline.",
|
"%s%s just went offline.",
|
||||||
weechat_prefix("network"),
|
weechat_prefix("network"),
|
||||||
@ -105,6 +111,9 @@ twc_connection_status_callback(Tox *tox, uint32_t friend_number,
|
|||||||
}
|
}
|
||||||
else if (status == 1)
|
else if (status == 1)
|
||||||
{
|
{
|
||||||
|
weechat_nicklist_add_nick(profile->buffer, profile->nicklist_group,
|
||||||
|
name, NULL, NULL, NULL, 1);
|
||||||
|
|
||||||
weechat_printf(profile->buffer,
|
weechat_printf(profile->buffer,
|
||||||
"%s%s just came online.",
|
"%s%s just came online.",
|
||||||
weechat_prefix("network"),
|
weechat_prefix("network"),
|
||||||
@ -127,6 +136,7 @@ twc_name_change_callback(Tox *tox, uint32_t friend_number,
|
|||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct t_twc_profile *profile = data;
|
struct t_twc_profile *profile = data;
|
||||||
|
struct t_gui_nick *nick = NULL;
|
||||||
struct t_twc_chat *chat = twc_chat_search_friend(profile,
|
struct t_twc_chat *chat = twc_chat_search_friend(profile,
|
||||||
friend_number,
|
friend_number,
|
||||||
false);
|
false);
|
||||||
@ -146,6 +156,14 @@ twc_name_change_callback(Tox *tox, uint32_t friend_number,
|
|||||||
old_name, new_name);
|
old_name, new_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nick = weechat_nicklist_search_nick(profile->buffer,
|
||||||
|
profile->nicklist_group, old_name);
|
||||||
|
if (nick)
|
||||||
|
weechat_nicklist_remove_nick(profile->buffer, nick);
|
||||||
|
|
||||||
|
weechat_nicklist_add_nick(profile->buffer, profile->nicklist_group,
|
||||||
|
new_name, NULL, NULL, NULL, 1);
|
||||||
|
|
||||||
weechat_printf(profile->buffer,
|
weechat_printf(profile->buffer,
|
||||||
"%s%s is now known as %s",
|
"%s%s is now known as %s",
|
||||||
weechat_prefix("network"),
|
weechat_prefix("network"),
|
||||||
|
Loading…
Reference in New Issue
Block a user