From: ueno Date: Mon, 2 Jun 2003 07:20:55 +0000 (+0000) Subject: * riece.el (riece-command-mode): Set default value of riece-freeze X-Git-Tag: strict-naming-branchpoint~21 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=5e3b959869ab838c4a79a4d79b5d53c39b9c7077;p=elisp%2Friece.git * riece.el (riece-command-mode): Set default value of riece-freeze & riece-own-freeze. * riece-options.el (riece-away-message): New user option. * riece-commands.el (riece-command-toggle-away): Query user away message. * riece-300.el (riece-handle-301-message): Set user's away status. (riece-handle-305-message): Ditto. (riece-handle-306-message): Ditto. (riece-handle-302-message): Ditto. (riece-handle-352-message): Ditto. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bff3eab..7461419 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,18 @@ 2003-06-02 Daiki Ueno + * riece.el (riece-command-mode): Set default value of riece-freeze + & riece-own-freeze. + * riece-options.el (riece-away-message): New user option. + * riece-commands.el (riece-command-toggle-away): Query user away + message. + * riece-300.el (riece-handle-301-message): Set user's away status. + (riece-handle-305-message): Ditto. + (riece-handle-306-message): Ditto. + (riece-handle-302-message): Ditto. + (riece-handle-352-message): Ditto. + +2003-06-02 Daiki Ueno + * riece-rdcc.el: Require riece-globals, riece-misc, riece-channel, and riece-identity. (riece-command-dcc-receive): Check the existence of diff --git a/lisp/riece-300.el b/lisp/riece-300.el index fb644d1..77ed5cb 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -45,20 +45,24 @@ (concat "^\\(" riece-user-regexp "\\)\\(\\*\\)?=\\([-+]\\)\\([^ ]+\\)") (car replies)) - (riece-insert-info - (list riece-dialogue-buffer riece-others-buffer) - (concat - (riece-concat-server-name - (format "%s is (%s) [%s, %s]" - (match-string 1 (car replies)) - (riece-strip-user-at-host (match-string 4 (car replies))) - (if (match-beginning 2) - "operator" - "not operator") - (if (eq (match-string 3 (car replies)) ?-) - "away" - "not away"))) - "\n"))) + (let ((user (match-string 1 (car replies))) + (away (eq (match-string 3 (car replies)) ?-))) + (riece-insert-info + (list riece-dialogue-buffer riece-others-buffer) + (concat + (riece-concat-server-name + (format "%s is (%s) [%s, %s]" + user + (riece-strip-user-at-host + (match-string 4 (car replies))) + (if (match-beginning 2) + "operator" + "not operator") + (if away + "away" + "not away"))) + "\n")) + (riece-user-set-away (riece-get-user user) away))) (setq replies (cdr replies))))) (defun riece-handle-303-message (prefix number name string) @@ -69,17 +73,29 @@ "\n"))) (defun riece-handle-301-message (prefix number name string) - (if (string-match - (concat "^\\(" riece-user-regexp "\\) :") - string) + (when (string-match + (concat "^\\(" riece-user-regexp "\\) :") + string) + (let ((user (match-string 1 string))) + (riece-user-set-away (riece-get-user user) t) (riece-insert-info (list riece-dialogue-buffer riece-others-buffer) (concat (riece-concat-server-name (format "%s is away: %s" - (match-string 1 string) + user (substring string (match-end 0)))) - "\n")))) + "\n"))))) + +(defun riece-handle-305-message (prefix number name string) + (riece-user-set-away (riece-get-user riece-real-nickname) nil) + (setq riece-away-indicator "-") + (force-mode-line-update t)) + +(defun riece-handle-306-message (prefix number name string) + (riece-user-set-away (riece-get-user riece-real-nickname) t) + (setq riece-away-indicator "A") + (force-mode-line-update t)) (defun riece-handle-311-message (prefix number name string) (if (string-match @@ -265,7 +281,7 @@ (host (match-string 3 string)) (server (match-string 4 string)) (nick (match-string 5 string)) - (away (match-string 6 string)) + (away (equal (match-string 6 string) "G")) (operator (match-string 7 string)) (flag (match-string 8 string)) (hops (match-string 9 string)) @@ -274,6 +290,7 @@ (riece-make-identity channel) riece-channel-buffer-alist)))) (riece-naming-assert-join nick channel) + (riece-user-set-away (riece-get-user user) away) (riece-insert-info buffer (format "%10s = %s (%s) [%s, %s, %s hops, on %s]\n" @@ -313,7 +330,7 @@ (if operator "operator" "not operator") - (if (equal away "G") + (if away "away" "not away") hops diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index fad792a..48cd591 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -491,7 +491,9 @@ (defun riece-command-toggle-away (&optional message) "Mark yourself as being away." (interactive - (if current-prefix-arg + (if (and (not (riece-user-get-away (riece-current-nickname))) + (or (null riece-away-message) + current-prefix-arg)) (let ((message (read-string "Away message: "))) (list message)))) (if message diff --git a/lisp/riece-options.el b/lisp/riece-options.el index cafcc4d..c9d000d 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -229,8 +229,13 @@ way is to put Riece variables on .emacs or file loaded from there." :group 'riece-options) (defcustom riece-quit-message nil - "Default signoff message." - :type '(radio (string :tag "Signoff message")) + "Default quit message." + :type '(radio (string :tag "Quit message")) + :group 'riece-options) + +(defcustom riece-away-message nil + "Default away message." + :type '(radio (string :tag "Away message")) :group 'riece-options) (defcustom riece-gather-channel-modes t diff --git a/lisp/riece.el b/lisp/riece.el index a2d745b..f4ef821 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -288,11 +288,13 @@ For a list of the generic commands type \\[riece-command-generic] ? RET. (interactive) (kill-all-local-variables) - (setq major-mode 'riece-command-mode - mode-name "Commands" + (setq riece-freeze riece-default-freeze + riece-freeze-indicator (if riece-freeze "F" "-") + riece-own-freeze riece-default-own-freeze + riece-own-freeze-indicator (if riece-own-freeze "M" "-") riece-away-indicator "-" - riece-freeze-indicator "-" - riece-own-freeze-indicator "-" + major-mode 'riece-command-mode + mode-name "Commands" mode-line-buffer-identification (riece-mode-line-buffer-identification '("Riece: " @@ -329,7 +331,7 @@ Instead, these commands are available: riece-freeze-indicator (if riece-freeze "F" "-") riece-own-freeze riece-default-own-freeze riece-own-freeze-indicator (if riece-own-freeze "M" "-") - + riece-away-indicator "-" major-mode 'riece-dialogue-mode mode-name "Dialogue" mode-line-buffer-identification