1 |
diff -Nur smeserver-qmHandle-1.4/root/etc/e-smith/web/functions/qmh.altqmail smeserver-qmHandle-1.4/root/etc/e-smith/web/functions/qmh |
2 |
--- smeserver-qmHandle-1.4/root/etc/e-smith/web/functions/qmh.altqmail 2008-07-06 10:49:50.000000000 -0400 |
3 |
+++ smeserver-qmHandle-1.4/root/etc/e-smith/web/functions/qmh 2017-07-10 15:40:37.223705546 -0400 |
4 |
@@ -83,18 +83,45 @@ |
5 |
print eval 'return "'.$fm->localise('QMH_DESC').'\n";'; |
6 |
|
7 |
my %labels = ( |
8 |
- "list-queues" => $fm->localise('LIST_QUEUE'), |
9 |
- "list-local-queue" => $fm->localise('LIST_LOCAL_QUEUE'), |
10 |
- "list-remote-queue" => $fm->localise('LIST_REMOTE_QUEUE'), |
11 |
+ "list-queues" => $fm->localise('LIST_QUEUE'), |
12 |
+ "list-local-queue" => $fm->localise('LIST_LOCAL_QUEUE'), |
13 |
+ "list-remote-queue" => $fm->localise('LIST_REMOTE_QUEUE'), |
14 |
"resend" => $fm->localise('RESEND_QUEUE'), |
15 |
- ); |
16 |
+ ); |
17 |
|
18 |
- my @labels = ( |
19 |
- 'list-queues', |
20 |
- 'list-local-queue', |
21 |
- 'list-remote-queue', |
22 |
+ my @labels = ( |
23 |
+ 'list-queues', |
24 |
+ 'list-local-queue', |
25 |
+ 'list-remote-queue', |
26 |
'resend', |
27 |
- ); |
28 |
+ ); |
29 |
+ |
30 |
+ my $altqmail=$conf->get('altqmail') || 0; |
31 |
+ if ( $altqmail) |
32 |
+ { |
33 |
+ %labels = ( |
34 |
+ "list-queues" => $fm->localise('LIST_QUEUE'), |
35 |
+ "list-local-queue" => $fm->localise('LIST_LOCAL_QUEUE'), |
36 |
+ "list-remote-queue" => $fm->localise('LIST_REMOTE_QUEUE'), |
37 |
+ "resend" => $fm->localise('RESEND_QUEUE'), |
38 |
+ "alt-list-queues" => "altqmail: ". $fm->localise('LIST_QUEUE'), |
39 |
+ "alt-list-local-queue" => "altqmail: ". $fm->localise('LIST_LOCAL_QUEUE'), |
40 |
+ "alt-list-remote-queue" => "altqmail: ". $fm->localise('LIST_REMOTE_QUEUE'), |
41 |
+ "alt-resend" => "altqmail: ". $fm->localise('RESEND_QUEUE'), |
42 |
+ ); |
43 |
+ |
44 |
+ @labels = ( |
45 |
+ 'list-queues', |
46 |
+ 'list-local-queue', |
47 |
+ 'list-remote-queue', |
48 |
+ 'resend', |
49 |
+ 'alt-list-queues', |
50 |
+ 'alt-list-local-queue', |
51 |
+ 'alt-list-remote-queue', |
52 |
+ 'alt-resend', |
53 |
+ ); |
54 |
+ |
55 |
+ } |
56 |
|
57 |
my $default_action = 'list-queues'; |
58 |
|
59 |
@@ -179,6 +206,33 @@ |
60 |
{ |
61 |
deleteMessageNumber($q); |
62 |
} |
63 |
+ |
64 |
+ elsif ($function eq 'alt-list-queues') |
65 |
+ { |
66 |
+ showListAltQueues ($q); |
67 |
+ } |
68 |
+ elsif ($function eq 'alt-list-local-queue') |
69 |
+ { |
70 |
+ showListLocalAltQueue ($q); |
71 |
+ } |
72 |
+ elsif ($function eq 'alt-list-remote-queue') |
73 |
+ { |
74 |
+ showListRemoteAltQueue ($q); |
75 |
+ } |
76 |
+ elsif ($function eq 'alt-resend') |
77 |
+ { |
78 |
+ Altresend($q); |
79 |
+ } |
80 |
+ elsif ($function eq 'alt-confirm-delete-message-number') |
81 |
+ { |
82 |
+ showDeleteAltMessageNumber ($q); |
83 |
+ } |
84 |
+ elsif ($function eq 'alt-delete-message-number') |
85 |
+ { |
86 |
+ deleteAltMessageNumber($q); |
87 |
+ } |
88 |
+ |
89 |
+ |
90 |
else |
91 |
{ |
92 |
# Unknown function - refresh the screen anyway |
93 |
@@ -219,6 +273,31 @@ |
94 |
return; |
95 |
} |
96 |
|
97 |
+sub showListAltQueues ($) |
98 |
+{ |
99 |
+ my ($q) = @_; |
100 |
+ |
101 |
+ |
102 |
+ esmith::cgi::genHeaderNonCacheable ($q, \%conf, |
103 |
+ "altqmail: ". $fm->localise('SHOWLISTQUEUES')); |
104 |
+ |
105 |
+ { |
106 |
+ print $q->hr; |
107 |
+ print $q->p($fm->localise('VIEW_TIME')),scalar localtime(time),"\n"; |
108 |
+ |
109 |
+ my $MailQueues = `/usr/bin/qmHandle -X -l`; |
110 |
+ $MailQueues =~ s/</'/g; |
111 |
+ $MailQueues =~ s/>/'/g; |
112 |
+ |
113 |
+ $MailQueues = AddAltLinks($MailQueues, $q); |
114 |
+ |
115 |
+ print $q->p ($q->pre ("$MailQueues")); |
116 |
+ } |
117 |
+ |
118 |
+ esmith::cgi::genFooter($fm); |
119 |
+ return; |
120 |
+} |
121 |
+ |
122 |
sub AddLinks |
123 |
{ |
124 |
my $queues = shift; |
125 |
@@ -238,6 +317,26 @@ |
126 |
return $queues; |
127 |
} |
128 |
|
129 |
+sub AddAltLinks |
130 |
+{ |
131 |
+ my $queues = shift; |
132 |
+ |
133 |
+ my @splitq = split(/\n/, $queues); |
134 |
+ |
135 |
+ for (my $i = 0; $i < $#splitq; $i++) { |
136 |
+ if ($splitq[$i] =~ /^(\d+)\s+(\(\d+\,\s+\d+\/+\d+\)\s*)$/ ) { |
137 |
+ $splitq[$i] = "<a href=\"" . |
138 |
+ $q->url( -absolute => 1 ) . |
139 |
+ "?state=perform&function=alt-confirm-delete-message-number" . |
140 |
+ "&msgid=$1\">$1</a> $2"; |
141 |
+ } |
142 |
+ } |
143 |
+ $queues = join("\n", @splitq); |
144 |
+ |
145 |
+ return $queues; |
146 |
+} |
147 |
+ |
148 |
+ |
149 |
#------------------------------------------------------------ |
150 |
# subroutine to showListLocalQueue |
151 |
#------------------------------------------------------------ |
152 |
@@ -262,6 +361,27 @@ |
153 |
return; |
154 |
} |
155 |
|
156 |
+sub showListLocalAltQueue ($) |
157 |
+{ |
158 |
+ my ($q) = @_; |
159 |
+ |
160 |
+ |
161 |
+ esmith::cgi::genHeaderNonCacheable ($q, \%conf, |
162 |
+ "altqmail: ". $fm->localise('LIST_LOCAL_QUEUE')); |
163 |
+ { |
164 |
+ print $q->hr; |
165 |
+ print $q->p($fm->localise('VIEW_TIME')),scalar localtime(time),"\n"; |
166 |
+ my $LocalQueue = `/usr/bin/qmHandle -X -L`; |
167 |
+ $LocalQueue =~ s/</'/g; |
168 |
+ $LocalQueue =~ s/>/'/g; |
169 |
+ |
170 |
+ print $q->p ($q->pre ("$LocalQueue")); |
171 |
+ } |
172 |
+ |
173 |
+ esmith::cgi::genFooter($fm); |
174 |
+ return; |
175 |
+} |
176 |
+ |
177 |
|
178 |
#------------------------------------------------------------ |
179 |
# subroutine to showListRemoteQueue |
180 |
@@ -288,6 +408,28 @@ |
181 |
return; |
182 |
} |
183 |
|
184 |
+sub showListRemoteAltQueue ($) |
185 |
+{ |
186 |
+ my ($q) = @_; |
187 |
+ esmith::cgi::genHeaderNonCacheable ($q, \%conf, |
188 |
+ "altqmail: ". $fm->localise('LIST_REMOTE_QUEUE')); |
189 |
+ |
190 |
+ { |
191 |
+ print $q->hr; |
192 |
+ print $q->p($fm->localise('VIEW_TIME')),scalar localtime(time),"\n"; |
193 |
+ |
194 |
+ my $RemoteQueue = `/usr/bin/qmHandle -X -R`; |
195 |
+ $RemoteQueue =~ s/</'/g; |
196 |
+ $RemoteQueue =~ s/>/'/g; |
197 |
+ |
198 |
+ $RemoteQueue = AddLinks($RemoteQueue); |
199 |
+ print $q->p ($q->pre ("$RemoteQueue")); |
200 |
+ } |
201 |
+ |
202 |
+ esmith::cgi::genFooter($fm); |
203 |
+ return; |
204 |
+} |
205 |
+ |
206 |
|
207 |
#------------------------------------------------------------ |
208 |
# subroutine to send ALARM to qmail |
209 |
@@ -312,6 +454,26 @@ |
210 |
return; |
211 |
} |
212 |
|
213 |
+sub Altresend ($) |
214 |
+{ |
215 |
+ my ($q) = @_; |
216 |
+ esmith::cgi::genHeaderNonCacheable ($q, \%conf, |
217 |
+ "altqmail: ". $fm->localise('TRY_SEND_QUEUE')); |
218 |
+ |
219 |
+ { |
220 |
+ print $q->hr; |
221 |
+ print $q->p($fm->localise('SEND_QUEUE_AT')),scalar localtime(time),"\n"; |
222 |
+ |
223 |
+ my $res = `/usr/bin/qmHandle -X -a`; |
224 |
+ |
225 |
+ print $q->p ($q->pre ("$res")); |
226 |
+ print $q->h3 ("Done."); |
227 |
+ } |
228 |
+ |
229 |
+ esmith::cgi::genFooter($fm); |
230 |
+ return; |
231 |
+} |
232 |
+ |
233 |
#------------------------------------------------------------ |
234 |
# subroutine to showDeleteMessageNumber |
235 |
#------------------------------------------------------------ |
236 |
@@ -346,6 +508,38 @@ |
237 |
return; |
238 |
} |
239 |
|
240 |
+sub showDeleteAltMessageNumber ($) |
241 |
+{ |
242 |
+ my ($q) = @_; |
243 |
+ my $msgid = $q->param ('msgid'); |
244 |
+ |
245 |
+ if ($msgid =~ /^(\d+)$/) { |
246 |
+ $msgid = $1; |
247 |
+ } else { |
248 |
+ $msgid = undef; |
249 |
+ } |
250 |
+ esmith::cgi::genHeaderNonCacheable ($q, \%conf, |
251 |
+ "altqmail: ". $fm->localise('DELETE_MSG_TITLEB')); |
252 |
+ |
253 |
+ print $q->hr; |
254 |
+ print $q->p($fm->localise('DELETE_MESSAGE')),"\n"; |
255 |
+ my $Message = `/usr/bin/qmHandle -X -m$msgid|head -100`; |
256 |
+ print $q->p ($q->pre ("$Message")); |
257 |
+ |
258 |
+ print $q->start_multipart_form(-method => 'POST', -action => $q->url (-absolute => 1)); |
259 |
+ print $q->table ({border => 0, cellspacing => 0, cellpadding => 4}, |
260 |
+ |
261 |
+ esmith::cgi::genButtonRow ($q, |
262 |
+ $q->submit (-name => 'action', -value => $fm->localise('Delete')))); |
263 |
+ print $q->hidden (-name => 'state', -override => 1, -default => 'perform'); |
264 |
+ print $q->hidden (-name => 'msgid', -override => 1, -default => "$msgid"); |
265 |
+ print $q->hidden (-name => 'function', -override => 1, -default => 'delete-message-number'); |
266 |
+ print $q->endform; |
267 |
+ esmith::cgi::genFooter ($q); |
268 |
+ return; |
269 |
+} |
270 |
+ |
271 |
+ |
272 |
sub deleteMessageNumber ($) |
273 |
{ |
274 |
my ($q) = @_; |
275 |
@@ -360,7 +554,7 @@ |
276 |
my $Output = `/usr/bin/qmHandle -d$msgid`; |
277 |
|
278 |
esmith::cgi::genHeaderNonCacheable ($q, \%conf, |
279 |
- $fm->localise('QMH_TITLE')); |
280 |
+ "altqmail: ". $fm->localise('QMH_TITLE')); |
281 |
|
282 |
print $q->hr; |
283 |
print $q->h3 ($fm->localise('DELETE'))," $msgid "; |
284 |
@@ -369,6 +563,29 @@ |
285 |
return; |
286 |
} |
287 |
|
288 |
+sub deleteAltMessageNumber ($) |
289 |
+{ |
290 |
+ my ($q) = @_; |
291 |
+ |
292 |
+ my $msgid = $q->param ('msgid'); |
293 |
+ |
294 |
+ if ($msgid =~ /^(\d+)$/) { |
295 |
+ $msgid = $1; |
296 |
+ } else { |
297 |
+ $msgid = undef; |
298 |
+ } |
299 |
+ my $Output = `/usr/bin/qmHandle -X -d$msgid`; |
300 |
+ |
301 |
+ esmith::cgi::genHeaderNonCacheable ($q, \%conf, |
302 |
+ "altqmail: ". $fm->localise('QMH_TITLE')); |
303 |
+ |
304 |
+ print $q->hr; |
305 |
+ print $q->h3 ($fm->localise('DELETE'))," $msgid "; |
306 |
+ |
307 |
+ esmith::cgi::genFooter ($q); |
308 |
+ return; |
309 |
+} |
310 |
+ |
311 |
|
312 |
__DATA__ |
313 |
<form> |
314 |
|