mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Use the PARAM_FLAG_STRIP_TRAILING_WS flag wherever possible.
This commit is contained in:
parent
3d9b9d473f
commit
d4676c9855
@ -757,7 +757,7 @@ static void cmd_completion(const char *data)
|
||||
int len;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_GETREST,
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"completion", &optlist, &key, &value))
|
||||
return;
|
||||
|
||||
|
@ -127,7 +127,8 @@ static void cmd_ignore(const char *data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"ignore", &optlist, &mask, &levels))
|
||||
return;
|
||||
|
||||
|
@ -87,8 +87,9 @@ static void cmd_log_open(const char *data)
|
||||
int level;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST |
|
||||
PARAM_FLAG_UNKNOWN_OPTIONS | PARAM_FLAG_OPTIONS,
|
||||
"log open", &optlist, &fname, &levels))
|
||||
PARAM_FLAG_UNKNOWN_OPTIONS | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_STRIP_TRAILING_WS, "log open", &optlist,
|
||||
&fname, &levels))
|
||||
return;
|
||||
if (*fname == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
|
@ -108,7 +108,8 @@ static void cmd_set(char *data)
|
||||
int clear, set_default;
|
||||
SETTINGS_REC *rec;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST |
|
||||
PARAM_FLAG_OPTIONS | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"set", &optlist, &key, &value))
|
||||
return;
|
||||
|
||||
@ -182,7 +183,7 @@ static void cmd_toggle(const char *data)
|
||||
void *free_arg;
|
||||
int type;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &key, &value))
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS, &key, &value))
|
||||
return;
|
||||
|
||||
if (*key == '\0')
|
||||
|
@ -246,8 +246,8 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 |
|
||||
PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN |
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
item, &channel, &nicks))
|
||||
return;
|
||||
|
||||
|
@ -184,8 +184,8 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server,
|
||||
if (server == NULL || !server->connected || !IS_IRC_SERVER(server))
|
||||
cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
|
||||
item, &channel, &nicks)) return;
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST |
|
||||
PARAM_FLAG_STRIP_TRAILING_WS, item, &channel, &nicks)) return;
|
||||
if (!server_ischannel(SERVER(server), channel)) cmd_param_error(CMDERR_NOT_JOINED);
|
||||
if (*nicks == '\0') {
|
||||
if (g_strcmp0(data, "*") != 0)
|
||||
@ -262,8 +262,8 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server, void *item)
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 1 |
|
||||
PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"ban", &optlist, &ban))
|
||||
return;
|
||||
|
||||
@ -297,8 +297,8 @@ static void cmd_unban(const char *data, IRC_SERVER_REC *server, void *item)
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 1 |
|
||||
PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"unban", &optlist, &ban))
|
||||
return;
|
||||
|
||||
|
@ -267,7 +267,8 @@ static void cmd_list(const char *data, IRC_SERVER_REC *server,
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_GETREST, "list", &optlist, &str))
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"list", &optlist, &str))
|
||||
return;
|
||||
|
||||
if (*str == '\0' && g_hash_table_lookup(optlist, "yes") == NULL &&
|
||||
@ -288,7 +289,8 @@ static void cmd_who(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest))
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST |
|
||||
PARAM_FLAG_STRIP_TRAILING_WS, &channel, &rest))
|
||||
return;
|
||||
|
||||
if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
|
||||
@ -320,7 +322,8 @@ static void cmd_names(const char *data, IRC_SERVER_REC *server,
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_GETREST, "names", &optlist, &channel))
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"names", &optlist, &channel))
|
||||
return;
|
||||
|
||||
if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
|
||||
@ -501,7 +504,8 @@ static void cmd_whowas(const char *data, IRC_SERVER_REC *server)
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &nicks, &rest))
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
&nicks, &rest))
|
||||
return;
|
||||
if (*nicks == '\0') nicks = server->nick;
|
||||
|
||||
|
@ -835,10 +835,10 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
if (*data == '+' || *data == '-') {
|
||||
target = "*";
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_GETREST, &mode))
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS, &mode))
|
||||
return;
|
||||
} else {
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &mode))
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS, &target, &mode))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -174,8 +174,8 @@ static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server,
|
||||
int queue, mode, passive;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS |
|
||||
PARAM_FLAG_GETREST, "dcc send",
|
||||
&optlist, &nick, &fileargs))
|
||||
PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"dcc send", &optlist, &nick, &fileargs))
|
||||
return;
|
||||
|
||||
chat = item_get_dcc(item);
|
||||
|
@ -496,8 +496,8 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
|
||||
&typestr, &nick, &arg))
|
||||
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST |
|
||||
PARAM_FLAG_STRIP_TRAILING_WS, &typestr, &nick, &arg))
|
||||
return;
|
||||
|
||||
if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
@ -36,7 +36,8 @@ static void cmd_notify(gchar *data)
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
|
||||
if (!cmd_get_params(data, &free_arg,
|
||||
2 | PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
|
||||
"notify", &optlist, &mask, &ircnets))
|
||||
return;
|
||||
if (*mask == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
Loading…
Reference in New Issue
Block a user