1
0
forked from bip/bip

fix notice logging file storage

This commit is contained in:
Arnaud Cornet 2008-12-26 08:56:03 +01:00
parent 20ce456e38
commit 8693044511
2 changed files with 21 additions and 9 deletions

View File

@ -880,6 +880,8 @@ static int irc_cli_notice(struct link_client *ic, struct line *line)
return OK_FORGET;
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);
return OK_COPY_CLI;
}
@ -1784,16 +1786,17 @@ 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) {
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);
return OK_COPY;
}
static int irc_notice(struct link_server *server, struct line *line)
{
if (!irc_line_includes(line, 2))
return ERR_PROTOCOL;
if (LINK(server)->s_state == IRCS_CONNECTED)
log_notice(LINK(server)->log, line->origin,
irc_line_elem(line, 1), irc_line_elem(line, 2));

View File

@ -524,15 +524,17 @@ void log_cli_privmsg(log_t *logdata, const char *ircmask,
do_log_privmsg(logdata, destination, 1, ircmask, message);
}
static void _log_notice(log_t *logdata, const char *ircmask, int src,
const char *destination, const char *message)
#if 0
static void do_log_notice(log_t *logdata, const char *storate, int src,
const char *from, const char *message)
{
char dir = '<';
if (!ircmask)
ircmask = "Server message";
if (!from)
from = "Server message";
if (src)
dir = '>';
if (*message == '\001' && *(message + strlen(message) - 1) == '\001')
return;
if (ischannel(*destination) || strchr(destination, '@')) {
@ -543,19 +545,26 @@ static void _log_notice(log_t *logdata, const char *ircmask, int src,
"%s %c %s (%s): %s", timestamp(),
dir, ircmask, destination, message);
}
log_write(logdata, destination, logdata->buffer);
log_write(logdata, storage, logdata->buffer);
}
#endif
void log_notice(log_t *logdata, const char *ircmask, const char *destination,
const char *message)
{
_log_notice(logdata, ircmask, 0, destination, message);
if (!ischannel(*destination)) {
char *nick = nick_from_ircmask(ircmask);
do_log_privmsg(logdata, nick, 0, ircmask, message);
free(nick);
} else {
do_log_privmsg(logdata, destination, 0, ircmask, message);
}
}
void log_cli_notice(log_t *logdata, const char *ircmask,
const char *destination, const char *message)
{
_log_notice(logdata, ircmask, 1, destination, message);
do_log_privmsg(logdata, destination, 1, ircmask, message);
}
void log_topic(log_t *logdata, const char *ircmask, const char *channel,