This modification supports to:
- Filter your spam mail after you have loged in.
- Filter your spam mail after click any mailbox, except Junk and Trash.
Based on
Steve Corona's modification at
http://roundcubeforum.net/forum/index.php?topic=2205.0Adding codes in
config/main.inc.php.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// keyword for subject filtering and move to Junk box
$rcmail_config['spam_subject'] = '/^\*\*\*SPAM\*\*\*/';~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adding a message in
program/localization//messages.inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$messages['spammessagesfound'] = '$nr of your spam message(s) was moved to $mbox';~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modify codes in program/step/mail/func.inc (SVN 1032)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// return the message list as HTML table
function rcmail_message_list($attrib) :
:
$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';
:
:
$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;
}:
:
// return javascript commands to add rows to the message list
function rcmail_js_message_list($a_headers, $insert_top=FALSE) :
:
$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)
{
$a_msg_cols = array();
$a_msg_flags = array();
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)
:
:
$OUTPUT->command('add_message_row',
$header->uid,
$a_msg_cols,
$a_msg_flags,
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 }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~