X-Git-Url: http://git.pond.sub.org/?p=eow;a=blobdiff_plain;f=empire.lisp;h=1f2aae423b6724f4d7a42cf171519c80d0cfd91f;hp=358d0010f5d8c5c1d1d715a60ebf89afd2c46ecb;hb=fc636ef0b61e6018deba9e31e2f9ab3efc381a1e;hpb=761774603f988ef58b11ab22c5bbf862819f9cef diff --git a/empire.lisp b/empire.lisp index 358d001..1f2aae4 100644 --- a/empire.lisp +++ b/empire.lisp @@ -99,7 +99,7 @@ (setf socket sock stream s connection-handler handler))) - (empire-log:info "empire:reconnect: ~a" c)) + (empire-log:info "~a: reconnect" c)) (defparameter +C_CMDOK+ "0") (defparameter +C_DATA+ "1") @@ -131,6 +131,7 @@ (defmethod set-new-mode ((m base-mode) new-mode) (let* ((c (connection m)) (mode (make-mode c new-mode))) + (empire-log:info "~a: set-new-mode ~a -> ~a" c (connection-mode c) new-mode) (setf (connection-mode c) mode))) (defgeneric handle-data (base-mode message)) @@ -250,6 +251,23 @@ (reconnect c)))))) message)) +(defparameter +special-command-char+ #\;) + +(defun special-command-p (line) + (char= +special-command-char+ (aref line 0))) + +(defmethod special-xup ((c connection)) + t) + +(defmethod special-command ((c connection) line) + (cond ((string= line "xup") (special-xup c)) + (t (empire-web:data (session c) "Unknown special command"))) + line) + +(defmethod command ((c connection) line) + (cond ((special-command-p line) (special-command c (subseq line 1))) + (t (send-message c line)))) + (defgeneric play (connection)) (defmethod play ((c connection)) (with-slots (user password) c