diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-10-17 17:45:23 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-10-17 17:45:23 +0000 |
commit | aeb71700244235c1e0991caa9ee94fa0df318410 (patch) | |
tree | f22ca2055b73c18a1689c29921302bd9bea89d06 /src | |
parent | 357d7c5a2fdc42eb9dc72413767280c0ffe94e0f (diff) | |
download | weechat-aeb71700244235c1e0991caa9ee94fa0df318410.zip |
Moved some functions in source code
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/plugins.c | 124 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 25 |
2 files changed, 73 insertions, 76 deletions
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index c326c9298..f5c1f984d 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -1016,6 +1016,68 @@ weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory, } /* + * weechat_plugin_printf: print a message on a server or channel buffer + */ + +void +weechat_plugin_printf (t_weechat_plugin *plugin, + char *server, char *channel, char *message, ...) +{ + t_gui_buffer *ptr_buffer; + va_list argptr; + static char buf[8192]; + + if (!plugin || !message) + return; + + ptr_buffer = plugin_find_buffer (server, channel); + va_start (argptr, message); + vsnprintf (buf, sizeof (buf) - 1, message, argptr); + va_end (argptr); + irc_display_prefix (ptr_buffer, PREFIX_PLUGIN); + gui_printf (ptr_buffer, "%s\n", buf); +} + +/* + * weechat_plugin_printf_server: print a message on server buffer + */ + +void +weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...) +{ + va_list argptr; + static char buf[8192]; + + if (!plugin || !message) + return; + + va_start (argptr, message); + vsnprintf (buf, sizeof (buf) - 1, message, argptr); + va_end (argptr); + irc_display_prefix (NULL, PREFIX_PLUGIN); + gui_printf (NULL, "%s\n", buf); +} + +/* + * weechat_plugin_infobar_printf: print a message in infobar + */ + +void +weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...) +{ + va_list argptr; + static char buf[1024]; + + if (!plugin || (time_displayed < 0) || !message) + return; + + va_start (argptr, message); + vsnprintf (buf, sizeof (buf) - 1, message, argptr); + va_end (argptr); + gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf); +} + +/* * weechat_plugin_msg_handler_add: add a message handler */ @@ -1098,68 +1160,6 @@ weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *plugin) } /* - * weechat_plugin_printf: print a message on a server or channel buffer - */ - -void -weechat_plugin_printf (t_weechat_plugin *plugin, - char *server, char *channel, char *message, ...) -{ - t_gui_buffer *ptr_buffer; - va_list argptr; - static char buf[8192]; - - if (!plugin || !message) - return; - - ptr_buffer = plugin_find_buffer (server, channel); - va_start (argptr, message); - vsnprintf (buf, sizeof (buf) - 1, message, argptr); - va_end (argptr); - irc_display_prefix (ptr_buffer, PREFIX_PLUGIN); - gui_printf (ptr_buffer, "%s\n", buf); -} - -/* - * weechat_plugin_printf_server: print a message on server buffer - */ - -void -weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...) -{ - va_list argptr; - static char buf[8192]; - - if (!plugin || !message) - return; - - va_start (argptr, message); - vsnprintf (buf, sizeof (buf) - 1, message, argptr); - va_end (argptr); - irc_display_prefix (NULL, PREFIX_PLUGIN); - gui_printf (NULL, "%s\n", buf); -} - -/* - * weechat_plugin_infobar_printf: print a message in infobar - */ - -void -weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...) -{ - va_list argptr; - static char buf[1024]; - - if (!plugin || (time_displayed < 0) || !message) - return; - - va_start (argptr, message); - vsnprintf (buf, sizeof (buf) - 1, message, argptr); - va_end (argptr); - gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf); -} - -/* * weechat_plugin_exec_command: execute a command (simulate user entry) */ diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index b90b4f113..3818dcfd7 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -121,7 +121,11 @@ struct t_weechat_plugin int (*mkdir_home) (t_weechat_plugin *, char *); void (*exec_on_files) (t_weechat_plugin *, char *, int (*)(t_weechat_plugin *, char *)); - + + void (*printf) (t_weechat_plugin *, char *, char *, char *, ...); + void (*printf_server) (t_weechat_plugin *, char *, ...); + void (*infobar_printf) (t_weechat_plugin *, int, char *, ...); + t_plugin_msg_handler *(*msg_handler_add) (t_weechat_plugin *, char *, t_plugin_handler_func *, char *, void *); @@ -134,15 +138,10 @@ struct t_weechat_plugin void (*cmd_handler_remove) (t_weechat_plugin *, t_plugin_cmd_handler *); void (*cmd_handler_remove_all) (t_weechat_plugin *); - void (*printf) (t_weechat_plugin *, char *, char *, char *, ...); - void (*printf_server) (t_weechat_plugin *, char *, ...); - void (*infobar_printf) (t_weechat_plugin *, int, char *, ...); - void (*exec_command) (t_weechat_plugin *, char *, char *, char *); char *(*get_info) (t_weechat_plugin *, char *, char *, char *); t_plugin_dcc_info *(*get_dcc_info) (t_weechat_plugin *); void (*free_dcc_info) (t_weechat_plugin *, t_plugin_dcc_info *); - char *(*get_config) (t_weechat_plugin *, char *); /* WeeChat developers: ALWAYS add new functions at the end */ @@ -156,6 +155,11 @@ extern int weechat_plugin_mkdir_home (t_weechat_plugin *, char *); extern void weechat_plugin_exec_on_files (t_weechat_plugin *, char *, int (*)(t_weechat_plugin *, char *)); +/* display functions */ +extern void weechat_plugin_printf (t_weechat_plugin *, char *, char *, char *, ...); +extern void weechat_plugin_printf_server (t_weechat_plugin *, char *, ...); +extern void weechat_plugin_infobar_printf (t_weechat_plugin *, int, char *, ...); + /* handler functions */ extern t_plugin_msg_handler *weechat_plugin_msg_handler_add (t_weechat_plugin *, char *, t_plugin_handler_func *, @@ -169,18 +173,11 @@ extern t_plugin_cmd_handler *weechat_plugin_cmd_handler_add (t_weechat_plugin *, extern void weechat_plugin_cmd_handler_remove (t_weechat_plugin *, t_plugin_cmd_handler *); extern void weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *); -/* display functions */ -extern void weechat_plugin_printf (t_weechat_plugin *, char *, char *, char *, ...); -extern void weechat_plugin_printf_server (t_weechat_plugin *, char *, ...); -extern void weechat_plugin_infobar_printf (t_weechat_plugin *, int, char *, ...); - -/* IRC functions */ +/* other functions */ extern void weechat_plugin_exec_command (t_weechat_plugin *, char *, char *, char *); extern char *weechat_plugin_get_info (t_weechat_plugin *, char *, char *, char *); extern t_plugin_dcc_info *weechat_plugin_get_dcc_info (t_weechat_plugin *); extern void weechat_plugin_free_dcc_info (t_weechat_plugin *, t_plugin_dcc_info *); - -/* other functions */ extern char *weechat_plugin_get_config (t_weechat_plugin *, char *); #endif /* weechat-plugin.h */ |