libpurple/protocols/irc/parse.c

changeset 38929
159404505264
parent 37966
956640da6944
parent 38924
233025cb30f5
child 39589
60c7ad40393f
--- a/libpurple/protocols/irc/parse.c	Thu Feb 22 22:41:59 2018 -0600
+++ b/libpurple/protocols/irc/parse.c	Thu Mar 29 23:20:36 2018 -0500
@@ -117,6 +117,7 @@
 	{ "906", "*", 0, irc_msg_authfail },		/* SASL auth failed		*/
 	{ "907", "*", 0, irc_msg_authfail },		/* SASL auth failed		*/
 	{ "cap", "vv:", 3, irc_msg_cap },		/* SASL capable			*/
+	{ "authenticate", ":", 1, irc_msg_authenticate }, /* SASL authenticate		*/
 #endif
 	{ "invite", "n:", 2, irc_msg_invite },		/* Invited			*/
 	{ "join", ":", 1, irc_msg_join },		/* Joined a channel		*/
@@ -546,7 +547,7 @@
 
 	mode_chars = irc->mode_chars ? irc->mode_chars : default_modes;
 
-	while (strchr(mode_chars, *nick) != NULL)
+	while (*nick && strchr(mode_chars, *nick) != NULL)
 		nick++;
 
 	return nick;
@@ -568,7 +569,7 @@
 	 * message and low-level quoting ... but if you want that crap,
 	 * use a real IRC client. */
 
-	if (msg[0] != '\001' || msg[strlen(msg) - 1] != '\001')
+	if (msg[0] != '\001' || msg[1] == '\0' || msg[strlen(msg) - 1] != '\001')
 		return g_strdup(msg);
 
 	if (!strncmp(cur, "ACTION ", 7)) {
@@ -695,6 +696,13 @@
 	 */
 	purple_signal_emit(_irc_protocol, "irc-receiving-text", gc, &input);
 
+	if (purple_debug_is_verbose()) {
+		char *clean = purple_utf8_salvage(input);
+		clean = g_strstrip(clean);
+		purple_debug_misc("irc", ">> %s\n", clean);
+		g_free(clean);
+	}
+
 	if (!strncmp(input, "PING ", 5)) {
 		msg = irc_format(irc, "vv", "PONG", input + 5);
 		irc_send(irc, msg);

mercurial