* riece.el (riece-command-mode): Set default value of riece-freeze
authorDaiki Ueno <ueno@unixuser.org>
Mon, 2 Jun 2003 07:20:55 +0000 (07:20 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Mon, 2 Jun 2003 07:20:55 +0000 (07:20 +0000)
& 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.

lisp/ChangeLog
lisp/riece-300.el
lisp/riece-commands.el
lisp/riece-options.el
lisp/riece.el

index bff3eab..7461419 100644 (file)
@@ -1,3 +1,16 @@
+2003-06-02  Daiki Ueno  <ueno@unixuser.org>
+
+       * 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  <ueno@unixuser.org>
 
        * riece-rdcc.el: Require riece-globals, riece-misc, riece-channel,
index fb644d1..77ed5cb 100644 (file)
           (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)
     "\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
             (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))
                           (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"
                   (if operator
                       "operator"
                     "not operator")
-                  (if (equal away "G")
+                  (if away
                       "away"
                     "not away")
                   hops
index fad792a..48cd591 100644 (file)
 (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
index cafcc4d..c9d000d 100644 (file)
@@ -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
index a2d745b..f4ef821 100644 (file)
@@ -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