1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00

Autologging fixes: Don't log WHOIS replies by default

(autolog_level = all -crap). And with /msg nick1,nick2 don't log to
file nick1,nick2.log but nick1.log and nick2.log separately.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@585 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-08-11 20:13:49 +00:00 committed by cras
parent 8eb324accc
commit 82d272799c
2 changed files with 26 additions and 6 deletions

View File

@ -347,13 +347,24 @@ static void sig_printtext_stripped(void *window, void *server,
const char *item, gpointer levelp,
const char *str)
{
char **items, **tmp;
int level;
g_return_if_fail(str != NULL);
level = GPOINTER_TO_INT(levelp);
if (logs != NULL && level != MSGLEVEL_NEVER)
log_file_write(item, level, str, FALSE);
if (logs == NULL || level == MSGLEVEL_NEVER)
return;
if (item == NULL)
log_file_write(NULL, level, str, FALSE);
else {
/* there can be multiple items separated with comma */
items = g_strsplit(item, ",", -1);
for (tmp = items; *tmp != NULL; tmp++)
log_file_write(*tmp, level, str, FALSE);
g_strfreev(items);
}
}
static int sig_rotate_check(void)

View File

@ -331,9 +331,12 @@ static void autolog_log(void *server, const char *target)
g_free(fname);
}
static void sig_printtext_stripped(WINDOW_REC *window, void *server, const char *target, gpointer levelp, const char *text)
static void sig_printtext_stripped(WINDOW_REC *window, void *server,
const char *target, gpointer levelp,
const char *text)
{
char windownum[MAX_INT_STRLEN];
char **targets, **tmp;
LOG_REC *log;
int level;
@ -341,8 +344,14 @@ static void sig_printtext_stripped(WINDOW_REC *window, void *server, const char
if (level == MSGLEVEL_NEVER) return;
/* let autolog create the log records */
if ((autolog_level & level) && target != NULL && *target != '\0')
autolog_log(server, target);
if ((autolog_level & level) && target != NULL && *target != '\0') {
/* there can be multiple targets separated with comma */
targets = g_strsplit(target, ",", -1);
for (tmp = targets; *tmp != NULL; tmp++) {
autolog_log(server, *tmp);
}
g_strfreev(targets);
}
/* save to log created with /WINDOW LOG */
ltoa(windownum, window->refnum);
@ -438,7 +447,7 @@ void fe_log_init(void)
autoremove_tag = g_timeout_add(60000, (GSourceFunc) sig_autoremove, NULL);
settings_add_str("log", "autolog_path", "~/irclogs/$tag/$0.log");
settings_add_str("log", "autolog_level", "all");
settings_add_str("log", "autolog_level", "all -crap");
settings_add_bool("log", "autolog", FALSE);
autolog_level = 0;