X-Git-Url: http://cgit.sxemacs.org/?p=riece;a=blobdiff_plain;f=lisp%2Friece-commands.el;h=c5c463b52eceaf27fb49bc3a1d2ee49a2943539a;hp=3d0f9a9e1d0737cce40e3592684749834480defc;hb=7f49617682aff4897389a9a83f8b640033b65321;hpb=5ff9b4c7bc7409cb1e0fff6215e5802a731e9d1e diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 3d0f9a9..c5c463b 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -154,6 +154,7 @@ the layout to the selected layout-name." (defun riece-command-topic (topic) (interactive + (riece-check-channel-commands-are-usable t) (list (read-from-minibuffer "Topic: " (cons (or (riece-with-server-buffer (riece-identity-server riece-current-channel) @@ -168,11 +169,8 @@ the layout to the selected layout-name." (defun riece-command-invite (user) (interactive + (riece-check-channel-commands-are-usable t) (let ((completion-ignore-case t)) - (unless (and riece-current-channel - (riece-channel-p (riece-identity-prefix - riece-current-channel))) - (error "Not on a channel")) (list (completing-read "User: " (mapcar #'list (riece-get-users-on-server)))))) @@ -182,15 +180,15 @@ the layout to the selected layout-name." (defun riece-command-kick (user &optional message) (interactive + (riece-check-channel-commands-are-usable t) (let ((completion-ignore-case t)) - (unless (and riece-current-channel - (riece-channel-p (riece-identity-prefix - riece-current-channel))) - (error "Not on a channel")) (list (completing-read "User: " - (mapcar #'list (riece-channel-get-users - riece-current-channel))) + (mapcar #'list + (riece-with-server-buffer + (riece-identity-server riece-current-channel) + (riece-channel-get-users + (riece-identity-prefix riece-current-channel))))) (if current-prefix-arg (read-string "Message: "))))) (riece-send-string @@ -210,7 +208,7 @@ the layout to the selected layout-name." (if (and riece-current-channel (riece-channel-p (riece-identity-prefix riece-current-channel))) - (cons (riece-format-identity riece-current-channel t) + (cons (riece-identity-prefix riece-current-channel) 0)))))) (if (or (not (equal pattern "")) (yes-or-no-p "Really want to query NAMES without argument? ")) @@ -224,7 +222,7 @@ the layout to the selected layout-name." (if (and riece-current-channel (riece-channel-p (riece-identity-prefix riece-current-channel))) - (cons (riece-format-identity riece-current-channel t) + (cons (riece-identity-prefix riece-current-channel) 0)))))) (if (or (not (equal pattern "")) (yes-or-no-p "Really want to query WHO without argument? ")) @@ -238,7 +236,7 @@ the layout to the selected layout-name." (if (and riece-current-channel (riece-channel-p (riece-identity-prefix riece-current-channel))) - (cons (riece-format-identity riece-current-channel t) + (cons (riece-identity-prefix riece-current-channel) 0)))))) (if (or (not (equal pattern "")) (yes-or-no-p "Really want to query LIST without argument? ")) @@ -251,6 +249,7 @@ the layout to the selected layout-name." (if current-prefix-arg (riece-completing-read-identity "Channel/User: " riece-current-channels) + (riece-check-channel-commands-are-usable t) riece-current-channel)) (riece-overriding-server-name (riece-identity-server channel)) (riece-temp-minibuffer-message @@ -272,6 +271,7 @@ the layout to the selected layout-name." (defun riece-command-set-operators (users &optional arg) (interactive + (riece-check-channel-commands-are-usable t) (let ((operators (riece-with-server-buffer (riece-identity-server riece-current-channel) @@ -313,6 +313,7 @@ the layout to the selected layout-name." (defun riece-command-set-speakers (users &optional arg) (interactive + (riece-check-channel-commands-are-usable t) (let ((speakers (riece-with-server-buffer (riece-identity-server riece-current-channel) @@ -356,9 +357,7 @@ the layout to the selected layout-name." "Send MESSAGE to the current channel." (if (equal message "") (error "No text to send")) - (unless riece-current-channel - (error (substitute-command-keys - "Type \\[riece-command-join] to join a channel"))) + (riece-check-channel-commands-are-usable) (if notice (progn (riece-send-string @@ -421,8 +420,14 @@ the layout to the selected layout-name." (interactive (let* ((completion-ignore-case t) (target - (riece-completing-read-identity - "Channel/User: " riece-current-channels)) + (if riece-join-channel-candidate + (let ((default (riece-format-identity + riece-join-channel-candidate))) + (riece-completing-read-identity + (format "Channel/User (default %s): " default) + riece-current-channels nil nil nil nil default)) + (riece-completing-read-identity + "Channel/User: " riece-current-channels))) key) (if (and current-prefix-arg (riece-channel-p (riece-identity-prefix target))) @@ -439,9 +444,6 @@ the layout to the selected layout-name." (defun riece-command-part-channel (target message) (let ((process (riece-server-process (riece-identity-server target)))) - (unless process - (error "%s" (substitute-command-keys - "Type \\[riece-command-open-server] to open server."))) (riece-process-send-string process (if message (format "PART %s :%s\r\n" @@ -452,6 +454,7 @@ the layout to the selected layout-name." (defun riece-command-part (target &optional message) (interactive + (riece-check-channel-commands-are-usable) (let* ((completion-ignore-case t) (target (riece-completing-read-identity @@ -525,7 +528,10 @@ the layout to the selected layout-name." (defun riece-command-toggle-away (&optional message) "Mark yourself as being away." (interactive - (if (and (not (riece-user-get-away (riece-current-nickname))) + (if (and (not (riece-with-server-buffer (riece-identity-server + (riece-current-nickname)) + (riece-user-get-away (riece-identity-prefix + (riece-current-nickname))))) (or (null riece-away-message) current-prefix-arg)) (let ((message (read-string "Away message: "))) @@ -574,10 +580,10 @@ If prefix argument ARG is non-nil, toggle frozen status." (read-string "Message: ") (or riece-quit-message (riece-extended-version)))) - (process-list riece-process-list)) - (while process-list - (riece-quit-server-process (car process-list) message) - (setq process-list (cdr process-list)))))) + (alist riece-server-process-alist)) + (while alist + (riece-quit-server-process (cdr (car alist)) message) + (setq alist (cdr alist)))))) (defun riece-command-raw (command) "Enter raw IRC command, which is sent to the server." @@ -615,13 +621,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (defun riece-command-close-server (server-name &optional message) (interactive - (list (completing-read - "Server: " - (mapcar - (lambda (process) - (with-current-buffer (process-buffer process) - (list riece-server-name))) - riece-process-list)) + (list (completing-read "Server: " riece-server-process-alist) (if current-prefix-arg (read-string "Message: ") (or riece-quit-message @@ -631,13 +631,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (defun riece-command-universal-server-name-argument () (interactive) (let* ((riece-overriding-server-name - (completing-read - "Server: " - (mapcar - (lambda (process) - (with-current-buffer (process-buffer process) - (list riece-server-name))) - riece-process-list))) + (completing-read "Server: " riece-server-process-alist)) (command (key-binding (read-key-sequence (format "Command to execute on \"%s\":"