From a87514cc02639b9efe78b876c1d215ffe6323d01 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Thu, 20 Sep 2007 15:23:27 +0000 Subject: [PATCH] minor fix to mmsbox --- mbuni/mmsbox/bearerbox.c | 1 - mbuni/mmsbox/mmsbox_cfg.c | 18 +++++++++++------- mbuni/mmsbox/mmsbox_resolve_shell.c | 7 ++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 9015bd9..9aebdcd 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -202,7 +202,6 @@ static void mm7soap_receive(MmsHTTPClientInfo *h) octstr_destroy(sx); } - qf = qfs->mms_queue_add(from, to, subject, h->m->id, mmc_id, delivert, expiryt, m, linkedid, diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index a91bfc8..c3b6bfb 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -485,17 +485,20 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m, Octstr **mmc_id) { if (m->reroute) { - *mmc_id = octstr_duplicate(m->reroute_mmsc_id); + *mmc_id = m->reroute_mmsc_id ? octstr_duplicate(m->reroute_mmsc_id) : NULL; return outgoing_qdir; } else { - Octstr *_mcid, *fto = NULL, *qdir = NULL; + Octstr *_mcid, *qdir = NULL; if (gwlist_len(to) > 0) { /* we route based on first recipient XXX */ - Octstr *r = gwlist_get(to, 0); - fto = r ? octstr_duplicate(r) : NULL; - } + Octstr *fto = gwlist_extract_first(to); + + normalize_number(octstr_get_cstr(unified_prefix), &fto); + _mcid = rfs->mmsbox_resolve(from,fto,octstr_get_cstr(m->id), rfs_data, rfs_settings); - _mcid = rfs->mmsbox_resolve(from,fto,octstr_get_cstr(m->id), rfs_data, rfs_settings); + gwlist_insert(to, 0, fto); /* put it back, after modification. */ + } else + _mcid = NULL; if (_mcid == NULL || octstr_len(_mcid) == 0) { *mmc_id = NULL; @@ -504,8 +507,9 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m, *mmc_id = octstr_duplicate(_mcid); qdir = outgoing_qdir; } + octstr_destroy(_mcid); - octstr_destroy(fto); + return qdir; } return 0; diff --git a/mbuni/mmsbox/mmsbox_resolve_shell.c b/mbuni/mmsbox/mmsbox_resolve_shell.c index 9009df2..1c006b4 100644 --- a/mbuni/mmsbox/mmsbox_resolve_shell.c +++ b/mbuni/mmsbox/mmsbox_resolve_shell.c @@ -30,7 +30,7 @@ static int _shell_resolvermodule_fini(void *module_data) return 0; } -static Octstr *_shell_resolve(Octstr *pfrom, Octstr *pto, void *module_data, void *settings_p) +static Octstr *_shell_resolve(Octstr *pfrom, Octstr *pto, char *in_mmc, void *module_data, void *settings_p) { Octstr *s; FILE *fp; @@ -39,8 +39,9 @@ static Octstr *_shell_resolve(Octstr *pfrom, Octstr *pto, void *module_data, voi if (script == NULL || octstr_len(script) == 0) return 0; - s = octstr_format("%s '%s' '%s' ", - octstr_get_cstr(script), octstr_get_cstr(pfrom), octstr_get_cstr(pto)); + s = octstr_format("%s '%s' '%s' '%s'", + octstr_get_cstr(script), octstr_get_cstr(pfrom), octstr_get_cstr(pto), + in_mmc); fp = popen(octstr_get_cstr(s), "r"); octstr_destroy(s);