1
0
Fork 0

minor mm4 message fixups

This commit is contained in:
bagyenda 2008-05-14 11:39:03 +00:00
parent 6b472bf22b
commit 6eb3e6629c
2 changed files with 31 additions and 2 deletions

View File

@ -1,3 +1,5 @@
2008-05-13 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fixups on MM4 interface message coding
2008-05-13 P. A. Bagyenda <bagyenda@dsmagic.com>
* Separate number normalisation for each MM4 connection.
2008-05-05 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -715,8 +715,28 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
} else {
char *x, tmp[32];
Octstr *xsender = octstr_format("system-user@%S", myhostname);
http_header_add(newhdrs, "X-Mms-Message-ID", msgid ? octstr_get_cstr(msgid) : "");
Octstr *y;
if (msgid) {
y = (octstr_get_char(msgid, 0) == '"') ? octstr_duplicate(msgid) :
octstr_format("\"%S\"", msgid);
http_header_add(newhdrs, "X-Mms-Message-ID", octstr_get_cstr(y));
octstr_destroy(y);
}
/* fixup messageid */
if ((y = http_header_value(headers, octstr_imm("Message-ID"))) != NULL) {
if (octstr_get_char(y, 0) != '<') {
octstr_insert_char(y, 0, '<');
octstr_append_char(y, '>');
}
http_header_remove_all(headers, "Message-ID");
http_header_add(newhdrs, "Message-ID", octstr_get_cstr(y));
octstr_destroy(y);
}
sprintf(tmp, "%d.%d.%d",
MAJOR_VERSION(MMS_3GPP_VERSION),
MINOR1_VERSION(MMS_3GPP_VERSION),
@ -748,12 +768,19 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
ret = MMS_SEND_ERROR_FATAL;
goto done;
}
http_header_add(newhdrs, "X-Mms-Message-Type", x);
/* Add a few more MM4 headers. */
http_header_add(newhdrs, "X-Mms-Ack-Request", dlr ? "Yes" : "No");
http_header_add(newhdrs, "Sender", octstr_get_cstr(from));
http_header_add(newhdrs, "X-Mms-Transaction-ID", transid);
y = (transid && transid[0] == '"') ? octstr_create(transid) :
octstr_format("\"%s\"", transid ? transid : "x");
http_header_add(newhdrs, "X-Mms-Transaction-ID", octstr_get_cstr(y));
octstr_destroy(y);
octstr_destroy(xsender);
}