1
0
mirror of https://github.com/irssi/irssi.git synced 2025-01-03 14:56:47 -05:00

Logs were closed and entirely removed after doing /RELOAD.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@418 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-07-02 18:52:15 +00:00 committed by cras
parent 7d1cbac459
commit eee71a093a

View File

@ -308,11 +308,10 @@ void log_update(LOG_REC *log)
signal_emit("log new", 1, log); signal_emit("log new", 1, log);
} }
void log_close(LOG_REC *log) static void log_destroy(LOG_REC *log)
{ {
g_return_if_fail(log != NULL); g_return_if_fail(log != NULL);
log_remove_config(log);
if (log->handle != -1) if (log->handle != -1)
log_stop_logging(log); log_stop_logging(log);
@ -324,6 +323,14 @@ void log_close(LOG_REC *log)
g_free(log); g_free(log);
} }
void log_close(LOG_REC *log)
{
g_return_if_fail(log != NULL);
log_remove_config(log);
log_destroy(log);
}
static void sig_printtext_stripped(void *window, void *server, const char *item, gpointer levelp, const char *str) static void sig_printtext_stripped(void *window, void *server, const char *item, gpointer levelp, const char *str)
{ {
int level; int level;
@ -377,10 +384,21 @@ static void log_read_config(void)
{ {
CONFIG_NODE *node; CONFIG_NODE *node;
LOG_REC *log; LOG_REC *log;
GSList *tmp; GSList *tmp, *next, *fnames;
while (logs != NULL) /* close old logs, save list of open logs */
log_close(logs->data); fnames = NULL;
for (tmp = logs; tmp != NULL; tmp = next) {
log = tmp->data;
next = tmp->next;
if (log->temp)
continue;
if (log->handle != -1)
fnames = g_slist_append(fnames, g_strdup(log->fname));
log_destroy(log);
}
node = iconfig_node_traverse("logs", FALSE); node = iconfig_node_traverse("logs", FALSE);
if (node == NULL) return; if (node == NULL) return;
@ -404,8 +422,12 @@ static void log_read_config(void)
node = config_node_section(node, "items", -1); node = config_node_section(node, "items", -1);
if (node != NULL) log->items = config_node_get_list(node); if (node != NULL) log->items = config_node_get_list(node);
if (log->autoopen) log_start_logging(log); if (log->autoopen || gslist_find_string(fnames, log->fname))
log_start_logging(log);
} }
g_slist_foreach(fnames, (GFunc) g_free, NULL);
g_slist_free(fnames);
} }
static void read_settings(void) static void read_settings(void)