Project

General

Profile

Bug #252 » bip-Write-received-PRIVMSG-to-the-sender-log.patch

Patch against HEAD (cosmetic improvements) - Arnaud Fontaine, 2011-10-03 07:54

View differences:

src/irc.c
}
static void irc_privmsg_check_ctcp(struct link_server *server,
const char *nick,
struct line *line)
{
if (irc_line_count(line) != 3)
......
if (!line->origin)
return;
char *nick;
nick = nick_from_ircmask(line->origin);
if (irc_line_elem_equals(line, 2, "\001VERSION\001")) {
WRITE_LINE2(CONN(server), NULL, "NOTICE", nick,
"\001VERSION bip-" PACKAGE_VERSION "\001");
}
free(nick);
}
static int irc_privmsg(struct link_server *server, struct line *line)
{
if (!irc_line_includes(line, 2))
return ERR_PROTOCOL;
if (LINK(server)->s_state == IRCS_CONNECTED)
log_privmsg(LINK(server)->log, line->origin,
irc_line_elem(line, 1), irc_line_elem(line, 2));
irc_privmsg_check_ctcp(server, line);
char *nick = nick_from_ircmask(line->origin);
if (LINK(server)->s_state == IRCS_CONNECTED) {
const char *ircmask = line->origin;
const char *destination = irc_line_elem(line, 1);
if (strcmp(server->nick, destination) == 0) {
/* when receiving a PRIVMSG, write it to the
sender log, otherwise it would be written to
a log with our nick */
ircmask = nick;
destination = nick;
}
log_privmsg(LINK(server)->log, ircmask,
destination, irc_line_elem(line, 2));
}
irc_privmsg_check_ctcp(server, nick, line);
free(nick);
return OK_COPY;
}
(2-2/2)