--- a/libpurple/protocols/irc/msgs.c Wed Jan 15 20:43:52 2014 -0800
+++ b/libpurple/protocols/irc/msgs.c Thu Jan 16 11:28:22 2014 +0100
@@ -595,13 +595,13 @@
PurpleConversation *convo;
if (!strcmp(name, "topic")) {
- if (!args[0] || !args[1])
+ g_return_if_fail(args[0]); + g_return_if_fail(args[1]); topic = irc_mirc2txt (args[1]);
- if (!args[0] || !args[1] || !args[2])
+ g_return_if_fail(args[1]); + g_return_if_fail(args[2]); topic = irc_mirc2txt (args[2]);
@@ -908,8 +908,7 @@
- if (!args || !args[1] || !gc)
components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
nick = irc_mask_nick(from);
@@ -982,14 +981,13 @@
- char *nick = irc_mask_nick(from), *userhost, *buf;
+ char *nick, *userhost, *buf;
+ nick = irc_mask_nick(from); if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) {
/* We are joining a channel for the first time */
@@ -1049,12 +1047,11 @@
PurpleConnection *gc = purple_account_get_connection(irc->account);
PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account);
- char *nick = irc_mask_nick(from), *buf;
+ nick = irc_mask_nick(from); purple_debug(PURPLE_DEBUG_ERROR, "irc", "Received a KICK for unknown channel %s\n", args[0]);
@@ -1238,9 +1235,6 @@
void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args)
- if (!args || !args[0] || !args[1])
irc_msg_handle_privmsg(irc, name, from, args[0], args[1], TRUE);
@@ -1260,8 +1254,7 @@
PurpleConversation *convo;
char *nick, *msg, *channel;
- if (!args || !args[0] || !gc)
/* Undernet likes to :-quote the channel name, for no good reason
* that I can see. This catches that. */
@@ -1294,8 +1287,6 @@
void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args)
buf = irc_format(irc, "v:", "PONG", args[0]);
@@ -1309,9 +1300,6 @@
parts = g_strsplit(args[1], " ", 2);
if (!parts[0] || !parts[1]) {
@@ -1345,9 +1333,6 @@
void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args)
- if (!args || !args[0] || !args[1])
irc_msg_handle_privmsg(irc, name, from, args[0], args[1], FALSE);
@@ -1424,9 +1409,6 @@
- if (!args || !args[0] || !gc)
data[0] = irc_mask_nick(from);
/* XXX this should have an API, I shouldn't grab this directly */
@@ -1456,9 +1438,6 @@
PurpleConnection *gc = purple_account_get_connection(irc->account);
- if (!args || !args[0] || !gc)
nick = irc_mask_nick(from);
msg = g_strdup_printf (_("Wallops from %s"), nick);
@@ -1633,7 +1612,7 @@
PurpleConnection *gc = purple_account_get_connection(irc->account);
const char *mech_list = NULL;
- if (!args[1] || !args[2] || strncmp(args[2], "sasl ", 6))
+ if (strncmp(args[2], "sasl ", 6)) if (strncmp(args[1], "ACK", 4)) {
const char *tmp = _("SASL authentication failed: Server does not support SASL authentication.");
--- a/libpurple/protocols/irc/parse.c Wed Jan 15 20:43:52 2014 -0800
+++ b/libpurple/protocols/irc/parse.c Thu Jan 16 11:28:22 2014 +0100
@@ -72,8 +72,8 @@
{ "322", "ncv:", -1, irc_msg_list }, /* List. */
{ "323", ":", -1, irc_msg_list }, /* End of list. */
{ "324", "ncv:", -1, irc_msg_chanmode }, /* Channel modes */
- { "331", "nc:", -1, irc_msg_topic }, /* No channel topic */
- { "332", "nc:", -1, irc_msg_topic }, /* Channel topic */
+ { "331", "nc:", 3, irc_msg_topic }, /* No channel topic */ + { "332", "nc:", 3, irc_msg_topic }, /* Channel topic */ { "333", "ncvv", -1, irc_msg_topicinfo }, /* Topic setter stuff */
{ "352", "ncvvvnv:", -1, irc_msg_who }, /* Channel WHO */
{ "353", "nvc:", -1, irc_msg_names }, /* Names list */
@@ -104,26 +104,26 @@
{ "506", "nc:", -1, irc_msg_nosend }, /* Must identify to send */
{ "515", "nc:", -1, irc_msg_regonly }, /* Registration required */
- { "903", "*", -1, irc_msg_authok}, /* SASL auth successful */
- { "904", "*", -1, irc_msg_authtryagain }, /* SASL auth failed, can recover*/
- { "905", "*", -1, irc_msg_authfail }, /* SASL auth failed */
- { "906", "*", -1, irc_msg_authfail }, /* SASL auth failed */
- { "907", "*", -1, irc_msg_authfail }, /* SASL auth failed */
- { "cap", "vv:", -1, irc_msg_cap }, /* SASL capable */
+ { "903", "*", 0, irc_msg_authok}, /* SASL auth successful */ + { "904", "*", 0, irc_msg_authtryagain }, /* SASL auth failed, can recover*/ + { "905", "*", 0, irc_msg_authfail }, /* SASL auth failed */ + { "906", "*", 0, irc_msg_authfail }, /* SASL auth failed */ + { "907", "*", 0, irc_msg_authfail }, /* SASL auth failed */ + { "cap", "vv:", 3, irc_msg_cap }, /* SASL capable */ - { "invite", "n:", -1, irc_msg_invite }, /* Invited */
- { "join", ":", -1, irc_msg_join }, /* Joined a channel */
+ { "invite", "n:", 2, irc_msg_invite }, /* Invited */ + { "join", ":", 1, irc_msg_join }, /* Joined a channel */ { "kick", "cn:", -1, irc_msg_kick }, /* KICK */
- { "mode", "tv:", -1, irc_msg_mode }, /* MODE for channel */
+ { "mode", "tv:", 2, irc_msg_mode }, /* MODE for channel */ { "nick", ":", -1, irc_msg_nick }, /* Nick change */
- { "notice", "t:", -1, irc_msg_notice }, /* NOTICE recv */
- { "part", "c:", -1, irc_msg_part }, /* Parted a channel */
- { "ping", ":", -1, irc_msg_ping }, /* Received PING from server */
- { "pong", "v:", -1, irc_msg_pong }, /* Received PONG from server */
- { "privmsg", "t:", -1, irc_msg_privmsg }, /* Received private message */
- { "topic", "c:", -1, irc_msg_topic }, /* TOPIC command */
- { "quit", ":", -1, irc_msg_quit }, /* QUIT notice */
- { "wallops", ":", -1, irc_msg_wallops }, /* WALLOPS command */
+ { "notice", "t:", 2, irc_msg_notice }, /* NOTICE recv */ + { "part", "c:", 1, irc_msg_part }, /* Parted a channel */ + { "ping", ":", 1, irc_msg_ping }, /* Received PING from server */ + { "pong", "v:", 2, irc_msg_pong }, /* Received PONG from server */ + { "privmsg", "t:", 2, irc_msg_privmsg }, /* Received private message */ + { "topic", "c:", 2, irc_msg_topic }, /* TOPIC command */ + { "quit", ":", 1, irc_msg_quit }, /* QUIT notice */ + { "wallops", ":", 1, irc_msg_wallops }, /* WALLOPS command */