degesch: try to log lines in more specific buffers
This commit is contained in:
parent
b132b979da
commit
458ac8b7c4
55
degesch.c
55
degesch.c
@ -4663,14 +4663,7 @@ irc_process_numeric (struct server *s,
|
||||
str_vector_init (©);
|
||||
str_vector_add_vector (©, msg->params.vector + !!msg->params.len);
|
||||
|
||||
// Join the parameter vector back, recode it to our internal encoding
|
||||
// and send it to the server buffer
|
||||
char *reconstructed = join_str_vector (©, ' ');
|
||||
str_vector_free (©);
|
||||
buffer_send (s->ctx, s->buffer, BUFFER_LINE_STATUS, 0,
|
||||
.text = irc_to_utf8 (s->ctx, reconstructed));
|
||||
free (reconstructed);
|
||||
|
||||
struct buffer *buffer = s->buffer;
|
||||
switch (numeric)
|
||||
{
|
||||
case IRC_RPL_WELCOME:
|
||||
@ -4681,15 +4674,53 @@ irc_process_numeric (struct server *s,
|
||||
irc_try_parse_welcome_for_userhost (s, msg->params.vector[1]);
|
||||
break;
|
||||
|
||||
case IRC_RPL_ISUPPORT: irc_handle_rpl_isupport (s, msg); break;
|
||||
case IRC_RPL_USERHOST: irc_handle_rpl_userhost (s, msg); break;
|
||||
case IRC_RPL_NAMREPLY: irc_handle_rpl_namreply (s, msg); break;
|
||||
case IRC_RPL_ENDOFNAMES: irc_handle_rpl_endofnames (s, msg); break;
|
||||
case IRC_RPL_ISUPPORT:
|
||||
irc_handle_rpl_isupport (s, msg); break;
|
||||
case IRC_RPL_USERHOST:
|
||||
irc_handle_rpl_userhost (s, msg); break;
|
||||
case IRC_RPL_NAMREPLY:
|
||||
irc_handle_rpl_namreply (s, msg); buffer = NULL; break;
|
||||
case IRC_RPL_ENDOFNAMES:
|
||||
irc_handle_rpl_endofnames (s, msg); buffer = NULL; break;
|
||||
|
||||
case IRC_ERR_NICKNAMEINUSE:
|
||||
// TODO: if (state == IRC_CONNECTED), use a different nick;
|
||||
// either use a number suffix, or accept commas in "nickname" config
|
||||
break;
|
||||
|
||||
case IRC_RPL_LIST:
|
||||
case IRC_RPL_WHOREPLY:
|
||||
case IRC_RPL_ENDOFWHO:
|
||||
|
||||
case IRC_ERR_UNKNOWNCOMMAND:
|
||||
case IRC_ERR_NEEDMOREPARAMS:
|
||||
// Just preventing these commands from getting printed in a more
|
||||
// specific buffer as that would be unwanted
|
||||
break;
|
||||
|
||||
default:
|
||||
// If the second parameter is something we have a buffer for
|
||||
// (a channel, a PM buffer), log it in that buffer. This is very basic
|
||||
// and we should whitelist/blacklist a lot more replies here.
|
||||
// TODO: if this happens, we should either strip the first parameter
|
||||
// from the buffer line, or at least put it in brackets
|
||||
if (msg->params.len > 1)
|
||||
{
|
||||
struct buffer *x;
|
||||
if ((x = str_map_find (&s->irc_buffer_map, msg->params.vector[1])))
|
||||
buffer = x;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
// Join the parameter vector back, recode it to our internal encoding
|
||||
// and send it to the server buffer
|
||||
char *reconstructed = join_str_vector (©, ' ');
|
||||
str_vector_free (©);
|
||||
buffer_send (s->ctx, buffer, BUFFER_LINE_STATUS, 0,
|
||||
.text = irc_to_utf8 (s->ctx, reconstructed));
|
||||
free (reconstructed);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user