diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-11-09 15:45:14 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-11-09 15:45:14 +0100 |
commit | 8c129779acf613fb1c23a6345eb64d745ef7e2f4 (patch) | |
tree | e969794a729ca30328644b360201b82bf6079cb4 /src/gui | |
parent | 25879ca18965d8b2a6e9f5de290cf1bc5eb82ae6 (diff) | |
download | weechat-8c129779acf613fb1c23a6345eb64d745ef7e2f4.zip |
Add function "hook_completion_get_string" in plugin API
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-completion.c | 21 | ||||
-rw-r--r-- | src/gui/gui-completion.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 02a7745b4..4b8f4c9e9 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -1162,6 +1162,27 @@ gui_completion_search (struct t_gui_completion *completion, int direction, } /* + * gui_completion_get_string: get a completion property as string + */ + +const char * +gui_completion_get_string (struct t_gui_completion *completion, + const char *property) +{ + if (completion) + { + if (string_strcasecmp (property, "base_command") == 0) + return completion->base_command; + else if (string_strcasecmp (property, "base_word") == 0) + return completion->base_word; + else if (string_strcasecmp (property, "args") == 0) + return completion->args; + } + + return NULL; +} + +/* * gui_completion_print_log: print completion list in log (usually for crash dump) */ diff --git a/src/gui/gui-completion.h b/src/gui/gui-completion.h index de0433997..f3bf2f44a 100644 --- a/src/gui/gui-completion.h +++ b/src/gui/gui-completion.h @@ -76,6 +76,8 @@ extern void gui_completion_list_add (struct t_gui_completion *completion, extern void gui_completion_search (struct t_gui_completion *completion, int direction, const char *data, int size, int pos); +extern const char *gui_completion_get_string (struct t_gui_completion *completion, + const char *property); extern void gui_completion_print_log (struct t_gui_completion *completion); #endif /* __WEECHAT_GUI_COMPLETION_H */ |