diff options
author | Timo Sirainen <cras@irssi.org> | 2000-05-18 08:46:56 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-05-18 08:46:56 +0000 |
commit | ae25925a1fdceeddff25076b5ff557e14f1aa4cb (patch) | |
tree | 7c417ca056f58f2720c41c1493f41ad3ed3d4fc7 /src/fe-common/core | |
parent | a0aa6493682fc7b12a83352857abd3697a1ea677 (diff) | |
download | irssi-ae25925a1fdceeddff25076b5ff557e14f1aa4cb.zip |
Some logging fixes. Flood checking had a memory leak. Query had a small
memory leak. Text buffer fixes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@226 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core')
-rw-r--r-- | src/fe-common/core/fe-log.c | 23 | ||||
-rw-r--r-- | src/fe-common/core/module-formats.c | 2 |
2 files changed, 18 insertions, 7 deletions
diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index 58cd28fe..6dcf7e40 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -48,7 +48,7 @@ static void cmd_log_open(const char *data) char *params, *args, *targetarg, *rotatearg, *fname, *levels; char window[MAX_INT_STRLEN]; LOG_REC *log; - int opened, level, rotate; + int level, rotate; args = "targets rotate"; params = cmd_get_params(data, 5 | PARAM_FLAG_MULTIARGS | PARAM_FLAG_GETREST, @@ -73,12 +73,15 @@ static void cmd_log_open(const char *data) log = log_create_rec(fname, level, targetarg); if (log != NULL && log->handle == -1 && stristr(args, "-noopen") == NULL) { /* start logging */ - opened = log_start_logging(log); - printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, - opened ? IRCTXT_LOG_OPENED : - IRCTXT_LOG_CREATE_FAILED, fname); - if (!opened) log_close(log); + if (log_start_logging(log)) { + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, + IRCTXT_LOG_OPENED, fname); + } else { + log_close(log); + log = NULL; + } } + if (log != NULL) { if (stristr(args, "-autoopen")) log->autoopen = TRUE; @@ -366,6 +369,12 @@ static void sig_log_locked(LOG_REC *log) IRCTXT_LOG_LOCKED, log->fname); } +static void sig_log_create_failed(LOG_REC *log) +{ + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, + IRCTXT_LOG_CREATE_FAILED, log->fname, g_strerror(errno)); +} + static void read_settings(void) { int old_autolog = autolog_level; @@ -401,6 +410,7 @@ void fe_log_init(void) signal_add("window item remove", (SIGNAL_FUNC) sig_window_item_remove); signal_add("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed); signal_add("log locked", (SIGNAL_FUNC) sig_log_locked); + signal_add("log create failed", (SIGNAL_FUNC) sig_log_create_failed); signal_add("setup changed", (SIGNAL_FUNC) read_settings); } @@ -420,5 +430,6 @@ void fe_log_deinit(void) signal_remove("window item remove", (SIGNAL_FUNC) sig_window_item_remove); signal_remove("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed); signal_remove("log locked", (SIGNAL_FUNC) sig_log_locked); + signal_remove("log create failed", (SIGNAL_FUNC) sig_log_create_failed); signal_remove("setup changed", (SIGNAL_FUNC) read_settings); } diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index 5ddb5f7e..abbf0f46 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -73,7 +73,7 @@ FORMAT_REC fecommon_core_formats[] = { { "log_opened", "Log file %W$0%n opened", 1, { 0 } }, { "log_closed", "Log file %W$0%n closed", 1, { 0 } }, - { "log_create_failed", "Couldn't create log file %W$0", 1, { 0 } }, + { "log_create_failed", "Couldn't create log file %_$0%_: $1", 2, { 0, 0 } }, { "log_locked", "Log file %W$0%n is locked, probably by another running Irssi", 1, { 0 } }, { "log_not_open", "Log file %W$0%n not open", 1, { 0 } }, { "log_started", "Started logging to file %W$0", 1, { 0 } }, |