summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-10-26 13:37:20 -0400
committerTingPing <tingping@tingping.se>2013-10-26 13:37:20 -0400
commita1c9294b89efcec752ca4a83e57fb2bf8dbf0ef8 (patch)
treed1f522a47910dd964955b8468c5063291970b196 /src
parent7cf9ea83cb8ab3d31a57e1969975aa79870fc6fa (diff)
Only update userlistgui when necessary
Diffstat (limited to 'src')
-rw-r--r--src/common/userlist.c16
1 files 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;
 	}