Synch up with riece-0.0.4.
[elisp/riece.git] / lisp / riece-commands.el
index cafdf3c..2c8cb1a 100644 (file)
@@ -37,8 +37,9 @@
 (defun riece-command-switch-to-channel (channel)
   (interactive (list (riece-completing-read-identity
                      "Channel/User: " riece-current-channels nil t)))
-  (riece-switch-to-channel channel)
-  (riece-redisplay-buffers))
+  (unless (equal channel riece-current-channels)
+    (riece-switch-to-channel channel)
+    (riece-redisplay-buffers)))
 
 (defun riece-command-switch-to-channel-by-number (number)
   (interactive
 (defun riece-command-topic (topic)
   (interactive
    (list (read-from-minibuffer
-         "Topic: " (cons (or (riece-with-identity-buffer riece-current-channel
+         "Topic: " (cons (or (riece-with-server-buffer
+                                 (riece-identity-server riece-current-channel)
                                (riece-channel-get-topic
                                 (riece-identity-prefix
                                  riece-current-channel)))
            (if (and riece-current-channel
                     (riece-channel-p (riece-identity-prefix
                                       riece-current-channel)))
-               (cons (riece-decode-identity riece-current-channel t)
+               (cons (riece-format-identity riece-current-channel t)
                      0))))))
   (if (or (not (equal pattern ""))
          (yes-or-no-p "Really want to query NAMES without argument? "))
            (if (and riece-current-channel
                     (riece-channel-p (riece-identity-prefix
                                       riece-current-channel)))
-               (cons (riece-decode-identity riece-current-channel t)
+               (cons (riece-format-identity riece-current-channel t)
                      0))))))
   (if (or (not (equal pattern ""))
          (yes-or-no-p "Really want to query WHO without argument? "))
            (if (and riece-current-channel
                     (riece-channel-p (riece-identity-prefix
                                       riece-current-channel)))
-               (cons (riece-decode-identity riece-current-channel t)
+               (cons (riece-format-identity riece-current-channel t)
                      0))))))
   (if (or (not (equal pattern ""))
          (yes-or-no-p "Really want to query LIST without argument? "))
 (defun riece-command-set-operators (users &optional arg)
   (interactive
    (let ((operators
-         (riece-with-identity-buffer riece-current-channel
+         (riece-with-server-buffer
+             (riece-identity-server riece-current-channel)
            (riece-channel-get-operators
             (riece-identity-prefix riece-current-channel))))
         (completion-ignore-case t)
                               (lambda (user)
                                 (unless (member user operators)
                                   (list user)))
-                              (riece-with-identity-buffer
-                                  riece-current-channel
+                              (riece-with-server-buffer
+                                  (riece-identity-server
+                                   riece-current-channel)
                                 (riece-channel-get-users
                                  (riece-identity-prefix
                                   riece-current-channel))))))))
 (defun riece-command-set-speakers (users &optional arg)
   (interactive
    (let ((speakers
-         (riece-with-identity-buffer riece-current-channel
+         (riece-with-server-buffer
+             (riece-identity-server riece-current-channel)
            (riece-channel-get-speakers
             (riece-identity-prefix riece-current-channel))))
         (completion-ignore-case t)
                               (lambda (user)
                                 (unless (member user speakers)
                                   (list user)))
-                              (riece-with-identity-buffer
-                                  riece-current-channel
+                              (riece-with-server-buffer
+                                  (riece-identity-server
+                                   riece-current-channel)
                                 (riece-channel-get-users
                                  (riece-identity-prefix
                                   riece-current-channel))))))))
 
 (defun riece-command-join (target &optional key)
   (interactive
-   (let ((completion-ignore-case t)
-        (target
-         (riece-completing-read-identity
-          "Channel/User: " riece-current-channels))
-        key)
+   (let* ((completion-ignore-case t)
+         (target
+          (riece-completing-read-identity
+           "Channel/User: " riece-current-channels))
+         key)
      (if (and current-prefix-arg
              (riece-channel-p target))
         (setq key
 
 (defun riece-command-part (target &optional message)
   (interactive
-   (let ((completion-ignore-case t)
+   (let* ((completion-ignore-case t)
         (target
          (riece-completing-read-identity
-          "Channel/User: " riece-current-channels))
+          "Channel/User: " riece-current-channels nil nil
+          (cons (riece-format-identity riece-current-channel) 0)))
         message)
      (if (and current-prefix-arg
              (riece-channel-p (riece-identity-prefix target)))