1
0
Fork 0

*** empty log message ***

This commit is contained in:
bagyenda 2009-03-05 04:15:38 +00:00
parent a15d86fa74
commit 1e761682a5
3 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,5 @@
2009-03-05 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added strip_type flag (-x) to mmsfromemail
2009-03-03 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added -n flag to prevent stripping of host/domain part from sender address on email2mms interface
2009-03-01 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -1115,14 +1115,14 @@ void _mms_fixup_address(Octstr **address, char *unified_prefix, List *strip_pref
if (i>0) /* an email address. */
return;
i = octstr_search(*address, octstr_imm("/TYPE="), 0);
i = octstr_case_search(*address, octstr_imm("/TYPE="), 0);
if (i > 0) {
typ = octstr_copy(*address, i, octstr_len(*address));
octstr_delete(*address, i, octstr_len(*address));
} else
typ = NULL;
if (isphonenum(*address) || (typ && octstr_str_compare(typ, "/TYPE=PLMN") == 0)) {
if (isphonenum(*address) || (typ && octstr_str_case_compare(typ, "/TYPE=PLMN") == 0)) {
mms_normalize_phonenum(address, unified_prefix, strip_prefixes);
octstr_append(*address, keep_suffix ? octstr_imm("/TYPE=PLMN") : octstr_imm(""));
} else if (typ)

View File

@ -51,7 +51,7 @@ static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid,
static void strip_quotes(Octstr *s);
static List *proxyrelays;
static int no_strip = 0;
static int no_strip = 0, strip_type = 0;
int main(int argc, char *argv[])
{
@ -533,6 +533,9 @@ static int find_own(int i, int argc, char *argv[])
else if (argv[i][1] == 'n') {
no_strip = 1;
return 0;
} else if (argv[i][1] == 'x') {
strip_type = 1;
return 0;
} else
return -1;
}
@ -585,17 +588,20 @@ static void fixup_sender(void)
if (!xfrom) return;
i = octstr_search(xfrom, octstr_imm("/TYPE="), 0);
i = octstr_case_search(xfrom, octstr_imm("/TYPE="), 0);
if (i>0) {
int j = octstr_search_char(xfrom, '@', 0);
if (j > i) { /* we have @, remove it */
if (xproxy == NULL)
xproxy = octstr_copy(xfrom, j+1, octstr_len(xfrom));
octstr_delete(xfrom, j, octstr_len(xfrom));
}
} else if (isphonenum(xfrom)) /* Add the TYPE element if missing. */
octstr_append(xfrom, octstr_imm("/TYPE=PLMN"));
else {
}
if (strip_type)
octstr_delete(xfrom, i, octstr_len(xfrom));
} else if (isphonenum(xfrom)) { /* Add the TYPE element if missing. */
if (!strip_type)
octstr_append(xfrom, octstr_imm("/TYPE=PLMN"));
} else {
i = octstr_search_char(xfrom, '@', 0);
if (i<0)
octstr_format_append(xfrom, "@unknown");
@ -606,7 +612,7 @@ static void fixup_sender(void)
/* clean the number. */
_mms_fixup_address(&xfrom,
octstr_get_cstr(settings->unified_prefix),
settings->strip_prefixes, 1);
settings->strip_prefixes, strip_type ? 0 : 1);
if (no_strip && isphone && xproxy)
octstr_format_append(xfrom, "@%S", xproxy);