1
0
Fork 0

added reroute-add-sender flag to mmsbox config

This commit is contained in:
bagyenda 2007-11-07 07:53:29 +00:00
parent a69feb2eb9
commit c58cfafec5
7 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,5 @@
2007-11-07 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added reroute-add-sender-to-subject config param for MMSBox
2007-09-25 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added flag to conditionally remove mm7: XML namespace prefix
2007-09-18 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -2367,6 +2367,20 @@ string
</td>
</tr>
<tr>
<td valign=top >
<tt>reroute-add-sender-to-subject</tt>
</td>
<td valign=top >
Boolean
</td>
<td valign=top >
If <tt>reroute</tt> is <tt>true</tt> and this flag is also true then all messages
received on this connection are re-routed, and the original sender
is added to the message subject line
</td>
</tr>
<tr>
<td valign=top >
<tt>mm7-mt-filter-params</tt>

View File

@ -142,6 +142,7 @@ MULTI_GROUP(mmsc,
OCTSTR(mm7-mt-filter-params)
OCTSTR(reroute)
OCTSTR(reroute-mmsc-id)
OCTSTR(reroute-add-sender-to-subject)
OCTSTR(mmsc-library)
OCTSTR(custom-settings)
)

View File

@ -25,6 +25,20 @@
#include "mmsbox.h"
#define MOD_SUBJECT(msg, mmc,xfrom) do { \
if ((mmc)->reroute_mod_subject) { \
Octstr *s = mms_get_header_value((msg),octstr_imm("Subject")); \
Octstr *f = octstr_duplicate(xfrom); \
int _i; \
if (s == NULL) s = octstr_create(""); \
if ((_i = octstr_search(f, octstr_imm("/TYPE="), 0)) >= 0) \
octstr_delete(f, _i, octstr_len(f)); \
octstr_format_append(s, " (from %S)", (f)); \
mms_replace_header_value((msg), "Subject", octstr_get_cstr(s)); \
octstr_destroy(s); octstr_destroy(f); \
} \
} while(0)
typedef struct MmsHTTPClientInfo {
HTTPClient *client;
Octstr *ua;
@ -166,7 +180,8 @@ static void mm7soap_receive(MmsHTTPClientInfo *h)
goto done;
}
mm7_get_envelope(mreq, &from, &to, &subject, &vasid, &expiryt, &delivert, &uaprof, &uaprof_tstamp);
mm7_get_envelope(mreq, &from, &to, &subject, &vasid,
&expiryt, &delivert, &uaprof, &uaprof_tstamp);
if (!from)
from = octstr_imm("anon@anon");
@ -202,6 +217,8 @@ static void mm7soap_receive(MmsHTTPClientInfo *h)
octstr_destroy(sx);
}
MOD_SUBJECT(m, h->m, from);
qf = qfs->mms_queue_add(from, to, subject,
h->m->id, mmc_id,
delivert, expiryt, m, linkedid,
@ -434,6 +451,8 @@ static void mm7eaif_receive(MmsHTTPClientInfo *h)
mms_remove_headers(m, "X-Mms-Expiry");
mms_remove_headers(m, "X-Mms-Sender-Visibility");
MOD_SUBJECT(m, h->m, hfrom);
/* Save it, put message id in header, return. */
qf = qfs->mms_queue_add(hfrom, to, subject,
h->m->id, mmc_id,

View File

@ -269,6 +269,7 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
m->use_mt_filter = 0;
mms_cfg_get_bool(x, octstr_imm("reroute"), &m->reroute);
mms_cfg_get_bool(x, octstr_imm("reroute-add-sender-to-subject"), &m->reroute_mod_subject);
m->reroute_mmsc_id = mms_cfg_get(x, octstr_imm("reroute-mmsc-id"));
if (m->reroute_mmsc_id != NULL && m->reroute == 0)
warning(0, "MMSBox: reroute-mmsc-id parameter set but reroute=false!");

View File

@ -36,6 +36,8 @@ typedef struct MmscGrp {
int reroute; /* whether messages from this mmsc are re-routed outwards. */
Octstr *reroute_mmsc_id;
int reroute_mod_subject; /* Set to true if we'll change subject line on reroute. */
MM7Version_t ver; /* supported MM7/SOAP version. */
int use_mt_filter; /* whether to use MT filter on this connection. */
Mutex *mutex;

View File

@ -36,6 +36,7 @@ typedef struct MmsResolverFuncStruct {
Octstr *(*mms_resolve)(Octstr * phonenum, void *module_data, void *settings, void *proxyrelays);
int (*mms_resolvermodule_fini)(void *module_data);
} MmsResolverFuncStruct;
extern MmsResolverFuncStruct mms_resolvefuncs; /* The module must expose this symbol. */