(main): Display "no messages in ..." warning for empty folders.
Showing
1 changed file
with
10 additions
and
1 deletions
... | @@ -171,6 +171,7 @@ main (int argc, char **argv) | ... | @@ -171,6 +171,7 @@ 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 | size_t total = 0; | ||
174 | 175 | ||
175 | /* Native Language Support */ | 176 | /* Native Language Support */ |
176 | mu_init_nls (); | 177 | mu_init_nls (); |
... | @@ -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,6 +207,7 @@ main (int argc, char **argv) | ... | @@ -207,6 +207,7 @@ 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) |
... | @@ -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 | ... | ... |
-
Please register or sign in to post a comment