summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-07-11 05:04:17 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-07-11 05:04:17 +0200
commitd48adf4557cf9c8f392977de7929c329d2d136f3 (patch)
tree60611487f50f57e78fb77d8196fa9b8f52b9ef43 /degesch.c
parentf2a6c0f29964e6f531c10f935288419c6a57f2ea (diff)
downloadxK-d48adf4557cf9c8f392977de7929c329d2d136f3.tar.gz
xK-d48adf4557cf9c8f392977de7929c329d2d136f3.tar.xz
xK-d48adf4557cf9c8f392977de7929c329d2d136f3.zip
degesch: log CAP traffic
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/degesch.c b/degesch.c
index f87b4f9..a3da97d 100644
--- a/degesch.c
+++ b/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);
}