aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-31 19:34:39 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-31 19:34:39 +0000
commit1ef3826c19d65e903314b6062252a992ca974174 (patch)
tree9e707e3dc006812741c7cbbfc42cf474295350b6 /apps
parent0555cf9687986807464fc857789b531561002eff (diff)
Recorded merge of revisions 255592 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r255592 | tilghman | 2010-03-31 14:13:02 -0500 (Wed, 31 Mar 2010) | 22 lines Recorded merge of revisions 255591 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r255591 | tilghman | 2010-03-31 14:09:46 -0500 (Wed, 31 Mar 2010) | 15 lines Ensure line terminators in email are consistent. Fixes an issue with certain Mail Transport Agents, where attachments are not interpreted correctly. (closes issue #16557) Reported by: jcovert Patches: 20100308__issue16557__1.4.diff.txt uploaded by tilghman (license 14) 20100308__issue16557__1.6.0.diff.txt uploaded by tilghman (license 14) 20100308__issue16557__trunk.diff.txt uploaded by tilghman (license 14) Tested by: ebroad, zktech Reviewboard: https://reviewboard.asterisk.org/r/544/ ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@255675 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index c6b07a3a5..d9b26eb18 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -214,7 +214,11 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
#define BASELINELEN 72
#define BASEMAXINLINE 256
-#define eol "\r\n"
+#ifdef IMAP_STORAGE
+#define ENDL "\r\n"
+#else
+#define ENDL "\n"
+#endif
#define MAX_DATETIME_FORMAT 512
#define MAX_NUM_CID_CONTEXTS 10
@@ -3769,14 +3773,16 @@ static int inchar(struct baseio *bio, FILE *fi)
static int ochar(struct baseio *bio, int c, FILE *so)
{
if (bio->linelength >= BASELINELEN) {
- if (fputs(eol,so) == EOF)
+ if (fputs(ENDL, so) == EOF) {
return -1;
+ }
bio->linelength= 0;
}
- if (putc(((unsigned char)c),so) == EOF)
+ if (putc(((unsigned char) c), so) == EOF) {
return -1;
+ }
bio->linelength++;
@@ -3845,8 +3851,9 @@ static int base_encode(char *filename, FILE *so)
fclose(fi);
- if (fputs(eol,so)==EOF)
+ if (fputs(ENDL, so) == EOF) {
return 0;
+ }
return 1;
}
@@ -4051,11 +4058,6 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
char *greeting_attachment;
char filename[256];
-#ifdef IMAP_STORAGE
-#define ENDL "\r\n"
-#else
-#define ENDL "\n"
-#endif
/* One alloca for multiple fields */
len_passdata2 = strlen(vmu->fullname);
@@ -4234,7 +4236,22 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
memset(passdata, 0, vmlen);
prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, passdata, vmlen, category, flag);
pbx_substitute_variables_helper(ast, emailbody, passdata, vmlen);
+#ifdef IMAP_STORAGE
+ {
+ /* Convert body to native line terminators for IMAP backend */
+ char *line = passdata, *next;
+ do {
+ /* Terminate line before outputting it to the file */
+ if ((next = strchr(line, '\n'))) {
+ *next++ = '\0';
+ }
+ fprintf(p, "%s" ENDL, line);
+ line = next;
+ } while (!ast_strlen_zero(line));
+ }
+#else
fprintf(p, "%s" ENDL, passdata);
+#endif
ast_channel_free(ast);
} else
ast_log(AST_LOG_WARNING, "Cannot allocate the channel for variables substitution\n");