text stringlengths 0 357 |
|---|
size_t dummy = 0; |
if (mailmime_parse(report_body, report_body_bytes, &dummy, &report_parsed)==MAIL_NO_ERROR |
&& report_parsed!=NULL) |
{ |
struct mailimf_fields* report_fields = mailmime_find_mailimf_fields(report_parsed); |
if (report_fields) |
{ |
struct mailimf_optional_field* of_disposition = mailimf_find_optional_field(report_fields, "Disposition"); /* MUST be preset, _if_ preset, we assume a sort of attribution and do not go into details */ |
struct mailimf_optional_field* of_org_msgid = mailimf_find_optional_field(report_fields, "Original-Message-ID"); /* can't live without */ |
if (of_disposition && of_disposition->fld_value && of_org_msgid && of_org_msgid->fld_value) |
{ |
char* rfc724_mid = NULL; |
dummy = 0; |
if (mailimf_msg_id_parse(of_org_msgid->fld_value, strlen(of_org_msgid->fld_value), &dummy, &rfc724_mid)==MAIL_NO_ERROR |
&& rfc724_mid!=NULL) |
{ |
uint32_t chat_id = 0; |
uint32_t msg_id = 0; |
if (dc_mdn_from_ext(context, from_id, rfc724_mid, sent_timestamp, &chat_id, &msg_id)) { |
carray_add(rr_event_to_send, (void*)(uintptr_t)chat_id, NULL); |
carray_add(rr_event_to_send, (void*)(uintptr_t)msg_id, NULL); |
} |
mdn_consumed = (msg_id!=0); |
free(rfc724_mid); |
} |
} |
} |
mailmime_free(report_parsed); |
} |
if (to_mmap_string_unref) { mmap_string_unref(to_mmap_string_unref); } |
} |
} |
} |
/* Move the MDN away to the chats folder. We do this for: |
- Consumed or not consumed MDNs from other messengers |
- Consumed MDNs from normal MUAs |
Unconsumed MDNs from normal MUAs are _not_ moved. |
NB: we do not delete the MDN as it may be used by other clients */ |
if (mime_parser->is_send_by_messenger || mdn_consumed) { |
dc_param_t* param = dc_param_new(); |
dc_param_set(param, DC_PARAM_SERVER_FOLDER, server_folder); |
dc_param_set_int(param, DC_PARAM_SERVER_UID, server_uid); |
if (mime_parser->is_send_by_messenger |
&& dc_sqlite3_get_config_int(context->sql, "mvbox_move", DC_MVBOX_MOVE_DEFAULT)) { |
dc_param_set_int(param, DC_PARAM_ALSO_MOVE, 1); |
} |
dc_job_add(context, DC_JOB_MARKSEEN_MDN_ON_IMAP, 0, param->packed, 0); |
dc_param_unref(param); |
} |
} |
} /* for() */ |
} |
{ |
/****************************************************************** |
* save locations |
*****************************************************************/ |
int location_id_written = 0; |
int send_event = 0; |
if (mime_parser->message_kml && chat_id > DC_CHAT_ID_LAST_SPECIAL) |
{ |
uint32_t newest_location_id = dc_save_locations(context, |
chat_id, from_id, mime_parser->message_kml->locations, 1); |
if (newest_location_id && !hidden) { |
dc_set_msg_location_id(context, insert_msg_id, newest_location_id); |
location_id_written = 1; |
send_event = 1; |
} |
} |
if (mime_parser->location_kml && chat_id > DC_CHAT_ID_LAST_SPECIAL) |
{ |
dc_contact_t* contact = dc_get_contact(context, from_id); |
if (mime_parser->location_kml->addr |
&& contact && contact->addr |
&& strcasecmp(contact->addr, mime_parser->location_kml->addr)==0) |
{ |
uint32_t newest_location_id = dc_save_locations(context, |
chat_id, from_id, mime_parser->location_kml->locations, 0); |
if (newest_location_id && !hidden && !location_id_written) { |
dc_set_msg_location_id(context, insert_msg_id, newest_location_id); |
} |
send_event = 1; |
} |
dc_contact_unref(contact); |
} |
if (send_event) { |
context->cb(context, DC_EVENT_LOCATION_CHANGED, from_id, 0); |
} |
} |
if (add_delete_job && carray_count(created_db_entries)>=2) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.