Moved some functions in source code

This commit is contained in:
Sebastien Helleu 2005-10-17 17:45:23 +00:00
parent 357d7c5a2f
commit aeb7170024
4 changed files with 146 additions and 152 deletions

View File

@ -1015,6 +1015,68 @@ weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
plugin_exec_on_files (plugin, directory, callback);
}
/*
* 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
*/
@ -1097,68 +1159,6 @@ weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *plugin)
plugin_cmd_handler_remove_all (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)
*/

View File

@ -122,6 +122,10 @@ struct t_weechat_plugin
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 */

View File

@ -1015,6 +1015,68 @@ weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
plugin_exec_on_files (plugin, directory, callback);
}
/*
* 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
*/
@ -1097,68 +1159,6 @@ weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *plugin)
plugin_cmd_handler_remove_all (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)
*/

View File

@ -122,6 +122,10 @@ struct t_weechat_plugin
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 */