Added header.
[riece] / lisp / riece-400.el
index 9681607..6dc4e43 100644 (file)
@@ -19,8 +19,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
 
@@ -28,7 +28,7 @@
 (require 'riece-misc)
 
 (eval-when-compile
-  (autoload 'riece-default-handle-numeric-reply "riece-filter"))
+  (autoload 'riece-default-handle-numeric-reply "riece-handle"))
 (defun riece-handle-default-400-message (prefix number name string)
   (riece-default-handle-numeric-reply
    riece-error-prefix prefix number name string))
   (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 "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