text stringlengths 0 357 |
|---|
* @return 1=the message is probably from a mailing list, |
* 0=the message is a normal messsage |
* |
* Some statistics: |
* |
* **Sorted out** by `List-ID`-header: |
* - Mailman mailing list messages - OK, mass messages |
* - Xing forum/event notifications - OK, mass messages |
* - Xing welcome-back, contact-request - Hm, but it _has_ the List-ID header |
* |
* **Sorted out** by `Precedence`-header: |
* - Majordomo mailing list messages - OK, mass messages |
* |
* **Not** sorted out: |
* - Pingdom notifications - OK, individual message |
* - Paypal notifications - OK, individual message |
* - Linked in visits, do-you-know - OK, individual message |
* - Share-It notifications - OK, individual message |
* - Transifex, Github notifications - OK, individual message |
* |
* Current state of mailing list handling: |
* |
* As we currently do not have an extra handling for mailing list messages, the |
* best is to ignore them completely. |
* |
* - if we know the sender, we should show them in the normal chat of the sender as this will lose the |
* context of the mail |
* |
* - for unknown senders, mailing list messages are often replies to known messages (see is_reply_to_known_message()) - |
* which gives the sender some trust. this should not happen for mailing list messages. |
* this may result in unwanted messages and contacts added to the address book that are not known. |
* |
* - of course, all this can be fixed, however, this may be a lot of work. |
* moreover, if we allow answering to mailing lists, it might not be easy to follow the conventions used in typical mailing list, |
* eg threads. |
* |
* "Mailing lists messages" in this sense are messages marked by List-Id or Precedence headers. |
* For the future, we might want to show mailing lists as groups. |
* (NB: typical mailing list header: `From: sender@gmx.net To: list@address.net) |
* |
*/ |
int dc_mimeparser_is_mailinglist_message(dc_mimeparser_t* mimeparser) |
{ |
if (mimeparser==NULL) { |
return 0; |
} |
if (dc_mimeparser_lookup_field(mimeparser, "List-Id")!=NULL) { |
return 1; /* mailing list identified by the presence of `List-ID` from RFC 2919 */ |
} |
struct mailimf_optional_field* precedence = dc_mimeparser_lookup_optional_field(mimeparser, "Precedence"); |
if (precedence!=NULL) { |
if (strcasecmp(precedence->fld_value, "list")==0 |
|| strcasecmp(precedence->fld_value, "bulk")==0) { |
return 1; /* mailing list identified by the presence of `Precedence: bulk` or `Precedence: list` from RFC 3834 */ |
} |
} |
return 0; |
} |
/** |
* Checks, if there is only one recipient address and if the recipient address |
* matches the sender address. The function does _not_ check, if this address |
* matches the address configured for a special account. |
* |
* The function searches in the outer MIME header, not in possibly protected |
* memoryhole headers (if needed, we can change this; the reason for this is |
* only that mailimf_get_recipients() was already there - and does not respect |
* memoryhole as used on a lower level before memoryhole is calculated) |
* |
* @private @memberof dc_mimeparser_t |
* @param mimeparser The MIME-parser object. |
* @return 1=Sender matches recipient |
* 0=Sender does not match recipient or there are more than one recipients |
*/ |
int dc_mimeparser_sender_equals_recipient(dc_mimeparser_t* mimeparser) |
{ |
int sender_equals_recipient = 0; |
const struct mailimf_field* fld = NULL; |
const struct mailimf_from* fld_from = NULL; |
struct mailimf_mailbox* mb = NULL; |
char* from_addr_norm = NULL; |
dc_hash_t* recipients = NULL; |
if (mimeparser==NULL || mimeparser->header_root==NULL) { |
goto cleanup; |
} |
/* get From: and check there is exactly one sender */ |
if ((fld=mailimf_find_field(mimeparser->header_root, MAILIMF_FIELD_FROM))==NULL |
|| (fld_from=fld->fld_data.fld_from)==NULL |
|| fld_from->frm_mb_list==NULL |
|| fld_from->frm_mb_list->mb_list==NULL |
|| clist_count(fld_from->frm_mb_list->mb_list)!=1) { |
goto cleanup; |
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.