degesch: further logging cleanup
This commit is contained in:
parent
ed349cb1d3
commit
3e47abdfbb
60
degesch.c
60
degesch.c
|
@ -4064,6 +4064,20 @@ irc_is_highlight (struct server *s, const char *message)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
irc_get_privmsg_prefix (struct server *s, struct user *user, const char *target)
|
||||||
|
{
|
||||||
|
if (user && irc_is_channel (s, target))
|
||||||
|
{
|
||||||
|
struct channel *channel;
|
||||||
|
struct channel_user *channel_user;
|
||||||
|
if ((channel = str_map_find (&s->irc_channels, target))
|
||||||
|
&& (channel_user = irc_channel_get_user (channel, user)))
|
||||||
|
return channel_user->prefixes.str;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
// --- Mode processor ----------------------------------------------------------
|
// --- Mode processor ----------------------------------------------------------
|
||||||
|
|
||||||
struct mode_processor
|
struct mode_processor
|
||||||
|
@ -4587,9 +4601,9 @@ irc_handle_notice_text (struct server *s,
|
||||||
{
|
{
|
||||||
const char *target = msg->params.vector[0];
|
const char *target = msg->params.vector[0];
|
||||||
struct buffer *buffer = irc_get_buffer_for_message (s, msg, target);
|
struct buffer *buffer = irc_get_buffer_for_message (s, msg, target);
|
||||||
|
if (!buffer)
|
||||||
|
return;
|
||||||
|
|
||||||
if (buffer)
|
|
||||||
{
|
|
||||||
char *nick = irc_cut_nickname (msg->prefix);
|
char *nick = irc_cut_nickname (msg->prefix);
|
||||||
// IRCv3.2 echo-message could otherwise cause us to highlight ourselves
|
// IRCv3.2 echo-message could otherwise cause us to highlight ourselves
|
||||||
if (!irc_is_this_us (s, msg->prefix) && irc_is_highlight (s, text->str))
|
if (!irc_is_this_us (s, msg->prefix) && irc_is_highlight (s, text->str))
|
||||||
|
@ -4599,7 +4613,6 @@ irc_handle_notice_text (struct server *s,
|
||||||
log_outcoming_notice (s, buffer, msg->prefix, text->str);
|
log_outcoming_notice (s, buffer, msg->prefix, text->str);
|
||||||
free (nick);
|
free (nick);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
irc_handle_notice (struct server *s, const struct irc_message *msg)
|
irc_handle_notice (struct server *s, const struct irc_message *msg)
|
||||||
|
@ -4752,39 +4765,29 @@ irc_handle_privmsg_text (struct server *s,
|
||||||
{
|
{
|
||||||
const char *target = msg->params.vector[0];
|
const char *target = msg->params.vector[0];
|
||||||
struct buffer *buffer = irc_get_buffer_for_message (s, msg, target);
|
struct buffer *buffer = irc_get_buffer_for_message (s, msg, target);
|
||||||
char *nick = irc_cut_nickname (msg->prefix);
|
if (!buffer)
|
||||||
|
return;
|
||||||
|
|
||||||
const char *prefixes = "";
|
char *nickname = irc_cut_nickname (msg->prefix);
|
||||||
if (irc_is_channel (s, target))
|
const char *prefixes = irc_get_privmsg_prefix
|
||||||
{
|
(s, str_map_find (&s->irc_users, nickname), target);
|
||||||
struct user *user;
|
|
||||||
struct channel *channel;
|
|
||||||
struct channel_user *channel_user;
|
|
||||||
if ((user = str_map_find (&s->irc_users, nick))
|
|
||||||
&& (channel = str_map_find (&s->irc_channels, target))
|
|
||||||
&& (channel_user = irc_channel_get_user (channel, user)))
|
|
||||||
prefixes = channel_user->prefixes.str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buffer)
|
|
||||||
{
|
|
||||||
// IRCv3.2 echo-message could otherwise cause us to highlight ourselves
|
// IRCv3.2 echo-message could otherwise cause us to highlight ourselves
|
||||||
if (irc_is_this_us (s, msg->prefix) || !irc_is_highlight (s, text->str))
|
if (irc_is_this_us (s, msg->prefix) || !irc_is_highlight (s, text->str))
|
||||||
{
|
{
|
||||||
if (is_action)
|
if (is_action)
|
||||||
log_outcoming_action (s, buffer, nick, text->str);
|
log_outcoming_action (s, buffer, nickname, text->str);
|
||||||
else
|
else
|
||||||
log_outcoming_privmsg (s, buffer, prefixes, nick, text->str);
|
log_outcoming_privmsg (s, buffer, prefixes, nickname, text->str);
|
||||||
}
|
}
|
||||||
else if (is_action)
|
else if (is_action)
|
||||||
log_server (s, buffer, BUFFER_LINE_HIGHLIGHT,
|
log_server (s, buffer, BUFFER_LINE_HIGHLIGHT,
|
||||||
" #a*#r #n #m", ATTR_HIGHLIGHT, msg->prefix, text->str);
|
" #a*#r #n #m", ATTR_HIGHLIGHT, msg->prefix, text->str);
|
||||||
else
|
else
|
||||||
log_server (s, buffer, BUFFER_LINE_HIGHLIGHT,
|
log_server (s, buffer, BUFFER_LINE_HIGHLIGHT,
|
||||||
"#a<#s#s>#r #m", ATTR_HIGHLIGHT, prefixes, nick, text->str);
|
"#a<#s#s>#r #m", ATTR_HIGHLIGHT, prefixes, nickname, text->str);
|
||||||
}
|
|
||||||
|
|
||||||
free (nick);
|
free (nickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -5722,18 +5725,7 @@ static void
|
||||||
log_autosplit_privmsg (struct server *s,
|
log_autosplit_privmsg (struct server *s,
|
||||||
struct send_autosplit_args *a, struct buffer *buffer, const char *line)
|
struct send_autosplit_args *a, struct buffer *buffer, const char *line)
|
||||||
{
|
{
|
||||||
const char *prefixes = "";
|
const char *prefixes = irc_get_privmsg_prefix (s, s->irc_user, a->target);
|
||||||
if (irc_is_channel (s, a->target))
|
|
||||||
{
|
|
||||||
struct user *user;
|
|
||||||
struct channel *channel;
|
|
||||||
struct channel_user *channel_user;
|
|
||||||
if ((user = s->irc_user)
|
|
||||||
&& (channel = str_map_find (&s->irc_channels, a->target))
|
|
||||||
&& (channel_user = irc_channel_get_user (channel, user)))
|
|
||||||
prefixes = channel_user->prefixes.str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buffer && soft_assert (s->irc_user))
|
if (buffer && soft_assert (s->irc_user))
|
||||||
log_outcoming_privmsg (s, buffer,
|
log_outcoming_privmsg (s, buffer,
|
||||||
prefixes, s->irc_user->nickname, line);
|
prefixes, s->irc_user->nickname, line);
|
||||||
|
|
Loading…
Reference in New Issue