* riece-400.el (riece-handle-475-message): New handler; query
authorueno <ueno>
Thu, 3 Feb 2005 08:26:51 +0000 (08:26 +0000)
committerueno <ueno>
Thu, 3 Feb 2005 08:26:51 +0000 (08:26 +0000)
channel key.

lisp/ChangeLog
lisp/riece-400.el

index 92dd125..eed70d2 100644 (file)
@@ -1,5 +1,10 @@
 2005-02-03  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece-400.el (riece-handle-475-message): New handler; query
+       channel key.
+
+2005-02-03  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-addon.el (riece-resolve-addon-dependencies): Rename from
        riece-resolve-addon.
        (riece-resolve-addon): Append add-ons under riece-addon-directory.
index 014d974..cb166c7 100644 (file)
   (message "Password incorrect from %s." prefix)
   (setq riece-reconnect-with-password t))
 
+(defun riece-handle-475-message (prefix number name string)
+  "ERR_BADCHANNELKEY \"<channel> :Cannot join channel (+k)\"."
+  (let* ((parameters (riece-split-parameters string))
+        (channel-identity (riece-make-identity (car parameters)
+                                               riece-server-name))
+        key)
+    (message "%s: %s" (car parameters) (nth 1 parameters))
+    (setq key
+         (condition-case nil
+             (let (inhibit-quit)
+               (riece-read-passwd
+                (format "Key for %s: "
+                        (riece-format-identity channel-identity t))))
+           (quit
+            (message (format "Key for %s: Quit"
+                             (riece-format-identity channel-identity t)))
+            'quit)))
+    (unless (eq key 'quit)
+      (riece-command-join-channel channel-identity key))))
+
 (provide 'riece-400)
 
 ;;; riece-400.el ends here