Commit c48ce2b1 c48ce2b12ea3e0048a0628b611e5b0993370dc9f by Sergey Poznyakoff

(main): Display "no messages in ..." warning for empty folders.

1 parent de88b2bb
Showing 1 changed file with 12 additions and 3 deletions
...@@ -171,7 +171,8 @@ main (int argc, char **argv) ...@@ -171,7 +171,8 @@ main (int argc, char **argv)
171 int index; 171 int index;
172 mailbox_t mbox; 172 mailbox_t mbox;
173 int status; 173 int status;
174 174 size_t total = 0;
175
175 /* Native Language Support */ 176 /* Native Language Support */
176 mu_init_nls (); 177 mu_init_nls ();
177 178
...@@ -194,7 +195,6 @@ main (int argc, char **argv) ...@@ -194,7 +195,6 @@ main (int argc, char **argv)
194 /* Fast approach */ 195 /* Fast approach */
195 observer_t observer; 196 observer_t observer;
196 observable_t observable; 197 observable_t observable;
197 size_t total;
198 198
199 print_header (mbox); 199 print_header (mbox);
200 200
...@@ -207,8 +207,9 @@ main (int argc, char **argv) ...@@ -207,8 +207,9 @@ main (int argc, char **argv)
207 } 207 }
208 else 208 else
209 { 209 {
210 mailbox_messages_count (mbox, &total);
210 mh_msgset_parse (mbox, &msgset, argc, argv, "all"); 211 mh_msgset_parse (mbox, &msgset, argc, argv, "all");
211 212
212 if (reverse) 213 if (reverse)
213 mh_msgset_reverse (&msgset); 214 mh_msgset_reverse (&msgset);
214 215
...@@ -216,6 +217,14 @@ main (int argc, char **argv) ...@@ -216,6 +217,14 @@ main (int argc, char **argv)
216 status = mh_iterate (mbox, &msgset, list_message, NULL); 217 status = mh_iterate (mbox, &msgset, list_message, NULL);
217 } 218 }
218 219
220 if (total == 0)
221 {
222 url_t url = NULL;
223
224 mailbox_get_url (mbox, &url);
225 mh_error (_("no messages in %s"), url_to_string (url));
226 }
227
219 clear_screen (); 228 clear_screen ();
220 mh_global_save_state (); 229 mh_global_save_state ();
221 230
......