~ubuntu-branches/ubuntu/quantal/dovecot/quantal

« back to all changes in this revision

Viewing changes to sieve/src/lib-sieve/sieve-comparators.h

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short, Scott Kitterman
  • Date: 2010-06-22 10:33:51 UTC
  • mfrom: (1.13.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100622103351-ifbmnklp8kxrhb30
Tags: 1:1.2.12-0ubuntu1
* New upstream release:
  - deliver: Don't crash when a message with Auto-submitted: header gets
   rejected.
  - lib-storage: Fixed header searches to work correctly when there are
    multiple headers with same name.
  - dict client: Disconnect from dict server after 1 second of idling.
  - dict: If process crashed, it wasn't automatically restarted
  - dict file: If dict file's group permissions equal world permissions,
    don't try to change its gid.
  - maildir: Fixed a memory leak when copying with hardlinks.
  - maildir: Expunging last messages may have assert-crashed if their
    filenames had just changed.
 * Update sieve patch to 0.1.17
 * debian/dovecot-common.postinst: Add warning about expired certificate.
   (Debian Bug: #576455)
 * Silence lintian warnings.

 [Scott Kitterman]
 * Rename dovecot-postfix to mail-stack-delivery per server-maverick-mail-
   integration spec.
   - Update debian/rules
   - Convert existing package to a dummy package and add new binary in debian/control
   - Update maintainer scripts.
   - Move previously installed backups and config files to new package name
     space in preinst
   - Add new debian/mail-stack-delivery.prerm to handle downgrades
   - Rename debian/dovecot-postfix.* to debian/mail-stack-delivery.*

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file
 
1
/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file 
2
2
 */
3
 
 
 
3
 
4
4
#ifndef __SIEVE_COMPARATORS_H
5
5
#define __SIEVE_COMPARATORS_H
6
6
 
10
10
#include "sieve-objects.h"
11
11
#include "sieve-code.h"
12
12
 
13
 
/*
14
 
 * Core comparators
 
13
/* 
 
14
 * Core comparators 
15
15
 */
16
 
 
 
16
 
17
17
enum sieve_comparator_code {
18
18
        SIEVE_COMPARATOR_I_OCTET,
19
19
        SIEVE_COMPARATOR_I_ASCII_CASEMAP,
31
31
        SIEVE_COMPARATOR_FLAG_ORDERING = (1 << 0),
32
32
        SIEVE_COMPARATOR_FLAG_EQUALITY = (1 << 1),
33
33
        SIEVE_COMPARATOR_FLAG_PREFIX_MATCH = (1 << 2),
34
 
        SIEVE_COMPARATOR_FLAG_SUBSTRING_MATCH = (1 << 3),
 
34
        SIEVE_COMPARATOR_FLAG_SUBSTRING_MATCH = (1 << 3),       
35
35
};
36
36
 
37
37
/*
39
39
 */
40
40
 
41
41
struct sieve_comparator_def {
42
 
        struct sieve_object_def obj_def;
43
 
 
 
42
        struct sieve_object_def obj_def;        
 
43
                
44
44
        unsigned int flags;
45
 
 
 
45
        
46
46
        /* Equality and ordering */
47
47
 
48
 
        int (*compare)(const struct sieve_comparator *cmp,
49
 
                const char *val1, size_t val1_size,
 
48
        int (*compare)(const struct sieve_comparator *cmp, 
 
49
                const char *val1, size_t val1_size, 
50
50
                const char *val2, size_t val2_size);
51
 
 
 
51
        
52
52
        /* Prefix and substring match */
53
 
 
54
 
        bool (*char_match)(const struct sieve_comparator *cmp,
 
53
        
 
54
        bool (*char_match)(const struct sieve_comparator *cmp, 
55
55
                const char **val, const char *val_end,
56
56
                const char **key, const char *key_end);
57
 
        bool (*char_skip)(const struct sieve_comparator *cmp,
 
57
        bool (*char_skip)(const struct sieve_comparator *cmp, 
58
58
                const char **val, const char *val_end);
59
59
};
60
60
 
64
64
 
65
65
struct sieve_comparator {
66
66
        struct sieve_object object;
67
 
 
 
67
        
68
68
        const struct sieve_comparator_def *def;
69
 
};
 
69
};      
70
70
 
71
71
#define SIEVE_COMPARATOR_DEFAULT(definition) \
72
72
        { SIEVE_OBJECT_DEFAULT(definition), &(definition) }
73
73
 
74
74
#define sieve_comparator_is(cmp, definition) \
75
 
        ( (cmp)->def == &(definition) )
 
75
        ( (cmp)->def == &(definition) ) 
76
76
 
77
77
static inline const struct sieve_comparator *sieve_comparator_copy
78
78
(pool_t pool, const struct sieve_comparator *cmp_orig)
87
87
/*
88
88
 * Comparator tagged argument
89
89
 */
90
 
 
 
90
 
91
91
extern const struct sieve_argument_def comparator_tag;
92
92
 
93
93
static inline bool sieve_argument_is_comparator
94
 
(struct sieve_ast_argument *arg)
 
94
(struct sieve_ast_argument *arg) 
95
95
{
96
 
        return ( arg->argument != NULL &&
 
96
        return ( arg->argument != NULL && 
97
97
                (arg->argument->def == &comparator_tag) );
98
98
}
99
99
 
100
100
void sieve_comparators_link_tag
101
 
        (struct sieve_validator *validator,
 
101
        (struct sieve_validator *validator, 
102
102
                struct sieve_command_registration *cmd_reg,     int id_code);
103
103
bool sieve_comparator_tag_is
104
104
        (struct sieve_ast_argument *tag, const struct sieve_comparator_def *cmp);
107
107
 
108
108
void sieve_comparator_register
109
109
        (struct sieve_validator *validator, const struct sieve_extension *ext,
110
 
                const struct sieve_comparator_def *cmp);
111
 
 
 
110
                const struct sieve_comparator_def *cmp); 
 
111
                
112
112
/*
113
113
 * Comparator operand
114
114
 */
121
121
 
122
122
static inline void sieve_opr_comparator_emit
123
123
(struct sieve_binary *sbin, const struct sieve_comparator *cmp)
124
 
{
 
124
125
125
        sieve_opr_object_emit(sbin, cmp->object.ext, cmp->object.def);
126
126
}
127
127
 
143
143
        return sieve_opr_object_dump
144
144
                (denv, &sieve_comparator_operand_class, address, NULL);
145
145
}
146
 
 
 
146
        
147
147
/*
148
148
 * Trivial/Common comparator method implementations
149
149
 */
150
150
 
151
151
bool sieve_comparator_octet_skip
152
 
        (const struct sieve_comparator *cmp ATTR_UNUSED,
 
152
        (const struct sieve_comparator *cmp ATTR_UNUSED, 
153
153
                const char **val, const char *val_end);
154
154
 
155
155
#endif /* __SIEVE_COMPARATORS_H */