text stringlengths 0 357 |
|---|
add_delete_job = (handshake & DC_HANDSHAKE_ADD_DELETE_JOB); |
state = DC_STATE_IN_SEEN; |
} |
dc_sqlite3_begin_transaction(context->sql); |
} |
/* test if there is a normal chat with the sender - if so, this allows us to create groups in the next step */ |
uint32_t test_normal_chat_id = 0; |
int test_normal_chat_id_blocked = 0; |
dc_lookup_real_nchat_by_contact_id(context, from_id, &test_normal_chat_id, &test_normal_chat_id_blocked); |
/* get the chat_id - a chat_id here is no indicator that the chat is displayed in the normal list, it might also be |
blocked and displayed in the deaddrop as a result */ |
if (chat_id==0) |
{ |
/* try to create a group |
(groups appear automatically only if the _sender_ is known, see core issue #54) */ |
int create_blocked = ((test_normal_chat_id&&test_normal_chat_id_blocked==DC_CHAT_NOT_BLOCKED) || incoming_origin>=DC_ORIGIN_MIN_START_NEW_NCHAT/*always false, for now*/)? DC_CHAT_NOT_BLOCKED : DC_CHAT_DEADDROP_BLOCKED; |
create_or_lookup_group(context, mime_parser, |
allow_creation, create_blocked, |
from_id, to_ids, &chat_id, &chat_id_blocked); |
if (chat_id && chat_id_blocked && !create_blocked) { |
dc_unblock_chat(context, chat_id); |
chat_id_blocked = 0; |
} |
} |
if (chat_id==0) |
{ |
/* check if the message belongs to a mailing list */ |
if (dc_mimeparser_is_mailinglist_message(mime_parser)) { |
chat_id = DC_CHAT_ID_TRASH; |
dc_log_info(context, 0, "Message belongs to a mailing list and is ignored."); |
} |
} |
if (chat_id==0) |
{ |
/* try to create a normal chat */ |
int create_blocked = (incoming_origin>=DC_ORIGIN_MIN_START_NEW_NCHAT/*always false, for now*/ || from_id==to_id)? DC_CHAT_NOT_BLOCKED : DC_CHAT_DEADDROP_BLOCKED; |
if (test_normal_chat_id) { |
chat_id = test_normal_chat_id; |
chat_id_blocked = test_normal_chat_id_blocked; |
} |
else if(allow_creation) { |
dc_create_or_lookup_nchat_by_contact_id(context, from_id, |
create_blocked, |
&chat_id, &chat_id_blocked); |
} |
if (chat_id && chat_id_blocked) { |
if (!create_blocked) { |
dc_unblock_chat(context, chat_id); |
chat_id_blocked = 0; |
} |
else if (dc_is_reply_to_known_message(context, mime_parser)) { |
dc_scaleup_contact_origin(context, from_id, DC_ORIGIN_INCOMING_REPLY_TO); /* we do not want any chat to be created implicitly. Because of the origin-scale-up, the contact requests will pop up and this should be just fine. */ |
dc_log_info(context, 0, "Message is a reply to a known message, mark sender as known."); |
incoming_origin = DC_MAX(incoming_origin, DC_ORIGIN_INCOMING_REPLY_TO); |
} |
} |
} |
if (chat_id==0) |
{ |
/* maybe from_id is null or sth. else is suspicious, move message to trash */ |
chat_id = DC_CHAT_ID_TRASH; |
} |
/* if the chat_id is blocked, |
for unknown senders and non-delta messages set the state to NOTICED |
to not result in a contact request (this would require the state FRESH) */ |
if (chat_id_blocked && state==DC_STATE_IN_FRESH) |
{ |
if (incoming_origin < DC_ORIGIN_MIN_VERIFIED |
&& msgrmsg==0) { |
state = DC_STATE_IN_NOTICED; |
} |
} |
} |
else /* outgoing */ |
{ |
state = DC_STATE_OUT_DELIVERED; /* the mail is on the IMAP server, probably it is also delivered. We cannot recreate other states (read, error). */ |
from_id = DC_CONTACT_ID_SELF; |
if (dc_array_get_cnt(to_ids) >= 1) { |
to_id = dc_array_get_id(to_ids, 0); |
if (chat_id==0) |
{ |
create_or_lookup_group(context, mime_parser, allow_creation, DC_CHAT_NOT_BLOCKED, from_id, to_ids, &chat_id, &chat_id_blocked); |
if (chat_id && chat_id_blocked) { |
dc_unblock_chat(context, chat_id); |
chat_id_blocked = 0; |
} |
} |
if (chat_id==0 && allow_creation) |
{ |
int create_blocked = (msgrmsg && !dc_is_contact_blocked(context, to_id))? DC_CHAT_NOT_BLOCKED : DC_CHAT_DEADDROP_BLOCKED; |
dc_create_or_lookup_nchat_by_contact_id(context, to_id, create_blocked, &chat_id, &chat_id_blocked); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.