-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroundcubemail-spam.patch
More file actions
159 lines (144 loc) · 7.46 KB
/
roundcubemail-spam.patch
File metadata and controls
159 lines (144 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
diff -ur roundcubemail-0.1-r1223-20080330/config/main.inc.php.dist roundcubemail-0.1-r1223-20080330.new/config/main.inc.php.dist
--- roundcubemail-0.1-r1223-20080330/config/main.inc.php.dist 2008-03-30 13:26:34.000000000 +0200
+++ roundcubemail-0.1-r1223-20080330.new/config/main.inc.php.dist 2008-03-30 14:32:46.762822531 +0200
@@ -250,6 +250,9 @@
// ONLY ENABLE IT IF YOU'RE REALLY SURE WHAT YOU'RE DOING!
$rcmail_config['enable_installer'] = false;
+// keyword for subject filtering and move to Junk box
+$rcmail_config['spam_subject'] = '/^\*\*\*SPAM\*\*\*/';
+
/***** these settings can be overwritten by user's preferences *****/
diff -ur roundcubemail-0.1-r1223-20080330/program/localization/en_GB/messages.inc roundcubemail-0.1-r1223-20080330.new/program/localization/en_GB/messages.inc
--- roundcubemail-0.1-r1223-20080330/program/localization/en_GB/messages.inc 2008-03-30 13:26:45.000000000 +0200
+++ roundcubemail-0.1-r1223-20080330.new/program/localization/en_GB/messages.inc 2008-03-30 14:56:30.368416277 +0200
@@ -72,6 +72,7 @@
$messages['copysuccess'] = 'Successfully copied $nr addresses';
$messages['copyerror'] = 'Could not copy any addresses';
$messages['sourceisreadonly'] = 'This address source is read-only';
+$messages['spammessagesfound'] = '$nr of your spam message(s) was moved to <strong>$mbox</strong>';
$messages['errorsavingcontact'] = 'Could not save the contact address';
$messages['movingmessage'] = 'Moving message...';
$messages['receiptsent'] = 'Successfully sent a read receipt';
@@ -79,4 +80,4 @@
$messages['nodeletelastidentity'] = 'You cannot delete this identity, it\'s your last one.';
$messages['addsubfolderhint'] = 'This folder will be created as subfolder of the currently selected one';
-?>
\ Brak znaku nowej linii na końcu pliku
+?>
diff -ur roundcubemail-0.1-r1223-20080330/program/localization/en_US/messages.inc roundcubemail-0.1-r1223-20080330.new/program/localization/en_US/messages.inc
--- roundcubemail-0.1-r1223-20080330/program/localization/en_US/messages.inc 2008-03-30 13:26:47.000000000 +0200
+++ roundcubemail-0.1-r1223-20080330.new/program/localization/en_US/messages.inc 2008-03-30 14:56:42.484361755 +0200
@@ -72,6 +72,7 @@
$messages['copysuccess'] = 'Successfully copied $nr addresses';
$messages['copyerror'] = 'Could not copy any addresses';
$messages['sourceisreadonly'] = 'This address source is read only';
+$messages['spammessagesfound'] = '$nr of your spam message(s) was moved to <strong>$mbox</strong>';
$messages['errorsavingcontact'] = 'Could not save the contact address';
$messages['movingmessage'] = 'Moving message...';
$messages['receiptsent'] = 'Successfully sent a read receipt';
@@ -79,4 +80,4 @@
$messages['nodeletelastidentity'] = 'You cannot delete this identity, it\'s your last one.';
$messages['addsubfolderhint'] = 'This folder will be created as subfolder of the currently selected one';
-?>
\ Brak znaku nowej linii na końcu pliku
+?>
diff -ur roundcubemail-0.1-r1223-20080330/program/localization/pl/messages.inc roundcubemail-0.1-r1223-20080330.new/program/localization/pl/messages.inc
--- roundcubemail-0.1-r1223-20080330/program/localization/pl/messages.inc 2008-03-30 13:26:45.000000000 +0200
+++ roundcubemail-0.1-r1223-20080330.new/program/localization/pl/messages.inc 2008-03-30 14:57:20.752189549 +0200
@@ -76,6 +76,7 @@
$messages['copysuccess'] = 'Pomyślnie skopiowano następującą liczbę adresów: $nr';
$messages['copyerror'] = 'Nie można skopiować żadnego adresu';
$messages['sourceisreadonly'] = 'Źródło adresu jest tylko do odczytu';
+$messages['spammessagesfound'] = '$nr wiadomości zostało przeniesionych do katalogu <strong>$mbox</strong>';
$messages['errorsavingcontact'] = 'Nie można było zapisać adresu kontaktu';
$messages['movingmessage'] = 'Przenoszenie wiadomości...';
$messages['receiptsent'] = 'Pomyślnie wysłano potwierdzenie dostarczenia';
@@ -83,4 +84,4 @@
$messages['nodeletelastidentity'] = 'Nie można skasować tej tożsamości, ponieważ jest ostatnią.';
$messages['addsubfolderhint'] = 'Ten folder zostanie utworzony jako podfolder aktualnie wybranego.';
-?>
\ Brak znaku nowej linii na końcu pliku
+?>
diff -ur roundcubemail-0.1-r1223-20080330/program/steps/mail/func.inc roundcubemail-0.1-r1223-20080330.new/program/steps/mail/func.inc
--- roundcubemail-0.1-r1223-20080330/program/steps/mail/func.inc 2008-03-30 13:26:52.000000000 +0200
+++ roundcubemail-0.1-r1223-20080330.new/program/steps/mail/func.inc 2008-03-30 15:00:01.859464563 +0200
@@ -197,9 +197,30 @@
$a_js_message_arr = array();
+// START MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+ $n_of_spam = 0;
+// END MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+
// create row for each message
foreach ($a_headers as $i => $header) //while (list($i, $header) = each($a_headers))
{
+
+// START MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+ $cont = Q(rcube_imap::decode_mime_string($header->subject, $header->charset));
+
+ // Check to see if this subject contains our spam line and is not in the
+ // designated junk mailbox
+
+ if ( ( $mbox!=$CONFIG['trash_mbox'] ) && ( $mbox!=$CONFIG['junk_mbox'] ) ){
+ if ( preg_match($CONFIG['spam_subject'], $cont) ){
+ $n_of_spam += 1;
+ // Move the message from this mailbox to the junk mail box
+ $IMAP->move_message( array($header->uid), $CONFIG['junk_mbox'], $mbox );
+ continue;
+ }
+ }
+// END MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+
$message_icon = $attach_icon = '';
$js_row_arr = array();
$zebra_class = $i%2 ? 'even' : 'odd';
@@ -293,6 +314,13 @@
$OUTPUT->set_env('coltypes', $a_show_cols);
$OUTPUT->include_script('list.js');
+
+// START MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+ if ( $n_of_spam ) {
+ $OUTPUT->command('set_unread_count', $CONFIG['junk_mbox'], $IMAP->messagecount($CONFIG['junk_mbox'], 'UNSEEN'));
+ $OUTPUT->show_message('spammessagesfound', 'warning', array('nr' => $n_of_spam, 'mbox' => rcube_label("junk")));
+ }
+// END MODIFICATION BY midnightz@hotmail.com - SPAM FIX
return $out;
}
@@ -313,6 +341,10 @@
$OUTPUT->command('set_message_coltypes', $a_show_cols);
+// START MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+ $n_of_spam = 0;
+// END MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+
// loop through message headers
foreach ($a_headers as $n => $header)
{
@@ -322,6 +354,17 @@
if (empty($header))
continue;
+// START MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+ $cont = Q(rcube_imap::decode_mime_string($header->subject, $header->charset));
+ if ( ( $mbox!=$CONFIG['trash_mbox'] ) && ( $mbox!=$CONFIG['junk_mbox'] ) ){
+ if ( preg_match($CONFIG['spam_subject'],$cont) ){
+ $n_of_spam += 1;
+ $IMAP->move_message( array($header->uid), $CONFIG['junk_mbox'], $mbox );
+ continue;
+ }
+ }
+// END MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+
// format each col; similar as in rcmail_message_list()
foreach ($a_show_cols as $col)
{
@@ -355,6 +398,14 @@
preg_match("/multipart\/m/i", $header->ctype),
$insert_top);
}
+
+// START MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+ if ( $n_of_spam ) {
+ $OUTPUT->command('set_unread_count', $CONFIG['junk_mbox'], $IMAP->messagecount($CONFIG['junk_mbox'], 'UNSEEN'));
+ $OUTPUT->show_message('spammessagesfound', 'warning', array('nr' => $n_of_spam, 'mbox' => rcube_label("junk")));
+ }
+// END MODIFICATION BY midnightz@hotmail.com - SPAM FIX
+
}