diff --git a/src/bip.c b/src/bip.c index 44b7770..65c11b0 100644 --- a/src/bip.c +++ b/src/bip.c @@ -1847,6 +1847,12 @@ void adm_blreset(struct link_client *ic) bip_notify(ic, "backlog resetted for this network."); } +void adm_blreset_store(struct link_client *ic, const char *store) +{ + log_reset_store(LINK(ic)->log, store); + bip_notify(ic, "backlog resetted for %s.", store); +} + void adm_follow_nick(struct link_client *ic, const char *val) { struct link *link = LINK(ic); @@ -2163,9 +2169,19 @@ int adm_bip(bip_t *bip, struct link_client *ic, struct line *line, int privmsg) } bip_notify(ic, "-- Jumping to next server"); } else if (irc_line_elem_case_equals(line, privmsg + 1, "BLRESET")) { - if (irc_line_count(line) == privmsg + 3 && - irc_line_elem_equals(line, privmsg + 2, "-q")) { - log_reinit_all(LINK(ic)->log); + if (irc_line_includes(line, privmsg + 2)) { + if (irc_line_elem_equals(line, privmsg + 2, "-q")) { + if (irc_line_includes(line, privmsg + 3)) { + log_reset_store(LINK(ic)->log, + irc_line_elem(line, + privmsg + 3)); + } else { + log_reinit_all(LINK(ic)->log); + } + } else { + adm_blreset_store(ic, irc_line_elem(line, + privmsg + 3)); + } } else { adm_blreset(ic); } diff --git a/src/irc.c b/src/irc.c index 870acbf..5d8d5e7 100644 --- a/src/irc.c +++ b/src/irc.c @@ -871,7 +871,7 @@ static int irc_cli_privmsg(bip_t *bip, struct link_client *ic, return adm_bip(bip, ic, line, 1); if (LINK(ic)->user->blreset_on_talk) - log_reinit_all(LINK(ic)->log); + log_reset_store(LINK(ic)->log, irc_line_elem(line, 1)); return OK_COPY_CLI; } @@ -882,7 +882,7 @@ static int irc_cli_notice(struct link_client *ic, struct line *line) log_cli_notice(LINK(ic)->log, LINK(ic)->l_server->nick, irc_line_elem(line, 1), irc_line_elem(line, 2)); if (LINK(ic)->user->blreset_on_talk) - log_reinit_all(LINK(ic)->log); + log_reset_store(LINK(ic)->log, irc_line_elem(line, 1)); return OK_COPY_CLI; } diff --git a/src/log.c b/src/log.c index df8ff5c..abefc60 100644 --- a/src/log.c +++ b/src/log.c @@ -689,6 +689,14 @@ void log_reinit_all(log_t *logdata) } } +void log_reset_store(log_t *log, const char *storename) +{ + logstore_t *store; + store = hash_get(&log->logfgs, storename); + if (store) + log_reset(store); +} + void log_client_none_connected(log_t *logdata) { logdata->connected = 0; diff --git a/src/log.h b/src/log.h index b114fbe..b1d62d1 100644 --- a/src/log.h +++ b/src/log.h @@ -100,6 +100,7 @@ void log_reset(logstore_t *); void log_reinit_all(log_t *logdata); void log_free(log_t *log); int check_dir(char *filename, int is_fatal); +void log_reset_store(log_t *log, const char *storename); list_t *log_backlogs(log_t *log); list_t *backlog_lines_from_last_mark(log_t *log, const char *bl);