From 025c3f507bd7173015ed5ca574702f846025de06 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 1 Jul 2005 05:54:35 +0000 Subject: [PATCH] mime conversion bug affecting content adaption fixed --- mbuni/mmlib/Makefile.in | 2 +- mbuni/mmlib/mms_mm7soap.c | 2 +- mbuni/mmlib/mms_msg.c | 6 ++++-- mbuni/mmlib/mms_msg.h | 7 +++++-- mbuni/mmlib/mms_uaprof.c | 14 +++----------- mbuni/mmlib/mms_uaprof.h | 2 +- mbuni/mmlib/mms_util.c | 4 ++-- 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/mbuni/mmlib/Makefile.in b/mbuni/mmlib/Makefile.in index 6d6060f..4949b7c 100644 --- a/mbuni/mmlib/Makefile.in +++ b/mbuni/mmlib/Makefile.in @@ -197,7 +197,7 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libmms.a -libmms_a_SOURCES = mms_mmbox.h mms_mmbox.c mms_billing.c mms_billing.h mms_msg.c mms_msg.h mms_queue.c mms_queue.h mms_strings.c mms_strings.h mms_uaprof.c mms_uaprof.h mms_util.c mms_util.h mms_resolve.h mms_resolve.c mms_mm7soap.c mms_detokenize.h +libmms_a_SOURCES = mms_mmbox.h mms_mmbox.c mms_billing.c mms_billing.h mms_msg.c mms_msg.h mms_queue.c mms_queue.h mms_strings.c mms_strings.h mms_uaprof.c mms_uaprof.h mms_util.c mms_util.h mms_resolve.h mms_resolve.c mms_mm7soap.c mms_detokenize.h mms_mm7soap.h plugindir = $(libdir)/mbuni plugin_LTLIBRARIES = libmms_billing_shell.la libmms_resolve_shell.la libmms_detokenize_shell.la libmms_billing_shell_la_SOURCES = mms_billing_shell.c diff --git a/mbuni/mmlib/mms_mm7soap.c b/mbuni/mmlib/mms_mm7soap.c index df4833f..4298199 100644 --- a/mbuni/mmlib/mms_mm7soap.c +++ b/mbuni/mmlib/mms_mm7soap.c @@ -860,7 +860,7 @@ MSoapMsg_t *mm7_mmsmsg_to_soap(MmsMsg *msg, Octstr *from, List *xto, case MMS_MSGTYPE_SEND_REQ: case MMS_MSGTYPE_RETRIEVE_CONF: m = mm7_soap_create(MM7_TAG_DeliverReq, transid); - m->msg = mms_tomime(msg); + m->msg = mms_tomime(msg,1); for (i = 0, n = xto ? list_len(xto) : 0; i < n; i++) { /* Add recipients. */ Octstr *xx = octstr_format("+ %S", list_get(xto, i)); diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index f817b47..e39438e 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -1232,7 +1232,7 @@ static void unconvert_mime_msg(MIMEEntity *m) } -MIMEEntity *mms_tomime(MmsMsg *msg) +MIMEEntity *mms_tomime(MmsMsg *msg, int base64) { MIMEEntity *m = gw_malloc(sizeof *m); int i, n; @@ -1253,7 +1253,8 @@ MIMEEntity *mms_tomime(MmsMsg *msg) } } convert_mime_msg(m); - base64_mimeparts(m); + if (base64) + base64_mimeparts(m); return m; } @@ -1472,6 +1473,7 @@ MmsMsg *mms_notification(MmsMsg *msg, unsigned int msize, Octstr *url, } else if (d) \ http_header_add(m->headers, #h, d); \ } while(0) + if (!optimizesize) { HX(From,NULL); HX(Subject,NULL); diff --git a/mbuni/mmlib/mms_msg.h b/mbuni/mmlib/mms_msg.h index 2190590..a36b3f5 100644 --- a/mbuni/mmlib/mms_msg.h +++ b/mbuni/mmlib/mms_msg.h @@ -44,9 +44,12 @@ extern int mms_messagetype(MmsMsg *msg); /* * Convert Mms Message to standard Mime entity. - * Does not recode any of the body parts. + * Does base64 encoding of binary parts if base64 is true + */ +extern MIMEEntity *mms_tomime(MmsMsg *msg, int base64); +/* + * De-convert from mime. */ -extern MIMEEntity *mms_tomime(MmsMsg *msg); extern MmsMsg *mms_frommime(MIMEEntity *mime); extern void mms_msgdump(MmsMsg *m, int headers_only); diff --git a/mbuni/mmlib/mms_uaprof.c b/mbuni/mmlib/mms_uaprof.c index 7fb4830..38960ce 100644 --- a/mbuni/mmlib/mms_uaprof.c +++ b/mbuni/mmlib/mms_uaprof.c @@ -1002,14 +1002,8 @@ int mms_transform_msg(MmsMsg *inmsg, MmsUaProfile *prof, MmsMsg **outmsg) else if (!prof->ccppaccept.content) return -2; - m = mms_tomime(inmsg); - -#if 0 - mms_msgdump(inmsg); - debug("MMS UA PROF", 0, "### in ua prof"); - mime_entity_dump(m); -#endif - + m = mms_tomime(inmsg,0); + modify_msg(m, prof); *outmsg = mms_frommime(m); @@ -1318,7 +1312,7 @@ int mms_format_special(MmsMsg *inmsg, char *txtmsg, char *htmlmsg, MIMEEntity **outmsg) { - MIMEEntity *m = mms_tomime(inmsg); + MIMEEntity *m = mms_tomime(inmsg,0); int ct = 0; if (!m) @@ -1327,9 +1321,7 @@ int mms_format_special(MmsMsg *inmsg, format_special(m, trans_smil, txtmsg, htmlmsg, &ct); *outmsg = m; - return 0; - } extern unsigned long mms_ua_maxmsgsize(MmsUaProfile *prof) diff --git a/mbuni/mmlib/mms_uaprof.h b/mbuni/mmlib/mms_uaprof.h index bcd3d88..bfc1312 100644 --- a/mbuni/mmlib/mms_uaprof.h +++ b/mbuni/mmlib/mms_uaprof.h @@ -42,7 +42,7 @@ extern int mms_transform_msg(MmsMsg *inmsg, MmsUaProfile *prof, MmsMsg **outmsg) /* Transforms the mms into a more 'readable' format: * SMIL is turned into html (with an alternative of text) if trans_smil is set, - * image and audio changed to email preferred formats. + * image and audio changed to email preferred formats. Does not base64 mime parts of result! */ extern int mms_format_special(MmsMsg *inmsg, int trans_smil, diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index a1078ec..c35d557 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -995,7 +995,7 @@ int mms_sendtoemail(Octstr *from, Octstr *to, } if (!trans_msg) - m = mms_tomime(msg); + m = mms_tomime(msg,0); else if ((ret = mms_format_special(msg, trans_smil, txt, html, &m)) < 0 || m == NULL) { @@ -1004,7 +1004,7 @@ int mms_sendtoemail(Octstr *from, Octstr *to, return -ret; } - base64_mimeparts(m); + base64_mimeparts(m); /* make sure parts are base64 formatted. */ /* Before we send it, we insert some email friendly headers if they are missing. */ http_header_add(newhdrs, "Subject", subject ? octstr_get_cstr(subject) : "MMS Message");