summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-10-20 00:29:28 -0400
committerTingPing <tingping@tingping.se>2013-10-20 00:29:58 -0400
commitad1520b29afcd0b120e7b91ac0e23b593dfde6fc (patch)
treebd360aabf3ca9bdde6420ca1a6ba723b4fe7c3c6
parent06a7d84b43904218f2299f582b6e2f9e0fe55b6c (diff)
Only split NAMES reply if server supports userhost-in-names
-rw-r--r--src/common/inbound.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 71ecc162..9278a05d 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -693,14 +693,18 @@ inbound_nameslist (server *serv, char *chan, char *names,
 	for (i = 0; name_list[i]; i++)
 	{
 		host = NULL;
+		offset = sizeof(name);
 
 		if (name_list[i][0] == 0)
 			continue;
 
-		/* Server may have userhost-in-names cap */
-		offset = strcspn (name_list[i], "!");
-		if (offset++ < strlen (name_list[i]))
-			host = name_list[i] + offset;
+		if (serv->have_uhnames)
+		{
+			/* Server may have userhost-in-names cap */
+			offset = strcspn (name_list[i], "!");
+			if (offset++ < strlen (name_list[i]))
+				host = name_list[i] + offset;
+		}
 
 		g_strlcpy (name, name_list[i], MIN(offset, sizeof(name)));
 
@@ -1595,6 +1599,11 @@ inbound_cap_ack (server *serv, char *nick, char *extensions,
 		serv->have_extjoin = TRUE;
 	}
 
+	if (strstr (extensions, "userhost-in-names") != NULL)
+	{
+		serv->have_uhnames = TRUE;
+	}
+
 	if (strstr (extensions, "server-time") != NULL)
 	{
 		serv->have_server_time = TRUE;