* riece-options.el (riece-addons): Add riece-button.
[riece] / lisp / riece-server.el
index ba66fce..2b18ba1 100644 (file)
@@ -148,13 +148,13 @@ the `riece-server-keyword-map' variable."
       (if (equal server-name "")
          (message "Logging in to IRC server...")
        (message "Logging in to %s..." server-name))
-      (if (or password
-             riece-reconnect-with-password)
+      (if riece-reconnect-with-password        ;password incorrect or not set.
+         (unwind-protect
+             (setq password (riece-read-passwd "Password: "))
+           (setq riece-reconnect-with-password nil)))
+      (if password
          (riece-process-send-string process
-                                    (format "PASS %s\r\n"
-                                            (or password
-                                                (riece-read-passwd
-                                                 "Password: ")))))
+                                    (format "PASS %s\r\n" password)))
       (riece-process-send-string process
                                 (format "USER %s * * :%s\r\n"
                                         (user-real-login-name)
@@ -207,11 +207,16 @@ the `riece-server-keyword-map' variable."
            (throw 'found t))
        (setq process-list (cdr process-list))))))
 
+(eval-when-compile
+  (autoload 'riece-exit "riece"))
 (defun riece-quit-server-process (process &optional message)
   (run-at-time riece-quit-timeout nil
               (lambda (process)
-                (if (memq process riece-process-list)
-                    (kill-process (process-buffer process))))
+                (when (memq process riece-process-list)
+                  (riece-close-server-process process)
+                  ;; If no server process is available, exit.
+                  (unless riece-process-list
+                    (riece-exit))))
               process)
   (riece-process-send-string process
                             (if message