* riece-options.el (riece-saved-forms): Added riece-addons.
[riece] / lisp / riece-ctcp.el
index 35d3eb5..1199dc3 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-ctcp.el --- CTCP add-on
+;;; riece-ctcp.el --- CTCP (Client To Client Protocol) support
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
 ;;; Code:
 
 (require 'riece-version)
@@ -53,7 +57,7 @@
 (defvar riece-ctcp-enabled nil)
 
 (defconst riece-ctcp-description
-  "CTCP (Client To Client Protocol) support")
+  "CTCP (Client To Client Protocol) support.")
 
 (defun riece-handle-ctcp-request (prefix string)
   (when (and riece-ctcp-enabled prefix string
                  (after-hook
                   (intern (concat "riece-ctcp-after-" request
                                   "-request-hook"))))
-             (unless (riece-ignore-errors (symbol-name hook)
-                       (run-hook-with-args-until-success
-                        hook prefix (car targets) message))
+             (unless (riece-funcall-ignore-errors
+                      (symbol-name hook)
+                      #'run-hook-with-args-until-success
+                      hook prefix (car targets) message)
                (if function
                    (riece-funcall-ignore-errors (symbol-name function)
                                                  function prefix (car targets)
                                                  message))
-               (riece-ignore-errors (symbol-name after-hook)
-                 (run-hook-with-args-until-success
-                  after-hook prefix (car targets) message))))
+               (riece-funcall-ignore-errors (symbol-name after-hook)
+                                            #'run-hook-with-args-until-success
+                                            after-hook prefix (car targets)
+                                            message)))
            t)))))
 
 (defun riece-handle-ctcp-version-request (prefix target string)
                    (riece-channel-buffer (riece-make-identity
                                           target riece-server-name))))
        (user (riece-prefix-nickname prefix)))
-    (riece-insert buffer (concat riece-ctcp-action-prefix user " " string
+    (riece-insert buffer (concat riece-ctcp-action-prefix
+                                (riece-format-identity
+                                 (riece-make-identity user riece-server-name)
+                                 t)
+                                " " string
                                 "\n"))
     (riece-insert
      (if (and riece-channel-buffer-mode
              (not (eq buffer riece-channel-buffer)))
         (list riece-dialogue-buffer riece-others-buffer)
        riece-dialogue-buffer)
-     (concat (riece-concat-server-name (concat riece-ctcp-action-prefix user
-                                              " " string)) "\n"))))
+     (concat (riece-concat-server-name
+             (concat riece-ctcp-action-prefix
+                     (riece-format-identity
+                      (riece-make-identity target riece-server-name)
+                      t)
+                     ": "
+                     (riece-format-identity
+                      (riece-make-identity user riece-server-name)
+                      t)
+                     " " string)) "\n"))))
 
 (defun riece-handle-ctcp-time-request (prefix target string)
   (let* ((target-identity (riece-make-identity target riece-server-name))
                  (after-hook
                   (intern (concat "riece-ctcp-after-" response
                                   "-response-hook"))))
-             (unless (riece-ignore-errors (symbol-name hook)
-                       (run-hook-with-args-until-success
-                        hook prefix (car targets) message))
+             (unless (riece-funcall-ignore-errors
+                      (symbol-name hook)
+                      #'run-hook-with-args-until-success
+                      hook prefix (car targets) message)
                (if function
                    (riece-funcall-ignore-errors
                     (symbol-name function)
                     function prefix (car targets) message))
-               (riece-ignore-errors (symbol-name after-hook)
-                 (run-hook-with-args-until-success
-                  after-hook prefix (car targets) message))))
+               (riece-funcall-ignore-errors (symbol-name after-hook)
+                                            #'run-hook-with-args-until-success
+                                            after-hook prefix (car targets)
+                                            message)))
            t)))))
 
 (defun riece-handle-ctcp-version-response (prefix target string)
       (riece-with-server-buffer (riece-identity-server target)
        (riece-concat-server-name
         (concat riece-ctcp-action-prefix
-                (riece-identity-prefix (riece-current-nickname)) " " action
-                " (in " (riece-format-identity target t) ")")))
+                (riece-format-identity target t) ": "
+                (riece-identity-prefix (riece-current-nickname)) " " action)))
       "\n"))))
 
 (defun riece-command-ctcp-time (target)