summaryrefslogtreecommitdiff
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2008-05-15 15:40:29 +0000
committerMark Michelson <mmichelson@digium.com>2008-05-15 15:40:29 +0000
commit028016b401278e3a2f96bab317730c8719da9043 (patch)
tree5bf58e02969b7786fb20a43c674626d7346b0f16 /apps/app_voicemail.c
parenta92223a24052ad3dff66a310d2cfeaf17cf9929d (diff)
When counting urgent messages when using IMAP storage, take into account that
the urgent messages are not in their own folder but are actually "flagged" messages in the INBOX. (closes issue #12659) Reported by: jaroth Patches: urgentfolder_v2.patch uploaded by jaroth (license 50) Tested by: jaroth git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116594 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 7c2cb9dba..4bbcd8d4b 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3177,6 +3177,7 @@ static int messagecount(const char *context, const char *mailbox, const char *fo
struct vm_state *vms_p;
int ret = 0;
int fold = folder_int(folder);
+ int urgent = 0;
if (ast_strlen_zero(mailbox))
return 0;
@@ -3225,6 +3226,12 @@ static int messagecount(const char *context, const char *mailbox, const char *fo
vms_p = get_vm_state_by_mailbox(mailbox,0);
}
+ /* If URGENT, then look at INBOX */
+ if (fold == 11) {
+ fold = NEW_FOLDER;
+ urgent = 1;
+ }
+
if (!vms_p) {
ast_debug(3,"Adding new vmstate for %s\n",vmu->imapuser);
if (!(vms_p = ast_calloc(1, sizeof(*vms_p)))) {
@@ -3235,7 +3242,6 @@ static int messagecount(const char *context, const char *mailbox, const char *fo
vms_p->mailstream = NIL; /* save for access from interactive entry point */
ast_debug(3, "Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
vms_p->updated = 1;
- /* set mailbox to INBOX! */
ast_copy_string(vms_p->curbox, mbox(fold), sizeof(vms_p->curbox));
init_vm_state(vms_p);
vmstate_insert(vms_p);
@@ -3261,7 +3267,7 @@ static int messagecount(const char *context, const char *mailbox, const char *fo
pgm->seen = 1;
}
/* look for urgent messages */
- if (fold == 11) {
+ if (urgent == 1) {
pgm->flagged = 1;
pgm->unflagged = 0;
}
@@ -3270,11 +3276,11 @@ static int messagecount(const char *context, const char *mailbox, const char *fo
vms_p->vmArrayIndex = 0;
mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
- if (fold == 0)
+ if (fold == 0 && urgent == 0)
vms_p->newmessages = vms_p->vmArrayIndex;
if (fold == 1)
vms_p->oldmessages = vms_p->vmArrayIndex;
- if(fold == 11)
+ if (fold == 0 && urgent == 1)
vms_p->urgentmessages = vms_p->vmArrayIndex;
/*Freeing the searchpgm also frees the searchhdr*/
mail_free_searchpgm(&pgm);