summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-02-12 21:21:54 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-02-12 21:21:54 +0000
commit0473d2c8db2875bfd7049a94f662984a8e8f815b (patch)
tree17535cee7496da80bd6022bcaae3eaf94aeba707 /src/common
parent34ce958df991fcbfed772c591bcf2dc3c8e86b7a (diff)
downloadweechat-0473d2c8db2875bfd7049a94f662984a8e8f815b.zip
Plugins messages are logged with new config option (log_plugin_msg); on server buffer, only server messages are logged
Diffstat (limited to 'src/common')
-rw-r--r--src/common/command.c4
-rw-r--r--src/common/log.c23
-rw-r--r--src/common/log.h2
-rw-r--r--src/common/weeconfig.c5
-rw-r--r--src/common/weeconfig.h1
5 files changed, 33 insertions, 2 deletions
diff --git a/src/common/command.c b/src/common/command.c
index e6cf37ad5..d38395bc3 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -704,8 +704,8 @@ user_command (t_irc_server *server, char *command)
else
{
irc_display_prefix ((server) ? server->buffer : NULL, PREFIX_ERROR);
- gui_printf ((server) ? server->buffer : NULL,
- _("This window is not a channel!\n"));
+ gui_printf_nolog ((server) ? server->buffer : NULL,
+ _("This window is not a channel!\n"));
}
}
}
diff --git a/src/common/log.c b/src/common/log.c
index cdaaba286..06f62f7cd 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -31,6 +31,7 @@
#include "weechat.h"
#include "log.h"
#include "weeconfig.h"
+#include "../gui/gui.h"
/*
@@ -72,6 +73,28 @@ log_write (t_gui_buffer *buffer, char *message)
}
/*
+ * log_write_line: writes a WeeChat line to log file
+ */
+
+void
+log_write_line (t_gui_buffer *buffer, t_gui_line *line)
+{
+ t_gui_message *ptr_msg;
+
+ if (buffer->log_file)
+ {
+ log_write_date (buffer);
+ for (ptr_msg = line->messages; ptr_msg; ptr_msg = ptr_msg->next_message)
+ {
+ if (ptr_msg->type != MSG_TYPE_TIME)
+ fprintf (buffer->log_file, "%s", ptr_msg->message);
+ }
+ fprintf (buffer->log_file, "\n");
+ fflush (buffer->log_file);
+ }
+}
+
+/*
* log_start: starts a log
*/
diff --git a/src/common/log.h b/src/common/log.h
index 74d67a63d..7119d50af 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -22,9 +22,11 @@
#define __WEECHAT_LOG_H 1
#include "../irc/irc.h"
+#include "../gui/gui.h"
extern void log_write_date (t_gui_buffer *);
extern void log_write (t_gui_buffer *, char *);
+extern void log_write_line (t_gui_buffer *, t_gui_line *);
extern void log_start (t_gui_buffer *);
extern void log_end (t_gui_buffer *);
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 91b96fc2c..04e678f40 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -432,6 +432,7 @@ t_config_option weechat_options_history[] =
int cfg_log_auto_server;
int cfg_log_auto_channel;
int cfg_log_auto_private;
+int cfg_log_plugin_msg;
char *cfg_log_path;
char *cfg_log_timestamp;
int cfg_log_hide_nickserv_pwd;
@@ -449,6 +450,10 @@ t_config_option weechat_options_log[] =
N_("automatically log private chats"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
+ { "log_plugin_msg", N_("log messages from plugins (scripts)"),
+ N_("log messages from plugins (scripts)"),
+ OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
+ NULL, NULL, &cfg_log_plugin_msg, NULL, NULL },
{ "log_path", N_("path for log files"),
N_("path for WeeChat log files"),
OPTION_TYPE_STRING, 0, 0, 0,
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index b231be902..920228a48 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -148,6 +148,7 @@ extern int cfg_history_max_commands;
extern int cfg_log_auto_server;
extern int cfg_log_auto_channel;
extern int cfg_log_auto_private;
+extern int cfg_log_plugin_msg;
extern char *cfg_log_path;
extern char *cfg_log_timestamp;
extern int cfg_log_hide_nickserv_pwd;