~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002110912

« back to all changes in this revision

Viewing changes to src/lib-storage/mail-search.h

  • Committer: Bazaar Package Importer
  • Author(s): CHuck Short, Chuck Short
  • Date: 2009-11-06 00:47:29 UTC
  • mfrom: (4.1.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106004729-i39n7v9e7d4h51f6
Tags: 1:1.2.6-1ubuntu1
* Merge from debian testing, remaining changes:
  Add new binary pkg dovecot-postfix that integrates postfix and dovecot
  automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restrictions
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
   + debian/dovecot-postfix.dirs: create backup directory for postfix's configuration
   + restart postfix and dovecot.
   + debian/dovecot-postfix.postrm:
     - remove all dovecot related configuration from postfix.
     - restart postfix and dovecot.
   + debian/dovecot-common.init:
     - check if /etc/dovecot/dovecot-postfix.conf exists and use it
       as the configuration file if so.
   + debian/patches/warning-ubuntu-postfix.dpatch
     - add warning about dovecot-postfix.conf in dovecot default 
       configuration file
   + debian/patches/dovecot-postfix.conf.diff:
     - Ubuntu server custom changes to the default dovecot configuration for
       better interfation with postfix
     - enable sieve plugin
   + debian/patches/dovecot-postfix.conf.diff:
     + Ubuntu server custom changes to the default dovecot configuration for
       better integration with postfix:
       - enable imap, pop3, imaps, pop3s and managesieve by default.
       - enable dovecot LDA (deliver).
       - enable SASL auth socket in postfix private directory.
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + Use Snakeoil SSL certificates by default.
     - debian/control: Depend on ssl-cert.
     - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert
       paths to snakeoil.
     - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
   + Add autopkgtest to debian/tests/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules:
       + install profile
     - debian/control:
       + Suggest ufw
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). LP: #254721
   + debian/control:
     - Update Vcs-* headers.
   + debian/rules:
     - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
       if they're not there since empty files are not included in the diff.gz 
       file.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
   + Dropped:
     - debian/patches/security-CVE-2009-3235: Applied upstream.
     - debian/patches/fix-pop3-assertion.dpatch: Applied upstream.
     - dovecot-sieve and dovecot-managesieve: Use the debian patches instead.

  [Chuck Short]
  - Updated dovecot-sieve to 0.1.13.
  - Updated dovecot-managesieve to 0.11.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef MAIL_SEARCH_H
2
2
#define MAIL_SEARCH_H
3
3
 
 
4
#include "seq-range-array.h"
4
5
#include "mail-types.h"
 
6
#include "mail-thread.h"
5
7
 
6
8
enum mail_search_arg_type {
7
9
        SEARCH_OR,
10
12
        /* sequence sets */
11
13
        SEARCH_ALL,
12
14
        SEARCH_SEQSET,
 
15
        SEARCH_UIDSET,
13
16
 
14
17
        /* flags */
15
18
        SEARCH_FLAGS,
36
39
        SEARCH_BODY,
37
40
        SEARCH_TEXT,
38
41
        SEARCH_BODY_FAST,
39
 
        SEARCH_TEXT_FAST
40
 
};
41
 
 
42
 
struct mail_search_seqset {
43
 
        uint32_t seq1, seq2;
44
 
        struct mail_search_seqset *next;
 
42
        SEARCH_TEXT_FAST,
 
43
 
 
44
        /* extensions */
 
45
        SEARCH_MODSEQ,
 
46
        SEARCH_INTHREAD,
 
47
        SEARCH_GUID,
 
48
        SEARCH_MAILBOX
 
49
};
 
50
 
 
51
enum mail_search_arg_flag {
 
52
        /* For (SENT)BEFORE/SINCE/ON searches: Don't drop timezone from
 
53
           comparisons */
 
54
        MAIL_SEARCH_ARG_FLAG_USE_TZ     = 0x01,
 
55
};
 
56
 
 
57
enum mail_search_modseq_type {
 
58
        MAIL_SEARCH_MODSEQ_TYPE_ANY = 0,
 
59
        MAIL_SEARCH_MODSEQ_TYPE_PRIVATE,
 
60
        MAIL_SEARCH_MODSEQ_TYPE_SHARED
 
61
};
 
62
 
 
63
struct mail_search_modseq {
 
64
        uint64_t modseq;
 
65
        enum mail_search_modseq_type type;
45
66
};
46
67
 
47
68
struct mail_search_arg {
50
71
        enum mail_search_arg_type type;
51
72
        struct {
52
73
                struct mail_search_arg *subargs;
53
 
                struct mail_search_seqset *seqset;
 
74
                ARRAY_TYPE(seq_range) seqset;
54
75
                const char *str;
55
76
                time_t time;
56
77
                uoff_t size;
57
78
                enum mail_flags flags;
 
79
                enum mail_search_arg_flag search_flags;
 
80
                enum mail_thread_type thread_type;
58
81
                struct mail_keywords *keywords;
 
82
                struct mail_search_modseq *modseq;
 
83
                struct mail_search_args *search_args;
 
84
                struct mail_search_result *search_result;
59
85
        } value;
60
86
 
61
87
        void *context;
66
92
        int result; /* -1 = unknown, 0 = unmatched, 1 = matched */
67
93
};
68
94
 
 
95
struct mail_search_args {
 
96
        int refcount, init_refcount;
 
97
 
 
98
        pool_t pool;
 
99
        struct mailbox *box;
 
100
        struct mail_search_arg *args;
 
101
        const char *charset;
 
102
 
 
103
        unsigned int simplified:1;
 
104
        unsigned int have_inthreads:1;
 
105
};
 
106
 
69
107
#define ARG_SET_RESULT(arg, res) \
70
108
        STMT_START { \
71
109
                (arg)->result = !(arg)->not ? (res) : \
75
113
typedef void mail_search_foreach_callback_t(struct mail_search_arg *arg,
76
114
                                            void *context);
77
115
 
 
116
/* Allocate keywords for search arguments. If change_uidsets is TRUE,
 
117
   change uidsets to seqsets. */
 
118
void mail_search_args_init(struct mail_search_args *args,
 
119
                           struct mailbox *box, bool change_uidsets,
 
120
                           const ARRAY_TYPE(seq_range) *search_saved_uidset);
 
121
/* Free keywords. The args can initialized afterwards again if needed.
 
122
   The args can be reused for other queries after calling this. */
 
123
void mail_search_args_deinit(struct mail_search_args *args);
 
124
/* Convert sequence sets in args to UIDs. */
 
125
void mail_search_args_seq2uid(struct mail_search_args *args);
 
126
/* Returns TRUE if the two search arguments are fully compatible.
 
127
   Always returns FALSE if there are seqsets, since they may point to different
 
128
   messages depending on when the search is run. */
 
129
bool mail_search_args_equal(const struct mail_search_args *args1,
 
130
                            const struct mail_search_args *args2);
 
131
 
 
132
void mail_search_args_ref(struct mail_search_args *args);
 
133
void mail_search_args_unref(struct mail_search_args **args);
 
134
 
 
135
struct mail_search_args *
 
136
mail_search_args_dup(const struct mail_search_args *args);
 
137
 
78
138
/* Reset the results in search arguments. match_always is reset only if
79
139
   full_reset is TRUE. */
80
140
void mail_search_args_reset(struct mail_search_arg *args, bool full_reset);
102
162
mail_search_args_analyze(struct mail_search_arg *args,
103
163
                         bool *have_headers, bool *have_body);
104
164
 
105
 
/* 1) Change args so that SEARCH_SUB and SEARCH_OR will never have "not" set
106
 
   2) Drop unnecessary nested SEARCH_SUB and SEARCH_ORs */
107
 
void mail_search_args_simplify(struct mail_search_arg *args);
 
165
/* Simplify/optimize search arguments */
 
166
void mail_search_args_simplify(struct mail_search_args *args);
108
167
 
109
168
#endif