From ehuelsmann at common-lisp.net Sun Jan 13 13:00:45 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 05:00:45 -0800 Subject: [cl-irc-cvs] r232 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 05:00:44 2013 New Revision: 232 Log: Patch submitted by Julien Danjou. Modified: trunk/package.lisp trunk/protocol.lisp Modified: trunk/package.lisp ============================================================================== --- trunk/package.lisp Sun Sep 23 09:44:44 2012 (r231) +++ trunk/package.lisp Sun Jan 13 05:00:44 2013 (r232) @@ -48,6 +48,7 @@ :client-stream :channels :add-hook + :append-hook :remove-hook :remove-hooks :remove-all-hooks Modified: trunk/protocol.lisp ============================================================================== --- trunk/protocol.lisp Sun Sep 23 09:44:44 2012 (r231) +++ trunk/protocol.lisp Sun Jan 13 05:00:44 2013 (r232) @@ -199,6 +199,7 @@ (defgeneric send-irc-message (connection command &rest arguments)) (defgeneric get-hooks (connection class)) (defgeneric add-hook (connection class hook)) +(defgeneric append-hook (connection class hook)) (defgeneric remove-hook (connection class hook)) (defgeneric remove-hooks (connection class)) (defgeneric remove-all-hooks (connection)) @@ -383,6 +384,11 @@ (setf (gethash class (hooks connection)) (pushnew hook (gethash class (hooks connection))))) +(defmethod append-hook (connection class hook) + "Append `hook' to `class'." + (setf (gethash class (hooks connection)) + (append (gethash class (hooks connection)) (list hook)))) + (defmethod remove-hook ((connection connection) class hook) "Remove `hook' from `class'." (setf (gethash class (hooks connection)) From ehuelsmann at common-lisp.net Sun Jan 13 18:31:26 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 10:31:26 -0800 Subject: [cl-irc-cvs] r233 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 10:31:25 2013 New Revision: 233 Log: Patch by Julien Danjou: register nickname upon RPL_WELCOME instead of at connection initiation. Modified: trunk/command.lisp trunk/event.lisp trunk/protocol.lisp Modified: trunk/command.lisp ============================================================================== --- trunk/command.lisp Sun Jan 13 05:00:44 2013 (r232) +++ trunk/command.lisp Sun Jan 13 10:31:25 2013 (r233) @@ -296,13 +296,8 @@ :socket socket :network-stream stream :client-stream logging-stream - :server-name server)) - (user (make-user connection - :nickname nickname - :username username - :realname realname))) + :server-name server))) #+sbcl (setf (sb-bsd-sockets::sockopt-keep-alive (usocket:socket socket)) t) - (setf (user connection) user) (unless (null password) (pass connection password)) (nick connection nickname) Modified: trunk/event.lisp ============================================================================== --- trunk/event.lisp Sun Jan 13 05:00:44 2013 (r232) +++ trunk/event.lisp Sun Jan 13 10:31:25 2013 (r233) @@ -141,6 +141,19 @@ (username user) username (hostname user) hostname))))) +(defmethod default-hook ((message irc-rpl_welcome-message)) + (with-slots + (connection host user arguments) + message + (destructuring-bind + (nickname welcome-message) + arguments + (setf (user connection) + (make-user connection + :nickname nickname + :hostname host + :username user))))) + (defmethod default-hook ((message irc-rpl_list-message)) (destructuring-bind (channel count topic) Modified: trunk/protocol.lisp ============================================================================== --- trunk/protocol.lisp Sun Jan 13 05:00:44 2013 (r232) +++ trunk/protocol.lisp Sun Jan 13 10:31:25 2013 (r233) @@ -247,6 +247,7 @@ irc-rpl_topic-message irc-rpl_namreply-message irc-rpl_endofnames-message + irc-rpl_welcome-message irc-ping-message irc-join-message irc-topic-message From ehuelsmann at common-lisp.net Sun Jan 13 18:33:15 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 10:33:15 -0800 Subject: [cl-irc-cvs] r234 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 10:33:14 2013 New Revision: 234 Log: Patch by Julien Danjou: Export READ-IRC-MESSAGE to allow construction of custom loops. Modified: trunk/package.lisp Modified: trunk/package.lisp ============================================================================== --- trunk/package.lisp Sun Jan 13 10:31:25 2013 (r233) +++ trunk/package.lisp Sun Jan 13 10:33:14 2013 (r234) @@ -12,6 +12,7 @@ (:nicknames :irc) (:export :read-message-loop :read-message + :read-irc-message :irc-message-event :start-background-message-handler :stop-background-message-handler From ehuelsmann at common-lisp.net Sun Jan 13 18:37:01 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 10:37:01 -0800 Subject: [cl-irc-cvs] r235 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 10:37:00 2013 New Revision: 235 Log: Patch by Julien Danjou: Remove otherwise unused symbol 'SOCKET-CONNECT'. Modified: trunk/package.lisp Modified: trunk/package.lisp ============================================================================== --- trunk/package.lisp Sun Jan 13 10:33:14 2013 (r234) +++ trunk/package.lisp Sun Jan 13 10:37:00 2013 (r235) @@ -18,7 +18,6 @@ :stop-background-message-handler :destructuring-arguments :&req - :socket-connect :server-name :server-port :no-such-reply From ehuelsmann at common-lisp.net Sun Jan 13 18:43:29 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 10:43:29 -0800 Subject: [cl-irc-cvs] r236 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 10:43:28 2013 New Revision: 236 Log: Patch by Julien Danjou: Remove the (unused) `socket' slot from connections. Modified: trunk/command.lisp trunk/protocol.lisp Modified: trunk/command.lisp ============================================================================== --- trunk/command.lisp Sun Jan 13 10:37:00 2013 (r235) +++ trunk/command.lisp Sun Jan 13 10:43:28 2013 (r236) @@ -293,7 +293,6 @@ (usocket:socket-stream socket)) (usocket:socket-stream socket))) (connection (make-connection :connection-type connection-type - :socket socket :network-stream stream :client-stream logging-stream :server-name server))) @@ -552,7 +551,6 @@ (make-dcc-chat-connection :irc-connection irc-connection :remote-user (find-user irc-connection (source message)) - :socket socket :network-stream (usocket:socket-stream socket)))))))) (defmethod dcc-request-accept ((message dcc-ctcp-dcc-chat-request-message)) Modified: trunk/protocol.lisp ============================================================================== --- trunk/protocol.lisp Sun Jan 13 10:37:00 2013 (r235) +++ trunk/protocol.lisp Sun Jan 13 10:43:28 2013 (r236) @@ -122,10 +122,6 @@ :initarg :server-port :accessor server-port :initform *default-irc-server-port*) - (socket - :initarg :socket - :reader socket - :documentation "Slot to store socket (for internal use only).") (network-stream :initarg :network-stream :accessor network-stream @@ -212,7 +208,6 @@ (password nil) (server-name "") (server-port nil) - (socket nil) (network-stream nil) (outgoing-external-format *default-outgoing-external-format*) (client-stream t) @@ -226,7 +221,6 @@ :password password :server-name server-name :server-port server-port - :socket socket :network-stream network-stream :output-stream output-stream :client-stream client-stream))) @@ -461,11 +455,6 @@ :accessor remote-user :documentation "The user at the other end of this connection. The user at this end can be reached via your normal connection object.") - (socket - :initarg :socket - :accessor socket - :initform nil - :documentation "Socket used to do the remote client.") (network-stream :initarg :network-stream :accessor network-stream) @@ -554,7 +543,6 @@ (client-stream nil) (irc-connection nil) (close-on-main t) - (socket nil) (network-stream nil) (outgoing-external-format *default-outgoing-external-format*) (hooks nil)) @@ -569,7 +557,6 @@ :output-stream output-stream :irc-connection irc-connection :close-on-main close-on-main - :socket socket :network-stream network-stream))) (dolist (hook hooks) (add-hook connection (car hook) (cdar hook))) From ehuelsmann at common-lisp.net Sun Jan 13 18:46:21 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 10:46:21 -0800 Subject: [cl-irc-cvs] r237 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 10:46:20 2013 New Revision: 237 Log: Patch by Julien Danjou: Add mode to the channel instead of the target. Modified: trunk/event.lisp Modified: trunk/event.lisp ============================================================================== --- trunk/event.lisp Sun Jan 13 10:43:28 2013 (r236) +++ trunk/event.lisp Sun Jan 13 10:46:20 2013 (r237) @@ -289,7 +289,7 @@ (op mode-name value) change (unless (has-mode-p channel mode-name) - (add-mode target mode-name + (add-mode channel mode-name (make-mode connection channel mode-name))) (funcall (if (char= #\+ op) #'set-mode #'unset-mode) channel mode-name value))))))) From ehuelsmann at common-lisp.net Sun Jan 13 18:50:37 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 10:50:37 -0800 Subject: [cl-irc-cvs] r238 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 10:50:37 2013 New Revision: 238 Log: Patch by Julien Danjou: MODE argument to mode command should be optional. Modified: trunk/command.lisp Modified: trunk/command.lisp ============================================================================== --- trunk/command.lisp Sun Jan 13 10:46:20 2013 (r237) +++ trunk/command.lisp Sun Jan 13 10:50:37 2013 (r238) @@ -9,7 +9,7 @@ (defgeneric nick (connection new-nickname)) (defgeneric user- (connection username mode &optional realname)) (defgeneric oper (connection name password)) -(defgeneric mode (connection nickname mode)) +(defgeneric mode (connection nickname &optional mode)) (defgeneric op (connection channel nickname)) (defgeneric deop (connection channel nickname)) (defgeneric voice (connection channel user)) @@ -103,7 +103,7 @@ (defmethod oper ((connection connection) (name string) (password string)) (send-irc-message connection :oper name password)) -(defmethod mode ((connection connection) (nickname string) (mode string)) +(defmethod mode ((connection connection) (nickname string) &optional mode) (send-irc-message connection :mode nickname mode)) ;; utility functions not part of the RFCs From ehuelsmann at common-lisp.net Sun Jan 13 18:59:50 2013 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 13 Jan 2013 10:59:50 -0800 Subject: [cl-irc-cvs] r239 - trunk Message-ID: Author: ehuelsmann Date: Sun Jan 13 10:59:49 2013 New Revision: 239 Log: Patch by Julien Danjou: Factorize mode changes. Modified: trunk/event.lisp trunk/package.lisp trunk/utility.lisp Modified: trunk/event.lisp ============================================================================== --- trunk/event.lisp Sun Jan 13 10:50:37 2013 (r238) +++ trunk/event.lisp Sun Jan 13 10:59:49 2013 (r239) @@ -279,20 +279,10 @@ (destructuring-bind (target channel &rest mode-arguments) arguments - (let* ((channel (find-channel connection channel)) - (mode-changes - (when channel - (parse-mode-arguments connection channel mode-arguments - :server-p (user connection))))) - (dolist (change mode-changes) - (destructuring-bind - (op mode-name value) - change - (unless (has-mode-p channel mode-name) - (add-mode channel mode-name - (make-mode connection channel mode-name))) - (funcall (if (char= #\+ op) #'set-mode #'unset-mode) - channel mode-name value))))))) + (let ((channel (find-channel connection channel))) + (when channel + (apply-mode-changes connection channel + mode-arguments (user connection))))))) (defmethod default-hook ((message irc-mode-message)) (destructuring-bind @@ -300,20 +290,9 @@ (arguments message) (let* ((connection (connection message)) (target (or (find-channel connection target) - (find-user connection target))) - (mode-changes - (when target - (parse-mode-arguments connection target arguments - :server-p (user connection))))) - (dolist (change mode-changes) - (destructuring-bind - (op mode-name value) - change - (unless (has-mode-p target mode-name) - (add-mode target mode-name - (make-mode connection target mode-name))) - (funcall (if (char= #\+ op) #'set-mode #'unset-mode) - target mode-name value)))))) + (find-user connection target)))) + (when target + (apply-mode-changes connection target arguments (user connection)))))) (defmethod default-hook ((message irc-nick-message)) (with-slots Modified: trunk/package.lisp ============================================================================== --- trunk/package.lisp Sun Jan 13 10:50:37 2013 (r238) +++ trunk/package.lisp Sun Jan 13 10:59:49 2013 (r239) @@ -32,6 +32,7 @@ :get-mode :set-mode :unset-mode + :apply-mode-changes :parse-mode-arguments :parse-raw-message :normalize-nickname Modified: trunk/utility.lisp ============================================================================== --- trunk/utility.lisp Sun Jan 13 10:50:37 2013 (r238) +++ trunk/utility.lisp Sun Jan 13 10:59:49 2013 (r239) @@ -493,6 +493,21 @@ (split-sequence:split-sequence #\: x)) (split-sequence:split-sequence #\, argument))) +(defun apply-mode-changes (connection target mode-arguments server-p) + (dolist (change (parse-mode-arguments connection target mode-arguments + :server-p server-p)) + (apply-mode-change connection target change))) + +(defun apply-mode-change (connection target change) + (destructuring-bind + (op mode-name value) + change + (unless (has-mode-p target mode-name) + (add-mode target mode-name + (make-mode connection target mode-name))) + (funcall (if (char= #\+ op) #'set-mode #'unset-mode) + target mode-name value))) + (defun parse-mode-arguments (connection target arguments &key server-p) "Create a list of mode changes with their arguments for `target' from `mode-string' and `arguments'. From jdanjou at common-lisp.net Sat Jan 26 17:05:27 2013 From: jdanjou at common-lisp.net (jdanjou at common-lisp.net) Date: Sat, 26 Jan 2013 09:05:27 -0800 Subject: [cl-irc-cvs] r240 - trunk Message-ID: Author: jdanjou Date: Sat Jan 26 09:05:25 2013 New Revision: 240 Log: Fix 710 repl code Signed-off-by: Julien Danjou Modified: trunk/variable.lisp Modified: trunk/variable.lisp ============================================================================== --- trunk/variable.lisp Sun Jan 13 10:59:49 2013 (r239) +++ trunk/variable.lisp Sat Jan 26 09:05:25 2013 (r240) @@ -330,6 +330,6 @@ (515 :err_nounidentified) ; Seen in dancer ircd source (516 :err_last_err_msg) ; Seen in dancer ircd source (671 :rpl_secureconnection) - (710 :rpl_noidea) ;; ## what's the real event? + (710 :rpl_knock) )) From jdanjou at common-lisp.net Sun Jan 27 15:58:22 2013 From: jdanjou at common-lisp.net (jdanjou at common-lisp.net) Date: Sun, 27 Jan 2013 07:58:22 -0800 Subject: [cl-irc-cvs] r241 - trunk Message-ID: Author: jdanjou Date: Sun Jan 27 07:58:21 2013 New Revision: 241 Log: Fix typo for `find-dcc-ctcp-message-class' Signed-off-by: Julien Danjou Modified: trunk/parse-message.lisp Modified: trunk/parse-message.lisp ============================================================================== --- trunk/parse-message.lisp Sat Jan 26 09:05:25 2013 (r240) +++ trunk/parse-message.lisp Sun Jan 27 07:58:21 2013 (r241) @@ -226,7 +226,7 @@ (let* ((class 'dcc-privmsg-message) (ctcp (ctcp-message-type string))) (when ctcp - (setf class (find-dcc-ctcp-message class ctcp))) + (setf class (find-dcc-ctcp-message-class ctcp))) (let ((instance (make-instance class :arguments (list string) :connection nil