Change the modeline to show the connection status even when the
authorChris Hanson <org/chris-hanson/cph>
Tue, 23 May 2000 04:36:24 +0000 (04:36 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 23 May 2000 04:36:24 +0000 (04:36 +0000)
folder is empty.

v7/src/imail/imail-top.scm

index f046f2e41b3bdb0534505307ffd432396afc9bd6..e9743c12a7e352a1e337b93e159da439e5844150 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-top.scm,v 1.96 2000/05/23 03:58:25 cph Exp $
+;;; $Id: imail-top.scm,v 1.97 2000/05/23 04:36:24 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
 ;;;
@@ -713,42 +713,45 @@ With prefix argument N moves backward N messages with these flags."
          (buffer-modeline-event! buffer 'PROCESS-STATUS)))))
 
 (define (imail-mode-line-summary-string buffer)
-  (let ((message (selected-message #f buffer)))
-    (and message
-        (let ((folder (message-folder message))
-              (index (message-index message)))
-          (and folder
-               (if index
-                   (let ((n (folder-length folder))
-                         (status (folder-connection-status folder)))
-                     (string-append
-                      (case status
-                        ((ONLINE) " online")
-                        ((OFFLINE) " offline")
-                        (else ""))
-                      " "
-                      (number->string (+ 1 index))
-                      "/"
-                      (number->string n)
-                      (let loop ((i 0) (unseen 0))
-                        (if (< i n)
-                            (loop (+ i 1)
-                                  (if (message-unseen? (get-message folder i))
-                                      (+ unseen 1)
-                                      unseen))
-                            (if (> unseen 0)
-                                (string-append " ("
-                                               (number->string unseen)
-                                               " unseen)")
-                                "")))
-                      (let ((flags
-                             (flags-delete "seen" (message-flags message))))
-                        (if (pair? flags)
-                            (string-append
-                             " "
-                             (decorated-string-append "" "," "" flags))
-                            ""))))
-                   " 0/0"))))))
+  (let ((folder (selected-folder #f buffer))
+       (message (selected-message #f buffer)))
+    (and folder
+        (let ((status (folder-connection-status folder)))
+          (string-append
+           (case status
+             ((ONLINE) " online")
+             ((OFFLINE) " offline")
+             (else ""))
+           (if (and message (message-attached? message folder))
+               (let ((index (message-index message)))
+                 (if index
+                     (let ((n (folder-length folder)))
+                       (string-append
+                        " "
+                        (number->string (+ 1 index))
+                        "/"
+                        (number->string n)
+                        (let loop ((i 0) (unseen 0))
+                          (if (< i n)
+                              (loop (+ i 1)
+                                    (if (message-unseen?
+                                         (get-message folder i))
+                                        (+ unseen 1)
+                                        unseen))
+                              (if (> unseen 0)
+                                  (string-append " ("
+                                                 (number->string unseen)
+                                                 " unseen)")
+                                  "")))
+                        (let ((flags
+                               (flags-delete "seen" (message-flags message))))
+                          (if (pair? flags)
+                              (string-append
+                               " "
+                               (decorated-string-append "" "," "" flags))
+                              ""))))
+                     " 0/0"))
+               ""))))))
 
 (define (maybe-reformat-headers message buffer)
   (let ((headers