r8476: improve kick handling
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 4 Jan 2004 00:09:49 +0000 (00:09 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 4 Jan 2004 00:09:49 +0000 (00:09 +0000)
logger.lisp

index 15080c17c81de67b6524ecf23f3eb2f1bb11a332..3c04c383266e6d8221963846421c39ea04dfa3ab 100644 (file)
@@ -242,10 +242,12 @@ o;;;  -*- Mode: Lisp -*-
 
 (defmethod %output-event ((format (eql :sexp)) stream utime type channel source text
                          msg unichannel)
-  (if unichannel
-      (format stream "(~S ~S ~S ~S ~S)~%" utime type source text (last-sexp-field type msg))
-    (format stream "(~S ~S ~S ~S ~S ~S)~%" utime type source channel text
-           (last-sexp-field type msg))))
+  (let ((*print-circle* nil)
+       (*print-pretty* nil))
+    (if unichannel
+       (format stream "(~S ~S ~S ~S ~S)~%" utime type source text (last-sexp-field type msg))
+      (format stream "(~S ~S ~S ~S ~S ~S)~%" utime type source channel text
+             (last-sexp-field type msg)))))
 
 (defmethod %output-event ((format (eql :text)) stream utime type channel source text
                          msg unichannel)
@@ -356,7 +358,14 @@ o;;;  -*- Mode: Lisp -*-
   (output-event msg :join (trailing-argument msg)))
 
 (defun kick-hook (msg)
-  (output-event msg :kick (first (arguments msg))))
+  (let ((logger (find-logger-with-connection (connection msg)))
+       (channel (first (arguments msg)))
+       (who-kicked (second (arguments msg))))
+    (when (string-equal (nickname logger) who-kicked)
+      (warn "*** Logging daemon ~A has been kicked from ~A at ~A" (nickname logger)
+           channel (format-date-time (received-time msg)))
+      #+ignore (remove-channel-logger logger channel))
+    (output-event msg :kick channel who-kicked)))
 
 (defun notice-hook (msg)
   (if (and (string-equal (source msg) "NickServ")
@@ -370,7 +379,7 @@ o;;;  -*- Mode: Lisp -*-
 (defun ping-hook (msg)
   (let ((logger (find-logger-with-connection (connection msg))))
     (pong (connection msg) (server logger))
-    (format *standard-output* "Sending pong to ~A~%" (server logger))))
+    #+debug (format *standard-output* "Sending pong to ~A~%" (server logger))))
 
 (defun pong-hook (msg)
   (let ((logger (find-logger-with-connection (connection msg))))