- (if (and (process-id process) ;not a network connection
- (string-match "^exited abnormally with code \\([0-9]+\\)"
- status))
- (if server-name
- (message "Connection to \"%s\" closed: %s"
- server-name (match-string 1 status))
- (message "Connection closed: %s" (match-string 1 status)))
- (if server-name
- (message "Connection to \"%s\" closed: %s"
- server-name (substring status 0 (1- (length status))))
- (message "Connection closed: %s"
- (substring status 0 (1- (length status))))))
- (riece-close-server server-name))))
+ (if riece-debug
+ (if (equal server-name "")
+ (riece-debug (format "Connection closed: %s"
+ (substring status 0 (1- (length status)))))
+ (riece-debug (format "Connection to \"%s\" closed: %s"
+ server-name
+ (substring status 0 (1- (length status))))))
+ (if (equal server-name "")
+ (message "Connection closed")
+ (message "Connection to \"%s\" closed" server-name)))
+ (let ((channels riece-current-channels))
+ (while channels
+ (if (and (car channels)
+ (equal (riece-identity-server (car channels))
+ server-name))
+ (riece-part-channel (car channels)))
+ (setq channels (cdr channels))))
+ (riece-redisplay-buffers)
+ (riece-close-server-process process)
+ ;; If no server process is available, exit.
+ (unless riece-server-process-alist
+ (riece-exit)))))