From e02f0db03062e913370cca668ee06e7f36ea35b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Thu, 18 Sep 2014 01:27:15 +0200 Subject: [PATCH] Added a notice for friends going offline. --- src/tox-weechat-tox-callbacks.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/tox-weechat-tox-callbacks.c b/src/tox-weechat-tox-callbacks.c index d225eb2..7d1b1e1 100644 --- a/src/tox-weechat-tox-callbacks.c +++ b/src/tox-weechat-tox-callbacks.c @@ -82,17 +82,24 @@ tox_weechat_connection_status_callback(Tox *tox, uint8_t status, void *data) { - if (status == 1) - { - struct t_tox_weechat_identity *identity = data; - char *name = tox_weechat_get_name_nt(identity->tox, friend_number); + struct t_tox_weechat_identity *identity = data; + char *name = tox_weechat_get_name_nt(identity->tox, friend_number); + if (status == 0) + { weechat_printf(identity->buffer, - "%s%s just went online!", + "%s%s just went offline.", weechat_prefix("network"), name); - free(name); } + else if (status == 1) + { + weechat_printf(identity->buffer, + "%s%s just came online.", + weechat_prefix("network"), + name); + } + free(name); } void