~james-page/ubuntu/raring/dovecot/autopkgtest

« back to all changes in this revision

Viewing changes to src/lib-index/mailbox-list-index.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-11 11:11:54 UTC
  • mfrom: (1.15.2) (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120611111154-678cwbdj6ktgsv1h
Tags: 1:2.1.7-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/{control,rules}: enable PIE hardening.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  + d/control: Drop B-D on systemd.
* Dropped changes:
  + d/patches/fix-racey-restart.patch: part of 2.1.x, no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef MAILBOX_LIST_INDEX_H
2
 
#define MAILBOX_LIST_INDEX_H
3
 
 
4
 
struct mailbox_list_index_view;
5
 
struct mailbox_list_index_sync_ctx;
6
 
 
7
 
/* Mailbox list index contains UID <-> mailbox name mapping. It also takes in
8
 
   a mail_index index which contains UID -> metadata information for the
9
 
   mailboxes. The mmap, in-memory and lock settings are taken from the
10
 
   mail_index. */
11
 
 
12
 
enum mailbox_list_index_flags {
13
 
        /* Mailbox has children. They may not be indexed however, so
14
 
           mailbox_list_index_info.has_children=FALSE is possible. */
15
 
        MAILBOX_LIST_INDEX_FLAG_CHILDREN        = 0x01,
16
 
        /* Mailbox has no children. mailbox_list_index_info.has_children
17
 
           should be FALSE. */
18
 
        MAILBOX_LIST_INDEX_FLAG_NOCHILDREN      = 0x02,
19
 
        /* The mailbox isn't selectable (eg. a directory) */
20
 
        MAILBOX_LIST_INDEX_FLAG_NOSELECT        = 0x04,
21
 
        /* The mailbox doesn't exist at all. This is only a placeholder for
22
 
           a child mailbox. When the children are deleted, this mailbox will
23
 
           be automatically deleted as well. */
24
 
        MAILBOX_LIST_INDEX_FLAG_NONEXISTENT     = 0x08
25
 
};
26
 
 
27
 
 
28
 
enum mailbox_list_sync_flags {
29
 
        /* All the child mailboxes are also being synced */
30
 
        MAILBOX_LIST_SYNC_FLAG_RECURSIVE        = 0x01,
31
 
        /* New mailboxes may be added, but none are removed */
32
 
        MAILBOX_LIST_SYNC_FLAG_PARTIAL          = 0x02
33
 
};
34
 
 
35
 
struct mailbox_list_index_info {
36
 
        const char *name;
37
 
        uint32_t uid;
38
 
        bool has_children;
39
 
};
40
 
 
41
 
struct mailbox_list_index *
42
 
mailbox_list_index_alloc(const char *path, char separator,
43
 
                         struct mail_index *mail_index);
44
 
void mailbox_list_index_free(struct mailbox_list_index **index);
45
 
 
46
 
/* Open or create mailbox list index. */
47
 
int mailbox_list_index_open_or_create(struct mailbox_list_index *index);
48
 
 
49
 
/* Synchronize the index with the backend. */
50
 
int mailbox_list_index_sync_init(struct mailbox_list_index *index,
51
 
                                 const char *path,
52
 
                                 enum mailbox_list_sync_flags flags,
53
 
                                 struct mailbox_list_index_sync_ctx **ctx_r);
54
 
struct mail_index_view *
55
 
mailbox_list_index_sync_get_view(struct mailbox_list_index_sync_ctx *ctx);
56
 
struct mail_index_transaction *
57
 
mailbox_list_index_sync_get_transaction(struct mailbox_list_index_sync_ctx*ctx);
58
 
int mailbox_list_index_sync_more(struct mailbox_list_index_sync_ctx *ctx,
59
 
                                 const char *name, uint32_t *seq_r);
60
 
int mailbox_list_index_sync_commit(struct mailbox_list_index_sync_ctx **ctx);
61
 
void mailbox_list_index_sync_rollback(struct mailbox_list_index_sync_ctx **ctx);
62
 
 
63
 
/* Mailbox list index and mail index must be kept in sync, so lookups and
64
 
   iterations must know the mail index view. The mail_view can be set to NULL
65
 
   to use the latest changes. Returns -1 if uidvalidity doesn't match. */
66
 
int mailbox_list_index_view_init(struct mailbox_list_index *index,
67
 
                                 struct mail_index_view *mail_view,
68
 
                                 struct mailbox_list_index_view **view_r);
69
 
void mailbox_list_index_view_deinit(struct mailbox_list_index_view **view);
70
 
 
71
 
/* Get mailbox UID for a given name. Returns 1 if found, 0 if not,
72
 
   -1 if error */
73
 
int mailbox_list_index_lookup(struct mailbox_list_index_view *view,
74
 
                              const char *name, uint32_t *uid_r);
75
 
 
76
 
/* Iterate through all the mailboxes. If recurse_level is -1, all the child
77
 
   mailboxes are returned, otherwise it's the number of levels to return
78
 
   (0 = only the mailboxes directly under the path). Returned mailbox names
79
 
   are allocated from name_pool. */
80
 
struct mailbox_list_iter_ctx *
81
 
mailbox_list_index_iterate_init(struct mailbox_list_index_view *view,
82
 
                                const char *path, int recurse_level);
83
 
/* Returns 1 if mailbox was returned, 0 at the end of iteration, -1 if error */
84
 
int mailbox_list_index_iterate_next(struct mailbox_list_iter_ctx *ctx,
85
 
                                    struct mailbox_list_index_info *info_r);
86
 
void mailbox_list_index_iterate_deinit(struct mailbox_list_iter_ctx **ctx);
87
 
 
88
 
#endif