From 716da9ee0d33fb7e0ed9221f8830da16679d0507 Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 22 Oct 2003 02:44:06 +0000 Subject: [PATCH] * riece-ctcp.el: Require 'riece-highlight. (riece-ctcp-action-face): New face. (riece-ctcp-action-face): New variable. (riece-ctcp-action-prefix): New variable. (riece-ctcp-requires): Require 'riece-highlight if it is enabled. (riece-ctcp-insinuate): Modify riece-dialogue-font-lock-keywords if 'riece-highlight is enabled. (riece-handle-ctcp-action-request): Prepend riece-ctcp-action-prefix instead of riece-change-prefix. (riece-command-ctcp-action): Ditto. --- lisp/ChangeLog | 11 +++++++++++ lisp/riece-ctcp.el | 45 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c98eab0..f766267 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2003-10-22 Daiki Ueno + * riece-ctcp.el: Require 'riece-highlight. + (riece-ctcp-action-face): New face. + (riece-ctcp-action-face): New variable. + (riece-ctcp-action-prefix): New variable. + (riece-ctcp-requires): Require 'riece-highlight if it is enabled. + (riece-ctcp-insinuate): Modify riece-dialogue-font-lock-keywords + if 'riece-highlight is enabled. + (riece-handle-ctcp-action-request): Prepend + riece-ctcp-action-prefix instead of riece-change-prefix. + (riece-command-ctcp-action): Ditto. + * riece-server.el (riece-quit-server-process): Use riece-run-at-time. * riece-xemacs.el (riece-run-at-time): New function. * riece-emacs.el (riece-run-at-time): New alias. diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index 0ffce09..dfde187 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -27,15 +27,42 @@ (require 'riece-version) (require 'riece-misc) (require 'riece-display) +(require 'riece-highlight) + +(defface riece-ctcp-action-face + '((((class color) + (background dark)) + (:foreground "PaleGreen" :italic t)) + (((class color) + (background light)) + (:foreground "ForestGreen" :italic t)) + (t + (:bold t))) + "Face used for displaying \"*** Action:\" line" + :group 'riece-highlight-faces) +(defvar riece-ctcp-action-face 'riece-ctcp-action-face) + +(defconst riece-ctcp-action-prefix "*** Action: ") (defvar riece-ctcp-ping-time nil) (defvar riece-ctcp-additional-clientinfo nil) (defvar riece-dialogue-mode-map) +(defun riece-ctcp-requires () + (if (memq 'riece-highlight riece-addons) + '(riece-highlight))) + (defun riece-ctcp-insinuate () (add-hook 'riece-privmsg-hook 'riece-handle-ctcp-request) (add-hook 'riece-notice-hook 'riece-handle-ctcp-response) + (if (memq 'riece-highlight riece-addons) + (setq riece-dialogue-font-lock-keywords + (cons (list (concat "^" riece-time-prefix-regexp "\\(" + (regexp-quote riece-ctcp-action-prefix) + ".*\\)$") + 1 riece-ctcp-action-face t t) + riece-dialogue-font-lock-keywords))) (define-key riece-dialogue-mode-map "\C-cv" 'riece-command-ctcp-version) (define-key riece-dialogue-mode-map "\C-cp" 'riece-command-ctcp-ping) (define-key riece-dialogue-mode-map "\C-ca" 'riece-command-ctcp-action) @@ -167,13 +194,15 @@ (riece-channel-buffer (riece-make-identity target riece-server-name)))) (user (riece-prefix-nickname prefix))) - (riece-insert-change buffer (concat user " " string "\n")) - (riece-insert-change + (riece-insert buffer (concat riece-ctcp-action-prefix user " " 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 user " " string)) "\n")))) + (concat (riece-concat-server-name (concat riece-ctcp-action-prefix user + " " string)) "\n")))) (defun riece-handle-ctcp-response (prefix string) (when (and prefix string @@ -302,17 +331,19 @@ (riece-identity-prefix target) action)) (let ((buffer (riece-channel-buffer target))) - (riece-insert-change + (riece-insert buffer - (concat (riece-identity-prefix (riece-current-nickname)) " " action "\n")) - (riece-insert-change + (concat riece-ctcp-action-prefix + (riece-identity-prefix (riece-current-nickname)) " " action "\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-identity-prefix (riece-current-nickname)) " " action)) + (concat riece-ctcp-action-prefix + (riece-identity-prefix (riece-current-nickname)) " " action)) "\n")))) (provide 'riece-ctcp) -- 1.7.10.4