proxy-mailbox.c revision a423d985ba7261661475811c22b21b80ec765a71
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3Timo Sirainen/* Copyright (C) 2003 Timo Sirainen */
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainenstatic int _allow_new_keywords(struct mailbox *box)
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
043c8a96a035379bcba04f487d58457beefdfcaaTimo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenstatic int _get_status(struct mailbox *box, enum mailbox_status_items items,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen return p->box->get_status(p->box, items, status);
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainen_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainenstatic void _notify_changes(struct mailbox *box, unsigned int min_interval,
8fb1e3e2349c9940732b5bb77a2a4053b8f72a4fTimo Sirainen mailbox_notify_callback_t *callback, void *context)
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen return p->box->notify_changes(box, min_interval, callback, context);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenstatic struct mail *_fetch(struct mailbox_transaction_context *t, uint32_t seq,
87460b08cb97b31cde640d4975a6aa2c1d0e7226Timo Sirainen struct proxy_mailbox_transaction_context *pt =
cf52b37d807553e91a2d6fb7cb2c8b4c34589e1dTimo Sirainen (struct proxy_mailbox_transaction_context *)t;
87460b08cb97b31cde640d4975a6aa2c1d0e7226Timo Sirainen struct proxy_mailbox *pbox = (struct proxy_mailbox *)t->box;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen return pbox->box->fetch(pt->ctx, seq, wanted_fields);
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainenstatic int _get_uids(struct mailbox *box, uint32_t uid1, uint32_t uid2,
86ad841251a38aa9ffcf4db4ee2c9fd449121bcbTimo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
5cda0bfea032000c4a51134c748d9efe6614870bTimo Sirainen return p->box->get_uids(p->box, uid1, uid2, seq1_r, seq2_r);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen_header_lookup_init(struct mailbox *box, const char *const headers[])
87460b08cb97b31cde640d4975a6aa2c1d0e7226Timo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
8b12e7b44abca3bd51a1c46e19ca504f3b55e723Timo Sirainen return p->box->header_lookup_init(p->box, headers);
87460b08cb97b31cde640d4975a6aa2c1d0e7226Timo Sirainenstatic int _search_get_sorting(struct mailbox *box,
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
8b12e7b44abca3bd51a1c46e19ca504f3b55e723Timo Sirainen return p->box->search_get_sorting(p->box, sort_program);
8b12e7b44abca3bd51a1c46e19ca504f3b55e723Timo Sirainen_search_init(struct mailbox_transaction_context *t,
8b12e7b44abca3bd51a1c46e19ca504f3b55e723Timo Sirainen const char *charset, struct mail_search_arg *args,
872b8fd8a8db97dc54067b7ab25bda96ec0aac0dTimo Sirainen struct mailbox_header_lookup_ctx *wanted_headers)
87460b08cb97b31cde640d4975a6aa2c1d0e7226Timo Sirainen struct proxy_mailbox_transaction_context *pt =
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen (struct proxy_mailbox_transaction_context *)t;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox *pbox = (struct proxy_mailbox *)t->box;
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen return pbox->box->search_init(pt->ctx, charset, args, sort_program,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenstatic int _transaction_commit(struct mailbox_transaction_context *t)
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox_transaction_context *pt =
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen (struct proxy_mailbox_transaction_context *)t;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox *pbox = (struct proxy_mailbox *)t->box;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen return pbox->box->transaction_commit(pt->ctx);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenstatic void _transaction_rollback(struct mailbox_transaction_context *t)
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox_transaction_context *pt =
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen (struct proxy_mailbox_transaction_context *)t;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox *pbox = (struct proxy_mailbox *)t->box;
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen_save_init(struct mailbox_transaction_context *t,
5cda0bfea032000c4a51134c748d9efe6614870bTimo Sirainen const char *from_envelope, struct istream *input, int want_mail)
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen struct proxy_mailbox_transaction_context *pt =
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen (struct proxy_mailbox_transaction_context *)t;
cf52b37d807553e91a2d6fb7cb2c8b4c34589e1dTimo Sirainen struct proxy_mailbox *pbox = (struct proxy_mailbox *)t->box;
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainen return pbox->box->save_init(pt->ctx, flags, received_date,
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainenstatic int _copy(struct mailbox_transaction_context *t, struct mail *mail,
e217d6fce33746e198ecc21bff0bc658664c9ef4Timo Sirainen struct proxy_mailbox_transaction_context *pt =
8ae72ad7d0c69e972cfa65d1e2ce4e3e9a8b765cTimo Sirainen (struct proxy_mailbox_transaction_context *)t;
70612e07102b75a8511aa7f9de60771176b18de0Timo Sirainen struct proxy_mailbox *pbox = (struct proxy_mailbox *)t->box;
1bdda5c0c30463160c47151537e6bb2c6c994841Timo Sirainen return pbox->box->copy(pt->ctx, mail, dest_mail_r);
e217d6fce33746e198ecc21bff0bc658664c9ef4Timo Sirainenstatic int _is_inconsistent(struct mailbox *box)
5df33e9ee65eec194105b338c55dedbf8422f695Timo Sirainen struct proxy_mailbox *p = (struct proxy_mailbox *) box;
19e8adccba16ff419f5675b1575358c2956dce83Timo Sirainenvoid proxy_mailbox_init(struct proxy_mailbox *proxy, struct mailbox *box)
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainen pb->transaction_begin = NULL; /* must be implemented */
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen pb->transaction_rollback = _transaction_rollback;
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainenvoid proxy_transaction_init(struct proxy_mailbox *proxy_box,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen struct proxy_mailbox_transaction_context *proxy_ctx,