diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index aa3fe12..416c930 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2008-09-04 P. A. Bagyenda + * Minor fix/addition for Content-ID handling 2008-09-02 P. A. Bagyenda * Added admin interface to mmsbox (can now start/stop and see status of any mmsc connection) 2008-09-01 P. A. Bagyenda diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 91355c0..778a2f6 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -711,11 +711,9 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, Octstr *mmc_id, Dict *url_map) { - Octstr *curl = NULL, *ctype = NULL, *body = NULL; + Octstr *curl = NULL, *ctype = NULL, *body = NULL, *xcid = NULL; char *src = NULL; int isurl, slash_prefix; - - static int cntr; /* For generating cids */ Octstr *cid = NULL; /* For each node in the smil doc, if it has an src attribute, then: @@ -765,9 +763,10 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, List *rh = http_create_empty_headers(), *rph = NULL; http_header_add(rh, "User-Agent", MM_NAME "/" VERSION); - if (mmsbox_url_fetch_content(HTTP_METHOD_GET, curl, rh, NULL, &rph, &body) == HTTP_OK) + if (mmsbox_url_fetch_content(HTTP_METHOD_GET, curl, rh, NULL, &rph, &body) == HTTP_OK) { ctype = http_header_value(rph, octstr_imm("Content-Type")); - else + xcid = http_header_value(rph, octstr_imm("Content-ID")); + } else error(0, "MMSBOX: Failed to load url %s within SMIL content from service %s!", octstr_get_cstr(curl), svc_name ? octstr_get_cstr(svc_name) : "unknown"); @@ -780,8 +779,9 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, } if (ctype && body) { /* If we got it, put it in. */ + static int cntr; /* For generating cids */ char _fext[5] = {0}, *fext = make_file_ext(curl, ctype, _fext); - Octstr *attr = octstr_format("cid:%06d.%s", ++cntr,fext); + Octstr *attr = xcid ? octstr_format("cid:%S", xcid) : octstr_format("cid:%06d.%s", ++cntr,fext); char *p = octstr_get_cstr(attr) + 4; Octstr *cid_header_val = octstr_format("<%s>", p); MIMEEntity *x = mime_entity_create(); @@ -814,6 +814,7 @@ done: octstr_destroy(curl); octstr_destroy(ctype); octstr_destroy(body); + octstr_destroy(xcid); xmlFree(src); return 0; }