Fixes to message decoding/encoding after introduction of mmbox changes.
This commit is contained in:
parent
148892ef80
commit
d59559f0fc
|
@ -249,8 +249,8 @@ static void mms_unpack_well_known_field(List *unpacked, int field_type,
|
|||
case MMS_HEADER_TO:
|
||||
case MMS_HEADER_CC:
|
||||
case MMS_HEADER_BCC:
|
||||
|
||||
decoded = decode_encoded_string_value(ret, context, hname);
|
||||
if (ret == WSP_FIELD_VALUE_DATA)
|
||||
decoded = decode_encoded_string_value(ret, context, hname);
|
||||
|
||||
if (mms_validate_address(decoded))
|
||||
warning(0, "Faulty address [%s] format in field %s!",
|
||||
|
@ -261,8 +261,8 @@ static void mms_unpack_well_known_field(List *unpacked, int field_type,
|
|||
case MMS_HEADER_RETRIEVE_TEXT:
|
||||
|
||||
case MMS_HEADER_STORE_STATUS_TEXT:
|
||||
|
||||
decoded = decode_encoded_string_value(ret, context, hname);
|
||||
if (ret == WSP_FIELD_VALUE_DATA)
|
||||
decoded = decode_encoded_string_value(ret, context, hname);
|
||||
break;
|
||||
case MMS_HEADER_TRANSACTION_ID:
|
||||
case MMS_HEADER_MESSAGE_ID:
|
||||
|
@ -411,7 +411,7 @@ static void mms_unpack_well_known_field(List *unpacked, int field_type,
|
|||
decoded = wsp_unpack_integer_value(context);
|
||||
|
||||
if (field_type == MMS_HEADER_PREVIOUSLY_SENT_BY)
|
||||
t = decode_encoded_string_value(ret, context, hname);
|
||||
t = decode_encoded_string_value(-1, context, hname);
|
||||
else
|
||||
t = wsp_unpack_date_value(context);
|
||||
|
||||
|
@ -544,7 +544,7 @@ static int decode_msgheaders(ParseContext *context, MmsMsg *msg, Octstr *from)
|
|||
int byte = parse_get_char(context);
|
||||
|
||||
|
||||
if (byte >= 128)
|
||||
if (byte >= 0x80)
|
||||
mms_unpack_well_known_field(msg->headers, byte&0x7f, context, from);
|
||||
else {
|
||||
parse_skip(context, -1); /* Go back a bit. */
|
||||
|
|
|
@ -580,10 +580,13 @@ void unbase64_mimeparts(MIMEEntity *m)
|
|||
Octstr *te = http_header_value(m->headers, octstr_imm("Content-Transfer-Encoding"));
|
||||
|
||||
if (ctype && te &&
|
||||
octstr_case_compare(te,octstr_imm("base64")) == 0) {
|
||||
octstr_case_compare(te,octstr_imm("base64")) == 0)
|
||||
octstr_base64_to_binary(m->body);
|
||||
http_header_remove_all(m->headers, "Content-Transfer-Encoding");
|
||||
}
|
||||
|
||||
http_header_remove_all(m->headers, "Content-Transfer-Encoding"); /* Remove it in all cases (?).*/
|
||||
|
||||
/* XXX may be we should deal with other transfer encodings here as well... */
|
||||
|
||||
if (ctype)
|
||||
octstr_destroy(ctype);
|
||||
if (te)
|
||||
|
|
|
@ -33,10 +33,27 @@ static int find_own(int i, int argc, char *argv[])
|
|||
return -1;
|
||||
else if (argv[i][1] == 'm')
|
||||
if (i + 1 < argc) {
|
||||
int ch;
|
||||
data = octstr_read_file(argv[i+1]);
|
||||
|
||||
/* try and detect if we are looking at plain text (mime-encoded) or binary encoded message. */
|
||||
ch = octstr_get_char(data, 0);
|
||||
if (isprint(ch)) {
|
||||
MIMEEntity *mime = mime_octstr_to_entity(data);
|
||||
MmsMsg *mm;
|
||||
if (mime && (mm = mms_frommime(mime)) != NULL) {
|
||||
octstr_destroy(data);
|
||||
data = mms_tobinary(mm);
|
||||
}
|
||||
if (mime)
|
||||
mime_entity_destroy(mime);
|
||||
if (mm)
|
||||
mms_destroy(mm);
|
||||
}
|
||||
return 1;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue