diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-12-13 11:47:12 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-12-13 11:47:12 +0100 |
commit | 2e74526bb9691389160b8174a69f272c4c3fc1e2 (patch) | |
tree | 8f27fee7f436113971d5deaf1dfb40f8b742ac87 /src/core | |
parent | 7a8fb5b2da202562b67c81fd9f08a731ba3eb024 (diff) | |
download | weechat-2e74526bb9691389160b8174a69f272c4c3fc1e2.zip |
Renamed hook "event" to "signal"
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-command.c | 20 | ||||
-rw-r--r-- | src/core/wee-hook.c | 56 | ||||
-rw-r--r-- | src/core/wee-hook.h | 18 | ||||
-rw-r--r-- | src/core/weechat.c | 2 |
4 files changed, 48 insertions, 48 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index d0b93696a..c2b9b9d78 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -992,21 +992,21 @@ command_plugin_list (char *name, int full) } } - /* events hooked */ + /* signals 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_EVENT)) + && (ptr_hook->type == HOOK_TYPE_SIGNAL)) { if (!hook_found) - gui_chat_printf (NULL, _(" events hooked:")); + gui_chat_printf (NULL, _(" signals hooked:")); hook_found = 1; gui_chat_printf (NULL, - _(" event: %s"), - HOOK_EVENT(ptr_hook, event) ? - HOOK_EVENT(ptr_hook, event) : _("(all)")); + _(" signal: %s"), + HOOK_SIGNAL(ptr_hook, signal) ? + HOOK_SIGNAL(ptr_hook, signal) : _("(all)")); } } @@ -1139,9 +1139,9 @@ command_quit (void *data, void *buffer, (void) argc; (void) argv; - hook_event_exec ("quit", - (argc > 1) ? - argv_eol[1] : CONFIG_STRING(config_look_default_msg_quit)); + hook_signal_exec ("quit", + (argc > 1) ? + argv_eol[1] : CONFIG_STRING(config_look_default_msg_quit)); quit_weechat = 1; @@ -1184,7 +1184,7 @@ command_reload (void *data, void *buffer, gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); /* tell to plugins to reload their configuration */ - (void) hook_event_exec ("config_reload", NULL); + hook_signal_exec ("config_reload", NULL); return WEECHAT_RC_OK; } diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 3f21e2e26..d5d7fcc38 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -679,34 +679,34 @@ hook_print_exec (void *buffer, time_t date, char *prefix, char *message) } /* - * hook_event: hook an event + * hook_signal: hook a signal */ struct t_hook * -hook_event (void *plugin, char *event, - t_hook_callback_event *callback, void *callback_data) +hook_signal (void *plugin, char *signal, + t_hook_callback_signal *callback, void *callback_data) { struct t_hook *new_hook; - struct t_hook_event *new_hook_event; + struct t_hook_signal *new_hook_signal; - if (!event || !event[0]) + if (!signal || !signal[0]) return NULL; new_hook = (struct t_hook *)malloc (sizeof (struct t_hook)); if (!new_hook) return NULL; - new_hook_event = (struct t_hook_event *)malloc (sizeof (struct t_hook_event)); - if (!new_hook_event) + new_hook_signal = (struct t_hook_signal *)malloc (sizeof (struct t_hook_signal)); + if (!new_hook_signal) { free (new_hook); return NULL; } - hook_init (new_hook, plugin, HOOK_TYPE_EVENT, callback_data); + hook_init (new_hook, plugin, HOOK_TYPE_SIGNAL, callback_data); - new_hook->hook_data = new_hook_event; - new_hook_event->callback = callback; - new_hook_event->event = strdup (event); + new_hook->hook_data = new_hook_signal; + new_hook_signal->callback = callback; + new_hook_signal->signal = strdup (signal); hook_add_to_list (new_hook); @@ -714,11 +714,11 @@ hook_event (void *plugin, char *event, } /* - * hook_event_exec: execute event hook + * hook_signal_exec: execute signal hook */ void -hook_event_exec (char *event, void *pointer) +hook_signal_exec (char *signal, void *pointer) { struct t_hook *ptr_hook, *next_hook; @@ -729,15 +729,15 @@ hook_event_exec (char *event, void *pointer) { next_hook = ptr_hook->next_hook; - if ((ptr_hook->type == HOOK_TYPE_EVENT) + if ((ptr_hook->type == HOOK_TYPE_SIGNAL) && (!ptr_hook->running) - && ((string_strcasecmp (HOOK_EVENT(ptr_hook, event), "*") == 0) - || (string_strcasecmp (HOOK_EVENT(ptr_hook, event), event) == 0))) + && ((string_strcasecmp (HOOK_SIGNAL(ptr_hook, signal), "*") == 0) + || (string_strcasecmp (HOOK_SIGNAL(ptr_hook, signal), signal) == 0))) { ptr_hook->running = 1; - (void) (HOOK_EVENT(ptr_hook, callback)) - (ptr_hook->callback_data, event, pointer); - if (ptr_hook->type == HOOK_TYPE_EVENT) + (void) (HOOK_SIGNAL(ptr_hook, callback)) + (ptr_hook->callback_data, signal, pointer); + if (ptr_hook->type == HOOK_TYPE_SIGNAL) ptr_hook->running = 0; } @@ -958,10 +958,10 @@ unhook (struct t_hook *hook) free (HOOK_PRINT(hook, message)); free ((struct t_hook_print *)hook->hook_data); break; - case HOOK_TYPE_EVENT: - if (HOOK_EVENT(hook, event)) - free (HOOK_EVENT(hook, event)); - free ((struct t_hook_event *)hook->hook_data); + case HOOK_TYPE_SIGNAL: + if (HOOK_SIGNAL(hook, signal)) + free (HOOK_SIGNAL(hook, signal)); + free ((struct t_hook_signal *)hook->hook_data); break; case HOOK_TYPE_CONFIG: if (HOOK_CONFIG(hook, type)) @@ -1087,12 +1087,12 @@ hook_print_log () log_printf (" buffer . . . . . . . : 0x%X", HOOK_PRINT(ptr_hook, buffer)); log_printf (" message. . . . . . . : '%s'", HOOK_PRINT(ptr_hook, message)); break; - case HOOK_TYPE_EVENT: - log_printf (" type . . . . . . . . . : %d (event)", ptr_hook->type); + case HOOK_TYPE_SIGNAL: + log_printf (" type . . . . . . . . . : %d (signal)", ptr_hook->type); log_printf (" callback_data. . . . . : 0x%X", ptr_hook->callback_data); - log_printf (" event data:"); - log_printf (" callback . . . . . . : 0x%X", HOOK_EVENT(ptr_hook, callback)); - log_printf (" event. . . . . . . . : '%s'", HOOK_EVENT(ptr_hook, event)); + log_printf (" signal data:"); + log_printf (" callback . . . . . . : 0x%X", HOOK_SIGNAL(ptr_hook, callback)); + log_printf (" signal . . . . . . . : '%s'", HOOK_SIGNAL(ptr_hook, signal)); break; case HOOK_TYPE_CONFIG: log_printf (" type . . . . . . . . . : %d (config)", ptr_hook->type); diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h index 72f69e062..caeb5b822 100644 --- a/src/core/wee-hook.h +++ b/src/core/wee-hook.h @@ -29,7 +29,7 @@ enum t_hook_type HOOK_TYPE_TIMER, /* timer */ HOOK_TYPE_FD, /* socket of file descriptor */ HOOK_TYPE_PRINT, /* printed message */ - HOOK_TYPE_EVENT, /* event */ + HOOK_TYPE_SIGNAL, /* signal */ HOOK_TYPE_CONFIG, /* config option */ HOOK_TYPE_COMPLETION, /* custom completions */ }; @@ -42,7 +42,7 @@ enum t_hook_type #define HOOK_TIMER(hook, var) (((struct t_hook_timer *)hook->hook_data)->var) #define HOOK_FD(hook, var) (((struct t_hook_fd *)hook->hook_data)->var) #define HOOK_PRINT(hook, var) (((struct t_hook_print *)hook->hook_data)->var) -#define HOOK_EVENT(hook, var) (((struct t_hook_event *)hook->hook_data)->var) +#define HOOK_SIGNAL(hook, var) (((struct t_hook_signal *)hook->hook_data)->var) #define HOOK_CONFIG(hook, var) (((struct t_hook_config *)hook->hook_data)->var) #define HOOK_COMPLETION(hook, var) (((struct t_hook_completion *)hook->hook_data)->var) @@ -105,12 +105,12 @@ struct t_hook_print int strip_colors; /* strip colors in msg for callback? */ }; -typedef int (t_hook_callback_event)(void *, char *, void *); +typedef int (t_hook_callback_signal)(void *, char *, void *); -struct t_hook_event +struct t_hook_signal { - t_hook_callback_event *callback; /* event callback */ - char *event; /* event selected ("*" = any event) */ + t_hook_callback_signal *callback; /* signal callback */ + char *signal; /* signal selected ("*" = any signal)*/ }; typedef int (t_hook_callback_config)(void *, char *, char *, char *); @@ -153,9 +153,9 @@ extern void hook_fd_exec (fd_set *, fd_set *, fd_set *); extern struct t_hook *hook_print (void *, void *, char *, int, t_hook_callback_print *, void *); extern void hook_print_exec (void *, time_t, char *, char *); -extern struct t_hook *hook_event (void *, char *, - t_hook_callback_event *, void *); -extern void hook_event_exec (char *, void *); +extern struct t_hook *hook_signal (void *, char *, + t_hook_callback_signal *, void *); +extern void hook_signal_exec (char *, void *); extern struct t_hook *hook_config (void *, char *, char *, t_hook_callback_config *, void *); extern void hook_config_exec (char *, char *, char *); diff --git a/src/core/weechat.c b/src/core/weechat.c index 9d35b02b1..bbbea7fec 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -521,7 +521,7 @@ weechat_dump (int crash) plugin_print_log (); - hook_event_exec ("dump_data", NULL); + hook_signal_exec ("dump_data", NULL); log_printf (""); log_printf ("****** End of WeeChat dump ******"); |