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

« back to all changes in this revision

Viewing changes to sieve/src/lib-sieve/cmd-discard.c

  • 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:
9
9
#include "sieve-code.h"
10
10
#include "sieve-dump.h"
11
11
#include "sieve-actions.h"
12
 
#include "sieve-validator.h"
 
12
#include "sieve-validator.h" 
13
13
#include "sieve-generator.h"
14
14
#include "sieve-interpreter.h"
15
15
#include "sieve-result.h"
16
16
 
17
 
/*
18
 
 * Discard command
19
 
 *
 
17
/* 
 
18
 * Discard command 
 
19
 * 
20
20
 * Syntax
21
21
 *   discard
22
 
 */
 
22
 */     
23
23
 
24
24
static bool cmd_discard_generate
25
 
        (const struct sieve_codegen_env *cgenv,
26
 
                struct sieve_command *ctx ATTR_UNUSED);
 
25
        (const struct sieve_codegen_env *cgenv, 
 
26
                struct sieve_command *ctx ATTR_UNUSED); 
27
27
 
28
 
const struct sieve_command_def cmd_discard = {
29
 
        "discard",
30
 
        SCT_COMMAND,
 
28
const struct sieve_command_def cmd_discard = { 
 
29
        "discard", 
 
30
        SCT_COMMAND, 
31
31
        0, 0, FALSE, FALSE,
32
 
        NULL, NULL, NULL,
33
 
        cmd_discard_generate,
34
 
        NULL
 
32
        NULL, NULL, NULL, 
 
33
        cmd_discard_generate, 
 
34
        NULL 
35
35
};
36
36
 
37
37
/*
43
43
static int cmd_discard_operation_execute
44
44
        (const struct sieve_runtime_env *renv, sieve_size_t *address);
45
45
 
46
 
const struct sieve_operation_def cmd_discard_operation = {
 
46
const struct sieve_operation_def cmd_discard_operation = { 
47
47
        "DISCARD",
48
48
        NULL,
49
49
        SIEVE_OPERATION_DISCARD,
50
 
        cmd_discard_operation_dump,
51
 
        cmd_discard_operation_execute
 
50
        cmd_discard_operation_dump, 
 
51
        cmd_discard_operation_execute 
52
52
};
53
53
 
54
 
/*
 
54
/* 
55
55
 * Discard actions
56
56
 */
57
57
 
58
58
static void act_discard_print
59
 
        (const struct sieve_action *action,
60
 
                const struct sieve_result_print_env *rpenv, bool *keep);
 
59
        (const struct sieve_action *action, 
 
60
                const struct sieve_result_print_env *rpenv, bool *keep);        
61
61
static bool act_discard_commit
62
 
        (const struct sieve_action *action,
 
62
        (const struct sieve_action *action, 
63
63
                const struct sieve_action_exec_env *aenv, void *tr_context, bool *keep);
64
 
 
 
64
                
65
65
const struct sieve_action_def act_discard = {
66
66
        "discard",
67
67
        0,
75
75
/*
76
76
 * Code generation
77
77
 */
78
 
 
 
78
 
79
79
static bool cmd_discard_generate
80
 
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
 
80
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) 
81
81
{
82
82
        sieve_operation_emit(cgenv->sbin, NULL, &cmd_discard_operation);
83
83
 
87
87
        return TRUE;
88
88
}
89
89
 
90
 
/*
 
90
/* 
91
91
 * Code dump
92
92
 */
93
93
 
109
109
 */
110
110
 
111
111
static int cmd_discard_operation_execute
112
 
(const struct sieve_runtime_env *renv ATTR_UNUSED,
 
112
(const struct sieve_runtime_env *renv ATTR_UNUSED, 
113
113
        sieve_size_t *address ATTR_UNUSED)
114
 
{
 
114
{       
115
115
        unsigned int source_line;
116
 
 
 
116
        
117
117
        /* Source line */
118
118
        if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
119
119
                sieve_runtime_trace_error(renv, "failed to read source line");
129
129
/*
130
130
 * Action implementation
131
131
 */
132
 
 
 
132
 
133
133
static void act_discard_print
134
 
(const struct sieve_action *action ATTR_UNUSED,
135
 
        const struct sieve_result_print_env *rpenv, bool *keep)
 
134
(const struct sieve_action *action ATTR_UNUSED, 
 
135
        const struct sieve_result_print_env *rpenv, bool *keep) 
136
136
{
137
137
        sieve_result_action_printf(rpenv, "discard");
138
 
 
 
138
        
139
139
        *keep = FALSE;
140
140
}
141
141
 
142
142
static bool act_discard_commit
143
 
(const struct sieve_action *action ATTR_UNUSED,
144
 
        const struct sieve_action_exec_env *aenv,
 
143
(const struct sieve_action *action ATTR_UNUSED, 
 
144
        const struct sieve_action_exec_env *aenv, 
145
145
        void *tr_context ATTR_UNUSED, bool *keep)
146
146
{
147
 
        sieve_result_log(aenv,
 
147
        sieve_result_log(aenv, 
148
148
                "marked message to be discarded if not explicitly delivered "
149
149
                "(discard action)");
150
150
        *keep = FALSE;