(cons (let ((message (car next-event))
(mode (cdr next-event)))
(send-message-one c message)
- (set-new-mode c mode))))))
+ (set-new-mode (connection-mode c) mode))))))
+
+(defun read-no-eval (stream)
+ (let ((*read-eval* nil))
+ (read stream)))
(defmethod handle-prompt ((m play-mode) message)
(let* ((c (connection m)))
(with-input-from-string (s message)
- (let* ((minutes (read s)) ;;FIXME DANGEROUS
- (btus (read s)))
+ (let* ((minutes (read-no-eval s))
+ (btus (read-no-eval s)))
(empire-web:prompt (session c)
(format nil "[~a,~a]: " minutes btus))))
(send-next-line c)))
(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))
- t)
+ (send-message c "xdump meta meta" :next-mode 'xdump-mode))
(defmethod special-command ((c connection) line)
(cond ((string= line "xup") (special-xup c))