diff options
author | Timo Sirainen <cras@irssi.org> | 2000-08-12 02:16:52 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-08-12 02:16:52 +0000 |
commit | 308e84bbc44db92fbb1fe0c2e177ae981865b788 (patch) | |
tree | 999d7f2daadda55483c4ccf3df3d938095d7429d /src/core | |
parent | 81af47808b0d9ef1a0a7637ae3e296054215a2a2 (diff) | |
download | irssi-308e84bbc44db92fbb1fe0c2e177ae981865b788.zip |
WJOIN -> /JOIN -window
WQUERY -> /QUERY -window.
Added support for /QUERY -<server tag>.
Added aliases for WJOIN and WQUERY to default config file.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@590 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/commands.c | 22 | ||||
-rw-r--r-- | src/core/commands.h | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/core/commands.c b/src/core/commands.c index 5fbec304..6802713f 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -233,6 +233,27 @@ static GSList *optlist_find(GSList *optlist, const char *option) return NULL; } +int command_have_option(const char *cmd, const char *option) +{ + COMMAND_REC *rec; + char **tmp; + + g_return_val_if_fail(cmd != NULL, FALSE); + g_return_val_if_fail(option != NULL, FALSE); + + rec = command_find(cmd); + g_return_val_if_fail(rec != NULL, FALSE); + + for (tmp = rec->options; *tmp != NULL; tmp++) { + char *name = iscmdtype(**tmp) ? (*tmp)+1 : *tmp; + + if (g_strcasecmp(name, option) == 0) + return TRUE; + } + + return FALSE; +} + void command_set_options(const char *cmd, const char *options) { COMMAND_REC *rec; @@ -276,7 +297,6 @@ void command_set_options(const char *cmd, const char *options) g_strfreev(optlist); /* linked list -> string[] */ - g_free(rec->options); str = gslist_to_string(list, " "); rec->options = g_strsplit(str, " ", -1); g_free(str); diff --git a/src/core/commands.h b/src/core/commands.h index 51bfda57..f5a5c084 100644 --- a/src/core/commands.h +++ b/src/core/commands.h @@ -82,6 +82,9 @@ int command_have_sub(const char *command); ((c) == '-' || (c) == '+' || (c) == '@') void command_set_options(const char *cmd, const char *options); +/* Returns TRUE if command has specified option. */ +int command_have_option(const char *cmd, const char *option); + /* count can have these flags: */ #define PARAM_WITHOUT_FLAGS(a) ((a) & 0x00ffffff) /* don't check for quotes - "arg1 arg2" is NOT treated as one argument */ |