]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 220833 via svnmerge from
authorJeff Peeler <jpeeler@digium.com>
Tue, 29 Sep 2009 17:04:46 +0000 (17:04 +0000)
committerJeff Peeler <jpeeler@digium.com>
Tue, 29 Sep 2009 17:04:46 +0000 (17:04 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
  r220833 | jpeeler | 2009-09-29 11:58:29 -0500 (Tue, 29 Sep 2009) | 12 lines

  Make deletion of temporary greetings work properly with IMAP_STORAGE

  When imapgreetings was set to yes, the message was being deleted but wasn't
  actually being expunged. When imapgreetings was set to no, the file based
  message was not being deleted at all. All good now!

  (closes issue #14949)
  Reported by: noahisaac
  Patches:
        vm_tempgreeting_removal.patch uploaded by noahisaac (license 748),
        modified by me
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@220834 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index 6f662804eea0b8d42734f7b291d2239c80129599..d7387282ee70a867b215f0dbf6024e3cf2dafdc8 100644 (file)
@@ -147,7 +147,7 @@ AST_THREADSTORAGE(ts_vmstate);
 static int init_mailstream(struct vm_state *vms, int box);
 static void write_file(char *filename, char *buffer, unsigned long len);
 static char *get_header_by_tag(char *header, char *tag, char *buf, size_t len);
-static void vm_imap_delete(int msgnum, struct ast_vm_user *vmu);
+static void vm_imap_delete(char *file, int msgnum, struct ast_vm_user *vmu);
 static char *get_user_by_mailbox(char *mailbox, char *buf, size_t len);
 static struct vm_state *get_vm_state_by_imapuser(const char *user, int interactive);
 static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, int interactive);
@@ -455,7 +455,7 @@ static char odbc_table[80];
 #define RETRIEVE(a,b,c,d) imap_retrieve_file(a,b,c,d)
 #define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
 #define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
-#define DELETE(a,b,c,d) (vm_imap_delete(b,d))
+#define DELETE(a,b,c,d) (vm_imap_delete(a,b,d))
 #else
 #define RETRIEVE(a,b,c,d)
 #define DISPOSE(a,b)
@@ -1147,14 +1147,15 @@ static void free_user(struct ast_vm_user *vmu)
 /* All IMAP-specific functions should go in this block. This
 * keeps them from being spread out all over the code */
 #ifdef IMAP_STORAGE
-static void vm_imap_delete(int msgnum, struct ast_vm_user *vmu)
+static void vm_imap_delete(char *file, int msgnum, struct ast_vm_user *vmu)
 {
        char arg[10];
        struct vm_state *vms;
        unsigned long messageNum;
 
-       /* Greetings aren't stored in IMAP, so we can't delete them there */
-       if (msgnum < 0) {
+       /* If greetings aren't stored in IMAP, just delete the file */
+       if (msgnum < 0 && !imapgreetings) {
+               ast_filedelete(file, NULL);
                return;
        }
 
@@ -1175,6 +1176,7 @@ static void vm_imap_delete(int msgnum, struct ast_vm_user *vmu)
        snprintf(arg, sizeof(arg), "%lu", messageNum);
        ast_mutex_lock(&vms->lock);
        mail_setflag(vms->mailstream, arg, "\\DELETED");
+       mail_expunge(vms->mailstream);
        ast_mutex_unlock(&vms->lock);
 }