X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=logger.lisp;h=b242f5a9f806480cc3e06a1e3f67aa8083ea3c31;hb=4082dbd4d3c80282c43b2c41b7e5dae41ba56e94;hp=82b784c5670fe4abad80e13ad88422d42671e61c;hpb=16ac0a894c208a354443b0165d710b96f1da4982;p=irc-logger.git diff --git a/logger.lisp b/logger.lisp index 82b784c..b242f5a 100644 --- a/logger.lisp +++ b/logger.lisp @@ -9,7 +9,7 @@ (defvar *daemon-monitor-process* nil "Process of background monitor.") (defparameter *timeout* 60) -(defclass channel () +(defclass log-channel () ((name :initarg :name :reader c-name :documentation "Name of channel.") (streams :initarg :streams :reader streams @@ -396,9 +396,13 @@ (output-event msg :privmsg channel (trailing-argument msg)))))) (defun action-hook (msg) - (output-event msg :action (first (arguments msg)) - (subseq (trailing-argument msg) 8 - (- (length (trailing-argument msg)) 1)))) + (let ((end (- (length (trailing-argument msg)) 1))) + ;; end has been as low as 7 + (when (< end 8) + (warn "End is less than 8: `~A'." msg)) + (output-event msg :action (first (arguments msg)) + (subseq (trailing-argument msg) (min 8 end) + (- (length (trailing-argument msg)) 1))))) (defun nick-hook (msg) (output-event msg :nick nil (trailing-argument msg))) @@ -422,9 +426,9 @@ logger "Logging daemon ~A has been kicked from ~A (~A)" (l-nickname logger) channel (trailing-argument msg)) - (daemon-sleep 1) + (daemon-sleep 5) (remove-channel-logger logger channel) - (daemon-sleep 1) + (daemon-sleep 10) (add-channel-logger logger channel) (add-private-log-entry logger "Rejoined ~A" channel)))) @@ -484,7 +488,7 @@ (defun make-a-channel (name formats output) - (make-instance 'channel + (make-instance 'log-channel :name name :streams (make-array (length formats) :initial-element nil) :output-root (when (and (pathnamep output) @@ -641,7 +645,8 @@ (add-private-log-entry nil "Calling create-logger [add-logger].~%") (let ((logger (do ((new-logger - (mp:with-timeout (*timeout* nil) + (#-sbcl mp:with-timeout #-sbcl (*timeout* nil) + #+sbcl sb-ext:with-timeout #+sbcl *timeout* (create-logger nick server :channels channels :output output :logging-stream logging-stream :password password :realname realname :username username @@ -649,7 +654,8 @@ :unknown-log unknown-log :formats formats :async async)) - (mp:with-timeout (*timeout* nil) + (#-sbcl mp:with-timeout #-sbcl (*timeout* nil) + #+sbcl sb-ext:with-timeout #+sbcl *timeout* (create-logger nick server :channels channels :output output :logging-stream logging-stream :password password :realname realname :username username @@ -718,7 +724,8 @@ (let ((text (trailing-argument msg)) (logger (find-logger-with-connection (connection msg)))) (when (and (stringp text) - (zerop (search (format nil "Closing Link: ~A" (l-nickname logger)) text))) + (eql 0 (search (format nil "Closing Link: ~A" + (l-nickname logger)) text))) (setf (warning-message-utime logger) (received-time msg))) (output-event msg :error nil (trailing-argument msg))))