pop3-migration-plugin.c revision e9d659ad49a3cf2190606a62289c86347608bffa
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen/* Copyright (c) 2007-2016 Dovecot authors, see the included COPYING file */
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen MODULE_CONTEXT(obj, pop3_migration_storage_module)
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen MODULE_CONTEXT(obj, pop3_migration_mail_module)
d8eedfaad386a8776e4931086b039b72e1ad38c4Timo Sirainen /* LIST size */
acc8c0647873b1c847bfa362ddefd0d219d0aa91Timo Sirainen /* sha1(TOP 0) - set only when needed */
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen /* sha1(header) - set only when needed */
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen/* NOTE: these headers must be sorted */
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenstatic const char *hdr_hash_skip_headers[] = {
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen "Content-Length",
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen "Return-Path", /* Yahoo IMAP has Return-Path, Yahoo POP3 doesn't */
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen "X-IMAPbase",
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen "X-Keywords",
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen "X-Message-Flag",
9446c7a5d400cba60d097c528bd08312552438e3Timo Sirainen "X-Yahoo-Newman-Property"
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenconst char *pop3_migration_plugin_version = DOVECOT_ABI_VERSION;
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenstatic MODULE_CONTEXT_DEFINE_INIT(pop3_migration_storage_module,
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenstatic MODULE_CONTEXT_DEFINE_INIT(pop3_migration_mail_module,
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenstatic int imap_msg_map_uid_cmp(const struct imap_msg_map *map1,
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenstatic int pop3_uidl_map_pop3_seq_cmp(const struct pop3_uidl_map *map1,
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenstatic int pop3_uidl_map_hdr_cmp(const struct pop3_uidl_map *map1,
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen return memcmp(map1->hdr_sha1, map2->hdr_sha1, sizeof(map1->hdr_sha1));
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenstatic int imap_msg_map_hdr_cmp(const struct imap_msg_map *map1,
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen return memcmp(map1->hdr_sha1, map2->hdr_sha1, sizeof(map1->hdr_sha1));
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainenpop3_header_filter_callback(struct header_filter_istream *input ATTR_UNUSED,
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen /* matched is handled differently for eoh by
b494ffed8ded8d170d9ace3dc607b1d278048241Timo Sirainen istream-header-filter. a design bug I guess.. */
bool *have_eoh_r)
const unsigned char *data, *p;
bool have_eoh;
if (have_eoh)
struct mailbox_transaction_context *t;
const char *uidl;
int ret = 0;
(void)mailbox_transaction_commit(&t);
return ret;
unsigned first_seq)
struct mailbox_transaction_context *t;
int ret = 0;
(void)mailbox_transaction_commit(&t);
return ret;
struct mailbox_transaction_context *t;
int ret = 0;
(void)mailbox_transaction_commit(&t);
return ret;
struct mailbox_transaction_context *t;
int ret = 0;
(void)mailbox_transaction_commit(&t);
return ret;
for (i = 0; i < count; i++) {
return i == count;
int ret;
pop3_idx++;
imap_idx++;
if (ret < 0)
pop3_idx++;
else if (ret > 0)
imap_idx++;
missing_uids_count = 0;
unsigned int i, count;
prev_uid = 0;
for (i = 0; i < count; i++) {
const char **value_r)
const char *pop3_box_vname;
void pop3_migration_plugin_deinit(void)