+(defclass xdump-mode (play-mode)
+ ((parser :initform (xdump:make-parser))
+ (phase :initform :meta-meta)))
+
+(defmethod handle-data ((m xdump-mode) message)
+ (with-slots (connection parser phase) m
+ (if (xdump:parse-line parser message)
+ ;;XXX consider something like a 'pop-mode function
+ (ccase phase
+ (:meta-meta
+ (setf phase :meta-table
+ parser (xdump:make-parser))
+ (send-message connection "xdump meta table"))
+ (:meta-table
+ (setf phase :table
+ parser (xdump:make-parser))
+ (send-message connection "xdump table *"))
+ (:table
+ (set-new-mode (connection-mode connection) 'play-mode))))))
+
+(defmethod special-xup ((c connection))
+ (send-message c "xdump meta meta" :next-mode 'xdump-mode))
+
+(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))))
+
+(defmethod quit ((c connection))
+ (usocket:socket-close (socket c)))