summary refs log tree commit diff stats
path: root/src/common/proto-irc.c
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-10-24 18:52:13 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-10-24 18:52:13 +0200
commitd9b5900525e469e40ab57e948713af1e81a07789 (patch)
tree8ee0b28f69366f2e932aed3db12bb3c231d5d1ce /src/common/proto-irc.c
parent464b005c97aeffc74a7eb59f452bbc5e90032cb3 (diff)
Add support for ircd-seven identify-msg (author unknown)
Diffstat (limited to 'src/common/proto-irc.c')
-rw-r--r--src/common/proto-irc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index b1c869fc..ed7d9a4d 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -49,6 +49,7 @@ irc_login (server *serv, char *user, char *realname)
 {
 	if (serv->password[0])
 		tcp_sendf (serv, "PASS %s\r\n", serv->password);
+	tcp_sendf (serv, "CAP LS\r\n");
 
 	tcp_sendf (serv,
 				  "NICK %s\r\n"
@@ -1114,6 +1115,41 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[])
 		}
 	}
 
+	else if (len == 3)
+	{
+		guint32 t;
+
+		t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2], (guint8)type[3]);
+		switch (t)
+		{
+			case WORDL('C','A','P','\0'):
+				if (strncasecmp (word[4], "ACK", 3) == 0)
+				{
+					if (strncasecmp (word[5][0]==':' ? word[5] + 1 : word[5], "identify-msg", 12) == 0)
+					{
+						serv->have_idmsg = TRUE;
+						tcp_send_len (serv, "CAP END\r\n", 9);
+					}
+				}
+				else if (strncasecmp (word[4], "LS", 2) == 0)
+				{
+					if (strstr (word_eol[5], "identify-msg") != 0)
+					{
+						tcp_send_len (serv, "CAP REQ :identify-msg\r\n", 23);
+					}
+					else
+					{
+						tcp_send_len (serv, "CAP END\r\n", 9);
+					}
+				}
+				else if (strncasecmp (word[4], "NAK",3) == 0)
+				{
+					tcp_send_len (serv, "CAP END\r\n", 9);
+				}
+				return;
+		}
+	}
+
 garbage:
 	/* unknown message */
 	PrintTextf (sess, "GARBAGE: %s\n", word_eol[1]);