X-Git-Url: https://cgit.sxemacs.org/?p=riece;a=blobdiff_plain;f=lisp%2Friece-commands.el;h=fe04361321a624d5ccb354b6e6da6bde48a617c7;hp=2c8cb1aa18a2722f7d9f6ad0a42d2b645bd591ba;hb=a872e7b2f534acf53b2f4e3149e3862448235351;hpb=005a2a7642c9f43d699922799801124a77d56f5d diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 2c8cb1a..fe04361 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -26,6 +26,7 @@ (require 'riece-channel) (require 'riece-complete) +(require 'riece-layout) (require 'riece-display) (require 'riece-version) (require 'riece-server) @@ -51,7 +52,7 @@ (if channel (riece-command-switch-to-channel channel) (error "No such number!")))) - + (eval-and-compile (let ((number 1)) (while (<= number 20) @@ -89,7 +90,8 @@ (start riece-current-channels) channel) (while (and start (not (eq start pointer))) - (setq channel (car start)) + (if (car start) + (setq channel (car start))) (setq start (cdr start))) (when (null channel) (setq start (copy-sequence riece-current-channels)) @@ -111,6 +113,13 @@ (interactive) (riece-redisplay-buffers t)) +(defun riece-command-change-layout (name) + "Select a layout-name from all current available layouts and change +the layout to the selected layout-name." + (interactive (list (completing-read "Layout: " riece-layout-alist))) + (setq riece-layout name) + (riece-command-configure-windows)) + (defun riece-command-toggle-channel-buffer-mode () (interactive) (setq riece-channel-buffer-mode @@ -180,8 +189,11 @@ (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 @@ -201,7 +213,7 @@ (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? ")) @@ -215,7 +227,7 @@ (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? ")) @@ -229,7 +241,7 @@ (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? ")) @@ -412,13 +424,20 @@ (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 target)) + (riece-channel-p (riece-identity-prefix target))) (setq key - (riece-read-passwd (format "Key for %s: " target)))) + (riece-read-passwd (format "Key for %s: " + (riece-format-identity target))))) (list target key))) (let ((pointer (riece-identity-member target riece-current-channels))) (if pointer @@ -445,8 +464,10 @@ (let* ((completion-ignore-case t) (target (riece-completing-read-identity - "Channel/User: " riece-current-channels nil nil - (cons (riece-format-identity riece-current-channel) 0))) + (format "Channel/User (default %s): " + (riece-format-identity riece-current-channel)) + riece-current-channels nil nil nil nil + (riece-format-identity riece-current-channel))) message) (if (and current-prefix-arg (riece-channel-p (riece-identity-prefix target))) @@ -513,7 +534,10 @@ (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: "))) @@ -564,10 +588,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (riece-extended-version)))) (process-list riece-process-list)) (while process-list - (riece-process-send-string (car process-list) - (if message - (format "QUIT :%s\r\n" message) - "QUIT\r\n")) + (riece-quit-server-process (car process-list) message) (setq process-list (cdr process-list)))))) (defun riece-command-raw (command) @@ -617,10 +638,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (read-string "Message: ") (or riece-quit-message (riece-extended-version))))) - (riece-process-send-string (riece-server-process server-name) - (if message - (format "QUIT :%s\r\n" message) - "QUIT\r\n"))) + (riece-quit-server-process (riece-server-process server-name) message)) (defun riece-command-universal-server-name-argument () (interactive)