text stringlengths 0 357 |
|---|
mb = (struct mailimf_mailbox*)clist_content(clist_begin(fld_from->frm_mb_list->mb_list)); |
if (mb==NULL) { |
goto cleanup; |
} |
from_addr_norm = dc_addr_normalize(mb->mb_addr_spec); |
/* get To:/Cc: and check there is exactly one recipent */ |
recipients = mailimf_get_recipients(mimeparser->header_root); |
if (dc_hash_cnt(recipients)!=1) { |
goto cleanup; |
} |
/* check if From:==To:/Cc: */ |
if (dc_hash_find_str(recipients, from_addr_norm)) { |
sender_equals_recipient = 1; |
} |
cleanup: |
dc_hash_clear(recipients); |
free(recipients); |
free(from_addr_norm); |
return sender_equals_recipient; |
} |
``` |
Filename: dc_move.c |
```c |
#include "dc_context.h" |
#include "dc_mimeparser.h" |
#include "dc_job.h" |
void dc_do_heuristics_moves(dc_context_t* context, const char* folder, uint32_t msg_id) |
{ |
// for already seen messages, folder may be different from msg->folder |
dc_msg_t* msg = NULL; |
sqlite3_stmt* stmt = NULL; |
if (dc_sqlite3_get_config_int(context->sql, "mvbox_move", DC_MVBOX_MOVE_DEFAULT)==0) { |
goto cleanup; |
} |
if (!dc_is_inbox(context, folder) && !dc_is_sentbox(context, folder)) { |
goto cleanup; |
} |
msg = dc_msg_new_load(context, msg_id); |
if (dc_msg_is_setupmessage(msg)) { |
// do not move setup messages; |
// there may be a non-delta device that wants to handle it |
goto cleanup; |
} |
if (dc_is_mvbox(context, folder)) { |
dc_update_msg_move_state(context, msg->rfc724_mid, DC_MOVE_STATE_STAY); |
goto cleanup; |
} |
if (msg->is_dc_message /*1=dc message, 2=reply to dc message*/) { |
dc_job_add(context, DC_JOB_MOVE_MSG, msg->id, NULL, 0); |
dc_update_msg_move_state(context, msg->rfc724_mid, DC_MOVE_STATE_MOVING); |
} |
cleanup: |
sqlite3_finalize(stmt); |
dc_msg_unref(msg); |
} |
``` |
Filename: dc_msg.c |
```c |
#include "dc_context.h" |
#include "dc_imap.h" |
#include "dc_smtp.h" |
#include "dc_job.h" |
#include "dc_pgp.h" |
#include "dc_mimefactory.h" |
#define DC_MSG_MAGIC 0x11561156 |
/** |
* Create new message object. Message objects are needed eg. for sending messages using |
* dc_send_msg(). Moreover, they are returned eg. from dc_get_msg(), |
* set up with the current state of a message. The message object is not updated; |
* to achieve this, you have to recreate it. |
* |
* @memberof dc_msg_t |
* @param context The context that should be stored in the message object. |
* @param viewtype The type to the message object to create, |
* one of the @ref DC_MSG constants. |
* @return The created message object. |
*/ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.