* riece-misc.el (riece-concat-user-status): New function.
authorueno <ueno>
Sun, 18 Jan 2004 00:44:06 +0000 (00:44 +0000)
committerueno <ueno>
Sun, 18 Jan 2004 00:44:06 +0000 (00:44 +0000)
* riece-300.el (riece-handle-302-message): Simplify user status
display.  (i.e. don't display "not operator", "not away", ...)
(riece-handle-352-message): Ditto.

lisp/ChangeLog
lisp/riece-300.el
lisp/riece-misc.el

index 2fafafa..267b88d 100644 (file)
@@ -1,3 +1,11 @@
+2004-01-18  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-misc.el (riece-concat-user-status): New function.
+
+       * riece-300.el (riece-handle-302-message): Simplify user status
+       display.  (i.e. don't display "not operator", "not away", ...)
+       (riece-handle-352-message): Ditto.
+
 2004-01-04  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-lsdb.el (riece-lsdb-add-user): Always pass canonical
index a44fa17..742e9e6 100644 (file)
                   "\\)\\(\\*\\)?=\\([-+]\\)\\([^ ]+\\)")
           (car replies))
          (let ((user (match-string 1 (car replies)))
+               (operator (not (null (match-beginning 2))))
                (away (eq (match-string 3 (car replies)) ?-))
                (user-at-host (match-string 4 (car replies)))
-               (operator (not (null (match-beginning 2)))))
+               status)
+           (if away
+               (setq status (cons "away" status)))
+           (if operator
+               (setq status (cons "operator" status)))
            (riece-user-toggle-away user away)
            (riece-user-toggle-operator user operator)
            (riece-insert-info
             (list riece-dialogue-buffer riece-others-buffer)
             (concat
              (riece-concat-server-name
-              (format "%s is (%s) [%s, %s]"
-                      (riece-format-identity
-                       (riece-make-identity user riece-server-name)
-                       t)
-                      (riece-strip-user-at-host user-at-host)
-                      (if operator
-                          "operator"
-                        "not operator")
-                      (if away
-                          "away"
-                        "not away")))
+              (riece-concat-user-status
+               status
+               (format "%s is (%s)"
+                       (riece-format-identity
+                        (riece-make-identity user riece-server-name)
+                        t)
+                       (riece-strip-user-at-host user-at-host))))
              "\n"))))
       (setq replies (cdr replies)))
   (riece-update-status-indicators)
             (name (substring string (match-end 0)))
             (buffer (riece-channel-buffer (riece-make-identity
                                            channel riece-server-name)))
-            (info (format "%10s = %s (%s) [%s, %s, %s hops, on %s]"
+            (info (format "%10s = %s (%s)"
                           (concat
                            (if (memq flag '(?@ ?+))
                                (char-to-string flag)
                             t))
                           name
                           (riece-strip-user-at-host
-                           (concat user "@" host))
-                          (if operator
-                              "operator"
-                            "not operator")
-                          (if away
-                              "away"
-                            "not away")
-                          hops
-                          server)))
+                           (concat user "@" host))))
+            status)
+       (if operator
+           (setq status (cons "operator" status)))
+       (if away
+           (setq status (cons "away" status)))
+       (unless (equal hops "0")
+         (setq status (cons (concat "on " server)
+                            (cons (concat hops " hops")
+                                  status))))
+       (if status
+           (setq status (nreverse status)))
        (riece-naming-assert-join nick channel)
        (riece-user-toggle-away user away)
        (riece-user-toggle-operator user operator)
-       (riece-insert-info buffer (concat info "\n"))
+       (riece-insert-info buffer (concat (riece-concat-user-status
+                                          status info)
+                                         "\n"))
        (riece-insert-info
         (if (and riece-channel-buffer-mode
                  (not (eq buffer riece-channel-buffer)))
           riece-dialogue-buffer)
         (concat
          (riece-concat-server-name
-          (concat
-           (riece-format-identity
-            (riece-make-identity channel riece-server-name)
-            t)
-           " "
-           info))
+          (riece-concat-user-status
+           status
+           (concat
+            (riece-format-identity
+             (riece-make-identity channel riece-server-name)
+             t)
+            " "
+            info)))
          "\n"))
        (riece-redisplay-buffers))))
 
index e3ff301..0a68bb1 100644 (file)
       string
     (concat string " (from " riece-server-name ")")))
 
+(defun riece-concat-user-status (status string)
+  (if status
+      (concat string " [" (mapconcat #'identity status ", ") "]")
+    string))
+
 (defun riece-prefix-user-at-host (prefix)
   (if (string-match "!" prefix)
       (substring prefix (match-end 0))