All pastes #369131 Raw Edit

Mine

public text v1 · immutable
#369131 ·published 2007-02-23 16:18 UTC
rendered paste body
--- apps/app_voicemail.c        2007-02-22 00:42:49.000000000 -0500
+++ apps/app_voicemail.c        2007-02-22 22:01:33.000000000 -0500
@@ -1870,7 +1870,7 @@
        }
        snprintf(dur, sizeof(dur), "%d:%02d", duration / 60, duration % 60);
        strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", vmu_tm(vmu, &tm));
-       fprintf(p, "Date: %s\r\n", date);
+       fprintf(p, "Date: %s\n", date);
 
        /* Set date format for voicemail mail */
        strftime(date, sizeof(date), emaildateformat, &tm);
@@ -1884,15 +1884,15 @@
                                memset(passdata, 0, vmlen);
                                prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
                                pbx_substitute_variables_helper(ast, fromstring, passdata, vmlen);
-                               fprintf(p, "From: %s <%s>\r\n", passdata, who);
+                               fprintf(p, "From: %s <%s>\n", passdata, who);
                        } else
                                ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
                        ast_channel_free(ast);
                } else
                        ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
        } else
-               fprintf(p, "From: Asterisk PBX <%s>\r\n", who);
-       fprintf(p, "To: %s <%s>\r\n", vmu->fullname, vmu->email);
+               fprintf(p, "From: Asterisk PBX <%s>\n", who);
+       fprintf(p, "To: %s <%s>\n", vmu->fullname, vmu->email);
        if (emailsubject) {
                struct ast_channel *ast;
                if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, 0))) {
@@ -1902,7 +1902,7 @@
                                memset(passdata, 0, vmlen);
                                prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
                                pbx_substitute_variables_helper(ast, emailsubject, passdata, vmlen);
-                               fprintf(p, "Subject: %s\r\n", passdata);
+                               fprintf(p, "Subject: %s\n", passdata);
                        } else
                                ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
                        ast_channel_free(ast);
@@ -1910,43 +1910,43 @@
                        ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
        } else  if (*emailtitle) {
                fprintf(p, emailtitle, msgnum + 1, mailbox) ;
-               fprintf(p,"\r\n") ;
+               fprintf(p,"\n") ;
        } else if (ast_test_flag((&globalflags), VM_PBXSKIP))
-               fprintf(p, "Subject: New message %d in mailbox %s\r\n", msgnum + 1, mailbox);
+               fprintf(p, "Subject: New message %d in mailbox %s\n", msgnum + 1, mailbox);
        else
-               fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\r\n", msgnum + 1, mailbox);
-       fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\r\n", msgnum, (unsigned int)ast_random(), mailbox, getpid(), host);
+               fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum + 1, mailbox);
+       fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)ast_random(), mailbox, getpid(), host);
        if(imap) {
                /* additional information needed for IMAP searching */
-               fprintf(p, "X-Asterisk-VM-Message-Num: %d\r\n", msgnum + 1);
-               /* fprintf(p, "X-Asterisk-VM-Orig-Mailbox: %s\r\n", ext); */
-               fprintf(p, "X-Asterisk-VM-Server-Name: %s\r\n", fromstring);
-               fprintf(p, "X-Asterisk-VM-Context: %s\r\n", context);
-               fprintf(p, "X-Asterisk-VM-Extension: %s\r\n", mailbox);
-               fprintf(p, "X-Asterisk-VM-Priority: %d\r\n", chan->priority);
-               fprintf(p, "X-Asterisk-VM-Caller-channel: %s\r\n", chan->name);
-               fprintf(p, "X-Asterisk-VM-Caller-ID-Num: %s\r\n", cidnum);
-               fprintf(p, "X-Asterisk-VM-Caller-ID-Name: %s\r\n", cidname);
-               fprintf(p, "X-Asterisk-VM-Duration: %d\r\n", duration);
+               fprintf(p, "X-Asterisk-VM-Message-Num: %d\n", msgnum + 1);
+               /* fprintf(p, "X-Asterisk-VM-Orig-Mailbox: %s\n", ext); */
+               fprintf(p, "X-Asterisk-VM-Server-Name: %s\n", fromstring);
+               fprintf(p, "X-Asterisk-VM-Context: %s\n", context);
+               fprintf(p, "X-Asterisk-VM-Extension: %s\n", mailbox);
+               fprintf(p, "X-Asterisk-VM-Priority: %d\n", chan->priority);
+               fprintf(p, "X-Asterisk-VM-Caller-channel: %s\n", chan->name);
+               fprintf(p, "X-Asterisk-VM-Caller-ID-Num: %s\n", cidnum);
+               fprintf(p, "X-Asterisk-VM-Caller-ID-Name: %s\n", cidname);
+               fprintf(p, "X-Asterisk-VM-Duration: %d\n", duration);
                if (!ast_strlen_zero(category))
-                       fprintf(p, "X-Asterisk-VM-Category: %s\r\n", category);
-               fprintf(p, "X-Asterisk-VM-Orig-date: %s\r\n", date);
-               fprintf(p, "X-Asterisk-VM-Orig-time: %ld\r\n", (long)time(NULL));
+                       fprintf(p, "X-Asterisk-VM-Category: %s\n", category);
+               fprintf(p, "X-Asterisk-VM-Orig-date: %s\n", date);
+               fprintf(p, "X-Asterisk-VM-Orig-time: %ld\n", (long)time(NULL));
        }
        if (!ast_strlen_zero(cidnum))
-               fprintf(p, "X-Asterisk-CallerID: %s\r\n", cidnum);
+               fprintf(p, "X-Asterisk-CallerID: %s\n", cidnum);
        if (!ast_strlen_zero(cidname))
-               fprintf(p, "X-Asterisk-CallerIDName: %s\r\n", cidname);
-       fprintf(p, "MIME-Version: 1.0\r\n");
+               fprintf(p, "X-Asterisk-CallerIDName: %s\n", cidname);
+       fprintf(p, "MIME-Version: 1.0\n");
        if (attach_user_voicemail) {
                /* Something unique. */
                snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)ast_random());
 
-               fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\r\n\r\n\r\n", bound);
+               fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
 
-               fprintf(p, "--%s\r\n", bound);
+               fprintf(p, "--%s\n", bound);
        }
-       fprintf(p, "Content-Type: text/plain; charset=%s\r\nContent-Transfer-Encoding: 8bit\r\n\r\n", charset);
+       fprintf(p, "Content-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n\n", charset);
        if (emailbody) {
                struct ast_channel *ast;
                if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, 0))) {
@@ -1956,17 +1956,17 @@
                                memset(passdata, 0, vmlen);
                                prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
                                pbx_substitute_variables_helper(ast, emailbody, passdata, vmlen);
-                               fprintf(p, "%s\r\n", passdata);
+                               fprintf(p, "%s\n", passdata);
                        } else
                                ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
                        ast_channel_free(ast);
                } else
                        ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
        } else {
-               fprintf(p, "Dear %s:\r\n\r\n\tJust wanted to let you know you were just left a %s long message (number %d)\r\n"
+               fprintf(p, "Dear %s:\n\n\tJust wanted to let you know you were just left a %s long message (number %d)\n"
 
-               "in mailbox %s from %s, on %s so you might\r\n"
-               "want to check it when you get a chance.  Thanks!\r\n\r\n\t\t\t\t--Asterisk\r\n\r\n", vmu->fullname, 
+               "in mailbox %s from %s, on %s so you might\n"
+               "want to check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n\n", vmu->fullname, 
                dur, msgnum + 1, mailbox, (cidname ? cidname : (cidnum ? cidnum : "an unknown caller")), date);
        }
        if (attach_user_voicemail) {
@@ -1985,24 +1985,24 @@
                        attach = newtmp;
                        ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
                }
-               fprintf(p, "--%s\r\n", bound);
-               fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"\r\n", ctype, format, msgnum, format);
-               fprintf(p, "Content-Transfer-Encoding: base64\r\n");
-               fprintf(p, "Content-Description: Voicemail sound attachment.\r\n");
-               fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.%s\"\r\n\r\n", msgnum, format);
+               fprintf(p, "--%s\n", bound);
+               fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"\n", ctype, format, msgnum, format);
+               fprintf(p, "Content-Transfer-Encoding: base64\n");
+               fprintf(p, "Content-Description: Voicemail sound attachment.\n");
+               fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.%s\"\n\n", msgnum, format);
                snprintf(fname, sizeof(fname), "%s.%s", attach, format);
                base_encode(fname, p);
                /* only attach if necessary */
                if (imap && strcmp(format, "gsm")) {
-                       fprintf(p, "--%s\r\n", bound);
-                       fprintf(p, "Content-Type: audio/x-gsm; name=\"msg%04d.%s\"\r\n", msgnum, format);
-                       fprintf(p, "Content-Transfer-Encoding: base64\r\n");
-                       fprintf(p, "Content-Description: Voicemail sound attachment.\r\n");
-                       fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.gsm\"\r\n\r\n", msgnum);
+                       fprintf(p, "--%s\n", bound);
+                       fprintf(p, "Content-Type: audio/x-gsm; name=\"msg%04d.%s\"\n", msgnum, format);
+                       fprintf(p, "Content-Transfer-Encoding: base64\n");
+                       fprintf(p, "Content-Description: Voicemail sound attachment.\n");
+                       fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.gsm\"\n\n", msgnum);
                        snprintf(fname, sizeof(fname), "%s.gsm", attach);
                        base_encode(fname, p);
                }
-               fprintf(p, "\r\n\r\n--%s--\r\n.\r\n", bound);
+               fprintf(p, "\n\n--%s--\n.\n", bound);
                if (tmpfd > -1)
                        close(tmpfd);
                unlink(newtmp);