degesch: fix /msg with CAP echo-message

This commit is contained in:
Přemysl Eric Janouch 2015-06-29 21:39:40 +02:00
parent 2b240b6631
commit be10e61c90
1 changed files with 20 additions and 9 deletions

View File

@ -2587,6 +2587,11 @@ log_full (struct app_context *ctx, struct server *s, struct buffer *buffer,
#define log_outcoming_action(s, buffer, who, text) \
log_server ((s), (buffer), 0, " #a*#r #n #m", ATTR_ACTION, (who), (text))
#define log_outcoming_orphan_notice(s, target, text) \
log_server_status ((s), (s)->buffer, "Notice -> #n: #m", (target), (text))
#define log_outcoming_orphan_privmsg(s, target, text) \
log_server_status ((s), (s)->buffer, "MSG(#n): #m", (target), (text))
#define log_ctcp_query(s, target, tag) \
log_server_status ((s), (s)->buffer, "CTCP query to #S: #S", target, tag)
#define log_ctcp_reply(s, target, reply /* freed! */) \
@ -4055,13 +4060,11 @@ irc_get_buffer_for_message (struct server *s,
char *nickname = irc_cut_nickname (msg->prefix);
if (irc_is_this_us (s, target))
buffer = irc_get_or_make_user_buffer (s, nickname);
// With the IRCv3.2 echo-message capability, we can receive messages
// as they are delivered to the target; in that case, check the origin
// FIXME: this breaks /msg with CAP echo-message, we should return
// NULL and the caller should do this check instead and handle it
else if (soft_assert (irc_is_this_us (s, nickname)))
buffer = irc_get_or_make_user_buffer (s, target);
free (nickname);
// With the IRCv3.2 echo-message capability, we can receive messages
// as they are delivered to the target; in that case we return NULL
// and the caller should check the origin
}
return buffer;
}
@ -4643,7 +4646,11 @@ irc_handle_notice_text (struct server *s,
const char *target = msg->params.vector[0];
struct buffer *buffer = irc_get_buffer_for_message (s, msg, target);
if (!buffer)
{
if (irc_is_this_us (s, msg->prefix))
log_outcoming_orphan_notice (s, target, text->str);
return;
}
char *nick = irc_cut_nickname (msg->prefix);
// IRCv3.2 echo-message could otherwise cause us to highlight ourselves
@ -4807,7 +4814,11 @@ irc_handle_privmsg_text (struct server *s,
const char *target = msg->params.vector[0];
struct buffer *buffer = irc_get_buffer_for_message (s, msg, target);
if (!buffer)
{
if (irc_is_this_us (s, msg->prefix))
log_outcoming_orphan_privmsg (s, target, text->str);
return;
}
char *nickname = irc_cut_nickname (msg->prefix);
const char *prefixes = irc_get_privmsg_prefix
@ -4826,7 +4837,7 @@ irc_handle_privmsg_text (struct server *s,
" #a*#r #n #m", ATTR_HIGHLIGHT, msg->prefix, text->str);
else
log_server (s, buffer, BUFFER_LINE_HIGHLIGHT,
"#a<#s#s>#r #m", ATTR_HIGHLIGHT, prefixes, nickname, text->str);
"#a<#S#S>#r #m", ATTR_HIGHLIGHT, prefixes, nickname, text->str);
free (nickname);
}
@ -5769,7 +5780,7 @@ log_autosplit_privmsg (struct server *s,
log_outcoming_privmsg (s, buffer,
prefixes, s->irc_user->nickname, line);
else
log_server_status (s, s->buffer, "MSG(#n): #m", a->target, line);
log_outcoming_orphan_privmsg (s, a->target, line);
}
#define SEND_AUTOSPLIT_PRIVMSG(s, target, message) \
@ -5783,7 +5794,7 @@ log_autosplit_notice (struct server *s,
if (buffer && soft_assert (s->irc_user))
log_outcoming_notice (s, buffer, s->irc_user->nickname, line);
else
log_server_status (s, s->buffer, "Notice -> #n: #m", a->target, line);
log_outcoming_orphan_notice (s, a->target, line);
}
#define SEND_AUTOSPLIT_NOTICE(s, target, message) \