From a1c9294b89efcec752ca4a83e57fb2bf8dbf0ef8 Mon Sep 17 00:00:00 2001 From: TingPing Date: Sat, 26 Oct 2013 13:37:20 -0400 Subject: Only update userlistgui when necessary --- src/common/userlist.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/common/userlist.c b/src/common/userlist.c index 4c997eb9..4e3a2615 100644 --- a/src/common/userlist.c +++ b/src/common/userlist.c @@ -139,31 +139,33 @@ userlist_add_hostname (struct session *sess, char *nick, char *hostname, char *realname, char *servername, char *account, unsigned int away) { struct User *user; + gboolean do_rehash = FALSE; user = userlist_find (sess, nick); if (user) { if (!user->hostname && hostname) + { + if (prefs.hex_gui_ulist_show_hosts) + do_rehash = TRUE; user->hostname = strdup (hostname); + } if (!user->realname && realname) user->realname = strdup (realname); if (!user->servername && servername) user->servername = strdup (servername); if (!user->account && account && strcmp (account, "0") != 0) user->account = strdup (account); - if (away != 0xff) { - if (prefs.hex_gui_ulist_show_hosts || user->away != away) - { - user->away = away; - fe_userlist_rehash (sess, user); - } + if (user->away != away) + do_rehash = TRUE; user->away = away; } fe_userlist_update (sess, user); - fe_userlist_rehash (sess, user); + if (do_rehash) + fe_userlist_rehash (sess, user); return 1; } -- cgit 1.4.1