text stringlengths 0 357 |
|---|
if ((optional_field=dc_mimeparser_lookup_optional_field(mime_parser, "Chat-Predecessor"))!=NULL) |
{ |
if (is_known_rfc724_mid(context, optional_field->fld_value)) { |
return 1; |
} |
} |
struct mailimf_field* field = NULL; |
if ((field=dc_mimeparser_lookup_field(mime_parser, "In-Reply-To"))!=NULL |
&& field->fld_type==MAILIMF_FIELD_IN_REPLY_TO) |
{ |
struct mailimf_in_reply_to* fld_in_reply_to = field->fld_data.fld_in_reply_to; |
if (fld_in_reply_to) { |
if (is_known_rfc724_mid_in_list(context, field->fld_data.fld_in_reply_to->mid_list)) { |
return 1; |
} |
} |
} |
if ((field=dc_mimeparser_lookup_field(mime_parser, "References"))!=NULL |
&& field->fld_type==MAILIMF_FIELD_REFERENCES) |
{ |
struct mailimf_references* fld_references = field->fld_data.fld_references; |
if (fld_references) { |
if (is_known_rfc724_mid_in_list(context, field->fld_data.fld_references->mid_list)) { |
return 1; |
} |
} |
} |
return 0; |
} |
/******************************************************************************* |
* Check if a message is a reply to any messenger message |
******************************************************************************/ |
static int is_msgrmsg_rfc724_mid(dc_context_t* context, const char* rfc724_mid) |
{ |
int is_msgrmsg = 0; |
if (rfc724_mid) { |
sqlite3_stmt* stmt = dc_sqlite3_prepare(context->sql, |
"SELECT id FROM msgs " |
" WHERE rfc724_mid=? " |
" AND msgrmsg!=0 " |
" AND chat_id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL) ";"); |
sqlite3_bind_text(stmt, 1, rfc724_mid, -1, SQLITE_STATIC); |
if (sqlite3_step(stmt)==SQLITE_ROW) { |
is_msgrmsg = 1; |
} |
sqlite3_finalize(stmt); |
} |
return is_msgrmsg; |
} |
static int is_msgrmsg_rfc724_mid_in_list(dc_context_t* context, const clist* mid_list) |
{ |
if (mid_list) { |
for (clistiter* cur = clist_begin(mid_list); cur!=NULL ; cur=clist_next(cur)) { |
if (is_msgrmsg_rfc724_mid(context, clist_content(cur))) { |
return 1; |
} |
} |
} |
return 0; |
} |
static int dc_is_reply_to_messenger_message(dc_context_t* context, dc_mimeparser_t* mime_parser) |
{ |
/* function checks, if the message defined by mime_parser references a message send by us from Delta Chat. |
This is similar to is_reply_to_known_message() but |
- checks also if any of the referenced IDs are send by a messenger |
- it is okay, if the referenced messages are moved to trash here |
- no check for the Chat-* headers (function is only called if it is no messenger message itself) */ |
struct mailimf_field* field = NULL; |
if ((field=dc_mimeparser_lookup_field(mime_parser, "In-Reply-To"))!=NULL |
&& field->fld_type==MAILIMF_FIELD_IN_REPLY_TO) |
{ |
struct mailimf_in_reply_to* fld_in_reply_to = field->fld_data.fld_in_reply_to; |
if (fld_in_reply_to) { |
if (is_msgrmsg_rfc724_mid_in_list(context, field->fld_data.fld_in_reply_to->mid_list)) { |
return 1; |
} |
} |
} |
if ((field=dc_mimeparser_lookup_field(mime_parser, "References"))!=NULL |
&& field->fld_type==MAILIMF_FIELD_REFERENCES) |
{ |
struct mailimf_references* fld_references = field->fld_data.fld_references; |
if (fld_references) { |
if (is_msgrmsg_rfc724_mid_in_list(context, field->fld_data.fld_references->mid_list)) { |
return 1; |
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.