summary refs log tree commit diff stats
path: root/src/common/proto-irc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/proto-irc.c')
-rw-r--r--src/common/proto-irc.c52
1 files changed, 42 insertions, 10 deletions
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index 906ee713..6eb7c58c 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -313,7 +313,10 @@ irc_join_info (server *serv, char *channel)
 static void
 irc_user_list (server *serv, char *channel)
 {
-	tcp_sendf (serv, "WHO %s\r\n", channel);
+	if (serv->have_whox)
+		tcp_sendf (serv, "WHO %s %%chtsunfra,152\r\n", channel);
+	else
+		tcp_sendf (serv, "WHO %s\r\n", channel);
 }
 
 /* userhost */
@@ -328,7 +331,7 @@ static void
 irc_away_status (server *serv, char *channel)
 {
 	if (serv->have_whox)
-		tcp_sendf (serv, "WHO %s %%ctnf,152\r\n", channel);
+		tcp_sendf (serv, "WHO %s %%chtsunfra,152\r\n", channel);
 	else
 		tcp_sendf (serv, "WHO %s\r\n", channel);
 }
@@ -560,7 +563,7 @@ process_numeric (session * sess, int n,
 		if (!serv->skip_next_whois)
 			EMIT_SIGNAL (XP_TE_WHOIS3, whois_sess, word[4], word_eol[5], NULL, NULL, 0);
 		else
-			inbound_user_info (sess, NULL, NULL, NULL, word[5], word[4], NULL, 0xff);
+			inbound_user_info (sess, NULL, NULL, NULL, word[5], word[4], NULL, NULL, 0xff);
 		break;
 
 	case 311:	/* WHOIS 1st line */
@@ -571,7 +574,7 @@ process_numeric (session * sess, int n,
 							 word[6], word_eol[8] + 1, 0);
 		else
 			inbound_user_info (sess, NULL, word[5], word[6], NULL, word[4],
-									 word_eol[8][0] == ':' ? word_eol[8] + 1 : word_eol[8], 0xff);
+									 word_eol[8][0] == ':' ? word_eol[8] + 1 : word_eol[8], NULL, 0xff);
 		break;
 
 	case 314:	/* WHOWAS */
@@ -716,7 +719,7 @@ process_numeric (session * sess, int n,
 				away = 1;
 
 			inbound_user_info (sess, word[4], word[5], word[6], word[7],
-									 word[8], word_eol[11], away);
+									 word[8], word_eol[11], word[10], away);
 
 			/* try to show only user initiated whos */
 			if (!who_sess || !who_sess->doing_who)
@@ -730,16 +733,17 @@ process_numeric (session * sess, int n,
 			unsigned int away = 0;
 			session *who_sess;
 
-			/* irc_away_status sends out a "152" */
+			/* irc_away_status and irc_user_list sends out a "152" */
 			if (!strcmp (word[4], "152"))
 			{
 				who_sess = find_channel (serv, word[5]);
 
-				if (*word[7] == 'G')
+				if (*word[10] == 'G')
 					away = 1;
 
-				/* :SanJose.CA.us.undernet.org 354 z1 152 #zed1 z1 H@ */
-				inbound_user_info (sess, word[5], 0, 0, 0, word[6], 0, away);
+				/* :server 354 yournick 152 #channel ~ident host servname nick H account :realname */
+				inbound_user_info (sess, word[5], word[6], word[7], word[8],
+									 word[9], word_eol[12], word[11], away);
 
 				/* try to show only user initiated whos */
 				if (!who_sess || !who_sess->doing_who)
@@ -965,13 +969,15 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[])
 		case WORDL('J','O','I','N'):
 			{
 				char *chan = word[3];
+				char *account = word[4];
+				char *realname = word_eol[5] + 1;
 
 				if (*chan == ':')
 					chan++;
 				if (!serv->p_cmp (nick, serv->nick))
 					inbound_ujoin (serv, chan, nick, ip);
 				else
-					inbound_join (serv, chan, nick, ip);
+					inbound_join (serv, chan, nick, ip, account, realname);
 			}
 			return;
 
@@ -1047,6 +1053,11 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[])
 		/* this should compile to a bunch of: CMP.L, JE ... nice & fast */
 		switch (t)
 		{
+
+		case WORDL('A','C','C','O'):
+			inbound_account (serv, nick, word[3]);
+			return;
+			
 		case WORDL('I','N','V','I'):
 			if (ignore_check (word[1], IG_INVI))
 				return;
@@ -1176,6 +1187,16 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[])
 						serv->have_awaynotify = TRUE;
 					}
 
+					if (strstr (word_eol[5], "account-notify") != 0)
+					{
+						serv->have_accnotify = TRUE;
+					}
+					
+					if (strstr (word_eol[5], "extended-join") != 0)
+					{
+						serv->have_extjoin = TRUE;
+					}
+
 					if (strstr (word_eol[5], "sasl") != 0)
 					{
 						serv->have_sasl = TRUE;
@@ -1208,6 +1229,17 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[])
 						want_cap ? strcat (buffer, " away-notify") : strcpy (buffer, "CAP REQ :away-notify");
 						want_cap = 1;
 					}
+					if (strstr (word_eol[5], "account-notify") != 0)
+					{
+						want_cap ? strcat (buffer, " account-notify") : strcpy (buffer, "CAP REQ :account-notify");
+						want_cap = 1;
+					}
+
+					if (strstr (word_eol[5], "extended-join") != 0)
+					{
+						want_cap ? strcat (buffer, " extended-join") : strcpy (buffer, "CAP REQ :extended-join");
+						want_cap = 1;
+					}
 					/* if the SASL password is set, request SASL auth */
 					if (strstr (word_eol[5], "sasl") != 0 && strlen (sess->server->saslpassword) != 0)
 					{