;; 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:
(require 'riece-complete)
(require 'riece-layout)
(require 'riece-display)
-(require 'riece-version)
(require 'riece-server)
(require 'riece-misc)
(require 'riece-identity)
(require 'riece-message)
+(autoload 'derived-mode-class "derived")
+
;;; Channel movement:
(defun riece-command-switch-to-channel (channel)
(interactive (list (riece-completing-read-identity
- "Channel/User: " riece-current-channels nil t)))
- (unless (equal channel riece-current-channels)
- (riece-switch-to-channel channel)
- (riece-redisplay-buffers)))
+ "Switch to channel/user: "
+ riece-current-channels nil t)))
+ (unless (equal channel riece-current-channel)
+ (riece-switch-to-channel channel)))
(defun riece-command-switch-to-channel-by-number (number)
(interactive
(let ((command-name (symbol-name this-command)))
(if (string-match "[0-9]+$" command-name)
(list (string-to-number (match-string 0 command-name)))
- (list (string-to-number (read-string "Number: "))))))
+ (list (string-to-number (read-string "Switch to number: "))))))
(let ((channel (nth (1- number) riece-current-channels)))
(if channel
(riece-command-switch-to-channel channel)
(defun riece-command-configure-windows ()
(interactive)
+ "Reconfigure windows with the current layout."
(riece-redisplay-buffers t))
+(defun riece-command-suspend-resume ()
+ (interactive)
+ "Save or restore the current window configuration."
+ (let ((entry (assq 'riece-window-configuration (frame-parameters))))
+ (modify-frame-parameters (selected-frame)
+ (list (cons 'riece-window-configuration
+ (current-window-configuration))))
+ (if (cdr entry)
+ (set-window-configuration (cdr entry))
+ (delete-other-windows))
+ (message
+ (substitute-command-keys
+ "\\[riece-command-suspend-resume] to get back the last windows"))))
+
(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)
+ (interactive (list (completing-read "Change layout: " riece-layout-alist)))
+ (setq riece-layout name
+ riece-save-variables-are-dirty t)
(riece-command-configure-windows))
(defun riece-command-toggle-channel-buffer-mode ()
riece-save-variables-are-dirty t)
(riece-command-configure-windows))
+(defun riece-command-toggle-others-buffer-mode ()
+ (interactive)
+ (setq riece-others-buffer-mode
+ (not riece-others-buffer-mode)
+ riece-save-variables-are-dirty t)
+ (riece-command-configure-windows))
+
(defun riece-command-toggle-user-list-buffer-mode ()
(interactive)
(setq riece-user-list-buffer-mode
(defun riece-command-finger (user &optional recurse)
(interactive
(let* ((completion-ignore-case t)
- (user (completing-read
- "User: "
- (mapcar #'list (riece-get-users-on-server)))))
+ (user (riece-completing-read-identity
+ "Finger user: "
+ (riece-get-users-on-server (riece-current-server-name))
+ nil nil nil nil nil t)))
(list user current-prefix-arg)))
(if recurse
- (riece-send-string (format "WHOIS %s %s\r\n" user user))
- (riece-send-string (format "WHOIS %s\r\n" user))))
+ (riece-send-string (format "WHOIS %s %s\r\n"
+ (riece-identity-prefix user)
+ (riece-identity-prefix user)))
+ (riece-send-string (format "WHOIS %s\r\n" (riece-identity-prefix user)))))
(defun riece-command-topic (topic)
(interactive
(progn
(riece-check-channel-commands-are-usable t)
(list (read-from-minibuffer
- "Topic: " (cons (or (riece-with-server-buffer
- (riece-identity-server
- riece-current-channel)
- (riece-channel-get-topic
- (riece-identity-prefix
- riece-current-channel)))
- "")
- 0)))))
+ "Set topic: " (cons (or (riece-with-server-buffer
+ (riece-identity-server
+ riece-current-channel)
+ (riece-channel-get-topic
+ (riece-identity-prefix
+ riece-current-channel)))
+ "")
+ 0)))))
(riece-send-string (format "TOPIC %s :%s\r\n"
(riece-identity-prefix riece-current-channel)
- topic)))
+ topic)
+ riece-current-channel))
(defun riece-command-invite (user)
(interactive
(let ((completion-ignore-case t))
(riece-check-channel-commands-are-usable t)
- (list (completing-read
- "User: "
- (mapcar #'list (riece-get-users-on-server))))))
+ (list (riece-completing-read-identity
+ "Invite user: "
+ (riece-get-users-on-server (riece-current-server-name))
+ nil nil nil nil nil t))))
(riece-send-string (format "INVITE %s %s\r\n"
- user (riece-identity-prefix
- riece-current-channel))))
+ (riece-identity-prefix user)
+ (riece-identity-prefix riece-current-channel))))
(defun riece-command-kick (user &optional message)
(interactive
(let ((completion-ignore-case t))
(riece-check-channel-commands-are-usable t)
(list (completing-read
- "User: "
- (mapcar #'list
- (riece-with-server-buffer
- (riece-identity-server riece-current-channel)
- (riece-channel-get-users
- (riece-identity-prefix riece-current-channel)))))
+ "Kick user: "
+ (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
user message)
(format "KICK %s %s\r\n"
(riece-identity-prefix riece-current-channel)
- user))))
+ user))
+ riece-current-channel))
(defun riece-command-names (pattern)
(interactive
(let ((completion-ignore-case t))
(list (read-from-minibuffer
- "Pattern: "
+ "NAMES pattern: "
(if (and riece-current-channel
(riece-channel-p (riece-identity-prefix
riece-current-channel)))
(interactive
(let ((completion-ignore-case t))
(list (read-from-minibuffer
- "Pattern: "
+ "WHO pattern: "
(if (and riece-current-channel
(riece-channel-p (riece-identity-prefix
riece-current-channel)))
(interactive
(let ((completion-ignore-case t))
(list (read-from-minibuffer
- "Pattern: "
+ "