From a3aae117ab5a197d76269f71317038cb6e48c93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Tue, 2 Sep 2014 20:34:22 +0200 Subject: [PATCH] Fixed bug where chats would not refresh properly on nick/status changes. --- src/tox-weechat-tox.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/tox-weechat-tox.c b/src/tox-weechat-tox.c index fc8672f..7f7f8ba 100644 --- a/src/tox-weechat-tox.c +++ b/src/tox-weechat-tox.c @@ -82,6 +82,15 @@ tox_weechat_do_timer_cb(void *data, return WEECHAT_RC_OK; } +int +tox_weechat_chat_refresh_timer_callback(void *data, int remaining) +{ + struct t_tox_chat *chat = data; + tox_weechat_chat_refresh(chat); + + return WEECHAT_RC_OK; +} + void tox_weechat_friend_message_callback(Tox *tox, int32_t friend_number, @@ -146,7 +155,8 @@ tox_weechat_name_change_callback(Tox *tox, struct t_tox_chat *chat = tox_weechat_get_existing_friend_chat(friend_number); if (chat) { - tox_weechat_chat_refresh(chat); + weechat_hook_timer(10, 0, 1, + tox_weechat_chat_refresh_timer_callback, chat); char *old_name = tox_weechat_get_name_nt(friend_number); char *new_name = tox_weechat_null_terminate(name, length); @@ -176,7 +186,8 @@ tox_weechat_user_status_callback(Tox *tox, { struct t_tox_chat *chat = tox_weechat_get_existing_friend_chat(friend_number); if (chat) - tox_weechat_chat_refresh(chat); + weechat_hook_timer(10, 0, 1, + tox_weechat_chat_refresh_timer_callback, chat); } void @@ -188,7 +199,8 @@ tox_weechat_status_message_callback(Tox *tox, { struct t_tox_chat *chat = tox_weechat_get_existing_friend_chat(friend_number); if (chat) - tox_weechat_chat_refresh(chat); + weechat_hook_timer(10, 0, 1, + tox_weechat_chat_refresh_timer_callback, chat); } void