[FEATURE] reset backlog on talk now "window" local

The reset_backlog_on_talk now resets current query or channel.
The /bip blreset command not takes an optional argument taking query
name or channel name.
This commit is contained in:
Arnaud Cornet 2009-01-09 11:26:12 +01:00
parent a6bb697f5d
commit f1221703b0
4 changed files with 30 additions and 5 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);