Update of /project/cl-irc/cvsroot/cl-irc In directory common-lisp:/tmp/cvs-serv28320
Modified Files: command.lisp package.lisp protocol.lisp Log Message: Rename slots with same function in preparation of more DCC implementation: {server-stream,dcc-stream} -> network-stream.
--- /project/cl-irc/cvsroot/cl-irc/command.lisp 2006/01/24 22:10:58 1.13 +++ /project/cl-irc/cvsroot/cl-irc/command.lisp 2006/01/25 20:03:27 1.14 @@ -1,4 +1,4 @@ -;;;; $Id: command.lisp,v 1.13 2006/01/24 22:10:58 ehuelsmann Exp $ +;;;; $Id: command.lisp,v 1.14 2006/01/25 20:03:27 ehuelsmann Exp $ ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/command.lisp,v $
;;;; See LICENSE for licensing information. @@ -141,8 +141,8 @@ (send-irc-message connection :quit message) #+(and sbcl (not sb-thread)) (sb-sys:invalidate-descriptor (sb-sys:fd-stream-fd - (server-stream connection))) - (close (server-stream connection)))) + (network-stream connection))) + (close (network-stream connection))))
(defmethod squit ((connection connection) (server string) (comment string)) (send-irc-message connection :squit comment server)) @@ -250,7 +250,7 @@ "Connect to server and return a connection object." (let* ((stream (socket-connect server port)) (connection (make-connection :connection-type connection-type - :server-stream stream + :network-stream stream :client-stream logging-stream :server-name server)) (user (make-user connection --- /project/cl-irc/cvsroot/cl-irc/package.lisp 2005/04/15 16:01:22 1.8 +++ /project/cl-irc/cvsroot/cl-irc/package.lisp 2006/01/25 20:03:27 1.9 @@ -1,4 +1,4 @@ -;;;; $Id: package.lisp,v 1.8 2005/04/15 16:01:22 ehuelsmann Exp $ +;;;; $Id: package.lisp,v 1.9 2006/01/25 20:03:27 ehuelsmann Exp $ ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/package.lisp,v $
;;;; See the LICENSE file for licensing information. @@ -38,7 +38,7 @@ :modes :user-count :users - :server-stream + :network-stream :client-stream :channels :add-hook --- /project/cl-irc/cvsroot/cl-irc/protocol.lisp 2006/01/24 22:10:58 1.28 +++ /project/cl-irc/cvsroot/cl-irc/protocol.lisp 2006/01/25 20:03:27 1.29 @@ -1,4 +1,4 @@ -;;;; $Id: protocol.lisp,v 1.28 2006/01/24 22:10:58 ehuelsmann Exp $ +;;;; $Id: protocol.lisp,v 1.29 2006/01/25 20:03:27 ehuelsmann Exp $ ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/protocol.lisp,v $
;;;; See LICENSE for licensing information. @@ -114,9 +114,9 @@ :initarg :server-name :accessor server-name :initform "Unknown server") - (server-stream - :initarg :server-stream - :accessor server-stream + (network-stream + :initarg :network-stream + :accessor network-stream :documentation "Stream used to talk to the IRC server.") (server-capabilities :initform *default-isupport-values* @@ -188,13 +188,13 @@ (defun make-connection (&key (connection-type 'connection) (user nil) (server-name "") - (server-stream nil) + (network-stream nil) (client-stream t) (hooks nil)) (let ((connection (make-instance connection-type :user user :server-name server-name - :server-stream server-stream + :network-stream network-stream :client-stream client-stream))) (dolist (hook hooks) (add-hook connection (car hook) (cadr hook))) @@ -237,7 +237,7 @@ (defmethod connectedp ((connection connection)) "Returns t if `connection' is connected to a server and is ready for input." - (let ((stream (server-stream connection))) + (let ((stream (network-stream connection))) (and (streamp stream) (open-stream-p stream))))
@@ -268,10 +268,10 @@ (start-process #'do-loop name) #+(and sbcl (not sb-thread)) (sb-sys:add-fd-handler (sb-sys:fd-stream-fd - (server-stream connection)) + (network-stream connection)) :input (lambda (fd) (declare (ignore fd)) - (if (listen (server-stream connection)) + (if (listen (network-stream connection)) (read-message connection) ;; select() returns with no ;; available data if the stream @@ -279,7 +279,7 @@ ;; end (EPIPE) (sb-sys:invalidate-descriptor (sb-sys:fd-stream-fd - (server-stream connection))))))))) + (network-stream connection)))))))))
(defun stop-background-message-handler (process) "Stops a background message handler process returned by the start function." @@ -296,7 +296,7 @@ (defmethod read-irc-message ((connection connection)) "Read and parse an IRC-message from the `connection'." (let ((message (create-irc-message - (read-line (server-stream connection) t)))) + (read-line (network-stream connection) t)))) (setf (connection message) connection) message))
@@ -307,8 +307,8 @@ (let ((raw-message (make-irc-message command :arguments arguments :trailing-argument trailing-argument))) - (write-sequence raw-message (server-stream connection)) - (force-output (server-stream connection)) + (write-sequence raw-message (network-stream connection)) + (force-output (network-stream connection)) raw-message))
(defmethod get-hooks ((connection connection) (class symbol)) @@ -379,7 +379,7 @@ user at this end can be reached via your normal connection object.") (stream :initarg :stream - :accessor dcc-stream) + :accessor network-stream) (output-stream :initarg :output-stream :accessor output-stream @@ -407,7 +407,7 @@ (defgeneric send-dcc-message (connection message))
(defmethod read-message ((connection dcc-connection)) - (let ((message (read-line (dcc-stream connection)))) + (let ((message (read-line (network-stream connection)))) (format (output-stream connection) "~A~%" message) (force-output (output-stream connection)) message)) @@ -416,20 +416,21 @@ (loop while (read-message connection)))
(defmethod send-dcc-message ((connection dcc-connection) message) - (format (dcc-stream connection) "~A~%" message)) + (format (network-stream connection) "~A~%" message) + (force-output (network-stream connection)))
;; argh. I want to name this quit but that gives me issues with ;; generic functions. need to resolve. (defmethod dcc-close ((connection dcc-connection)) #+(and sbcl (not sb-thread)) (sb-sys:invalidate-descriptor (sb-sys:fd-stream-fd (stream connection))) - (close (dcc-stream connection)) + (close (network-stream connection)) (setf (user connection) nil) (setf *dcc-connections* (remove connection *dcc-connections*)) )
(defmethod connectedp ((connection dcc-connection)) - (let ((stream (dcc-stream connection))) + (let ((stream (network-stream connection))) (and (streamp stream) (open-stream-p stream))))