From 3d59903562fa80647818e0b2f138f458843c974f Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Thu, 19 Jul 2007 19:45:24 +0000 Subject: [PATCH] minor fixes re filtering --- mbuni/mmlib/mms_cfg.def | 1 + mbuni/mmsbox/mmsbox.c | 14 ++++++++++++++ mbuni/mmsbox/mmsbox_cfg.c | 5 ++++- mbuni/mmsbox/mmsbox_cfg.h | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mbuni/mmlib/mms_cfg.def b/mbuni/mmlib/mms_cfg.def index 324380f..1c9065b 100644 --- a/mbuni/mmlib/mms_cfg.def +++ b/mbuni/mmlib/mms_cfg.def @@ -86,6 +86,7 @@ SINGLE_GROUP(mbuni, OCTSTR(sendmms-port-ssl) OCTSTR(mmsbox-mt-filter-library) + OCTSTR(mmsbox-mt-always-multipart) ) MULTI_GROUP(mmsproxy, diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index e93fe7a..0f935f0 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -964,6 +964,20 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, if (mt_filter && mmc) /* filter it too. */ mt_filter->filter(&me, msg_url, mmc); + + if (mt_multipart && + octstr_case_search(ctype, octstr_imm("multipart/"), 0) != 0) { /* requires multipart but this one is not, wrap it */ + MIMEEntity *xm = mime_entity_create(); + List *h1 = http_create_empty_headers(); + + http_header_add(h1, "Content-Type", "multipart/related"); + mime_replace_headers(xm, h1); + mime_entity_add_part(xm, me); + + http_destroy_headers(h1); + + me = xm; + } } diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index f180f80..73fdf6a 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -32,6 +32,7 @@ long mmsbox_maxsendattempts, mmsbox_send_back_off; long maxthreads = 0; double queue_interval = -1; Octstr *unified_prefix; +int mt_multipart = 0; struct SendMmsPortInfo sendmms_port; @@ -159,7 +160,9 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func) /* load the filter if any. */ if ((mt_filter = load_module(grp, "mmsbox-mt-filter-library", "mmsbox_mt_filter")) != NULL) info(0, "MMSBox: Loaded MT Filter [%s]", mt_filter->name); - + + mms_cfg_get_bool(grp, octstr_imm("mmsbox-mt-always-multipart"), &mt_multipart); + /* Now get sendmms users. */ l = mms_cfg_get_multi(cfg, octstr_imm("send-mms-user")); diff --git a/mbuni/mmsbox/mmsbox_cfg.h b/mbuni/mmsbox/mmsbox_cfg.h index ed5033a..12815eb 100644 --- a/mbuni/mmsbox/mmsbox_cfg.h +++ b/mbuni/mmsbox/mmsbox_cfg.h @@ -87,6 +87,7 @@ extern struct SendMmsPortInfo { } sendmms_port; extern struct MmsBoxMTfilter *mt_filter; +extern int mt_multipart; extern int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func); extern MmscGrp *get_handler_mmc(Octstr *id, Octstr *to); #endif