[net-nittin-irc-cvs] CVS update: net-nittin-irc/event.lisp
Erik Enge
eenge at common-lisp.net
Sun Nov 23 23:21:39 UTC 2003
Update of /project/net-nittin-irc/cvsroot/net-nittin-irc
In directory common-lisp.net:/tmp/cvs-serv31306
Modified Files:
event.lisp
Log Message:
adding default hooks
Date: Sun Nov 23 18:21:39 2003
Author: eenge
Index: net-nittin-irc/event.lisp
diff -u net-nittin-irc/event.lisp:1.9 net-nittin-irc/event.lisp:1.10
--- net-nittin-irc/event.lisp:1.9 Sun Nov 23 17:39:15 2003
+++ net-nittin-irc/event.lisp Sun Nov 23 18:21:38 2003
@@ -1,4 +1,4 @@
-;;;; $Id: event.lisp,v 1.9 2003/11/23 22:39:15 eenge Exp $
+;;;; $Id: event.lisp,v 1.10 2003/11/23 23:21:38 eenge Exp $
;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/event.lisp,v $
;;;; See LICENSE for licensing information.
@@ -14,16 +14,9 @@
(apply-to-hooks message)
(client-log (connection message) message "UNHANLDED-EVENT:"))
-(defmethod irc-message-event ((message irc-error-reply))
- (apply-to-hooks message)
- (let* ((connection (connection message))
- (stream (client-stream connection)))
- (client-log connection message)))
-
-(defmethod irc-message-event ((message irc-rpl_whoisuser-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
- (let ((user (find-user (connection message) (second (arguments message))))
+(defmethod default-hook ((message irc-rpl_whoisuser-message))
+ (let ((user (find-user (connection message)
+ (second (arguments message))))
(realname (trailing-argument message))
(username (third (arguments message)))
(hostname (fourth (arguments message))))
@@ -31,9 +24,7 @@
(setf (username user) username)
(setf (hostname user) hostname)))
-(defmethod irc-message-event ((message irc-rpl_list-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-rpl_list-message))
(let ((connection (connection message))
(channel (second (arguments message)))
(user-count (parse-integer (or (third (arguments message)) "0")))
@@ -44,16 +35,12 @@
:user-count user-count))
(channel-list connection))))
-(defmethod irc-message-event ((message irc-rpl_topic-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-rpl_topic-message))
(setf (topic (find-channel (connection message)
(second (arguments message))))
(trailing-argument message)))
-(defmethod irc-message-event ((message irc-rpl_namreply-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-rpl_namreply-message))
(let ((channel (find-channel (connection message) (car (last (arguments message))))))
(dolist (nickname (tokenize-string (trailing-argument message)))
(add-user channel
@@ -62,14 +49,10 @@
:username (user message)
:hostname (host message))))))
-(defmethod irc-message-event ((message irc-ping-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
- (pong (connection message) (trailing-argument message) ))
+(defmethod default-hook ((message irc-ping-message))
+ (pong (connection message) (trailing-argument message)))
-(defmethod irc-message-event ((message irc-join-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-join-message))
(let* ((connection (connection message))
(user (find-or-make-user
(connection message)
@@ -82,16 +65,12 @@
(add-channel connection channel)
(add-user channel user))))
-(defmethod irc-message-event ((message irc-topic-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-topic-message))
(setf (topic (find-channel (connection message)
(first (arguments message))))
(trailing-argument message)))
-(defmethod irc-message-event ((message irc-part-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-part-message))
(let* ((connection (connection message))
(channel (find-channel connection (first (arguments message))))
(user (find-user connection (source message))))
@@ -99,15 +78,11 @@
(remove-channel connection channel)
(remove-user channel user))))
-(defmethod irc-message-event ((message irc-quit-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-quit-message))
(let ((connection (connection message)))
(remove-user-everywhere connection (find-user connection (source message)))))
-(defmethod irc-message-event ((message irc-nick-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-nick-message))
(if (self-message-p message)
(change-nickname (connection message) (user (connection message))
(trailing-argument message))
@@ -118,16 +93,7 @@
(format nil "Could not find user with nick ~A~%"
(source message)))))))
-;; if we don't know about the user, we should probably add him here to
-;; the dangling-users as he is messaging us without being on a channel
-;; we are.
-(defmethod irc-message-event ((message irc-privmsg-message))
- (apply-to-hooks message)
- (client-log (connection message) message))
-
-(defmethod irc-message-event ((message irc-kick-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message irc-kick-message))
(let* ((connection (connection message))
(channel (find-channel connection (first (arguments message))))
(user (find-user connection (second (arguments message)))))
@@ -135,9 +101,7 @@
(remove-channel connection channel)
(remove-user channel user))))
-(defmethod irc-message-event ((message ctcp-time-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message ctcp-time-message))
(multiple-value-bind (second minute hour date month year day) (get-decoded-time)
(send-irc-message
(connection message)
@@ -146,9 +110,7 @@
(make-time-message second minute hour date month year day)))
(source message))))
-(defmethod irc-message-event ((message ctcp-source-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message ctcp-source-message))
(send-irc-message
(connection message)
:notice (make-ctcp-message
@@ -158,9 +120,7 @@
*download-file*))
(source message)))
-(defmethod irc-message-event ((message ctcp-finger-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message ctcp-finger-message))
(let* ((user (user (connection message)))
(finger-info (if (not (zerop (length (realname user))))
(realname user)
@@ -171,18 +131,14 @@
(format nil "FINGER ~A" finger-info))
(source message))))
-(defmethod irc-message-event ((message ctcp-version-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message ctcp-version-message))
(send-irc-message
(connection message)
:notice (make-ctcp-message
(format nil "VERSION ~A" *ctcp-version*))
(source message)))
-(defmethod irc-message-event ((message ctcp-ping-message))
- (apply-to-hooks message)
- (client-log (connection message) message)
+(defmethod default-hook ((message ctcp-ping-message))
(send-irc-message
(connection message)
:notice (make-ctcp-message
More information about the Net-nittin-irc-cvs
mailing list