diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 36ae036..e77f3bf 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2009-03-05 P. A. Bagyenda + * Added strip_type flag (-x) to mmsfromemail 2009-03-03 P. A. Bagyenda * Added -n flag to prevent stripping of host/domain part from sender address on email2mms interface 2009-03-01 P. A. Bagyenda diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index 585d2a8..2611811 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -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) diff --git a/mbuni/mmsc/mmsfromemail.c b/mbuni/mmsc/mmsfromemail.c index 2fcce7d..ccfd936 100644 --- a/mbuni/mmsc/mmsfromemail.c +++ b/mbuni/mmsc/mmsfromemail.c @@ -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);