From ce84ac2e7b588441b2fe56013b0c932c3c7f0cb2 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 27 Jun 2008 17:02:28 +0000 Subject: [PATCH] *** empty log message *** --- mbuni/ChangeLog | 2 ++ mbuni/mmlib/mms_util.c | 7 ++++--- mbuni/mmsbox/mmsbox.c | 2 +- mbuni/mmsc/mmsfromemail.c | 27 ++++++++++++++++++++------- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 9e95c71..a7303eb 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2008-06-27 P. A. Bagyenda + * Minor fix to MM4 .RES handling: use proxy sendmail command if present 2008-06-26 P. A. Bagyenda * Added pgsql-queue into build process (configure.ac) * Misc. Changes to pluggable mmsbox-mmsc interface diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index b527864..714ef0b 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -1827,6 +1827,8 @@ MIMEEntity *make_multipart_formdata(void) MIMEEntity *x = mime_entity_create(); List *rh = http_create_empty_headers(); + http_header_add(rh, "User-Agent", MM_NAME "/" VERSION); + http_header_add(rh, "Accept", "*/*"); http_header_add(rh, "Content-Type", "multipart/form-data"); mime_replace_headers(x, rh); http_destroy_headers(rh); @@ -1847,11 +1849,10 @@ void add_multipart_form_field(MIMEEntity *multipart, char *field_name, char *cty http_header_add(xh, "Content-Disposition", octstr_get_cstr(cd)); if (ctype) /* This header must come after the above it seems. */ http_header_add(xh, "Content-Type", ctype); - + + mime_entity_set_body(p, data); mime_replace_headers(p, xh); - mime_entity_set_body(p, data); - mime_entity_add_part(multipart, p); /* add it to list so far. */ mime_entity_destroy(p); diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 5a3aef4..22a7ef9 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -955,7 +955,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, m = mms_frommime(mime); mime_entity_destroy(mime); } - } else if (octstr_case_compare(ctype, octstr_imm("application/smil")) == 0) { + } else if (octstr_case_search(ctype, octstr_imm("application/smil"), 0) == 0) { xmlDocPtr smil; xmlChar *buf = NULL; int bsize = 0; diff --git a/mbuni/mmsc/mmsfromemail.c b/mbuni/mmsc/mmsfromemail.c index 15229b6..a423eae 100644 --- a/mbuni/mmsc/mmsfromemail.c +++ b/mbuni/mmsc/mmsfromemail.c @@ -45,7 +45,8 @@ static void fixup_recipient(void); static void fixup_sender(void); static void fixup_addresses(List *headers); -static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, char *status, Octstr *msgid); +static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, char *status, Octstr *msgid, + Octstr *sendmail_cmd); static void strip_quotes(Octstr *s); @@ -466,10 +467,21 @@ int main(int argc, char *argv[]) /* respond to the sender as necessary. */ if (mm4_type && err && - ack && octstr_str_case_compare(ack, "Yes") == 0) - send_mm4_res(mtype+1, orig_sys, me, transid, err, newmsgid); - - + ack && octstr_str_case_compare(ack, "Yes") == 0) { + int i, n; + Octstr *sendmail_cmd = settings->sendmail; + /* try and find proxy and it's send command. */ + if (xproxy) + for (i = 0, n = gwlist_len(proxyrelays); ihost) == 0 && + mp->sendmail) { + sendmail_cmd = mp->sendmail; + break; + } + } + send_mm4_res(mtype+1, orig_sys, me, transid, err, newmsgid, sendmail_cmd); + } octstr_destroy(mm4_type); octstr_destroy(transid); octstr_destroy(orig_sys); @@ -613,7 +625,8 @@ static void fixup_addresses(List *headers) fixup_address_type(headers, "From"); } -static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, char *status, Octstr *msgid) +static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, char *status, Octstr *msgid, + Octstr *sendmail_cmd) { char tmp[32]; List *h = http_create_empty_headers(); @@ -637,7 +650,7 @@ static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, mime_replace_headers(m, h); http_destroy_headers(h); - mm_send_to_email(to, sender, octstr_imm(""), msgid, m, 0, &err, octstr_get_cstr(settings->sendmail), + mm_send_to_email(to, sender, octstr_imm(""), msgid, m, 0, &err, octstr_get_cstr(sendmail_cmd), settings->hostname); if (err) { warning(0, "MM4 send.RES reported: %s!", octstr_get_cstr(err));