1
0
Fork 0

minor fix to message routing

This commit is contained in:
bagyenda 2008-01-01 06:45:16 +00:00
parent fcad678f3c
commit 9748e88621
1 changed files with 20 additions and 9 deletions

View File

@ -504,17 +504,21 @@ MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from)
/* handle message routing. */
Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
Octstr **mmc_id) {
Octstr **mmc_id)
{
if (m->reroute) {
*mmc_id = m->reroute_mmsc_id ? octstr_duplicate(m->reroute_mmsc_id) : NULL;
return outgoing_qdir;
} else {
Octstr *_mcid, *qdir = NULL;
Octstr *fto;
if (gwlist_len(to) > 0) { /* we route based on first recipient XXX */
Octstr *fto = gwlist_extract_first(to);
if (gwlist_len(to) > 0 &&
(fto = gwlist_extract_first(to)) != NULL) { /* we route based on first recipient XXX */
Octstr *xto = octstr_duplicate(fto);
Octstr *xfrom = octstr_duplicate(from);
if (unified_prefix)
_mms_fixup_address(&xfrom, octstr_get_cstr(unified_prefix), 0);
@ -523,10 +527,17 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
_mcid = rfs->mmsbox_resolve(xfrom,fto,octstr_get_cstr(m->id), rfs_data, rfs_settings);
if (unified_prefix)
_mms_fixup_address(&fto, octstr_get_cstr(unified_prefix), 1);
if (fto)
gwlist_insert(to, 0, fto); /* put it back, after modification. */
/* modify what was sent to us. */
if (octstr_len(_mcid) == 0) { /* put recipient back, unmodified if incoming only. */
gwlist_insert(to, 0, xto);
octstr_destroy(fto);
} else {
if (unified_prefix)
_mms_fixup_address(&fto, octstr_get_cstr(unified_prefix), 1);
gwlist_insert(to, 0, fto);
octstr_destroy(xto);
}
if (xfrom) {
octstr_delete(from, 0, octstr_len(from));
octstr_append(from, xfrom);
@ -535,7 +546,7 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
} else
_mcid = NULL;
if (_mcid == NULL || octstr_len(_mcid) == 0) {
if (octstr_len(_mcid) == 0) {
*mmc_id = NULL;
qdir = incoming_qdir;
} else {