From b3d7dbfb02f18f8858f0ce335191826013ce10a9 Mon Sep 17 00:00:00 2001 From: Arnaud Cornet Date: Sat, 10 Jan 2009 13:26:59 +0100 Subject: [PATCH] [COSMETIC] Avoid opening a query with your own nic This exception is cosmetic, but you want it. Most of the time, you get backlog from your own nick for your mode changes only. Hence opening a query just to say "end of backlog"... --- src/irc.c | 1 - src/log.c | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/irc.c b/src/irc.c index a59f66f..335f9ed 100644 --- a/src/irc.c +++ b/src/irc.c @@ -868,7 +868,6 @@ static int irc_cli_privmsg(bip_t *bip, struct link_client *ic, if (irc_line_elem_equals(line, 1, "-bip")) return adm_bip(bip, ic, line, 1); - printf("%d<-\n", LINK(ic)->user->blreset_on_talk); if (LINK(ic)->user->blreset_on_talk) 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 555ab85..d5c870e 100644 --- a/src/log.c +++ b/src/log.c @@ -1308,14 +1308,24 @@ list_t *backlog_lines_from_last_mark(log_t *log, const char *bl, if (log_has_backlog(log, bl)) { ret = log_backread(log, bl, dest); - /* clean this up */ - irc_line_init(&l); - l.origin = P_IRCMASK; - _irc_line_append(&l, "PRIVMSG"); - _irc_line_append(&l, dest); - _irc_line_append(&l, "End of backlog"); - list_add_last(ret, irc_line_to_string(&l)); - _irc_line_deinit(&l); + /* + * This exception is cosmetic, but you want it. + * Most of the time, you get backlog from your own nick for + * your mode changes only. + * Hence opening a query just to say "end of backlog"... + */ + if (strcmp(bl, cli_nick) != 0) { + /* clean this up */ + irc_line_init(&l); + l.origin = P_IRCMASK; + if (dest == cli_nick) + l.origin = bl; + _irc_line_append(&l, "PRIVMSG"); + _irc_line_append(&l, dest); + _irc_line_append(&l, "End of backlog"); + list_add_last(ret, irc_line_to_string(&l)); + _irc_line_deinit(&l); + } } return ret; }