minor fix to mms_fixup_address
This commit is contained in:
parent
a87514cc02
commit
15f61ba8d5
|
@ -263,7 +263,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho
|
|||
if (mms_validate_address(e->from) != 0) {
|
||||
warning(0, "mms_queueread: Mal-formed address [%s] in file %s! "
|
||||
"Attempting fixup.", res, xqf);
|
||||
_mms_fixup_address(&e->from, NULL);
|
||||
_mms_fixup_address(&e->from, NULL, 1);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
|
@ -272,7 +272,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho
|
|||
if (mms_validate_address(t) != 0) {
|
||||
warning(0, "mms_queueread: Mal-formed address [%s] in file %s! "
|
||||
"Attempting fixup.", res, xqf);
|
||||
_mms_fixup_address(&t, NULL);
|
||||
_mms_fixup_address(&t, NULL, 1);
|
||||
}
|
||||
to = gw_malloc(sizeof *to);
|
||||
to->rcpt = t;
|
||||
|
|
|
@ -963,7 +963,7 @@ int isphonenum(Octstr *s)
|
|||
}
|
||||
|
||||
/* Doesn't handle IP addresses very well */
|
||||
void _mms_fixup_address(Octstr **address, char *unified_prefix)
|
||||
void _mms_fixup_address(Octstr **address, char *unified_prefix, int keep_suffix)
|
||||
{
|
||||
int i;
|
||||
Octstr *typ;
|
||||
|
@ -983,11 +983,11 @@ void _mms_fixup_address(Octstr **address, char *unified_prefix)
|
|||
if (isphonenum(*address) || (typ && octstr_str_compare(typ, "/TYPE=PLMN") == 0)) {
|
||||
if (unified_prefix)
|
||||
normalize_number(unified_prefix, address);
|
||||
octstr_append(*address, octstr_imm("/TYPE=PLMN"));
|
||||
octstr_append(*address, keep_suffix ? octstr_imm("/TYPE=PLMN") : octstr_imm(""));
|
||||
} else if (typ)
|
||||
octstr_append(*address, typ);
|
||||
octstr_append(*address, keep_suffix ? typ : octstr_imm(""));
|
||||
else
|
||||
octstr_append(*address, octstr_imm("@unknown"));
|
||||
octstr_append(*address, keep_suffix ? octstr_imm("@unknown") : octstr_imm(""));
|
||||
octstr_destroy(typ);
|
||||
}
|
||||
|
||||
|
|
|
@ -153,8 +153,8 @@ unsigned long _mshash(char *s);
|
|||
|
||||
/* Tell us whether address is a phone number. */
|
||||
int isphonenum(Octstr *s);
|
||||
/* Fixup an address: Normalize number (if prefix given), Add type, etc. */
|
||||
void _mms_fixup_address(Octstr **address, char *unified_prefix);
|
||||
/* Fixup an address: Normalize number (if prefix given), Add type (if keep_suffix is set), etc. */
|
||||
void _mms_fixup_address(Octstr **address, char *unified_prefix, int keep_suffix);
|
||||
|
||||
/* Check that host is one of hosts in semi-colon separated list in host_list */
|
||||
int is_allowed_host(Octstr *host, Octstr *host_list);
|
||||
|
|
|
@ -866,7 +866,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
|||
for (j = 0; j < gwlist_len(hv); j++) {
|
||||
Octstr *v = gwlist_get(hv, j);
|
||||
/* Fix the address. */
|
||||
_mms_fixup_address(&v, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL);
|
||||
_mms_fixup_address(&v, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL, 1);
|
||||
gwlist_append(xto, v);
|
||||
}
|
||||
octstr_destroy(v);
|
||||
|
@ -922,7 +922,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
|||
xservice_code = octstr_duplicate(hsvc_code);
|
||||
|
||||
if (from)
|
||||
_mms_fixup_address(&from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL);
|
||||
_mms_fixup_address(&from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL, 1);
|
||||
|
||||
/* Now get the data. */
|
||||
if (octstr_case_compare(ctype, octstr_imm("application/vnd.wap.mms-message")) == 0)
|
||||
|
@ -1263,7 +1263,7 @@ static void sendmms_func(void *unused)
|
|||
|
||||
if ((from = http_cgi_variable(cgivars, "from")) != NULL) {
|
||||
from = octstr_duplicate(from);
|
||||
_mms_fixup_address(&from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL);
|
||||
_mms_fixup_address(&from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL, 1);
|
||||
http_header_add(rh, "X-Mbuni-From", octstr_get_cstr(from));
|
||||
octstr_destroy(from);
|
||||
} else if (!u->faked_sender)
|
||||
|
|
|
@ -492,11 +492,17 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
|||
|
||||
if (gwlist_len(to) > 0) { /* we route based on first recipient XXX */
|
||||
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);
|
||||
Octstr *xfrom = octstr_duplicate(from);
|
||||
|
||||
gwlist_insert(to, 0, fto); /* put it back, after modification. */
|
||||
_mms_fixup_address(&xfrom, octstr_get_cstr(unified_prefix), 0);
|
||||
_mms_fixup_address(&fto, octstr_get_cstr(unified_prefix), 0);
|
||||
|
||||
_mcid = rfs->mmsbox_resolve(xfrom,fto,octstr_get_cstr(m->id), rfs_data, rfs_settings);
|
||||
|
||||
_mms_fixup_address(&fto, octstr_get_cstr(unified_prefix), 1);
|
||||
if (fto)
|
||||
gwlist_insert(to, 0, fto); /* put it back, after modification. */
|
||||
octstr_destroy(xfrom);
|
||||
} else
|
||||
_mcid = NULL;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ static int sendMsg(MmsEnvelope *e)
|
|||
MmsEnvelopeTo *to = gwlist_get(e->to, i);
|
||||
Octstr *s = octstr_duplicate(to->rcpt);
|
||||
|
||||
_mms_fixup_address(&s, octstr_get_cstr(settings->unified_prefix));
|
||||
_mms_fixup_address(&s, octstr_get_cstr(settings->unified_prefix), 1);
|
||||
gwlist_append(l, s);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
|
|||
while ((x = gwlist_extract_first(to)) != NULL) {
|
||||
octstr_strip_blanks(x);
|
||||
_mms_fixup_address(&x,
|
||||
settings->unified_prefix ? octstr_get_cstr(settings->unified_prefix) : NULL);
|
||||
settings->unified_prefix ? octstr_get_cstr(settings->unified_prefix) : NULL, 1);
|
||||
gwlist_append(l, x);
|
||||
}
|
||||
gwlist_destroy(to, NULL);
|
||||
|
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* fix from address. */
|
||||
_mms_fixup_address(&from,
|
||||
settings->unified_prefix ? octstr_get_cstr(settings->unified_prefix) : NULL);
|
||||
settings->unified_prefix ? octstr_get_cstr(settings->unified_prefix) : NULL, 1);
|
||||
|
||||
#if 0
|
||||
mms_start_profile_engine(octstr_get_cstr(settings->ua_profile_cache_dir));
|
||||
|
|
Loading…
Reference in New Issue