# HG changeset patch # User Timo Sirainen # Date 1291606841 0 # Node ID 5815ff80f1982d3caa791d84d88d9a84ef2b1980 # Parent 3c883e0dcb31f7ac454ff06d7bb743953a5fd3e1 fts: Added missing new files for last commit. diff -r 3c883e0dcb31 -r 5815ff80f198 src/plugins/fts/fts-mailbox.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/plugins/fts/fts-mailbox.c Mon Dec 06 03:40:41 2010 +0000 @@ -0,0 +1,56 @@ +/* Copyright (c) 2006-2010 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "mail-storage.h" +#include "fts-mailbox.h" +#include "../virtual/virtual-storage.h" + +bool fts_mailbox_get_virtual_uid(struct mailbox *box, + const char *backend_mailbox, + uint32_t backend_uidvalidity, + uint32_t backend_uid, uint32_t *uid_r) +{ + struct virtual_mailbox *vbox; + + if (strcmp(box->storage->name, VIRTUAL_STORAGE_NAME) != 0) + return FALSE; + + vbox = (struct virtual_mailbox *)box; + return vbox->vfuncs.get_virtual_uid(box, backend_mailbox, + backend_uidvalidity, + backend_uid, uid_r); +} + +void fts_mailbox_get_virtual_backend_boxes(struct mailbox *box, + ARRAY_TYPE(mailboxes) *mailboxes, + bool only_with_msgs) +{ + struct virtual_mailbox *vbox; + + if (strcmp(box->storage->name, VIRTUAL_STORAGE_NAME) != 0) + array_append(mailboxes, &box, 1); + else { + vbox = (struct virtual_mailbox *)box; + vbox->vfuncs.get_virtual_backend_boxes(box, mailboxes, + only_with_msgs); + } +} + +void fts_mailbox_get_virtual_box_patterns(struct mailbox *box, + ARRAY_TYPE(mailbox_virtual_patterns) *includes, + ARRAY_TYPE(mailbox_virtual_patterns) *excludes) +{ + struct virtual_mailbox *vbox; + + if (strcmp(box->storage->name, VIRTUAL_STORAGE_NAME) != 0) { + struct mailbox_virtual_pattern pat; + + memset(&pat, 0, sizeof(pat)); + pat.ns = mailbox_list_get_namespace(box->list); + pat.pattern = box->name; + array_append(includes, &pat, 1); + } else { + vbox = (struct virtual_mailbox *)box; + vbox->vfuncs.get_virtual_box_patterns(box, includes, excludes); + } +} diff -r 3c883e0dcb31 -r 5815ff80f198 src/plugins/fts/fts-mailbox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/plugins/fts/fts-mailbox.h Mon Dec 06 03:40:41 2010 +0000 @@ -0,0 +1,22 @@ +#ifndef FTS_MAILBOX_H +#define FTS_MAILBOX_H + +/* If box is a virtual mailbox, look up UID for the given backend message. + Returns TRUE if found, FALSE if not. */ +bool fts_mailbox_get_virtual_uid(struct mailbox *box, + const char *backend_mailbox, + uint32_t backend_uidvalidity, + uint32_t backend_uid, uint32_t *uid_r); +/* If box is a virtual mailbox, return all backend mailboxes. If + only_with_msgs=TRUE, return only those mailboxes that have at least one + message existing in the virtual mailbox. */ +void fts_mailbox_get_virtual_backend_boxes(struct mailbox *box, + ARRAY_TYPE(mailboxes) *mailboxes, + bool only_with_msgs); +/* If mailbox is a virtual mailbox, return all mailbox list patterns that + are used to figure out which mailboxes belong to the virtual mailbox. */ +void fts_mailbox_get_virtual_box_patterns(struct mailbox *box, + ARRAY_TYPE(mailbox_virtual_patterns) *includes, + ARRAY_TYPE(mailbox_virtual_patterns) *excludes); + +#endif