From d48adf4557cf9c8f392977de7929c329d2d136f3 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sat, 11 Jul 2015 05:04:17 +0200
Subject: degesch: log CAP traffic
---
degesch.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
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);
}
--
cgit v1.2.3-70-g09d2