[cl-irc-devel] [PATCH] Add defgeneric forms to eliminate style warnings
Erik Huelsmann
e.huelsmann at gmx.net
Sun Mar 14 17:27:49 UTC 2004
Hi,
Attached is the beginnings of a patch to eliminate style warnings which
appear when compiled code is loaded using (asdf:operate 'asdf:load-op 'cl-irc).
When using require these warnings don't occur, but that method is said to be
only supported on SBCL.
While trying to make my own application warning-free, I started doing cl-irc
too. If anybody objects to me adding defgenerics, please say so. Also, the
current patch adds these defgenerics in the middle of the protocol.lisp file.
I think I prefer the beginning of the file, but if anybody has an opinion on
that subject I'd like to know that too.
bye,
Erik.
Index: event.lisp
===================================================================
RCS file: /project/cl-irc/cvsroot/cl-irc/event.lisp,v
--- event.lisp 5 Jan 2004 14:13:03 -0000 1.1.1.1
+++ event.lisp 10 Mar 2004 22:08:40 -0000
@@ -14,6 +14,12 @@
(apply-to-hooks message)
(client-log (connection message) message "UNHANDLED-EVENT:"))
+
+(defgeneric default-hook (message)
+ (:documentation "Minimum action to be executed upon reception
+of the IRC message to keep the connection, channel and user
+objects in sync."))
+
(defmethod default-hook ((message irc-rpl_whoisuser-message))
(let ((user (find-user (connection message)
(second (arguments message))))
Index: protocol.lisp
===================================================================
RCS file: /project/cl-irc/cvsroot/cl-irc/protocol.lisp,v
--- protocol.lisp 8 Jan 2004 23:11:47 -0000 1.2
+++ protocol.lisp 10 Mar 2004 22:08:41 -0000
@@ -61,6 +61,23 @@
(print-unreadable-object (object stream :type t :identity t)
(princ (server-name object) stream)))
+(defgeneric add-default-hooks (connection))
+(defgeneric client-raw-log (connection message))
+(defgeneric connectedp (connection))
+(defgeneric read-message (connection))
+(defgeneric start-process (function name))
+(defgeneric start-background-message-handler (connection))
+;;(defgeneric stop-background-message-handler (process))
+(defgeneric read-message-loop (connection))
+(defgeneric read-irc-message (connection))
+(defgeneric send-irc-message (connection command
+ &optional trailing-argument &rest arguments))
+(defgeneric get-hooks (connection class))
+(defgeneric add-hook (connection class hook))
+(defgeneric remove-hook (connection class hook))
+(defgeneric remove-hoods (connection class))
+(defgeneric remove-all-hooks (connection))
+
(defun make-connection (&key (user nil)
(server-name "")
(server-socket nil)
@@ -239,6 +256,8 @@
#-sbcl
(warn "make-dcc-connection not supported for this implementation."))
+(defgeneric dcc-close (connection))
+
(defmethod read-message ((connection dcc-connection))
(let ((message (read-line (dcc-stream connection))))
(format (output-stream connection) "~A~%" message)
@@ -323,6 +342,12 @@
(add-user channel user))
channel))
+(defgeneric find-channel (connection channel))
+(defgeneric remove-all-channels (connection))
+(defgeneric add-channel (connection channel))
+(defgeneric remove-channel (connection channel))
+(defgeneric remove-users (channel))
+
(defmethod find-channel ((connection connection) (channel string))
"Return channel as designated by `channel'. If no such channel can
be found, return nil."
@@ -409,6 +434,16 @@
(new-string (substitute #\~ #\^ new-string)))
(string-downcase new-string)))
+(defgeneric find-user (connection nickname))
+(defgeneric add-user (object user))
+(defgeneric remove-all-users (connection))
+(defgeneric remove-user (object user))
+;;(defgeneric remove-channel (channel user))
+(defgeneric remove-user-everywhere (connection user))
+(defgeneric find-or-make-user (connection nickname
+ &key username hostname realname))
+(defgeneric change-nickname (connection user new-nickname))
+
(defmethod find-user ((connection connection) (nickname string))
"Return user as designated by `nickname' or nil if no such user is
known."
@@ -513,6 +548,11 @@
(print-unreadable-object (object stream :type t :identity t)
(format stream "~A ~A" (source object) (command object))))
+(defgeneric self-message-p (message))
+(defgeneric find-irc-message-class (type))
+(defgeneric client-log (connection message &optional prefix))
+(defgeneric apply-to-hooks (message))
+
(defmethod self-message-p ((message irc-message))
"Did we send this message?"
(string-equal (source message)
@@ -577,6 +617,8 @@
:accessor ctcp-command)))
(defclass standard-ctcp-message (ctcp-mixin message) ())
+
+(defgeneric find-ctcp-message-class (type))
(defmacro define-ctcp-message (ctcp-command)
(let ((name (intern-message-symbol :ctcp ctcp-command)))
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
More information about the cl-irc-devel
mailing list