* riece.el (riece-dialogue-mode-map): Bind "p" to
authorDaiki Ueno <ueno@unixuser.org>
Sun, 19 Oct 2003 07:16:42 +0000 (07:16 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Sun, 19 Oct 2003 07:16:42 +0000 (07:16 +0000)
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
lisp/riece-commands.el
lisp/riece-misc.el
lisp/riece-server.el
lisp/riece.el

index 8e854f7..d05b1d3 100644 (file)
@@ -1,3 +1,17 @@
+2003-10-19  Daiki Ueno  <ueno@unixuser.org>
+
+       * 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  <ueno@unixuser.org>
 
        * riece-menu.el (riece-menu-create-layouts-menu): New function.
index f48effa..c1ab9f7 100644 (file)
@@ -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
index 0e218e6..c20d3ad 100644 (file)
 
 (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))))
 
     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)
index b290d57..27b40e8 100644 (file)
@@ -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
index d6994bb..301510c 100644 (file)
@@ -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