]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: Added missing new files for last commit.
authorTimo Sirainen <tss@iki.fi>
Mon, 6 Dec 2010 03:40:41 +0000 (03:40 +0000)
committerTimo Sirainen <tss@iki.fi>
Mon, 6 Dec 2010 03:40:41 +0000 (03:40 +0000)
src/plugins/fts/fts-mailbox.c [new file with mode: 0644]
src/plugins/fts/fts-mailbox.h [new file with mode: 0644]

diff --git a/src/plugins/fts/fts-mailbox.c b/src/plugins/fts/fts-mailbox.c
new file mode 100644 (file)
index 0000000..9fa1c70
--- /dev/null
@@ -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 --git a/src/plugins/fts/fts-mailbox.h b/src/plugins/fts/fts-mailbox.h
new file mode 100644 (file)
index 0000000..e4c3984
--- /dev/null
@@ -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