summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2007-12-13 11:47:12 +0100
committerSebastien Helleu <flashcode@flashtux.org>2007-12-13 11:47:12 +0100
commit2e74526bb9691389160b8174a69f272c4c3fc1e2 (patch)
tree8f27fee7f436113971d5deaf1dfb40f8b742ac87 /src/plugins
parent7a8fb5b2da202562b67c81fd9f08a731ba3eb024 (diff)
downloadweechat-2e74526bb9691389160b8174a69f272c4c3fc1e2.zip
Renamed hook "event" to "signal"
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/alias/alias.c8
-rw-r--r--src/plugins/demo/demo.c10
-rw-r--r--src/plugins/irc/irc.c18
-rw-r--r--src/plugins/logger/logger.c62
-rw-r--r--src/plugins/plugin-api.c12
-rw-r--r--src/plugins/plugin-api.h6
-rw-r--r--src/plugins/plugin.c2
-rw-r--r--src/plugins/weechat-plugin.h9
8 files changed, 69 insertions, 58 deletions
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index 432d0480f..0908832da 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -533,15 +533,15 @@ alias_config_read ()
}
/*
- * alias_config_reaload_event_cb: reload alias configuration file
+ * alias_config_reaload_signal_cb: reload alias configuration file
*/
int
-alias_config_reload_event_cb (void *data, char *event, void *pointer)
+alias_config_reload_signal_cb (void *data, char *signal, void *pointer)
{
/* make C compiler happy */
(void) data;
- (void) event;
+ (void) signal;
(void) pointer;
alias_free_all ();
@@ -750,7 +750,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
"%(alias)",
&unalias_command_cb, NULL);
- weechat_hook_event ("config_reload", &alias_config_reload_event_cb, NULL);
+ weechat_hook_signal ("config_reload", &alias_config_reload_signal_cb, NULL);
weechat_hook_completion ("alias", &alias_completion_cb, NULL);
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c
index 5a87ff3c4..186f95218 100644
--- a/src/plugins/demo/demo.c
+++ b/src/plugins/demo/demo.c
@@ -254,18 +254,18 @@ demo_info_command_cb (void *data, void *buffer, int argc, char **argv,
}
/*
- * demo_event_cb: callback for event hook
+ * demo_signal_cb: callback for signal hook
*/
int
-demo_event_cb (void *data, char *event, void *pointer)
+demo_signal_cb (void *data, char *signal, void *pointer)
{
/* make C compiler happy */
(void) data;
weechat_printf (NULL,
- _("demo_event: event: %s, pointer: %X"),
- event, pointer);
+ _("demo_signal: signal: %s, pointer: %X"),
+ signal, pointer);
return WEECHAT_RC_OK;
}
@@ -313,7 +313,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
"inactivity|input|input_mask|input_pos",
&demo_info_command_cb, NULL);
- weechat_hook_event ("*", &demo_event_cb, NULL);
+ weechat_hook_signal ("*", &demo_signal_cb, NULL);
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index 89f5e0c75..ab99c55dc 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -58,7 +58,7 @@ gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
*/
int
-irc_dump_data_cb (void *data, char *event, void *pointer)
+irc_dump_data_cb (void *data, char *signal, void *pointer)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
@@ -66,7 +66,7 @@ irc_dump_data_cb (void *data, char *event, void *pointer)
/* make C compiler happy */
(void) data;
- (void) event;
+ (void) signal;
(void) pointer;
weechat_log_printf ("");
@@ -125,17 +125,17 @@ irc_create_directories ()
}
/*
- * irc_quit_cb: callback for event "quit"
+ * irc_quit_cb: callback for "quit" signal
*/
int
-irc_quit_cb (void *data, char *event, void *pointer)
+irc_quit_cb (void *data, char *signal, void *pointer)
{
struct t_irc_server *ptr_server;
/* make C compiler happy */
(void) data;
- (void) event;
+ (void) signal;
(void) pointer;
for (ptr_server = irc_servers; ptr_server;
@@ -174,10 +174,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
irc_command_init ();
- /* hook events */
- weechat_hook_event ("dump_data", &irc_dump_data_cb, NULL);
- weechat_hook_event ("config_reload", &irc_config_reload_cb, NULL);
- weechat_hook_event ("quit", &irc_quit_cb, NULL);
+ /* hook signals */
+ weechat_hook_signal ("dump_data", &irc_dump_data_cb, NULL);
+ weechat_hook_signal ("config_reload", &irc_config_reload_cb, NULL);
+ weechat_hook_signal ("quit", &irc_quit_cb, NULL);
/* hook completions */
weechat_hook_completion ("irc_server", &irc_completion_server_cb, NULL);
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index e68a313e9..7a0eb8041 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -45,15 +45,15 @@ char plugin_description[] = "Logger plugin for WeeChat";
struct t_weechat_plugin *weechat_logger_plugin = NULL;
#define weechat_plugin weechat_logger_plugin
-static char *logger_path = NULL;
-static char *logger_time_format = NULL;
+char *logger_path = NULL;
+char *logger_time_format = NULL;
/*
* logger_config_read: read config options for logger plugin
*/
-static void
+void
logger_config_read ()
{
if (logger_path)
@@ -80,7 +80,7 @@ logger_config_read ()
* return 1 if success, 0 if failed
*/
-static int
+int
logger_create_directory ()
{
int rc;
@@ -99,8 +99,7 @@ logger_create_directory ()
{
if (mkdir (dir2, 0755) < 0)
{
- if (errno != EEXIST)
- rc = 0;
+ if (errno != EEXIST) rc = 0;
}
else
chmod (dir2, 0700);
@@ -124,7 +123,7 @@ logger_create_directory ()
* logger_get_filename: build log filename for a buffer
*/
-static char *
+char *
logger_get_filename (void *buffer)
{
struct t_plugin_infolist *ptr_infolist;
@@ -202,7 +201,7 @@ logger_get_filename (void *buffer)
* logger_write_line: write a line to log file
*/
-static void
+void
logger_write_line (struct t_logger_buffer *logger_buffer, char *format, ...)
{
va_list argptr;
@@ -270,7 +269,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer, char *format, ...)
* logger_start_buffer: start a log for a buffer
*/
-static void
+void
logger_start_buffer (void *buffer)
{
struct t_logger_buffer *ptr_logger_buffer;
@@ -305,7 +304,7 @@ logger_start_buffer (void *buffer)
* logger_start_buffer_all: start log buffer for all buffers
*/
-static void
+void
logger_start_buffer_all ()
{
struct t_plugin_infolist *ptr_infolist;
@@ -322,7 +321,7 @@ logger_start_buffer_all ()
* logger_end: end log for a logger buffer
*/
-static void
+void
logger_end (struct t_logger_buffer *logger_buffer)
{
time_t seconds;
@@ -353,7 +352,7 @@ logger_end (struct t_logger_buffer *logger_buffer)
* logger_end_all: end log for all buffers
*/
-static void
+void
logger_end_all ()
{
struct t_logger_buffer *ptr_logger_buffer;
@@ -366,24 +365,35 @@ logger_end_all ()
}
/*
- * logger_event_cb: callback for event hook
+ * logger_buffer_open_signal_cb: callback for buffer_open signal
*/
-static int
-logger_event_cb (void *data, char *event, void *pointer)
+int
+logger_buffer_open_signal_cb (void *data, char *signal, void *pointer)
{
/* make C compiler happy */
(void) data;
+ (void) signal;
(void) pointer;
- if (weechat_strcasecmp (event, "buffer_open") == 0)
- {
- logger_start_buffer (pointer);
- }
- else if (weechat_strcasecmp (event, "buffer_close") == 0)
- {
- logger_end (logger_buffer_search (pointer));
- }
+ logger_start_buffer (pointer);
+
+ return WEECHAT_RC_OK;
+}
+
+/*
+ * logger_buffer_close_signal_cb: callback for buffer_close signal
+ */
+
+int
+logger_buffer_close_signal_cb (void *data, char *signal, void *pointer)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) signal;
+ (void) pointer;
+
+ logger_end (logger_buffer_search (pointer));
return WEECHAT_RC_OK;
}
@@ -392,7 +402,7 @@ logger_event_cb (void *data, char *event, void *pointer)
* logger_print_cb: callback for print hook
*/
-static int
+int
logger_print_cb (void *data, void *buffer, time_t date, char *prefix,
char *message)
{
@@ -441,8 +451,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
logger_start_buffer_all ();
- weechat_hook_event ("buffer_open", &logger_event_cb, NULL);
- weechat_hook_event ("buffer_close", &logger_event_cb, NULL);
+ weechat_hook_signal ("buffer_open", &logger_buffer_open_signal_cb, NULL);
+ weechat_hook_signal ("buffer_close", &logger_buffer_close_signal_cb, NULL);
weechat_hook_print (NULL, NULL, 1, &logger_print_cb, NULL);
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index f957b7b2d..968cf0dc7 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -1367,16 +1367,16 @@ plugin_api_hook_print (struct t_weechat_plugin *plugin, void *buffer,
}
/*
- * plugin_api_hook_event: hook an event
+ * plugin_api_hook_signal: hook a signal
*/
struct t_hook *
-plugin_api_hook_event (struct t_weechat_plugin *plugin, char *event,
- int (*callback)(void *, char *, void *),
- void *data)
+plugin_api_hook_signal (struct t_weechat_plugin *plugin, char *signal,
+ int (*callback)(void *, char *, void *),
+ void *data)
{
- if (plugin && event && event[0] && callback)
- return hook_event (plugin, event, callback, data);
+ if (plugin && signal && signal[0] && callback)
+ return hook_signal (plugin, signal, callback, data);
return NULL;
}
diff --git a/src/plugins/plugin-api.h b/src/plugins/plugin-api.h
index e67cd0680..39b2a7748 100644
--- a/src/plugins/plugin-api.h
+++ b/src/plugins/plugin-api.h
@@ -156,9 +156,9 @@ extern struct t_hook *plugin_api_hook_print (struct t_weechat_plugin *,
void *, char *, int,
int (*)(void *, void *, time_t, char *, char *),
void *);
-extern struct t_hook *plugin_api_hook_event (struct t_weechat_plugin *, char *,
- int (*)(void *, char *, void *),
- void *);
+extern struct t_hook *plugin_api_hook_signal (struct t_weechat_plugin *, char *,
+ int (*)(void *, char *, void *),
+ void *);
extern struct t_hook *plugin_api_hook_config (struct t_weechat_plugin *,
char *, char *,
int (*)(void *, char *, char *, char *),
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index a625a1eb5..b231b6e24 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -303,7 +303,7 @@ plugin_load (char *filename)
new_plugin->hook_timer = &plugin_api_hook_timer;
new_plugin->hook_fd = &plugin_api_hook_fd;
new_plugin->hook_print = &plugin_api_hook_print;
- new_plugin->hook_event = &plugin_api_hook_event;
+ new_plugin->hook_signal = &plugin_api_hook_signal;
new_plugin->hook_config = &plugin_api_hook_config;
new_plugin->hook_completion = &plugin_api_hook_completion;
new_plugin->unhook = &plugin_api_unhook;
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 136fade94..81117665c 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -168,8 +168,8 @@ struct t_weechat_plugin
int,
int (*)(void *, void *, time_t, char *, char *),
void *);
- struct t_hook *(*hook_event) (struct t_weechat_plugin *, char *,
- int (*)(void *, char *, void *), void *);
+ struct t_hook *(*hook_signal) (struct t_weechat_plugin *, char *,
+ int (*)(void *, char *, void *), void *);
struct t_hook *(*hook_config) (struct t_weechat_plugin *, char *, char *,
int (*)(void *, char *, char *, char *),
void *);
@@ -418,8 +418,9 @@ struct t_weechat_plugin
__data) \
weechat_plugin->hook_print(weechat_plugin, __buffer, __msg, \
__stri__colors, __callback, __data)
-#define weechat_hook_event(__event, __callback, __data) \
- weechat_plugin->hook_event(weechat_plugin, __event, __callback, __data)
+#define weechat_hook_signal(__signal, __callback, __data) \
+ weechat_plugin->hook_signal(weechat_plugin, __signal, __callback, \
+ __data)
#define weechat_hook_config(__type, __option, __callback, __data) \
weechat_plugin->hook_config(weechat_plugin, __type, __option, \
__callback, __data)