Commit 259e8389 259e83899823c5d665d91edcb27da76b00d5dcdf by Sergey Poznyakoff

Minor fixes.

* mh/msgchk.c (checkmail): take into account various
possible return codes.
1 parent 441dda65
...@@ -295,14 +295,26 @@ checkmail (const char *username, int personal) ...@@ -295,14 +295,26 @@ checkmail (const char *username, int personal)
295 if (notify & NOTIFY_MAIL) 295 if (notify & NOTIFY_MAIL)
296 { 296 {
297 mu_off_t mbsiz = 0; 297 mu_off_t mbsiz = 0;
298 int newmail = 0;
298 299
299 rc = mu_mailbox_message_unseen (mbox, &recent); 300 rc = mu_mailbox_message_unseen (mbox, &recent);
300 if (rc) 301 switch (rc)
301 { 302 {
303 case 0:
304 newmail = 1;
305 break;
306
307 case MU_ERR_NOENT:
308 newmail = 0;
309 break;
310
311 default:
302 if (rc != ENOSYS && rc != MU_ERR_INFO_UNAVAILABLE) 312 if (rc != ENOSYS && rc != MU_ERR_INFO_UNAVAILABLE)
303 mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_unseen", 313 mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_unseen",
304 mu_url_to_string (url), rc); 314 mu_url_to_string (url), rc);
305 rc = mu_mailbox_messages_recent (mbox, &recent); 315 rc = mu_mailbox_messages_recent (mbox, &recent);
316 if (rc == 0)
317 newmail = recent > 0;
306 } 318 }
307 319
308 if (rc) 320 if (rc)
...@@ -329,11 +341,11 @@ checkmail (const char *username, int personal) ...@@ -329,11 +341,11 @@ checkmail (const char *username, int personal)
329 else 341 else
330 { 342 {
331 if (personal) 343 if (personal)
332 mu_printf (recent ? _("You have new mail waiting") : 344 mu_printf (newmail ? _("You have new mail waiting") :
333 _("You have old mail waiting")); 345 _("You have old mail waiting"));
334 else 346 else
335 mu_printf (recent ? _("%s has new mail waiting") : 347 mu_printf (newmail ? _("%s has new mail waiting") :
336 _("%s has old mail waiting"), username); 348 _("%s has old mail waiting"), username);
337 } 349 }
338 350
339 if (date_option) 351 if (date_option)
......