From: Paul L. <pdo...@us...> - 2011-05-07 06:49:46
|
Update of /cvsroot/serverfilters/server_side_filters_sieve In directory vz-cvs-3.sog:/tmp/cvs-serv28480 Modified Files: functions.php Log Message: Add custom action capability Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/server_side_filters_sieve/functions.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** functions.php 11 Jan 2011 02:32:58 -0000 1.1.1.1 --- functions.php 7 May 2011 06:49:44 -0000 1.2 *************** *** 83,87 **** * folder for moving or copying * filtered message ! * ACTION -- "MOVE", "COPY", or "DELETE", * indicating how to handle a * filtered message --- 83,90 ---- * folder for moving or copying * filtered message ! * ACTION -- "MOVE", "COPY", "DELETE" or any ! * custom action that is defined in ! * $custom_actions in the Server ! * Side Filters main configuration, * indicating how to handle a * filtered message *************** *** 203,207 **** * folder for moving or copying * filtered message ! * ACTION -- "MOVE", "COPY", or "DELETE", * indicating how to handle a * filtered message --- 206,213 ---- * folder for moving or copying * filtered message ! * ACTION -- "MOVE", "COPY", "DELETE" or any ! * custom action that is defined in ! * $custom_actions in the Server ! * Side Filters main configuration, * indicating how to handle a * filtered message *************** *** 298,305 **** global $stop_after_move_or_delete, ! $default_sieve_action; server_side_filters_sieve_init(); $raw_filter_rules = ''; --- 304,315 ---- global $stop_after_move_or_delete, ! $default_sieve_action, $custom_actions; + // retrieve configuration settings for this plugin + // AND for parent plugin (custom actions) + // server_side_filters_sieve_init(); + server_side_filters_init(); $raw_filter_rules = ''; *************** *** 344,348 **** // build this filter's action // ! if ($rule['ACTION'] == 'DELETE') { $action = 'discard;'; --- 354,410 ---- // build this filter's action // ! $custom_action_move_is_possible = FALSE; ! $custom_action_moved = FALSE; ! if (!empty($custom_actions[$rule['ACTION']]) ! && is_array($custom_actions[$rule['ACTION']])) ! { ! $action = $custom_actions[$rule['ACTION']]['FILTER_ACTION']; ! ! // make sure imap4flags extension is required if using ! // flag actions (this is a little loose, but should suffice) ! // ! if (strpos($action, 'addflag') !== FALSE ! || strpos($action, 'removeflag') !== FALSE ! || strpos($action, 'setflag') !== FALSE ! || strpos($action, 'hasflag') !== FALSE) ! $required_extensions['imap4flags'] = TRUE; ! ! if (!empty($custom_actions[$rule['ACTION']]['SECONDARY_TRANSPORT']) ! && $custom_actions[$rule['ACTION']]['SECONDARY_TRANSPORT'] == 'FORBIDDEN') ! { ! $parsed_filter_rules[$index]['COPY_TO_FOLDER'] = 'OFF'; ! $parsed_filter_rules[$index]['SEND_TO_ADDRESS'] = 'OFF'; ! } ! else ! { ! if (!empty($custom_actions[$rule['ACTION']]['SECONDARY_TRANSPORT_COPY'])) ! { ! $copy = ':copy '; ! $required_extensions['copy'] = TRUE; ! } ! else ! { ! $copy = ''; ! $custom_action_move_is_possible = TRUE; ! } ! ! if ($rule['COPY_TO_FOLDER'] == 'ON' && $rule['SEND_TO_ADDRESS'] == 'ON') ! { ! $action .= "\n fileinto $copy\"" . $rule['TARGET_FOLDER'] ! . "\";\n redirect $copy\"" . $rule['EMAIL_ADDRESS'] . '";'; ! $required_extensions['fileinto'] = TRUE; ! if ($custom_action_move_is_possible) $custom_action_moved = TRUE; ! } ! else if ($rule['COPY_TO_FOLDER'] == 'ON') ! { ! $action .= "\n fileinto $copy\"" . $rule['TARGET_FOLDER'] . '";'; ! $required_extensions['fileinto'] = TRUE; ! if ($custom_action_move_is_possible) $custom_action_moved = TRUE; ! } ! else if ($rule['SEND_TO_ADDRESS'] == 'ON') ! $action .= "\n redirect $copy\"" . $rule['EMAIL_ADDRESS'] . '";'; ! } ! } ! else if ($rule['ACTION'] == 'DELETE') { $action = 'discard;'; *************** *** 370,374 **** // if ($stop_after_move_or_delete ! && ($rule['ACTION'] == 'MOVE' || $rule['ACTION'] == 'DELETE')) $action .= "\n stop;"; --- 432,436 ---- // if ($stop_after_move_or_delete ! && ($rule['ACTION'] == 'MOVE' || $rule['ACTION'] == 'DELETE' || $custom_action_moved)) $action .= "\n stop;"; |