diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-11-11 13:34:43 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-11-11 13:34:43 +0100 |
commit | 4478777876a5b285c78a3daef02fd970eb2d5597 (patch) | |
tree | 7ef1da66efcc7b37ab7ea0cfc113e64c3f64c55d /src/core/wee-command.c | |
parent | 60428b0d2ea2f42d056a13f3380844a6032f5e81 (diff) | |
download | weechat-4478777876a5b285c78a3daef02fd970eb2d5597.zip |
Event hook added
Diffstat (limited to 'src/core/wee-command.c')
-rw-r--r-- | src/core/wee-command.c | 129 |
1 files changed, 75 insertions, 54 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 2b68be93a..41b3bfeb1 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -41,7 +41,9 @@ #include "wee-list.h" #include "../gui/gui-chat.h" #include "../gui/gui-history.h" +#include "../gui/gui-input.h" #include "../gui/gui-keyboard.h" +#include "../gui/gui-status.h" #include "../gui/gui-window.h" #include "../plugins/plugin.h" #include "../plugins/plugin-config.h" @@ -520,6 +522,20 @@ command_buffer (struct t_gui_buffer *buffer, return -1; } } + else if (string_strcasecmp (argv[0], "close") == 0) + { + if (!buffer->plugin) + { + gui_chat_printf (NULL, + _("%sError: WeeChat main buffer can't be " + "closed"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + return -1; + } + gui_buffer_free (buffer, 1); + gui_status_draw (gui_current_window->buffer, 1); + gui_input_draw (gui_current_window->buffer, 1); + } else if (string_strcasecmp (argv[0], "notify") == 0) { if (argc < 2) @@ -1276,54 +1292,6 @@ command_plugin_list (char *name, int full) } } - /* prints hooked */ - hook_found = 0; - for (ptr_hook = weechat_hooks; ptr_hook; - ptr_hook = ptr_hook->next_hook) - { - if ((ptr_hook->plugin == ptr_plugin) - && (ptr_hook->type == HOOK_TYPE_PRINT)) - { - if (!hook_found) - gui_chat_printf (NULL, _(" prints hooked:")); - hook_found = 1; - if (HOOK_PRINT(ptr_hook, buffer)) - gui_chat_printf (NULL, - _(" buffer: %s / %s, message: \"%s\""), - HOOK_PRINT(ptr_hook, buffer)->category, - HOOK_PRINT(ptr_hook, buffer)->name, - HOOK_PRINT(ptr_hook, message) ? - HOOK_PRINT(ptr_hook, message) : _("(none)")); - else - gui_chat_printf (NULL, - _(" message: \"%s\""), - HOOK_PRINT(ptr_hook, message) ? - HOOK_PRINT(ptr_hook, message) : _("(none)")); - } - } - - /* config options hooked */ - hook_found = 0; - for (ptr_hook = weechat_hooks; ptr_hook; - ptr_hook = ptr_hook->next_hook) - { - if ((ptr_hook->plugin == ptr_plugin) - && (ptr_hook->type == HOOK_TYPE_CONFIG)) - { - if (!hook_found) - gui_chat_printf (NULL, - _(" configuration otions " - "hooked:")); - hook_found = 1; - gui_chat_printf (NULL, - " (%s) %s", - HOOK_CONFIG(ptr_hook, type) ? - HOOK_CONFIG(ptr_hook, type) : "*", - HOOK_CONFIG(ptr_hook, option) ? - HOOK_CONFIG(ptr_hook, option) : "*"); - } - } - /* timers hooked */ hook_found = 0; for (ptr_hook = weechat_hooks; ptr_hook; @@ -1385,18 +1353,71 @@ command_plugin_list (char *name, int full) } } - /* keyboards hooked */ + /* prints hooked */ + hook_found = 0; + for (ptr_hook = weechat_hooks; ptr_hook; + ptr_hook = ptr_hook->next_hook) + { + if ((ptr_hook->plugin == ptr_plugin) + && (ptr_hook->type == HOOK_TYPE_PRINT)) + { + if (!hook_found) + gui_chat_printf (NULL, _(" prints hooked:")); + hook_found = 1; + if (HOOK_PRINT(ptr_hook, buffer)) + gui_chat_printf (NULL, + _(" buffer: %s / %s, message: \"%s\""), + HOOK_PRINT(ptr_hook, buffer)->category, + HOOK_PRINT(ptr_hook, buffer)->name, + HOOK_PRINT(ptr_hook, message) ? + HOOK_PRINT(ptr_hook, message) : _("(none)")); + else + gui_chat_printf (NULL, + _(" message: \"%s\""), + HOOK_PRINT(ptr_hook, message) ? + HOOK_PRINT(ptr_hook, message) : _("(none)")); + } + } + + /* events hooked */ hook_found = 0; for (ptr_hook = weechat_hooks; ptr_hook; ptr_hook = ptr_hook->next_hook) { if ((ptr_hook->plugin == ptr_plugin) - && (ptr_hook->type == HOOK_TYPE_KEYBOARD)) - hook_found++; + && (ptr_hook->type == HOOK_TYPE_EVENT)) + { + if (!hook_found) + gui_chat_printf (NULL, _(" events hooked:")); + hook_found = 1; + gui_chat_printf (NULL, + _(" event: %s"), + HOOK_EVENT(ptr_hook, event) ? + HOOK_EVENT(ptr_hook, event) : _("(all)")); + } + } + + /* config options hooked */ + hook_found = 0; + for (ptr_hook = weechat_hooks; ptr_hook; + ptr_hook = ptr_hook->next_hook) + { + if ((ptr_hook->plugin == ptr_plugin) + && (ptr_hook->type == HOOK_TYPE_CONFIG)) + { + if (!hook_found) + gui_chat_printf (NULL, + _(" configuration otions " + "hooked:")); + hook_found = 1; + gui_chat_printf (NULL, + " (%s) %s", + HOOK_CONFIG(ptr_hook, type) ? + HOOK_CONFIG(ptr_hook, type) : "*", + HOOK_CONFIG(ptr_hook, option) ? + HOOK_CONFIG(ptr_hook, option) : "*"); + } } - if (hook_found) - gui_chat_printf (NULL, _(" %d keyboards hooked"), - hook_found); } } } |