diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-11-27 19:31:49 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-11-27 19:31:49 +0100 |
commit | cb60cf9640f99eb73f8c84942a57e8fdc632262b (patch) | |
tree | 8c355f101868d4e6f2fc30a019b49217c34dc755 /src | |
parent | afef4b0d8a652ee60270a8a12fdbc8df7841cdaf (diff) | |
download | weechat-cb60cf9640f99eb73f8c84942a57e8fdc632262b.zip |
alias: rename callback for infolist "alias"
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/alias/alias-info.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/src/plugins/alias/alias-info.c b/src/plugins/alias/alias-info.c index f4204bb98..346c40999 100644 --- a/src/plugins/alias/alias-info.c +++ b/src/plugins/alias/alias-info.c @@ -26,62 +26,56 @@ /* - * Returns infolist with alias info. + * Returns alias infolist "alias". */ struct t_infolist * -alias_info_get_infolist_cb (void *data, const char *infolist_name, - void *pointer, const char *arguments) +alias_info_infolist_alias_cb (void *data, const char *infolist_name, + void *pointer, const char *arguments) { struct t_infolist *ptr_infolist; struct t_alias *ptr_alias; /* make C compiler happy */ (void) data; + (void) infolist_name; (void) arguments; - if (!infolist_name || !infolist_name[0]) + if (pointer && !alias_valid (pointer)) return NULL; - if (weechat_strcasecmp (infolist_name, ALIAS_PLUGIN_NAME) == 0) + ptr_infolist = weechat_infolist_new (); + if (!ptr_infolist) + return NULL; + + if (pointer) { - if (pointer && !alias_valid (pointer)) + /* build list with only one alias */ + if (!alias_add_to_infolist (ptr_infolist, pointer)) + { + weechat_infolist_free (ptr_infolist); return NULL; - - ptr_infolist = weechat_infolist_new (); - if (ptr_infolist) + } + return ptr_infolist; + } + else + { + /* build list with all aliases matching arguments */ + for (ptr_alias = alias_list; ptr_alias; + ptr_alias = ptr_alias->next_alias) { - if (pointer) + if (!arguments || !arguments[0] + || weechat_string_match (ptr_alias->name, arguments, 0)) { - /* build list with only one alias */ - if (!alias_add_to_infolist (ptr_infolist, pointer)) + if (!alias_add_to_infolist (ptr_infolist, ptr_alias)) { weechat_infolist_free (ptr_infolist); return NULL; } - return ptr_infolist; - } - else - { - /* build list with all aliases matching arguments */ - for (ptr_alias = alias_list; ptr_alias; - ptr_alias = ptr_alias->next_alias) - { - if (!arguments || !arguments[0] - || weechat_string_match (ptr_alias->name, arguments, 0)) - { - if (!alias_add_to_infolist (ptr_infolist, ptr_alias)) - { - weechat_infolist_free (ptr_infolist); - return NULL; - } - } - } - return ptr_infolist; } } + return ptr_infolist; } - return NULL; } @@ -92,8 +86,9 @@ alias_info_get_infolist_cb (void *data, const char *infolist_name, void alias_info_init () { - weechat_hook_infolist ("alias", N_("list of aliases"), - N_("alias pointer (optional)"), - N_("alias name (wildcard \"*\" is allowed) (optional)"), - &alias_info_get_infolist_cb, NULL); + weechat_hook_infolist ( + "alias", N_("list of aliases"), + N_("alias pointer (optional)"), + N_("alias name (wildcard \"*\" is allowed) (optional)"), + &alias_info_infolist_alias_cb, NULL); } |