;;; Code:
-(eval-when-compile
- (require 'cl)
- (require 'static))
+(eval-when-compile (require 'cl))
(require 'pces)
(require 'sasl)
(defvar acap-response nil
"ACAP Response.")
+(defvar acap-logging-out nil
+ "Non-nil when ACAP is logging out.")
+
(make-variable-buffer-local 'acap-state)
(make-variable-buffer-local 'acap-auth)
(make-variable-buffer-local 'acap-capability)
(make-variable-buffer-local 'acap-server)
(make-variable-buffer-local 'acap-port)
(make-variable-buffer-local 'acap-response)
+(make-variable-buffer-local 'acap-logging-out)
(defvar acap-network-stream-alist
'((default . open-network-stream-as-binary)))
(defun acap-close (process)
(with-current-buffer (process-buffer process)
+ (setq acap-logging-out t)
(unless (acap-response-ok-p (acap-send-command-wait process "LOGOUT"))
(message "Server %s didn't let me log out" acap-server))
(when (memq (process-status process) '(open run))
(while (and (not (acap-response-cont-p acap-response))
(< acap-reached-tag tag))
(when (acap-response-bye-p acap-response)
- (error (prog1 (acap-response-bye-message acap-response)
- (setq acap-response nil))))
+ (if acap-logging-out
+ (setq acap-response nil)
+ (error "%s"
+ (prog1 (acap-response-bye-message acap-response)
+ (setq acap-response nil)))))
(or (and (not (memq (process-status process) '(open run)))
(sit-for 1))
(let ((len (/ (point-max) 1024))
(progn
(acap-forward)
(acap-parse-return-data-list)))))
- (ALERT ;(cons 'alert (acap-parse-resp-body))
- (message (nth 1 (acap-parse-resp-body))))
- ((BYE Bye bye)
+ (ALERT
+;;; (cons 'alert (acap-parse-resp-body))
+ (message "%s" (nth 1 (acap-parse-resp-body))))
+ ((BYE Bye bye)
(cons 'bye (acap-parse-resp-body)))
(CHANGE (cons 'change
(list (acap-parse-quoted)
;; response-stat
(OK (cons 'stat-ok (acap-parse-resp-body)))
(NO (cons 'stat-no (acap-parse-resp-body)))
- (BAD ;(cons 'stat-bad (acap-parse-resp-body))
+ (BAD
+;;; (cons 'stat-bad (acap-parse-resp-body))
;; XXX cyrus-sml-acap does not return tagged bad response?
- (error (nth 1 (acap-parse-resp-body))))))
+ (error "%s" (nth 1 (acap-parse-resp-body))))))
((integerp token)
;; tagged response.
(setq tag token)