IRC: fill required command parameter counts (part 2) release-2.x.y
authorTomasz Wasilczyk <twasilczyk@pidgin.im>
Thu, 16 Jan 2014 11:46:05 +0100
branchrelease-2.x.y
changeset5845d9fa7084 pushlog
parent 9f132a6855cd
child 6b0e0566af20
IRC: fill required command parameter counts (part 2)
libpurple/protocols/irc/msgs.c
libpurple/protocols/irc/parse.c
      1.1 --- a/libpurple/protocols/irc/msgs.c
      1.2 +++ b/libpurple/protocols/irc/msgs.c
      1.3 @@ -259,9 +259,6 @@
      1.4  {
      1.5  	PurpleConnection *gc = purple_account_get_connection(irc->account);
      1.6  
      1.7 -	if (!args || !args[1] || !gc)
      1.8 -		return;
      1.9 -
     1.10  	purple_notify_error(gc, NULL, _("Bad mode"), args[1]);
     1.11  }
     1.12  
     1.13 @@ -315,9 +312,6 @@
     1.14  	PurpleConnection *gc = purple_account_get_connection(irc->account);
     1.15  	char *buf;
     1.16  
     1.17 -	if (!args || !args[1] || !gc)
     1.18 -		return;
     1.19 -
     1.20  	buf = g_strdup_printf(_("You are banned from %s."), args[1]);
     1.21  	purple_notify_error(gc, _("Banned"), _("Banned"), buf);
     1.22  	g_free(buf);
     1.23 @@ -328,9 +322,6 @@
     1.24  	PurpleConversation *convo;
     1.25  	char *buf, *nick;
     1.26  
     1.27 -	if (!args || !args[0] || !args[1] || !args[2])
     1.28 -		return;
     1.29 -
     1.30  	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
     1.31  	if (!convo)
     1.32  		return;
     1.33 @@ -683,9 +674,6 @@
     1.34  	PurpleConnection *gc = purple_account_get_connection(irc->account);
     1.35  	char *buf;
     1.36  
     1.37 -	if (!args || !args[1] || !gc)
     1.38 -		return;
     1.39 -
     1.40  	buf = g_strdup_printf(_("Unknown message '%s'"), args[1]);
     1.41  	purple_notify_error(gc, _("Unknown message"), buf, _("The IRC server received a message it did not understand."));
     1.42  	g_free(buf);
     1.43 @@ -776,9 +764,6 @@
     1.44  {
     1.45  	char *escaped;
     1.46  
     1.47 -	if (!args || !args[0])
     1.48 -		return;
     1.49 -
     1.50  	if (!strcmp(name, "375")) {
     1.51  		if (irc->motd)
     1.52  			g_string_free(irc->motd, TRUE);
     1.53 @@ -815,11 +800,7 @@
     1.54  
     1.55  void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args)
     1.56  {
     1.57 -	PurpleConnection *gc;
     1.58 -
     1.59 -	gc = purple_account_get_connection(irc->account);
     1.60 -	if (gc == NULL || args == NULL || args[2] == NULL)
     1.61 -		return;
     1.62 +	PurpleConnection *gc = purple_account_get_connection(irc->account);
     1.63  
     1.64  	purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, _("Time Response"),
     1.65  			    _("The IRC server's local time is:"),
     1.66 @@ -830,9 +811,6 @@
     1.67  {
     1.68  	PurpleConnection *gc = purple_account_get_connection(irc->account);
     1.69  
     1.70 -	if (gc == NULL || args == NULL || args[1] == NULL)
     1.71 -		return;
     1.72 -
     1.73  	purple_notify_error(gc, NULL, _("No such channel"), args[1]);
     1.74  }
     1.75  
     1.76 @@ -892,9 +870,6 @@
     1.77  {
     1.78  	PurpleConversation *convo;
     1.79  
     1.80 -	if (!args || !args[1] || !args[2])
     1.81 -		return;
     1.82 -
     1.83  	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
     1.84  	if (!convo)
     1.85  		return;
     1.86 @@ -924,9 +899,6 @@
     1.87  	PurpleConnection *gc = purple_account_get_connection(irc->account);
     1.88  	char *buf;
     1.89  
     1.90 -	if (!args || !args[1] || !gc)
     1.91 -		return;
     1.92 -
     1.93  	buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]);
     1.94  	purple_notify_error(gc, _("Invitation only"), _("Invitation only"), buf);
     1.95  	g_free(buf);
     1.96 @@ -1194,9 +1166,6 @@
     1.97  	char *newnick, *buf, *end;
     1.98  	PurpleConnection *gc = purple_account_get_connection(irc->account);
     1.99  
    1.100 -	if (!args || !args[1])
    1.101 -		return;
    1.102 -
    1.103  	if (gc && purple_connection_get_state(gc) == PURPLE_CONNECTED) {
    1.104  		/* We only want to do the following dance if the connection
    1.105  		   has not been successfully completed.  If it has, just
    1.106 @@ -1242,9 +1211,6 @@
    1.107  {
    1.108  	PurpleConnection *gc = purple_account_get_connection(irc->account);
    1.109  
    1.110 -	if (!args || !args[2] || !gc)
    1.111 -		return;
    1.112 -
    1.113  	purple_notify_error(gc, _("Cannot change nick"), _("Could not change nick"), args[2]);
    1.114  }
    1.115  
    1.116 @@ -1386,9 +1352,6 @@
    1.117  	PurpleConversation *convo;
    1.118  	char *msg;
    1.119  
    1.120 -	if (!args || !args[1] || !args[2] || !gc)
    1.121 -		return;
    1.122 -
    1.123  	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
    1.124  	if (convo) {
    1.125  		/* This is a channel we're already in; for some reason,
    1.126 @@ -1427,9 +1390,6 @@
    1.127  {
    1.128  	PurpleConnection *gc = purple_account_get_connection(irc->account);
    1.129  
    1.130 -	if (!args || !args[1])
    1.131 -		return;
    1.132 -
    1.133  	purple_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]);
    1.134  }
    1.135  
      2.1 --- a/libpurple/protocols/irc/parse.c
      2.2 +++ b/libpurple/protocols/irc/parse.c
      2.3 @@ -80,29 +80,29 @@
      2.4  	{ "366", "nc:", -1, irc_msg_names },		/* End of names			*/
      2.5  	{ "367", "ncnnv", -1, irc_msg_ban },		/* Ban list			*/
      2.6  	{ "368", "nc:", -1, irc_msg_ban },		/* End of ban list		*/
      2.7 -	{ "372", "n:", -1, irc_msg_motd },		/* MOTD				*/
      2.8 -	{ "375", "n:", -1, irc_msg_motd },		/* Start MOTD			*/
      2.9 -	{ "376", "n:", -1, irc_msg_motd },		/* End of MOTD			*/
     2.10 -	{ "391", "nv:", -1, irc_msg_time },		/* Time reply			*/
     2.11 -	{ "401", "nt:", -1, irc_msg_nonick },		/* No such nick/chan		*/
     2.12 -	{ "406", "nt:", -1, irc_msg_nonick },		/* No such nick for WHOWAS	*/
     2.13 -	{ "403", "nc:", -1, irc_msg_nochan },		/* No such channel		*/
     2.14 -	{ "404", "nt:", -1, irc_msg_nosend },		/* Cannot send to chan		*/
     2.15 -	{ "421", "nv:", -1, irc_msg_unknown },		/* Unknown command		*/
     2.16 -	{ "422", "n:", -1, irc_msg_motd },		/* MOTD file missing		*/
     2.17 -	{ "432", "vn:", -1, irc_msg_badnick },		/* Erroneous nickname		*/
     2.18 -	{ "433", "vn:", -1, irc_msg_nickused },		/* Nickname already in use	*/
     2.19 -	{ "437", "nc:", -1, irc_msg_unavailable },	/* Nick/channel is unavailable	*/
     2.20 -	{ "438", "nn:", -1, irc_msg_nochangenick },	/* Nick may not change		*/
     2.21 -	{ "442", "nc:", -1, irc_msg_notinchan },	/* Not in channel		*/
     2.22 -	{ "473", "nc:", -1, irc_msg_inviteonly },	/* Tried to join invite-only	*/
     2.23 -	{ "474", "nc:", -1, irc_msg_banned },		/* Banned from channel		*/
     2.24 -	{ "477", "nc:", -1, irc_msg_regonly },		/* Registration Required	*/
     2.25 -	{ "478", "nct:", -1, irc_msg_banfull },		/* Banlist is full		*/
     2.26 -	{ "482", "nc:", -1, irc_msg_notop },		/* Need to be op to do that	*/
     2.27 -	{ "501", "n:", -1, irc_msg_badmode },		/* Unknown mode flag		*/
     2.28 -	{ "506", "nc:", -1, irc_msg_nosend },		/* Must identify to send	*/
     2.29 -	{ "515", "nc:", -1, irc_msg_regonly },		/* Registration required	*/
     2.30 +	{ "372", "n:", 1, irc_msg_motd },		/* MOTD				*/
     2.31 +	{ "375", "n:", 1, irc_msg_motd },		/* Start MOTD			*/
     2.32 +	{ "376", "n:", 1, irc_msg_motd },		/* End of MOTD			*/
     2.33 +	{ "391", "nv:", 3, irc_msg_time },		/* Time reply			*/
     2.34 +	{ "401", "nt:", 2, irc_msg_nonick },		/* No such nick/chan		*/
     2.35 +	{ "406", "nt:", 2, irc_msg_nonick },		/* No such nick for WHOWAS	*/
     2.36 +	{ "403", "nc:", 2, irc_msg_nochan },		/* No such channel		*/
     2.37 +	{ "404", "nt:", 3, irc_msg_nosend },		/* Cannot send to chan		*/
     2.38 +	{ "421", "nv:", 2, irc_msg_unknown },		/* Unknown command		*/
     2.39 +	{ "422", "n:", 1, irc_msg_motd },		/* MOTD file missing		*/
     2.40 +	{ "432", "vn:", 0, irc_msg_badnick },		/* Erroneous nickname		*/
     2.41 +	{ "433", "vn:", 2, irc_msg_nickused },		/* Nickname already in use	*/
     2.42 +	{ "437", "nc:", 2, irc_msg_unavailable },	/* Nick/channel is unavailable	*/
     2.43 +	{ "438", "nn:", 3, irc_msg_nochangenick },	/* Nick may not change		*/
     2.44 +	{ "442", "nc:", 3, irc_msg_notinchan },		/* Not in channel		*/
     2.45 +	{ "473", "nc:", 2, irc_msg_inviteonly },	/* Tried to join invite-only	*/
     2.46 +	{ "474", "nc:", 2, irc_msg_banned },		/* Banned from channel		*/
     2.47 +	{ "477", "nc:", 3, irc_msg_regonly },		/* Registration Required	*/
     2.48 +	{ "478", "nct:", 3, irc_msg_banfull },		/* Banlist is full		*/
     2.49 +	{ "482", "nc:", 3, irc_msg_notop },		/* Need to be op to do that	*/
     2.50 +	{ "501", "n:", 2, irc_msg_badmode },		/* Unknown mode flag		*/
     2.51 +	{ "506", "nc:", 3, irc_msg_nosend },		/* Must identify to send	*/
     2.52 +	{ "515", "nc:", 3, irc_msg_regonly },		/* Registration required	*/
     2.53  #ifdef HAVE_CYRUS_SASL
     2.54  	{ "903", "*", 0, irc_msg_authok},		/* SASL auth successful		*/
     2.55  	{ "904", "*", 0, irc_msg_authtryagain },	/* SASL auth failed, can recover*/