/[mailutils]/mailutils/libsieve/actions.c
ViewVC logotype

Diff of /mailutils/libsieve/actions.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by gray, Wed Nov 13 13:34:21 2002 UTC revision 1.4 by gray, Thu Nov 14 07:15:58 2002 UTC
# Line 26  Line 26 
26  #include <sieve.h>  #include <sieve.h>
27    
28  int  int
29  sieve_action_stop (sieve_machine_t *mach, list_t args, list_t tags)  sieve_action_stop (sieve_machine_t mach, list_t args, list_t tags)
30  {  {
31      sieve_log_action (mach, "STOP", NULL);
32      mach->pc = 0;
33    return 0;    return 0;
34  }  }
35    
36  int  int
37  sieve_action_keep (sieve_machine_t *mach, list_t args, list_t tags)  sieve_action_keep (sieve_machine_t mach, list_t args, list_t tags)
38  {  {
39      sieve_log_action (mach, "KEEP", NULL);
40    return 0;    return 0;
41  }  }
42    
43  int  int
44  sieve_action_discard (sieve_machine_t *mach, list_t args, list_t tags)  sieve_action_discard (sieve_machine_t mach, list_t args, list_t tags)
45  {  {
46      sieve_log_action (mach, "DISCARD", NULL);
47      if (sieve_is_dry_run (mach))
48        return 0;
49      sieve_mark_deleted (mach->msg, 1);
50    return 0;    return 0;
51  }  }
52    
53  int  int
54  sieve_action_fileinto (sieve_machine_t *mach, list_t args, list_t tags)  sieve_action_fileinto (sieve_machine_t mach, list_t args, list_t tags)
55  {  {
56    return 0;    int rc;
57      sieve_value_t *val = sieve_value_get (args, 0);
58      if (!val)
59        {
60          sieve_error (mach, "fileinto: can't get filename!");
61          sieve_abort (mach);
62        }
63      sieve_log_action (mach, "FILEINTO", "delivering into %s", val->v.string);
64      if (sieve_is_dry_run (mach))
65        return 0;
66    
67      rc = message_save_to_mailbox (mach->msg, mach->ticket, mach->mu_debug,
68                                    val->v.string);
69      if (rc)
70        sieve_error (mach, "fileinto: cannot save to mailbox: %s",
71                     mu_errstring (rc));
72      else
73        sieve_mark_deleted (mach->msg, 1);    
74      
75      return rc;
76  }  }
77    
78  int  int
79  sieve_action_reject (sieve_machine_t *mach, list_t args, list_t tags)  sieve_action_reject (sieve_machine_t mach, list_t args, list_t tags)
80  {  {
81      sieve_value_t *val = sieve_value_get (args, 0);
82      if (!val)
83        {
84          sieve_error (mach, "redirect: can't get text!");
85          sieve_abort (mach);
86        }
87      sieve_log_action (mach, "REJECT", NULL);  
88      if (sieve_is_dry_run (mach))
89        return 0;
90    return 0;    return 0;
91  }  }
92    
93  int  int
94  sieve_action_redirect (sieve_machine_t *mach, list_t args, list_t tags)  sieve_action_redirect (sieve_machine_t mach, list_t args, list_t tags)
95  {  {
96      sieve_value_t *val = sieve_value_get (args, 0);
97      if (!val)
98        {
99          sieve_error (mach, "redirect: can't get address!");
100          sieve_abort (mach);
101        }
102      sieve_log_action (mach, "REDIRECT", "to %s", val->v.string);
103      if (sieve_is_dry_run (mach))
104        return 0;
105    return 0;    return 0;
106  }  }
107    
# Line 71  sieve_register_standard_actions () Line 115  sieve_register_standard_actions ()
115  {  {
116    sieve_register_action ("stop", sieve_action_stop, NULL, NULL, 1);    sieve_register_action ("stop", sieve_action_stop, NULL, NULL, 1);
117    sieve_register_action ("keep", sieve_action_keep, NULL, NULL, 1);    sieve_register_action ("keep", sieve_action_keep, NULL, NULL, 1);
118    sieve_register_action ("discard", sieve_action_keep, NULL, NULL, 1);    sieve_register_action ("discard", sieve_action_discard, NULL, NULL, 1);
119    sieve_register_action ("fileinto", sieve_action_keep, fileinto_args,    sieve_register_action ("fileinto", sieve_action_fileinto, fileinto_args,
120                           NULL, 1);                           NULL, 1);
121    sieve_register_action ("reject", sieve_action_reject, fileinto_args,    sieve_register_action ("reject", sieve_action_reject, fileinto_args,
122                           NULL, 0);                           NULL, 0);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26