add NICK/QUIT logging to irc_log
authorTero Marttila <terom@fixme.fi>
Fri, 27 Mar 2009 00:08:32 +0200
changeset 80 1b989bc67760
parent 79 e26f972300e4
child 81 d90edc052352
add NICK/QUIT logging to irc_log
src/irc_log.c
--- a/src/irc_log.c	Fri Mar 27 00:08:23 2009 +0200
+++ b/src/irc_log.c	Fri Mar 27 00:08:32 2009 +0200
@@ -176,6 +176,38 @@
 }
 
 /**
+ * Log a NICK event on a channel
+ *
+ * :nm NICK <nickname>
+ *
+ * This logs the new nickname as the target
+ */
+static void irc_log_on_chan_NICK (const struct irc_line *line, void *arg)
+{
+    struct irc_log_chan *chan_ctx = arg;
+
+    const char *nickname = line->args[0];
+
+    // log it
+    irc_log_event(chan_ctx->ctx, chan_ctx, line->source, line->command, nickname, NULL);
+}
+
+/**
+ * Log a QUIT event on a channel
+ *
+ * :nm QUIT [<message>]
+ */
+static void irc_log_on_chan_QUIT (const struct irc_line *line, void *arg)
+{
+    struct irc_log_chan *chan_ctx = arg;
+
+    const char *message = line->args[0];
+
+    // log it
+    irc_log_event(chan_ctx->ctx, chan_ctx, line->source, line->command, NULL, message);
+}
+
+/**
  * Log a MODE event on a channel
  *
  * :nm MODE <channel> [<modearg> [...]]
@@ -227,6 +259,8 @@
  * Note that these get a `struct irc_log_chan*` as an argument.
  */
 static struct irc_cmd_handler _chan_cmd_handlers[] = {
+    {   "NICK",     &irc_log_on_chan_NICK           },
+    {   "QUIT",     &irc_log_on_chan_QUIT           },
     {   "JOIN",     &irc_log_on_chan_generic        },
     {   "PART",     &irc_log_on_chan_generic        },
     {   "MODE",     &irc_log_on_chan_MODE           },