[asterisk-commits] mmichelson: branch mmichelson/imap_consistency r129682 - /team/mmichelson/ima...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 10 13:59:25 CDT 2008


Author: mmichelson
Date: Thu Jul 10 13:59:24 2008
New Revision: 129682

URL: http://svn.digium.com/view/asterisk?view=rev&rev=129682
Log:
Changed instances of make_gsm_file to make_file.

Why? Well, for one thing they accomplish the 
same task except that make_gsm_file for some 
silly reason had a call to mkdir() in it...and 
it more or less ignored the return value of 
the mkdir() call.

Also, make_gsm_file had absolutely _nothing_ 
at all to do with gsm whatsoever so its name 
was just plain stupid and misleading.

Furthermore, the mode in the mkdir() call was
set to 01777. This seems overly silly to me.

Oh, and for some reason, an unused "imapuser"
string was passed to make_gsm_file.

Good riddance!
</rant>


Modified:
    team/mmichelson/imap_consistency/apps/app_voicemail.c

Modified: team/mmichelson/imap_consistency/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/imap_consistency/apps/app_voicemail.c?view=diff&rev=129682&r1=129681&r2=129682
==============================================================================
--- team/mmichelson/imap_consistency/apps/app_voicemail.c (original)
+++ team/mmichelson/imap_consistency/apps/app_voicemail.c Thu Jul 10 13:59:24 2008
@@ -138,7 +138,6 @@
 static void init_vm_state(struct vm_state *vms);
 static void copy_msgArray(struct vm_state *dst, struct vm_state *src);
 static int save_body(BODY *body, struct vm_state *vms, char *section, char *format);
-static int make_gsm_file(char *dest, size_t len, char *imapuser, char *dir, int num);
 static void get_mailbox_delimiter(MAILSTREAM *stream);
 static void mm_parsequota (MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pquota);
 static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int box, int target);
@@ -898,15 +897,6 @@
 }
 
 #ifdef IMAP_STORAGE
-static int make_gsm_file(char *dest, size_t len, char *imapuser, char *dir, int num)
-{
-	if (mkdir(dir, 01777) && (errno != EEXIST)) {
-		ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dir, strerror(errno));
-		return snprintf(dest, len, "%s/msg%04d", dir, num);
-	}
-	return snprintf(dest, len, "%s/msg%04d", dir, num);
-}
-
 static void vm_imap_delete(int msgnum, struct vm_state *vms)
 {
 	unsigned long messageNum = 0;
@@ -1702,7 +1692,7 @@
 		return -1;
 	}
 	snprintf(todir, sizeof(todir), "%s%s/%s/tmp", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
-	make_gsm_file(vms->fn, sizeof(vms->fn), vms->imapuser, todir, msgnum);
+	make_file(vms->fn, sizeof(vms->fn), todir, msgnum);
 
 	mail_fetchstructure (vms->mailstream,vms->msgArray[msgnum],&body);
 	
@@ -4379,7 +4369,7 @@
 				/* ast_copy_string(fmt, vmfmts, sizeof(fmt));*/
 				/* if (!ast_strlen_zero(fmt)) { */
 				snprintf(todir, sizeof(todir), "%s%s/%s/tmp", VM_SPOOL_DIR, vmtmp->context, vmtmp->mailbox);
-				make_gsm_file(vms->fn, sizeof(vms->fn), vms->imapuser, todir, vms->curmsg);
+				make_file(vms->fn, sizeof(vms->fn), todir, vms->curmsg);
 				if (option_debug > 2)
 					ast_log (LOG_DEBUG,"Before mail_fetchstructure, message number is %ld, filename is:%s\n",vms->msgArray[vms->curmsg], vms->fn);
 				/*mail_fetchstructure (mailstream, vmArray[0], &body); */




More information about the asterisk-commits mailing list