[svn-commits] tilghman: branch 1.6.0 r255674 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 31 14:34:34 CDT 2010


Author: tilghman
Date: Wed Mar 31 14:34:30 2010
New Revision: 255674

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=255674
Log:
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/
  ........
................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=255674&r1=255673&r2=255674
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Wed Mar 31 14:34:30 2010
@@ -210,7 +210,11 @@
 
 #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
@@ -3315,14 +3319,16 @@
 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)
+		}
+
+		bio->linelength = 0;
+	}
+
+	if (putc(((unsigned char)c), so) == EOF) {
 		return -1;
+	}
 
 	bio->linelength++;
 
@@ -3382,8 +3388,9 @@
 
 	fclose(fi);
 	
-	if (fputs(eol, so) == EOF)
+	if (fputs(ENDL, so) == EOF) {
 		return 0;
+	}
 
 	return 1;
 }
@@ -3581,12 +3588,6 @@
 	size_t len_passdata = 0, len_passdata2, tmplen;
 	char *greeting_attachment;
 
-#ifdef IMAP_STORAGE
-#define ENDL "\r\n"
-#else
-#define ENDL "\n"
-#endif
-
 	/* One alloca for multiple fields */
 	len_passdata2 = strlen(vmu->fullname);
 	if (emailsubject && (tmplen = strlen(emailsubject)) > len_passdata2) {
@@ -3754,7 +3755,22 @@
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, passdata, vmlen, category);
 			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(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
@@ -3852,7 +3868,6 @@
 			unlink(newtmp);
 		}
 	}
-#undef ENDL
 }
 
 static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, const char *fromfolder, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category)




More information about the svn-commits mailing list