1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 12:26:40 +02:00

make possible to log with plugins / scripts

This commit is contained in:
Emmanuel Bouthenot
2006-02-16 16:10:25 +00:00
parent 91af3fe728
commit 8855d39f44
14 changed files with 482 additions and 0 deletions
+26
View File
@@ -35,6 +35,7 @@
#include "plugins.h"
#include "plugins-config.h"
#include "../common/command.h"
#include "../common/log.h"
#include "../common/weeconfig.h"
#include "../irc/irc.h"
#include "../gui/gui.h"
@@ -213,6 +214,31 @@ weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, cha
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, "%s", buf);
}
/*
* weechat_plugin_log: add a message on logs
*/
void
weechat_plugin_log (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 = gui_buffer_search (server, channel);
if (ptr_buffer)
{
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
log_write_line (ptr_buffer, buf);
}
}
/*
* weechat_plugin_msg_handler_add: add a message handler
*/