text stringlengths 0 357 |
|---|
sqlite3_bind_int (stmt, 4, chat_id); |
sqlite3_bind_int (stmt, 5, from_id); |
sqlite3_bind_int (stmt, 6, to_id); |
sqlite3_bind_int64(stmt, 7, sort_timestamp); |
sqlite3_bind_int64(stmt, 8, sent_timestamp); |
sqlite3_bind_int64(stmt, 9, rcvd_timestamp); |
sqlite3_bind_int (stmt, 10, part->type); |
sqlite3_bind_int (stmt, 11, state); |
sqlite3_bind_int (stmt, 12, msgrmsg); |
sqlite3_bind_text (stmt, 13, part->msg? part->msg : "", -1, SQLITE_STATIC); |
sqlite3_bind_text (stmt, 14, txt_raw? txt_raw : "", -1, SQLITE_STATIC); |
sqlite3_bind_text (stmt, 15, part->param->packed, -1, SQLITE_STATIC); |
sqlite3_bind_int (stmt, 16, part->bytes); |
sqlite3_bind_int (stmt, 17, hidden); |
sqlite3_bind_text (stmt, 18, save_mime_headers? imf_raw_not_terminated : NULL, header_bytes, SQLITE_STATIC); |
sqlite3_bind_text (stmt, 19, mime_in_reply_to, -1, SQLITE_STATIC); |
sqlite3_bind_text (stmt, 20, mime_references, -1, SQLITE_STATIC); |
if (sqlite3_step(stmt)!=SQLITE_DONE) { |
dc_log_info(context, 0, "Cannot write DB."); |
goto cleanup; /* i/o error - there is nothing more we can do - in other cases, we try to write at least an empty record */ |
} |
free(txt_raw); |
txt_raw = NULL; |
insert_msg_id = dc_sqlite3_get_rowid(context->sql, "msgs", "rfc724_mid", rfc724_mid); |
carray_add(created_db_entries, (void*)(uintptr_t)chat_id, NULL); |
carray_add(created_db_entries, (void*)(uintptr_t)insert_msg_id, NULL); |
} |
dc_log_info(context, 0, "Message has %i parts and is assigned to chat #%i.", icnt, chat_id); |
/* check event to send */ |
if (chat_id==DC_CHAT_ID_TRASH) |
{ |
create_event_to_send = 0; |
} |
else if (incoming && state==DC_STATE_IN_FRESH) |
{ |
if (from_id_blocked) { |
create_event_to_send = 0; |
} |
else if (chat_id_blocked) { |
create_event_to_send = DC_EVENT_MSGS_CHANGED; |
/*if (dc_sqlite3_get_config_int(context->sql, "show_deaddrop", 0)!=0) { |
create_event_to_send = DC_EVENT_INCOMING_MSG; |
}*/ |
} |
else { |
create_event_to_send = DC_EVENT_INCOMING_MSG; |
} |
} |
dc_do_heuristics_moves(context, server_folder, insert_msg_id); |
} |
else |
{ |
// there are no non-meta data in message, do some basic calculations so that the varaiables are correct in the further processing |
if (sent_timestamp > time(NULL)) { |
sent_timestamp = time(NULL); |
} |
} |
if (carray_count(mime_parser->reports) > 0) |
{ |
/****************************************************************** |
* Handle reports (mainly MDNs) |
*****************************************************************/ |
int mdns_enabled = dc_sqlite3_get_config_int(context->sql, "mdns_enabled", DC_MDNS_DEFAULT_ENABLED); |
icnt = carray_count(mime_parser->reports); |
for (i = 0; i < icnt; i++) |
{ |
int mdn_consumed = 0; |
struct mailmime* report_root = carray_get(mime_parser->reports, i); |
struct mailmime_parameter* report_type = mailmime_find_ct_parameter(report_root, "report-type"); |
if (report_root==NULL || report_type==NULL || report_type->pa_value==NULL) { |
continue; |
} |
if (strcmp(report_type->pa_value, "disposition-notification")==0 |
&& clist_count(report_root->mm_data.mm_multipart.mm_mp_list) >= 2 /* the first part is for humans, the second for machines */) |
{ |
if (mdns_enabled /*to get a clear functionality, do not show incoming MDNs if the options is disabled*/) |
{ |
struct mailmime* report_data = (struct mailmime*)clist_content(clist_next(clist_begin(report_root->mm_data.mm_multipart.mm_mp_list))); |
if (report_data |
&& report_data->mm_content_type->ct_type->tp_type==MAILMIME_TYPE_COMPOSITE_TYPE |
&& report_data->mm_content_type->ct_type->tp_data.tp_composite_type->ct_type==MAILMIME_COMPOSITE_TYPE_MESSAGE |
&& strcmp(report_data->mm_content_type->ct_subtype, "disposition-notification")==0) |
{ |
/* we received a MDN (although the MDN is only a header, we parse it as a complete mail) */ |
const char* report_body = NULL; |
size_t report_body_bytes = 0; |
char* to_mmap_string_unref = NULL; |
if (mailmime_transfer_decode(report_data, &report_body, &report_body_bytes, &to_mmap_string_unref)) |
{ |
struct mailmime* report_parsed = NULL; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.