1 |
unnilennium |
1.1 |
--- smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/00setup.zarafaprocmail 2009-02-21 21:05:05.000000000 +1100 |
2 |
|
|
+++ smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/00setup 2009-02-21 23:18:05.000000000 +1100 |
3 |
|
|
@@ -0,0 +1,14 @@ |
4 |
|
|
+{ |
5 |
|
|
+ # vim: ft=perl: |
6 |
|
|
+ |
7 |
|
|
+ use esmith::AccountsDB; |
8 |
|
|
+ our $adb = esmith::AccountsDB->open_ro or die "Couldn't open AccountsDB"; |
9 |
|
|
+ |
10 |
|
|
+ $user = $adb->get($USERNAME) or die "No user $USERNAME in AccountsDB"; |
11 |
|
|
+ %props = $user->props; |
12 |
|
|
+ |
13 |
|
|
+ our $zarafa1 = $props{zarafa} || 'disabled1'; |
14 |
|
|
+ our $zarafa2 = ${'zarafa-server'}{GlobalForward} || 'disabled2'; |
15 |
|
|
+ |
16 |
|
|
+ $OUT = ''; |
17 |
|
|
+} |
18 |
|
|
--- smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/40global.zarafaprocmail 2009-02-21 15:19:36.000000000 +1100 |
19 |
|
|
+++ smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/40global 2009-02-21 23:48:43.000000000 +1100 |
20 |
|
|
@@ -2,19 +2,6 @@ |
21 |
|
|
use esmith::config; |
22 |
|
|
use esmith::db; |
23 |
|
|
|
24 |
|
|
- my %accounts; |
25 |
|
|
- tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; |
26 |
|
|
- |
27 |
|
|
- # get $USERNAME from esmith::config |
28 |
|
|
- die "Username criterion missing." unless defined ($USERNAME); |
29 |
|
|
- |
30 |
|
|
- my $type = db_get_type(\%accounts, $USERNAME); |
31 |
|
|
- |
32 |
|
|
- die |
33 |
|
|
- "Account $USERNAME is not a user account; " |
34 |
|
|
- . "update email forwarding failed.\n" |
35 |
|
|
- unless $type eq 'user'; |
36 |
|
|
- |
37 |
|
|
my %processmail; |
38 |
|
|
tie %processmail, 'esmith::config', '/home/e-smith/db/processmail'; |
39 |
|
|
|
40 |
|
|
@@ -84,15 +71,18 @@ |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
##construct the deliver line |
44 |
|
|
- if ($action eq 'sort') |
45 |
|
|
+ if (($action eq 'sort') || ($action eq 'create')) |
46 |
|
|
{ |
47 |
|
|
# to a folder |
48 |
|
|
- $deliver = "\$MAILDIR/".'.'."$deliver"."/"; |
49 |
|
|
- } |
50 |
|
|
- elsif ($action eq 'create') |
51 |
|
|
- { |
52 |
|
|
- # to a folder |
53 |
|
|
- $deliver = "\$MAILDIR/".'.'."$deliver"."/"; |
54 |
|
|
+ if (($zarafa1 eq 'enabled') || ($zarafa2 eq 'enabled')) |
55 |
|
|
+ { |
56 |
|
|
+ if ($deliver eq 'junkmail') |
57 |
|
|
+ { $deliver = "| zarafa-dagent -j $USERNAME"; } |
58 |
|
|
+ else |
59 |
|
|
+ { $deliver = "| zarafa-dagent $USERNAME -C -F 'Inbox\\$deliver'"; } |
60 |
|
|
+ } |
61 |
|
|
+ else |
62 |
|
|
+ { $deliver = "\$MAILDIR/".'.'."$deliver"."/"; } |
63 |
|
|
} |
64 |
|
|
elsif ($action eq 'forward') |
65 |
|
|
{ |
66 |
|
|
@@ -114,7 +104,15 @@ |
67 |
|
|
if ($action2 eq 'sort') |
68 |
|
|
{ |
69 |
|
|
# to a folder |
70 |
|
|
- $deliver = "\$MAILDIR/".'.'."$deliver2"."/"; |
71 |
|
|
+ if (($zarafa1 eq 'enabled') || ($zarafa2 eq 'enabled')) |
72 |
|
|
+ { |
73 |
|
|
+ if ($deliver eq 'junkmail') |
74 |
|
|
+ { $deliver = "| zarafa-dagent -j $USERNAME"; } |
75 |
|
|
+ else |
76 |
|
|
+ { $deliver = "| zarafa-dagent $USERNAME -C -F 'Inbox\\$deliver'"; } |
77 |
|
|
+ } |
78 |
|
|
+ else |
79 |
|
|
+ { $deliver = "\$MAILDIR/".'.'."$deliver2"."/"; } |
80 |
|
|
} |
81 |
|
|
elsif ($action2 eq 'forward') |
82 |
|
|
{ |
83 |
|
|
--- smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/15log.zarafaprocmail 2009-02-21 21:19:25.000000000 +1100 |
84 |
|
|
+++ smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/15log 2009-02-22 00:07:29.000000000 +1100 |
85 |
|
|
@@ -2,20 +2,6 @@ |
86 |
|
|
use esmith::config; |
87 |
|
|
use esmith::db; |
88 |
|
|
|
89 |
|
|
- my %accounts; |
90 |
|
|
- tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; |
91 |
|
|
- |
92 |
|
|
- # get $USERNAME from esmith::config - put there by the |
93 |
|
|
- # email-update-user action as a temporary variable |
94 |
|
|
- die "Username criterion missing." unless defined ($USERNAME); |
95 |
|
|
- |
96 |
|
|
- my $type = db_get_type(\%accounts, $USERNAME); |
97 |
|
|
- |
98 |
|
|
- die |
99 |
|
|
- "Account $USERNAME is not a user account; " |
100 |
|
|
- . "update email forwarding failed.\n" |
101 |
|
|
- unless $type eq 'user'; |
102 |
|
|
- |
103 |
|
|
my %processmail; |
104 |
|
|
tie %processmail, 'esmith::config', '/home/e-smith/db/processmail'; |
105 |
|
|
|
106 |
|
|
@@ -43,4 +29,4 @@ |
107 |
|
|
$OUT .= "LOGABSTRACT=all\n"; |
108 |
|
|
$OUT .= "LOGFILE=\$HOME/procmail.log\n"; |
109 |
|
|
} |
110 |
|
|
-} |
111 |
|
|
\ No newline at end of file |
112 |
|
|
+} |
113 |
|
|
--- smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/25options.zarafaprocmail 2009-02-21 23:25:50.000000000 +1100 |
114 |
|
|
+++ smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/25options 2009-02-21 23:26:47.000000000 +1100 |
115 |
|
|
@@ -1,31 +1,6 @@ |
116 |
|
|
{ |
117 |
|
|
-# use esmith::config; |
118 |
|
|
-# use esmith::db; |
119 |
|
|
-# |
120 |
|
|
-# my %accounts; |
121 |
|
|
-# tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; |
122 |
|
|
-# |
123 |
|
|
-# # get $USERNAME from esmith::config - put there by the |
124 |
|
|
-# # email-update-user action as a temporary variable |
125 |
|
|
-# die "Username criterion missing." unless defined ($USERNAME); |
126 |
|
|
-# |
127 |
|
|
-# my $type = db_get_type(\%accounts, $USERNAME); |
128 |
|
|
-# |
129 |
|
|
-# die |
130 |
|
|
-# "Account $USERNAME is not a user account; " |
131 |
|
|
-# . "update email forwarding failed.\n" |
132 |
|
|
-# unless $type eq 'user'; |
133 |
|
|
-# |
134 |
|
|
-# my %processmail; |
135 |
|
|
-# tie %processmail, 'esmith::config', '/home/e-smith/db/processmail'; |
136 |
|
|
-# |
137 |
|
|
-# # delete duplicates |
138 |
|
|
-# my $deldups = db_get_prop(\%processmail, $USERNAME, "deldups") || ''; |
139 |
|
|
-# if ($deldups eq 'yes') |
140 |
|
|
-# { |
141 |
|
|
$OUT .= "\n"; |
142 |
|
|
$OUT .= "# ---- delete duplicates -------\n"; |
143 |
|
|
$OUT .= ":0 Wh: msgid.lock\n"; |
144 |
|
|
$OUT .= "| \$FORMAIL -D 8192 msgid.cache\n"; |
145 |
|
|
-# } |
146 |
|
|
-} |
147 |
|
|
\ No newline at end of file |
148 |
|
|
+} |
149 |
|
|
--- smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/90default.zarafaprocmail 2009-02-21 21:26:08.000000000 +1100 |
150 |
|
|
+++ smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/90default 2009-02-21 23:48:00.000000000 +1100 |
151 |
|
|
@@ -1,8 +1,18 @@ |
152 |
|
|
{ |
153 |
|
|
$OUT .= "\n"; |
154 |
|
|
- $OUT .= "# ---- to the inbox------------------\n"; |
155 |
|
|
- $OUT .= ":0\n"; |
156 |
|
|
- $OUT .= "\$DEFAULT\n"; |
157 |
|
|
+ $OUT .= "# ---- to the inbox------------------\n"; |
158 |
|
|
+ |
159 |
|
|
+ if (($zarafa1 eq 'enabled') || ($zarafa2 eq 'enabled')) |
160 |
|
|
+ { |
161 |
|
|
+ $OUT .= ":0\n"; |
162 |
|
|
+ $OUT .= "| zarafa-dagent $USERNAME \n"; |
163 |
|
|
+ } |
164 |
|
|
+ else |
165 |
|
|
+ { |
166 |
|
|
+ $OUT .= ":0\n"; |
167 |
|
|
+ $OUT .= "\$DEFAULT\n"; |
168 |
|
|
+ } |
169 |
|
|
+ |
170 |
|
|
$OUT .= "\n"; |
171 |
|
|
$OUT .= "# ---- end of rules ------------------\n"; |
172 |
|
|
} |
173 |
|
|
--- smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/60user.zarafaprocmail 2009-02-21 17:39:47.000000000 +1100 |
174 |
|
|
+++ smeserver-mailsorting-1.2/root/etc/e-smith/templates-user/.procmailrc/60user 2009-02-21 23:48:59.000000000 +1100 |
175 |
|
|
@@ -2,26 +2,9 @@ |
176 |
|
|
use esmith::config; |
177 |
|
|
use esmith::db; |
178 |
|
|
|
179 |
|
|
- my %conf; |
180 |
|
|
- tie %conf, 'esmith::config'; |
181 |
|
|
- |
182 |
|
|
- my %accounts; |
183 |
|
|
- tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; |
184 |
|
|
- |
185 |
|
|
- die "Username criterion missing." unless defined ($USERNAME); |
186 |
|
|
- |
187 |
|
|
- my $type = db_get_type(\%accounts, $USERNAME); |
188 |
|
|
- |
189 |
|
|
- die |
190 |
|
|
- "Account $USERNAME is not a user account; " |
191 |
|
|
- . "update email forwarding failed.\n" |
192 |
|
|
- unless $type eq 'user'; |
193 |
|
|
- |
194 |
|
|
my %processmail; |
195 |
|
|
tie %processmail, 'esmith::config', '/home/e-smith/db/processmail'; |
196 |
|
|
|
197 |
|
|
- my $sep = '.'; |
198 |
|
|
- |
199 |
|
|
# get users rules |
200 |
|
|
my @pmRules = (); |
201 |
|
|
foreach (sort keys %processmail) |
202 |
|
|
@@ -51,7 +34,7 @@ |
203 |
|
|
my $action = db_get_prop(\%processmail, $pmRule, "action") || ''; |
204 |
|
|
my $action2 = db_get_prop(\%processmail, $pmRule, "action2") || ''; |
205 |
|
|
#allow for spaces _ to \_ |
206 |
|
|
- $deliver =~ s/ /\\ /g; |
207 |
|
|
+ $deliver =~ s/ /\\ /g; |
208 |
|
|
$deliver2 =~ s/ /\\ /g; |
209 |
|
|
|
210 |
|
|
foreach ($basis, $basis2) |
211 |
|
|
@@ -88,16 +71,19 @@ |
212 |
|
|
} |
213 |
|
|
} |
214 |
|
|
|
215 |
|
|
- ## construct the deliver line |
216 |
|
|
- if ($action eq 'sort') |
217 |
|
|
+ ##construct the deliver line |
218 |
|
|
+ if (($action eq 'sort') || ($action eq 'create')) |
219 |
|
|
{ |
220 |
|
|
# to a folder |
221 |
|
|
- $deliver = "\$MAILDIR/"."$sep"."$deliver"."/"; |
222 |
|
|
- } |
223 |
|
|
- elsif ($action eq 'create') |
224 |
|
|
- { |
225 |
|
|
- # to a folder |
226 |
|
|
- $deliver = "\$MAILDIR/"."$sep"."$deliver"."/"; |
227 |
|
|
+ if (($zarafa1 eq 'enabled') || ($zarafa2 eq 'enabled')) |
228 |
|
|
+ { |
229 |
|
|
+ if ($deliver eq 'junkmail') |
230 |
|
|
+ { $deliver = "| zarafa-dagent -j $USERNAME"; } |
231 |
|
|
+ else |
232 |
|
|
+ { $deliver = "| zarafa-dagent $USERNAME -C -F 'Inbox\\$deliver'"; } |
233 |
|
|
+ } |
234 |
|
|
+ else |
235 |
|
|
+ { $deliver = "\$MAILDIR/".'.'."$deliver"."/"; } |
236 |
|
|
} |
237 |
|
|
elsif ($action eq 'forward') |
238 |
|
|
{ |
239 |
|
|
@@ -115,11 +101,19 @@ |
240 |
|
|
$deliver = "$deliver"; |
241 |
|
|
} |
242 |
|
|
|
243 |
|
|
- ## construct the 2nd deliver line |
244 |
|
|
+ ##construct the 2nd deliver line |
245 |
|
|
if ($action2 eq 'sort') |
246 |
|
|
{ |
247 |
|
|
# to a folder |
248 |
|
|
- $deliver2 = "\$MAILDIR/"."$sep"."$deliver2"."/"; |
249 |
|
|
+ if (($zarafa1 eq 'enabled') || ($zarafa2 eq 'enabled')) |
250 |
|
|
+ { |
251 |
|
|
+ if ($deliver eq 'junkmail') |
252 |
|
|
+ { $deliver = "| zarafa-dagent -j $USERNAME"; } |
253 |
|
|
+ else |
254 |
|
|
+ { $deliver = "| zarafa-dagent $USERNAME -C -F 'Inbox\\$deliver'"; } |
255 |
|
|
+ } |
256 |
|
|
+ else |
257 |
|
|
+ { $deliver = "\$MAILDIR/".'.'."$deliver2"."/"; } |
258 |
|
|
} |
259 |
|
|
elsif ($action2 eq 'forward') |
260 |
|
|
{ |