Skip to content

Commit

Permalink
push-notification: Error handling fix and cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Oct 19, 2016
1 parent bad0f9d commit f948338
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/plugins/push-notification/push-notification-driver-ox.c
Expand Up @@ -309,19 +309,15 @@ static int push_notification_driver_ox_get_mailbox_status

/* open and sync new instance of the same mailbox to get most recent status */
box = mailbox_alloc(mailbox_get_namespace(mbox)->list, mailbox_get_name(mbox), MAILBOX_FLAG_READONLY);
mailbox_open(box);
if (mailbox_sync(box, 0) < 0) {
i_warning("mailbox_sync(%s): %s", mailbox_get_vname(mbox), mailbox_get_last_error(box, NULL));
}

/* only 'unseen' is needed at the moment */
ret = mailbox_get_status(box, STATUS_UNSEEN, r_box_status);
if (ret < 0) {
i_error("Could not get mailbox '%s' status: %s",
mailbox_get_vname(box), mailbox_get_last_error(box, NULL));
i_error("mailbox_sync(%s) failed: %s", mailbox_get_vname(mbox), mailbox_get_last_error(box, NULL));
ret = -1;
} else {
/* only 'unseen' is needed at the moment */
mailbox_get_open_status(box, STATUS_UNSEEN, r_box_status);
push_notification_driver_debug(OX_LOG_LABEL, dtxn->ptxn->muser, "Got status of mailbox '%s': (unseen: %u)",
mailbox_get_vname(box), r_box_status->unseen);
ret = 0;
}

mailbox_free(&box);
Expand Down

0 comments on commit f948338

Please sign in to comment.