+(defun special-command-p (line)
+ (and (> (length line) 0)
+ (char= +special-command-char+ (aref line 0))))
+
+(defclass xdump-mode (play-mode)
+ ((table-buffer
+ :initform nil
+ :accessor table-buffer
+ :documentation "Intermediate storage for incomplete table dump.")))
+
+(defmethod handle-data ((m xdump-mode) message)
+ (with-slots (connection table-buffer) m
+ (if (char= #\/ (aref message 0))
+ (progn
+ (format t "table: ~a~%" table-buffer)
+ (set-new-mode m 'play-mode)))
+ ;XXX check table size
+ (with-input-from-string (s (format nil "(~a)" message))
+ (setf table-buffer (cons (read s) table-buffer)))))
+
+(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)))