Permalink
Browse files

Use document handler in idle state in obby/rudel-obby-server.el

* obby/rudel-obby-server.el (rudel-obby-server-state-idle): added
  superclass rudel-obby-document-handler
  (rudel-obby-server-state-idle::document-container-slot): set initarg
  to 'server
  (rudel-obby-server-state-idle::rudel-obby/obby_document): removed;
  handled by superclass
  • Loading branch information...
1 parent 36807c0 commit 7c05ed07624e0a87d44d742063ed86ce5c8f45d3 @scymtym scymtym committed Jul 6, 2010
Showing with 3 additions and 21 deletions.
  1. +3 −21 obby/rudel-obby-server.el
View
@@ -229,8 +229,9 @@ failed encryption negotiation."
;;
(defclass rudel-obby-server-state-idle
- (rudel-obby-server-connection-state)
- ()
+ (rudel-obby-server-connection-state
+ rudel-obby-document-handler)
+ ((document-container-slot :initform 'server))
"Idle state of a server connection.
The connection enters this state when all setup work is finished,
@@ -322,25 +323,6 @@ of her color to COLOR."
nil)
)
-(defmethod rudel-obby/obby_document
- ((this rudel-obby-server-state-idle) doc-id action &rest arguments)
- "Handle obby 'document' messages."
- (with-parsed-arguments ((doc-id document-id))
- ;; Locate the document based on owner id and document id
- (let ((document (with-slots (server) (oref this :connection)
- (rudel-find-document server doc-id
- #'equal #'rudel-both-ids))))
- (if document
- (rudel-dispatch
- this "rudel-obby/obby_document/" action
- (append (list document) arguments))
- ;; Display a warning if we cannot find the document.
- (display-warning
- '(rudel obby)
- (format "Could not find document: `%s'" doc-id)
- :warning))))
- )
-
(defmethod rudel-obby/obby_document/subscribe
((this rudel-obby-server-state-idle) document user-id)
"Handle 'subscribe' submessage of obby 'document' message."

0 comments on commit 7c05ed0

Please sign in to comment.