[asterisk-commits] mogorman: trunk r42491 -
/trunk/apps/app_voicemail.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Sep 8 15:54:29 MST 2006
Author: mogorman
Date: Fri Sep 8 17:54:28 2006
New Revision: 42491
URL: http://svn.digium.com/view/asterisk?rev=42491&view=rev
Log:
Get rid of ugly tmp directory, although I really should
fix the way imap accesses its temporary voice files.
Modified:
trunk/apps/app_voicemail.c
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=42491&r1=42490&r2=42491&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri Sep 8 17:54:28 2006
@@ -124,8 +124,6 @@
static int make_gsm_file(char *dest, char *imapuser, char *dir, int num);
static void get_mailbox_delimiter(MAILSTREAM *stream);
static void mm_parsequota (MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pquota);
-/* should define TMP in config file... */
-#define TMP "/tmp"
struct vmstate {
struct vm_state *vms;
struct vmstate *next;
@@ -2882,7 +2880,7 @@
/* here is a big difference! We add one to it later */
msgnum = newmsgs + oldmsgs;
ast_log(LOG_NOTICE, "Messagecount set to %d\n",msgnum);
- sprintf(fn, "%s/msg%s%04d", TMP, vmu->mailbox, msgnum);
+ snprintf(fn, sizeof(fn), "%s/imap/msg%s%04d", VM_SPOOL_DIR, vmu->mailbox, msgnum);
/* set variable for compatability */
pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", "IMAP_STORAGE");
@@ -3722,7 +3720,7 @@
const char *category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY");
#ifdef IMAP_STORAGE
- stpcpy(todir,TMP);
+ snprintf(todir, sizeof(todir), "%s/imap",VM_SPOOL_DIR);
sprintf(fn, "%s/msg%s%04d", todir, vmu->mailbox, msgnum);
#else
make_dir(todir, sizeof(todir), vmu->context, vmu->mailbox, "INBOX");
@@ -3968,8 +3966,8 @@
ast_log (LOG_DEBUG,"**** format set to %s, vmfmts set to %s\n",fmt,vmfmts);
/* ast_copy_string(fmt, vmfmts, sizeof(fmt));*/
/* if (!ast_strlen_zero(fmt)) { */
-
- make_gsm_file(vms->fn, vms->imapuser, TMP, vms->curmsg);
+ snprintf(todir, sizeof(todir), "%s/imap", VM_SPOOL_DIR);
+ make_gsm_file(vms->fn, vms->imapuser, 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); */
@@ -3983,7 +3981,6 @@
myserveremail = vmtmp->serveremail;
int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
attach_user_voicemail = ast_test_flag(vmtmp, VM_ATTACH);
- stpcpy(todir,TMP);
sprintf(fn, "%s/%s/msg%04d", todir, vms->imapuser, vms->curmsg);
/* NULL category for IMAP storage */
sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox, chan->cid.cid_num, chan->cid.cid_name, fn, fmt, duration, attach_user_voicemail, chan, NULL);
@@ -4299,7 +4296,7 @@
char origtime[32];
char duration[16];
char category[32];
-
+ char todir[256];
int res = 0;
char *temp;
@@ -4318,8 +4315,8 @@
ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
return -1;
}
-
- make_gsm_file(vms->fn, vms->imapuser,TMP, vms->curmsg);
+ snprintf(todir, sizeof(todir), "%s/imap", VM_SPOOL_DIR);
+ make_gsm_file(vms->fn, vms->imapuser, todir, vms->curmsg);
mail_fetchstructure (vms->mailstream,vms->msgArray[vms->curmsg],&body);
save_body(body,vms,"3","gsm");
@@ -4398,7 +4395,6 @@
res = 0;
if (!res) {
- /* make_file(vms->fn, sizeof(vms->fn), TMP, vms->curmsg); */
vms->heard[vms->curmsg] = 1;
res = wait_file(chan, vms, vms->fn);
}
More information about the asterisk-commits
mailing list