From a1fa945c5f826ed4c76ab2b7d0f83f92eedd04b3 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 19 Sep 2008 15:58:15 +0000 Subject: [PATCH] *** empty log message *** --- mbuni/mmlib/mms_cfg.c | 22 ++++++++++---------- mbuni/mmlib/mms_mm7soap.c | 6 +++--- mbuni/mmlib/mms_strings.def | 3 --- mbuni/mmsbox/mmsbox.c | 41 ++++++++++++++++++------------------- 4 files changed, 34 insertions(+), 38 deletions(-) diff --git a/mbuni/mmlib/mms_cfg.c b/mbuni/mmlib/mms_cfg.c index 31b2435..f9ad45f 100644 --- a/mbuni/mmlib/mms_cfg.c +++ b/mbuni/mmlib/mms_cfg.c @@ -87,9 +87,9 @@ static int is_multigroup(Octstr *grpname) { #define OCTSTR(x) #define SINGLE_GROUP(name, fields) \ - if (octstr_case_compare(grpname, octstr_imm(#name)) == 0) return 0; + if (octstr_str_case_compare(grpname, #name) == 0) return 0; #define MULTI_GROUP(name, fields) \ - if (octstr_case_compare(grpname, octstr_imm(#name)) == 0) return 1; + if (octstr_str_case_compare(grpname, #name) == 0) return 1; #include "mms_cfg.def" return -1; @@ -98,9 +98,9 @@ static int is_multigroup(Octstr *grpname) static int valid_in_group(Octstr *grp, Octstr *field) { /* first validate whether field is permitted in the group. */ -#define OCTSTR(parm) else if (octstr_case_compare(field,octstr_imm(#parm)) == 0) return 1; +#define OCTSTR(parm) else if (octstr_str_case_compare(field,#parm) == 0) return 1; #define SINGLE_GROUP(grpname, fields) \ - else if (octstr_case_compare(grp, octstr_imm(#grpname)) == 0) { \ + else if (octstr_str_case_compare(grp, #grpname) == 0) { \ if (0) (void)0; \ fields \ } @@ -172,7 +172,7 @@ mCfg *mms_cfg_read(Octstr *file) octstr_get_cstr(value)); #endif - if (octstr_case_compare(field, octstr_imm("group")) == 0) + if (octstr_str_case_compare(field, "group") == 0) if (grp == NULL) { /* grp name. */ int ismulti = is_multigroup(value); @@ -374,13 +374,13 @@ int mms_cfg_get_bool(mCfg *cfg, mCfgGrp *grp, Octstr *name, int *bool) if (!val) return -1; - if (octstr_case_compare(val, octstr_imm("yes")) == 0 || - octstr_case_compare(val, octstr_imm("true")) == 0 || - octstr_case_compare(val, octstr_imm("1")) == 0) + if (octstr_str_case_compare(val, "yes") == 0 || + octstr_str_case_compare(val, "true") == 0 || + octstr_str_case_compare(val, "1") == 0) *bool = 1; - else if (octstr_case_compare(val, octstr_imm("no")) == 0 || - octstr_case_compare(val, octstr_imm("false")) == 0 || - octstr_case_compare(val, octstr_imm("0")) == 0) + else if (octstr_str_case_compare(val, "no") == 0 || + octstr_str_case_compare(val, "false") == 0 || + octstr_str_case_compare(val, "0") == 0) *bool = 0; else { mms_error(0, "mms_cfg", NULL, "Unable to convert value `%s' to boolean for field `%s' in group `%s'", diff --git a/mbuni/mmlib/mms_mm7soap.c b/mbuni/mmlib/mms_mm7soap.c index 1694b5b..d503a9b 100644 --- a/mbuni/mmlib/mms_mm7soap.c +++ b/mbuni/mmlib/mms_mm7soap.c @@ -337,7 +337,7 @@ MSoapMsg_t *mm7_parse_soap(List *headers, Octstr *body) hx = mime_entity_headers(x); get_content_type(hx, &xctype, &xparams); - if (xctype && octstr_case_compare(xctype, octstr_imm("text/xml")) != 0) { + if (xctype && octstr_str_case_compare(xctype, "text/xml") != 0) { /* Found something that might be the body, since its not XML. * Perhaps we compare bodies? For broken ones anyway, so no bother! */ @@ -891,11 +891,11 @@ MmsMsg *mm7_soap_to_mmsmsg(MSoapMsg_t *m, Octstr *from) mms_replace_header_value(msg, "X-Mms-Priority", octstr_get_cstr(s)); octstr_destroy(s); } - + if ((s = http_header_value(m->envelope, octstr_imm("DeliveryReport"))) != NULL) { long x = mms_string_to_boolean_flag(s); if (x >= 0) - mms_replace_header_value(msg, "X-Mms-Delivery-Report", + mms_replace_header_value(msg, "X-Mms-Delivery-Report", (char *)mms_reports_to_cstr(x)); octstr_destroy(s); } diff --git a/mbuni/mmlib/mms_strings.def b/mbuni/mmlib/mms_strings.def index f957197..03e9fc6 100644 --- a/mbuni/mmlib/mms_strings.def +++ b/mbuni/mmlib/mms_strings.def @@ -294,9 +294,6 @@ VNSTRING(MM7_5, "Subject",MM7_TAG_Subject) VNSTRING(MM7_5, "SubmitReq",MM7_TAG_SubmitReq) VNSTRING(MM7_5, "SubmitRsp",MM7_TAG_SubmitRsp) -VNSTRING(MM7_5, "GetDeviceProfileReq",MM7_TAG_GetDeviceProfileReq) -VNSTRING(MM7_5, "GetDeviceProfileRsp",MM7_TAG_GetDeviceProfileRsp) - VNSTRING(MM7_5, "TimeStamp",MM7_TAG_TimeStamp) VNSTRING(MM7_5, "To",MM7_TAG_To) VNSTRING(MM7_5, "TransactionID",MM7_TAG_TransactionID) diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index ce5c459..3bcf864 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -85,11 +85,11 @@ done: Octstr *body = mime_entity_body(res); if (charset == NULL || octstr_str_compare(charset, "unknown") == 0) { - if (charset) octstr_destroy(charset); - charset = octstr_imm(DEFAULT_CHARSET); + octstr_destroy(charset); + charset = octstr_create(DEFAULT_CHARSET); } - if (octstr_case_compare(charset, octstr_imm(DEFAULT_CHARSET)) != 0) { + if (octstr_str_case_compare(charset, DEFAULT_CHARSET) != 0) { charset_convert(body, DEFAULT_CHARSET, octstr_get_cstr(charset)); /* XXX error ignored? */ mime_entity_set_body(res, body); } @@ -99,11 +99,9 @@ done: } done2: - if (ctype) - octstr_destroy(ctype); - if (params) - octstr_destroy(params); + octstr_destroy(ctype); + octstr_destroy(params); return res; } @@ -189,7 +187,7 @@ static void add_all_matching_parts(MIMEEntity *plist, MmsServiceUrlParam *pm, headers = mime_entity_headers(me); if (pm->type == WHOLE_BINARY && lev == 0) { data = mms_tobinary(msg); - ctype = octstr_imm("application/vnd.wap.mms-message"); + ctype = octstr_create("application/vnd.wap.mms-message"); } else if (pm->type == NO_PART && lev == 0) { data = octstr_create(""); /* We'll add value below. */ goto done; @@ -210,7 +208,7 @@ static void add_all_matching_parts(MIMEEntity *plist, MmsServiceUrlParam *pm, get_content_type(headers, &xctype, ¶ms); -#define BEGINSWITH(s, prefix) (octstr_case_search(s, octstr_imm(prefix),0) == 0) +#define BEGINSWITH(s, prefix) (octstr_str_case_search(s, prefix,0) == 0) #define TYPE_MATCH(typ, prefix) ((pm->type) == (typ) && \ BEGINSWITH(xctype, prefix)) if (xctype) @@ -433,7 +431,7 @@ static int fetch_serviceurl(MmsEnvelope *e, octstr_destroy(s); } rb = octstr_read_pipe(fp); - ctype = octstr_imm("application/smil"); + ctype = octstr_create("application/smil"); pclose(fp); } if (!rb) @@ -443,7 +441,7 @@ static int fetch_serviceurl(MmsEnvelope *e, break; case TRANS_TYPE_TEXT: rb = octstr_duplicate(ms->url); - ctype = octstr_imm("text/plain"); + ctype = octstr_create("text/plain"); typ = URL_TYPE; break; @@ -606,7 +604,7 @@ int main(int argc, char *argv[]) cfidx = get_and_set_debugs(argc, argv, NULL); if (argv[cfidx] == NULL) - fname = octstr_imm("mbuni.conf"); + fname = octstr_create("mbuni.conf"); else fname = octstr_create(argv[cfidx]); @@ -987,7 +985,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, _mms_fixup_address(&from, NULL, NULL, 1); /* Don't normalise. */ /* Now get the data. */ - if (octstr_case_compare(ctype, octstr_imm("application/vnd.wap.mms-message")) == 0) + if (octstr_str_case_compare(ctype, "application/vnd.wap.mms-message") == 0) m = mms_frombinary(data, from); else if (octstr_case_search(ctype, octstr_imm("multipart/"), 0) == 0) { /* treat it differently. */ MIMEEntity *mime = mime_http_to_entity(reply_headers, data); @@ -995,7 +993,8 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, mime_entity_destroy(me); me = mime; } - } else if (octstr_case_search(ctype, octstr_imm(MBUNI_MULTIPART_TYPE), 0) == 0) { /* Mbuni multipart.*/ + } else if (octstr_case_search(ctype, + octstr_imm(MBUNI_MULTIPART_TYPE), 0) == 0) { /* Mbuni multipart.*/ List *l = octstr_split_words(data); MIMEEntity *mime = multipart_from_urls(l); @@ -1289,7 +1288,7 @@ static void dispatch_sendmms_recv(List *rl) subject = http_cgi_variable(h->cgivars, "subject"); if ((base_url = http_cgi_variable(h->cgivars, "base-url")) == NULL) - base_url = octstr_imm("http://localhost"); + base_url = octstr_create("http://localhost"); else base_url = octstr_duplicate(base_url); /* because we need to delete it below. */ @@ -1301,7 +1300,7 @@ static void dispatch_sendmms_recv(List *rl) if (charset) octstr_format_append(ctype, "; charset=%S", charset); } else if ((data = http_cgi_variable(h->cgivars, "smil")) != NULL) /* smil. */ - ctype = octstr_imm("application/smil"); + ctype = octstr_create("application/smil"); else if ((data = http_cgi_variable(h->cgivars, "content-url")) != NULL) { /* arbitrary content. */ List *reqh = http_create_empty_headers(), *rph = NULL; Octstr *reply = NULL, *params = NULL; @@ -1319,7 +1318,7 @@ static void dispatch_sendmms_recv(List *rl) http_destroy_headers(reqh); http_destroy_headers(rh); - rh = rph; /* replace as real reply headers. */ + rh = rph ? rph : http_create_empty_headers(); /* replace as real reply headers. */ skip_ctype = 1; octstr_destroy(params); } else if ((data = http_cgi_variable(h->cgivars, "content")) != NULL) { /* any content. */ @@ -1339,11 +1338,11 @@ static void dispatch_sendmms_recv(List *rl) data = octstr_duplicate(h->body); ctype = http_header_value(h->headers, octstr_imm("Content-Type")); } else - rb = octstr_imm("Missing content"); + rb = octstr_create("Missing content"); if ((to = http_cgi_variable(h->cgivars, "to")) == NULL) - rb = octstr_imm("Missing recipient!"); + rb = octstr_create("Missing recipient!"); else lto = octstr_split_words(to); @@ -1358,7 +1357,7 @@ static void dispatch_sendmms_recv(List *rl) HTTP_REPLACE_HEADER(rh, "X-Mbuni-From", octstr_get_cstr(from)); octstr_destroy(from); } else if (!u->faked_sender) - rb = octstr_imm("Missing Sender address"); + rb = octstr_create("Missing Sender address"); if (lto) { for (i = 0, n = gwlist_len(lto); i < n; i++) { @@ -1417,7 +1416,7 @@ static void dispatch_sendmms_recv(List *rl) send_as_incoming ? err : transid); octstr_destroy(transid); } else if (!rb) - rb = octstr_imm("Failed to send message"); + rb = octstr_create("Failed to send message"); http_send_reply(h->client, (res == 0) ? HTTP_OK : HTTP_BAD_REQUEST, hh, rb ? rb : octstr_imm("Sent")); mms_info(0, "mmsbox", NULL,"MMSBox.mmssend: u=%s, %s [%s]",