summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-10-20 01:33:57 -0400
committerTingPing <tingping@tingping.se>2013-10-20 01:33:57 -0400
commit20c9c94a61e003b541ce6833f1aa5e09d1d5d94c (patch)
treed7ffac4ce938c1c12eaeb8cb53a98cda04e7e29a
parentad1520b29afcd0b120e7b91ac0e23b593dfde6fc (diff)
Ignore nick prefix when splitting NAMES reply
-rw-r--r--src/common/inbound.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 9278a05d..912fbbd5 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -668,7 +668,7 @@ inbound_nameslist (server *serv, char *chan, char *names,
 {
 	session *sess;
 	char **name_list;
-	char *host;
+	char *host, *nopre_name;
 	char name[NICKLEN];
 	int i, offset;
 
@@ -700,8 +700,17 @@ inbound_nameslist (server *serv, char *chan, char *names,
 
 		if (serv->have_uhnames)
 		{
-			/* Server may have userhost-in-names cap */
-			offset = strcspn (name_list[i], "!");
+			offset = 0;
+			nopre_name = name_list[i];
+
+			/* Ignore prefixes so '!' won't cause issues */
+			while (strchr (serv->nick_prefixes, *nopre_name) != NULL)
+			{
+				*nopre_name++;
+				offset++;
+			}
+
+			offset += strcspn (nopre_name, "!");
 			if (offset++ < strlen (name_list[i]))
 				host = name_list[i] + offset;
 		}