/pidgin/main: 5845d9fa7084: IRC: fill required command parameter...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Tue Jan 28 10:38:12 EST 2014
Changeset: 5845d9fa70847045d52c255ea372b963d2077aa6
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-01-16 11:46 +0100
Branch: release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/5845d9fa7084
Description:
IRC: fill required command parameter counts (part 2)
diffstat:
libpurple/protocols/irc/msgs.c | 42 +------------------------------------
libpurple/protocols/irc/parse.c | 46 ++++++++++++++++++++--------------------
2 files changed, 24 insertions(+), 64 deletions(-)
diffs (192 lines):
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -259,9 +259,6 @@ void irc_msg_badmode(struct irc_conn *ir
{
PurpleConnection *gc = purple_account_get_connection(irc->account);
- if (!args || !args[1] || !gc)
- return;
-
purple_notify_error(gc, NULL, _("Bad mode"), args[1]);
}
@@ -315,9 +312,6 @@ void irc_msg_banned(struct irc_conn *irc
PurpleConnection *gc = purple_account_get_connection(irc->account);
char *buf;
- if (!args || !args[1] || !gc)
- return;
-
buf = g_strdup_printf(_("You are banned from %s."), args[1]);
purple_notify_error(gc, _("Banned"), _("Banned"), buf);
g_free(buf);
@@ -328,9 +322,6 @@ void irc_msg_banfull(struct irc_conn *ir
PurpleConversation *convo;
char *buf, *nick;
- if (!args || !args[0] || !args[1] || !args[2])
- return;
-
convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
if (!convo)
return;
@@ -683,9 +674,6 @@ void irc_msg_unknown(struct irc_conn *ir
PurpleConnection *gc = purple_account_get_connection(irc->account);
char *buf;
- if (!args || !args[1] || !gc)
- return;
-
buf = g_strdup_printf(_("Unknown message '%s'"), args[1]);
purple_notify_error(gc, _("Unknown message"), buf, _("The IRC server received a message it did not understand."));
g_free(buf);
@@ -776,9 +764,6 @@ void irc_msg_motd(struct irc_conn *irc,
{
char *escaped;
- if (!args || !args[0])
- return;
-
if (!strcmp(name, "375")) {
if (irc->motd)
g_string_free(irc->motd, TRUE);
@@ -815,11 +800,7 @@ void irc_msg_motd(struct irc_conn *irc,
void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args)
{
- PurpleConnection *gc;
-
- gc = purple_account_get_connection(irc->account);
- if (gc == NULL || args == NULL || args[2] == NULL)
- return;
+ PurpleConnection *gc = purple_account_get_connection(irc->account);
purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, _("Time Response"),
_("The IRC server's local time is:"),
@@ -830,9 +811,6 @@ void irc_msg_nochan(struct irc_conn *irc
{
PurpleConnection *gc = purple_account_get_connection(irc->account);
- if (gc == NULL || args == NULL || args[1] == NULL)
- return;
-
purple_notify_error(gc, NULL, _("No such channel"), args[1]);
}
@@ -892,9 +870,6 @@ void irc_msg_notop(struct irc_conn *irc,
{
PurpleConversation *convo;
- if (!args || !args[1] || !args[2])
- return;
-
convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
if (!convo)
return;
@@ -924,9 +899,6 @@ void irc_msg_inviteonly(struct irc_conn
PurpleConnection *gc = purple_account_get_connection(irc->account);
char *buf;
- if (!args || !args[1] || !gc)
- return;
-
buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]);
purple_notify_error(gc, _("Invitation only"), _("Invitation only"), buf);
g_free(buf);
@@ -1194,9 +1166,6 @@ void irc_msg_nickused(struct irc_conn *i
char *newnick, *buf, *end;
PurpleConnection *gc = purple_account_get_connection(irc->account);
- if (!args || !args[1])
- return;
-
if (gc && purple_connection_get_state(gc) == PURPLE_CONNECTED) {
/* We only want to do the following dance if the connection
has not been successfully completed. If it has, just
@@ -1242,9 +1211,6 @@ void irc_msg_nochangenick(struct irc_con
{
PurpleConnection *gc = purple_account_get_connection(irc->account);
- if (!args || !args[2] || !gc)
- return;
-
purple_notify_error(gc, _("Cannot change nick"), _("Could not change nick"), args[2]);
}
@@ -1386,9 +1352,6 @@ void irc_msg_regonly(struct irc_conn *ir
PurpleConversation *convo;
char *msg;
- if (!args || !args[1] || !args[2] || !gc)
- return;
-
convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
if (convo) {
/* This is a channel we're already in; for some reason,
@@ -1427,9 +1390,6 @@ void irc_msg_unavailable(struct irc_conn
{
PurpleConnection *gc = purple_account_get_connection(irc->account);
- if (!args || !args[1])
- return;
-
purple_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]);
}
diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c
--- a/libpurple/protocols/irc/parse.c
+++ b/libpurple/protocols/irc/parse.c
@@ -80,29 +80,29 @@ static struct _irc_msg {
{ "366", "nc:", -1, irc_msg_names }, /* End of names */
{ "367", "ncnnv", -1, irc_msg_ban }, /* Ban list */
{ "368", "nc:", -1, irc_msg_ban }, /* End of ban list */
- { "372", "n:", -1, irc_msg_motd }, /* MOTD */
- { "375", "n:", -1, irc_msg_motd }, /* Start MOTD */
- { "376", "n:", -1, irc_msg_motd }, /* End of MOTD */
- { "391", "nv:", -1, irc_msg_time }, /* Time reply */
- { "401", "nt:", -1, irc_msg_nonick }, /* No such nick/chan */
- { "406", "nt:", -1, irc_msg_nonick }, /* No such nick for WHOWAS */
- { "403", "nc:", -1, irc_msg_nochan }, /* No such channel */
- { "404", "nt:", -1, irc_msg_nosend }, /* Cannot send to chan */
- { "421", "nv:", -1, irc_msg_unknown }, /* Unknown command */
- { "422", "n:", -1, irc_msg_motd }, /* MOTD file missing */
- { "432", "vn:", -1, irc_msg_badnick }, /* Erroneous nickname */
- { "433", "vn:", -1, irc_msg_nickused }, /* Nickname already in use */
- { "437", "nc:", -1, irc_msg_unavailable }, /* Nick/channel is unavailable */
- { "438", "nn:", -1, irc_msg_nochangenick }, /* Nick may not change */
- { "442", "nc:", -1, irc_msg_notinchan }, /* Not in channel */
- { "473", "nc:", -1, irc_msg_inviteonly }, /* Tried to join invite-only */
- { "474", "nc:", -1, irc_msg_banned }, /* Banned from channel */
- { "477", "nc:", -1, irc_msg_regonly }, /* Registration Required */
- { "478", "nct:", -1, irc_msg_banfull }, /* Banlist is full */
- { "482", "nc:", -1, irc_msg_notop }, /* Need to be op to do that */
- { "501", "n:", -1, irc_msg_badmode }, /* Unknown mode flag */
- { "506", "nc:", -1, irc_msg_nosend }, /* Must identify to send */
- { "515", "nc:", -1, irc_msg_regonly }, /* Registration required */
+ { "372", "n:", 1, irc_msg_motd }, /* MOTD */
+ { "375", "n:", 1, irc_msg_motd }, /* Start MOTD */
+ { "376", "n:", 1, irc_msg_motd }, /* End of MOTD */
+ { "391", "nv:", 3, irc_msg_time }, /* Time reply */
+ { "401", "nt:", 2, irc_msg_nonick }, /* No such nick/chan */
+ { "406", "nt:", 2, irc_msg_nonick }, /* No such nick for WHOWAS */
+ { "403", "nc:", 2, irc_msg_nochan }, /* No such channel */
+ { "404", "nt:", 3, irc_msg_nosend }, /* Cannot send to chan */
+ { "421", "nv:", 2, irc_msg_unknown }, /* Unknown command */
+ { "422", "n:", 1, irc_msg_motd }, /* MOTD file missing */
+ { "432", "vn:", 0, irc_msg_badnick }, /* Erroneous nickname */
+ { "433", "vn:", 2, irc_msg_nickused }, /* Nickname already in use */
+ { "437", "nc:", 2, irc_msg_unavailable }, /* Nick/channel is unavailable */
+ { "438", "nn:", 3, irc_msg_nochangenick }, /* Nick may not change */
+ { "442", "nc:", 3, irc_msg_notinchan }, /* Not in channel */
+ { "473", "nc:", 2, irc_msg_inviteonly }, /* Tried to join invite-only */
+ { "474", "nc:", 2, irc_msg_banned }, /* Banned from channel */
+ { "477", "nc:", 3, irc_msg_regonly }, /* Registration Required */
+ { "478", "nct:", 3, irc_msg_banfull }, /* Banlist is full */
+ { "482", "nc:", 3, irc_msg_notop }, /* Need to be op to do that */
+ { "501", "n:", 2, irc_msg_badmode }, /* Unknown mode flag */
+ { "506", "nc:", 3, irc_msg_nosend }, /* Must identify to send */
+ { "515", "nc:", 3, irc_msg_regonly }, /* Registration required */
#ifdef HAVE_CYRUS_SASL
{ "903", "*", 0, irc_msg_authok}, /* SASL auth successful */
{ "904", "*", 0, irc_msg_authtryagain }, /* SASL auth failed, can recover*/
More information about the Commits
mailing list