degesch: log CAP traffic
This commit is contained in:
parent
f2a6c0f299
commit
d48adf4557
14
degesch.c
14
degesch.c
|
@ -4706,12 +4706,15 @@ irc_handle_cap (struct server *s, const struct irc_message *msg)
|
|||
struct str_vector v;
|
||||
str_vector_init (&v);
|
||||
|
||||
const char *args = "";
|
||||
if (msg->params.len > 2)
|
||||
split_str_ignore_empty (msg->params.vector[2], ' ', &v);
|
||||
split_str_ignore_empty ((args = msg->params.vector[2]), ' ', &v);
|
||||
|
||||
const char *subcommand = msg->params.vector[1];
|
||||
if (!strcasecmp_ascii (subcommand, "ACK"))
|
||||
{
|
||||
log_server_status (s, s->buffer,
|
||||
"#s: #S", "Capabilities acknowledged", args);
|
||||
for (size_t i = 0; i < v.len; i++)
|
||||
{
|
||||
const char *cap = v.vector[i];
|
||||
|
@ -4727,9 +4730,16 @@ irc_handle_cap (struct server *s, const struct irc_message *msg)
|
|||
irc_send (s, "CAP END");
|
||||
}
|
||||
else if (!strcasecmp_ascii (subcommand, "NAK"))
|
||||
{
|
||||
log_server_error (s, s->buffer,
|
||||
"#s: #S", "Capabilities not acknowledged", args);
|
||||
irc_send (s, "CAP END");
|
||||
}
|
||||
else if (!strcasecmp_ascii (subcommand, "LS"))
|
||||
{
|
||||
log_server_status (s, s->buffer,
|
||||
"#s: #S", "Capabilities supported", args);
|
||||
|
||||
struct str_vector chosen;
|
||||
str_vector_init (&chosen);
|
||||
|
||||
|
@ -4746,6 +4756,8 @@ irc_handle_cap (struct server *s, const struct irc_message *msg)
|
|||
char *chosen_str = join_str_vector (&chosen, ' ');
|
||||
str_vector_free (&chosen);
|
||||
irc_send (s, "CAP REQ :%s", chosen_str);
|
||||
log_server_status (s, s->buffer,
|
||||
"#s: #S", "Capabilities requested", chosen_str);
|
||||
free (chosen_str);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue