1
0
Fork 0

content-id fix for mmsbox

This commit is contained in:
bagyenda 2008-09-04 06:49:36 +00:00
parent 6263d512b8
commit 02a5ede686
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,5 @@
2008-09-04 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fix/addition for Content-ID handling
2008-09-02 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added admin interface to mmsbox (can now start/stop and see status of any mmsc connection)
2008-09-01 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -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;
}