From 82676196b44cbfde31efc8a365b38190ae940c8e Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 19 Oct 2003 07:16:42 +0000 Subject: [PATCH] * riece.el (riece-dialogue-mode-map): Bind "p" to riece-command-enter-message-to-user. * riece-misc.el (riece-current-nickname): Use riece-current-server-name. (riece-get-users-on-server): Ditto. * riece-server.el (riece-current-server-name): New function. (riece-send-string): Use it. * riece-commands.el (riece-command-enter-message-to-user): New command. --- lisp/ChangeLog | 14 ++++++++++++++ lisp/riece-commands.el | 19 +++++++++++++++++++ lisp/riece-misc.el | 6 ++---- lisp/riece-server.el | 20 +++++++++++--------- lisp/riece.el | 1 + 5 files changed, 47 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8e854f7..d05b1d3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,19 @@ 2003-10-19 Daiki Ueno + * riece.el (riece-dialogue-mode-map): Bind "p" to + riece-command-enter-message-to-user. + + * riece-misc.el (riece-current-nickname): Use + riece-current-server-name. + (riece-get-users-on-server): Ditto. + + * riece-server.el (riece-current-server-name): New function. + (riece-send-string): Use it. + + * riece-commands.el (riece-command-enter-message-to-user): New command. + +2003-10-19 Daiki Ueno + * riece-menu.el (riece-menu-create-layouts-menu): New function. (riece-menu-items): Use it. diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index f48effa..c1ab9f7 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -399,6 +399,25 @@ the layout to the selected layout-name." (let ((next-line-add-newlines t)) (next-line 1))) +(defun riece-command-enter-message-to-user (user) + "Send the current line to USER." + (interactive + (let ((completion-ignore-case t)) + (list (completing-read + "User: " + (mapcar #'list (riece-get-users-on-server)))))) + (let ((text (buffer-substring + (riece-line-beginning-position) + (riece-line-end-position)))) + (riece-send-string + (format "PRIVMSG %s :%s\r\n" user text)) + (riece-display-message + (riece-make-message (riece-current-nickname) + (riece-make-identity user (riece-current-server-name)) + text nil t))) + (let ((next-line-add-newlines t)) + (next-line 1))) + (defun riece-command-join-channel (target key) (let ((process (riece-server-process (riece-identity-server target)))) (unless process diff --git a/lisp/riece-misc.el b/lisp/riece-misc.el index 0e218e6..c20d3ad 100644 --- a/lisp/riece-misc.el +++ b/lisp/riece-misc.el @@ -107,7 +107,7 @@ (defun riece-current-nickname () "Return the current nickname." - (riece-with-server-buffer (riece-identity-server riece-current-channel) + (riece-with-server-buffer (riece-current-server-name) (if riece-real-nickname (riece-make-identity riece-real-nickname riece-server-name)))) @@ -181,9 +181,7 @@ user-at-host)) (defun riece-get-users-on-server () - (riece-with-server-buffer (if riece-current-channel - (riece-identity-server riece-current-channel) - "") + (riece-with-server-buffer (riece-current-server-name) (let (users) (mapatoms (lambda (atom) diff --git a/lisp/riece-server.el b/lisp/riece-server.el index b290d57..27b40e8 100644 --- a/lisp/riece-server.el +++ b/lisp/riece-server.el @@ -108,16 +108,18 @@ the `riece-server-keyword-map' variable." (with-current-buffer (process-buffer process) (process-send-string process (riece-encode-coding-string string)))) -(defun riece-send-string (string) - (let* ((server-name - (or riece-overriding-server-name +(defun riece-current-server-name () + (or riece-overriding-server-name ;already in the server buffer - (if (local-variable-p 'riece-server-name (current-buffer)) - riece-server-name - (if riece-current-channel - (riece-identity-server riece-current-channel) - (if (riece-server-opened "") - ""))))) + (if (local-variable-p 'riece-server-name (current-buffer)) + riece-server-name + (if riece-current-channel + (riece-identity-server riece-current-channel) + (if (riece-server-opened "") + ""))))) + +(defun riece-send-string (string) + (let* ((server-name (riece-current-server-name)) (process (riece-server-process server-name))) (unless process (error "%s" (substitute-command-keys diff --git a/lisp/riece.el b/lisp/riece.el index d6994bb..301510c 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -166,6 +166,7 @@ If optional argument SAFE is nil, overwrite previous definitions." "O" riece-command-open-server "C" riece-command-close-server "M" riece-command-universal-server-name-argument + "p" riece-command-enter-message-to-user "q" riece-command-quit "r" riece-command-configure-windows "x" riece-command-copy-region -- 1.7.10.4