From 499a7d75b59e7bfdf3bfc9201015f7bc94e3135e Mon Sep 17 00:00:00 2001 From: Arnaud Cornet Date: Fri, 5 Jun 2009 00:43:05 +0200 Subject: [PATCH] backlog tweak --- src/log.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/log.c b/src/log.c index ae90d55..b21f294 100644 --- a/src/log.c +++ b/src/log.c @@ -613,15 +613,12 @@ void log_mode(log_t *logdata, const char *ircmask, const char *channel, void log_disconnected(log_t *logdata) { - logstore_t *store; hash_iterator_t hi; snprintf(logdata->buffer, LOGLINE_MAXLEN, "%s -!- Disconnected" " from server...", timestamp()); for (hash_it_init(&logdata->logfgs, &hi); hash_it_item(&hi); - hash_it_next(&hi)) { - store = hash_it_item(&hi); + hash_it_next(&hi)) log_write(logdata, hash_it_key(&hi), logdata->buffer); - } } void log_ping_timeout(log_t *logdata) @@ -684,11 +681,23 @@ void log_reset_all(log_t *logdata) { logstore_t *store; hash_iterator_t hi; + list_t drop; + + list_init(&drop, NULL); for (hash_it_init(&logdata->logfgs, &hi); hash_it_item(&hi); hash_it_next(&hi)) { store = hash_it_item(&hi); - log_reset(store); + if (ischannel(*hash_it_key(&hi))) + log_reset(store); + else + list_add_last(&drop, strdup(hash_it_key(&hi))); + } + + char *name; + while ((name = list_remove_first(&drop))) { + log_drop(logdata, name); + free(name); } } @@ -699,6 +708,8 @@ void log_reset_store(log_t *log, const char *storename) store = hash_get(&log->logfgs, storename); if (store) log_reset(store); + if (!ischannel(*storename)) + log_drop(log, storename); } void log_client_none_connected(log_t *logdata)