From d845bbae7b1bab525e9fdfd38c21eb0eb630b6c0 Mon Sep 17 00:00:00 2001 From: ueno Date: Tue, 3 Jun 2003 00:31:34 +0000 Subject: [PATCH] * riece-server.el (riece-server-keyword-map): `:coding-system' -> `:coding'. (riece-open-server): Follow the change. * riece-ctcp.el (riece-command-ctcp-action): New command. (riece-ctcp-insinuate): Bind it in riece-dialogue-mode-map. (riece-handle-ctcp-action-request): New handler. * riece.el (riece-command-mode): Enclose status indicators with `{}'; show riece-user-indicator. (riece-channel-mode): Likewise. (riece-dialogue-mode): Enclose status indicators with `{}'. * riece-globals.el (riece-user-indicator): New indicator. (riece-freeze-indicator): Default to "-". * riece-display.el (riece-update-channel-indicator): Don't update modeline. (riece-update-status-indicators): Set riece-user-indicator. * riece-300.el (riece-handle-324-message): Update channel indicator. --- lisp/ChangeLog | 21 +++++++++++++++++++++ lisp/riece-300.el | 4 +++- lisp/riece-ctcp.el | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- lisp/riece-display.el | 28 ++++++++++++++-------------- lisp/riece-globals.el | 4 ++-- lisp/riece-server.el | 4 ++-- lisp/riece.el | 21 ++++++++++++++------- 7 files changed, 102 insertions(+), 28 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 92fd4f1..1e64db5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,24 @@ +2003-06-03 Daiki Ueno + + * riece-server.el (riece-server-keyword-map): `:coding-system' -> + `:coding'. + (riece-open-server): Follow the change. + + * riece-ctcp.el (riece-command-ctcp-action): New command. + (riece-ctcp-insinuate): Bind it in riece-dialogue-mode-map. + (riece-handle-ctcp-action-request): New handler. + + * riece.el (riece-command-mode): Enclose status indicators with + `{}'; show riece-user-indicator. + (riece-channel-mode): Likewise. + (riece-dialogue-mode): Enclose status indicators with `{}'. + * riece-globals.el (riece-user-indicator): New indicator. + (riece-freeze-indicator): Default to "-". + * riece-display.el (riece-update-channel-indicator): Don't update + modeline. + (riece-update-status-indicators): Set riece-user-indicator. + * riece-300.el (riece-handle-324-message): Update channel indicator. + 2003-06-02 Daiki Ueno * riece.el (riece-command-mode): Don't set riece-freeze-indicator. diff --git a/lisp/riece-300.el b/lisp/riece-300.el index 5846267..7e2b58c 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -231,7 +231,9 @@ (concat (riece-concat-server-name (format "Mode for %s: %s" channel mode-string)) - "\n")))))) + "\n"))) + (riece-update-channel-indicator) + (force-mode-line-update t)))) (defun riece-handle-set-topic (prefix number name string remove) (if (string-match "^\\([^ ]+\\) :" string) diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index f13a1d6..d86eb42 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -35,7 +35,8 @@ (add-hook 'riece-privmsg-hook 'riece-handle-ctcp-request) (add-hook 'riece-notice-hook 'riece-handle-ctcp-response) (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-cp" 'riece-command-ctcp-ping) + (define-key riece-dialogue-mode-map "\C-ca" 'riece-command-ctcp-action)) (defun riece-handle-ctcp-request (prefix string) (when (and prefix string @@ -124,6 +125,20 @@ target)) "\n")))) +(defun riece-handle-ctcp-action-request (prefix target string) + (let ((buffer (if (riece-channel-p target) + (cdr (riece-identity-assoc-no-server + (riece-make-identity target) + riece-channel-buffer-alist)))) + (user (riece-prefix-nickname prefix))) + (riece-insert-change buffer (concat user " " string "\n")) + (riece-insert-change + (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")))) + (defun riece-handle-ctcp-response (prefix string) (when (and prefix string (riece-prefix-nickname prefix)) @@ -206,6 +221,35 @@ (riece-send-string (format "PRIVMSG %s :\1PING\1\r\n" user)) (setq riece-ctcp-ping-time (current-time))) +(defun riece-command-ctcp-action (channel action) + (interactive + (list (if current-prefix-arg + (completing-read + "Channel/User: " + (mapcar #'list riece-current-channels)) + riece-current-channel) + (read-string "Action: "))) + (if (equal action "") + (error "No action")) + (riece-send-string (format "PRIVMSG %s :\1ACTION %s\1\r\n" + (riece-identity-prefix channel) + action)) + (let ((buffer (cdr (riece-identity-assoc-no-server + (riece-make-identity channel) + riece-channel-buffer-alist)))) + (riece-insert-change + buffer + (concat (riece-identity-prefix (riece-current-nickname)) " " action "\n")) + (riece-insert-change + (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)) + "\n")))) + (provide 'riece-ctcp) -;;; riece-ctcp.el ends here \ No newline at end of file +;;; riece-ctcp.el ends here diff --git a/lisp/riece-display.el b/lisp/riece-display.el index ee9c090..6da4df6 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -156,9 +156,7 @@ (concat riece-current-channel ": " (riece-channel-get-topic riece-current-channel)) riece-current-channel)) - "None")) - (with-current-buffer riece-command-buffer - (force-mode-line-update))) + "None"))) (defun riece-update-channel-list-indicator () (if (and riece-current-channels @@ -179,17 +177,19 @@ (setq riece-channel-list-indicator "No channel"))) (defun riece-update-status-indicators () - (riece-with-server-buffer - (setq riece-away-indicator - (if (and riece-real-nickname - (riece-user-get-away riece-real-nickname)) - "A" - "-")) - (setq riece-operator-indicator - (if (and riece-real-nickname - (riece-user-get-operator riece-real-nickname)) - "O" - "-"))) + (with-current-buffer riece-command-buffer + (riece-with-server-buffer + (setq riece-away-indicator + (if (and riece-real-nickname + (riece-user-get-away riece-real-nickname)) + "A" + "-") + riece-operator-indicator + (if (and riece-real-nickname + (riece-user-get-operator riece-real-nickname)) + "O" + "-") + riece-user-indicator riece-real-nickname))) (setq riece-freeze-indicator (with-current-buffer (if (and riece-channel-buffer-mode riece-channel-buffer) diff --git a/lisp/riece-globals.el b/lisp/riece-globals.el index fbba31b..6c77e86 100644 --- a/lisp/riece-globals.el +++ b/lisp/riece-globals.el @@ -116,11 +116,11 @@ Local to the channel buffers.") "A modeline indicator of the current channel.") (defvar riece-channel-list-indicator "No channel" "The current joined channels, \"pretty-printed.\".") +(defvar riece-user-indicator nil) (defvar riece-away-indicator "-") (defvar riece-operator-indicator "-") -(defvar riece-freeze-indicator nil) -(defvar riece-own-freeze-indicator nil) +(defvar riece-freeze-indicator "-") ;;; Buffers: (defvar riece-command-buffer "*Commands*" diff --git a/lisp/riece-server.el b/lisp/riece-server.el index 0bb1eaa..9a47c35 100644 --- a/lisp/riece-server.el +++ b/lisp/riece-server.el @@ -39,7 +39,7 @@ (:username riece-username) (:password) (:function #'open-network-stream) - (:coding-system riece-default-coding-system)) + (:coding riece-default-coding-system)) "Mapping from keywords to default values. All keywords that can be used must be listed here.")) @@ -138,7 +138,7 @@ the `riece-server-keyword-map' variable." (with-current-buffer (process-buffer process) (setq riece-last-nickname riece-real-nickname riece-nick-accepted 'sent - riece-coding-system coding-system)) + riece-coding-system coding)) (if server-name (setq riece-server-process-alist (cons (cons server-name process) diff --git a/lisp/riece.el b/lisp/riece.el index ac3c37d..70f069b 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -296,9 +296,14 @@ For a list of the generic commands type \\[riece-command-generic] ? RET. (riece-mode-line-buffer-identification '("Riece: " mode-line-modified + "{" riece-away-indicator riece-operator-indicator - "-- " riece-current-channel " " riece-real-nickname))) + riece-freeze-indicator + "} " + riece-user-indicator + " " + riece-channel-indicator))) (riece-simplify-mode-line-format) (use-local-map riece-command-mode-map) @@ -331,11 +336,12 @@ Instead, these commands are available: (riece-mode-line-buffer-identification '("Riece: " mode-line-modified + "{" riece-away-indicator riece-operator-indicator riece-freeze-indicator - riece-own-freeze-indicator - " " riece-channel-list-indicator " ")) + "} " + riece-channel-list-indicator " ")) buffer-read-only t tab-stop-list riece-tab-stop-list) (riece-update-status-indicators) @@ -361,10 +367,12 @@ Instead, these commands are available: (riece-mode-line-buffer-identification '("Riece: " mode-line-modified + "{" riece-away-indicator riece-operator-indicator riece-freeze-indicator - riece-own-freeze-indicator + "} " + riece-user-indicator " " riece-channel-indicator)))) @@ -389,7 +397,7 @@ Instead, these commands are available: (kill-all-local-variables) (setq mode-line-modified "--- " major-mode 'riece-user-list-mode - mode-name "Riece Channel member" + mode-name "User list" mode-line-buffer-identification (riece-mode-line-buffer-identification '("Riece: " riece-channel-indicator " ")) @@ -413,8 +421,7 @@ Instead, these commands are available: (defun riece-load-and-build-addon-dependencies (addons) (let ((load-path (cons riece-addon-directory load-path)) - dependencies - pointer) + dependencies) (while addons (require (car addons)) ;error will be reported here (let* ((requires -- 1.7.10.4