text stringlengths 0 357 |
|---|
uint32_t row_id = dc_add_or_lookup_contact(context, display_name_dec /*can be NULL*/, addr_spec, origin, NULL); |
free(display_name_dec); |
if (row_id) { |
if (!dc_array_search_id(ids, row_id, NULL)) { |
dc_array_add_id(ids, row_id); |
} |
} |
} |
static void dc_add_or_lookup_contacts_by_mailbox_list(dc_context_t* context, const struct mailimf_mailbox_list* mb_list, int origin, dc_array_t* ids, int* check_self) |
{ |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC || mb_list==NULL) { |
return; |
} |
for (clistiter* cur = clist_begin(mb_list->mb_list); cur!=NULL ; cur=clist_next(cur)) { |
struct mailimf_mailbox* mb = (struct mailimf_mailbox*)clist_content(cur); |
if (mb) { |
add_or_lookup_contact_by_addr(context, mb->mb_display_name, mb->mb_addr_spec, origin, ids, check_self); |
} |
} |
} |
static void dc_add_or_lookup_contacts_by_address_list(dc_context_t* context, const struct mailimf_address_list* adr_list, int origin, dc_array_t* ids, int* check_self) |
{ |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC || adr_list==NULL /*may be NULL eg. if bcc is given as `Bcc: \n` in the header */) { |
return; |
} |
for (clistiter* cur = clist_begin(adr_list->ad_list); cur!=NULL ; cur=clist_next(cur)) { |
struct mailimf_address* adr = (struct mailimf_address*)clist_content(cur); |
if (adr) { |
if (adr->ad_type==MAILIMF_ADDRESS_MAILBOX) { |
struct mailimf_mailbox* mb = adr->ad_data.ad_mailbox; /* can be NULL */ |
if (mb) { |
add_or_lookup_contact_by_addr(context, mb->mb_display_name, mb->mb_addr_spec, origin, ids, check_self); |
} |
} |
else if (adr->ad_type==MAILIMF_ADDRESS_GROUP) { |
struct mailimf_group* group = adr->ad_data.ad_group; /* can be NULL */ |
if (group && group->grp_mb_list /*can be NULL*/) { |
dc_add_or_lookup_contacts_by_mailbox_list(context, group->grp_mb_list, origin, ids, check_self); |
} |
} |
} |
} |
} |
/******************************************************************************* |
* Check if a message is a reply to a known message (messenger or non-messenger) |
******************************************************************************/ |
static int is_known_rfc724_mid(dc_context_t* context, const char* rfc724_mid) |
{ |
int is_known = 0; |
if (rfc724_mid) { |
sqlite3_stmt* stmt = dc_sqlite3_prepare(context->sql, |
"SELECT m.id FROM msgs m " |
" LEFT JOIN chats c ON m.chat_id=c.id " |
" WHERE m.rfc724_mid=? " |
" AND m.chat_id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL) |
" AND c.blocked=0;"); |
sqlite3_bind_text(stmt, 1, rfc724_mid, -1, SQLITE_STATIC); |
if (sqlite3_step(stmt)==SQLITE_ROW) { |
is_known = 1; |
} |
sqlite3_finalize(stmt); |
} |
return is_known; |
} |
static int is_known_rfc724_mid_in_list(dc_context_t* context, const clist* mid_list) |
{ |
if (mid_list) { |
clistiter* cur; |
for (cur = clist_begin(mid_list); cur!=NULL ; cur=clist_next(cur)) { |
if (is_known_rfc724_mid(context, clist_content(cur))) { |
return 1; |
} |
} |
} |
return 0; |
} |
static int dc_is_reply_to_known_message(dc_context_t* context, dc_mimeparser_t* mime_parser) |
{ |
/* check if the message is a reply to a known message; the replies are identified by the Message-ID from |
`In-Reply-To`/`References:` (to support non-Delta-Clients) or from `Chat-Predecessor:` (Delta clients, see comment in dc_chat.c) */ |
struct mailimf_optional_field* optional_field = NULL; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.