Changeset 5862


Ignore:
Timestamp:
04/02/12 17:58:17 (12 years ago)
Author:
airton
Message:

Ticket #1794 - Codificar DFD0060 - Aplicacao das regras nas mensagens da caixa de entrada

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r5861 r5862  
    51615161        } 
    51625162         
    5163         function apliSieveFilter($msgs , $proc ) 
     5163        function apliSieveFilter($msgs , $proc) 
    51645164        { 
    51655165                $ret = array(); 
    5166                  
    5167                 switch($proc['action']){ 
    5168                         case 'fileintro': 
    5169                                 $imap = $this->open_mbox( 'INBOX' ); 
    5170                                 foreach( $msgs as $msg ) 
     5166                foreach ($msgs as $i => $msg) 
     5167                { 
     5168                        switch($proc['type']){ 
     5169                                case 'fileinto': 
     5170                                        $imap = $this->open_mbox( 'INBOX' ); 
    51715171                                        if($proc['keep'] === true) 
    5172                                                 $ret[$msg][] =  imap_mail_copy($imap,$msg,$proc['value']); 
     5172                                                $ret[$msg][] = imap_mail_copy($imap,$msg,$proc['value'], CP_UID); 
    51735173                                        else 
    5174                                                 $ret[$msg][] = imap_mail_move($imap,$msg,$proc['value']); 
    5175                                 break; 
    5176                         case 'redirect': 
    5177                                         foreach($msgs as $msg) 
    5178                                         {                                
     5174                                                /* Está sempre copiando a mensagem para a pasta destino */ 
     5175                                            //$ret[$msg][] = imap_mail_move($imap,$msg,$proc['parameter'], CP_UID); 
     5176                                                $ret[$msg][] = imap_mail_move($imap,$msg,$proc['parameter'], CP_UID); 
     5177                                        break; 
     5178                                case 'redirect':         
     5179                                        /* TO-DO: Fix the problems of include serviceLocator file */ 
     5180                                        //foreach($msgs as $msg) 
     5181                                        //{                              
     5182                                                /* 
    51795183                                                $info = $this->get_info_msg(array('msg_folder' => 'INBOX','msg_number' => $msg)); 
    5180                                  
    5181                                                 require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php'; 
     5184                                                //require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php'; 
    51825185                                                $mailService = ServiceLocator::getService('mail'); 
    51835186                                                 
    5184                                                 $ret[$msg][] = $mailService->sendMail( $proc['value'] , $info['from']['full'] , $info['subject'] ,$info['body'] ); 
    5185                                                  
    5186                                                 if($proc['keep'] !== true) 
    5187                                                     $this->delete_msgs(array('msgs_number' => $msg , 'folder' => 'INBOX')); 
    5188                                         }        
    5189                                 break; 
    5190                          
    5191                         case 'setflag': 
    5192                                 foreach($msgs as $msg) 
    5193                                         $ret[$msg][] = $this->set_messages_flag( array( 'folder' => 'INBOX' , 'msgs_to_set' => $msg , 'flag' => $proc['value']) ); 
    5194                  
    5195                                 break; 
    5196                 } 
    5197                  
     5187                                                $ret[$msg][] = $mailService->sendMail( $proc['parameter'] , $info['from']['full'] , $info['subject'] ,$info['body'] ); 
     5188                                                                                 
     5189                                                if($proc['keep'] !== true) 
     5190                                                        $this->delete_msgs(array('msgs_number' => $msg , 'folder' => 'INBOX')); 
     5191                                                         
     5192                                                */        
     5193                                        //}      
     5194                                        break; 
     5195                                 
     5196                                case 'setflag': 
     5197                                        foreach($msgs as $msg) 
     5198                                                $ret[$msg][] = $this->set_messages_flag( array( 'folder' => 'INBOX' , 'msgs_to_set' => $msg , 'flag' => $proc['parameter']) ); 
     5199                                        break; 
     5200                        } 
     5201                } 
    51985202                return $ret; 
    51995203        } 
  • trunk/expressoMail1_2/setup/phpgw_pt-br.lang

    r5858 r5862  
    827827You have %1 follow ups due for today:   expressoMail1_2 pt-br   Você tem %1 mensagens sinalizadas para hoje: 
    828828Don't show this window anymore today.   expressoMail1_2 pt-br   Não mostrar essa janela por hoje. 
     829Contains        expressoMail1_2 pt-br   Contém 
    829830Criteria        expressoMail1_2 pt-br   Critérios 
    830831Name of the rule        expressoMail1_2 pt-br   Nome da regra 
  • trunk/prototype/config/filter.ini

    r5341 r5862  
    2323 
    2424 
    25 [after.update] 
    26 applySieveFilter = modules/filters/interceptors/FilterMapping.php 
     25;[after.update] 
     26;applySieveFilter = modules/filters/interceptors/FilterMapping.php 
    2727 
    2828 
  • trunk/prototype/modules/filters/edit-filter.ejs

    r5801 r5862  
    2020                                <label class="small"><%= get_lang("Sender")%></label> 
    2121                                <select name="criteriaOperator[]"> 
    22                                         <option value="="><%= get_lang("is equal to")%></option> 
     22                                        <option value="="><%= get_lang("contains")%></option> 
    2323                                        <option value="*"><%= get_lang("contains the phrase")%></option> 
    2424                                        <option value="!*"><%= get_lang("doesn't contain the phrase")%></option> 
     
    3333                                <label class="small"><%= get_lang("Receiver")%></label> 
    3434                                <select name="criteriaOperator[]"> 
    35                                         <option value="="><%= get_lang("is equal to")%></option> 
     35                                        <option value="="><%= get_lang("contains")%></option> 
    3636                                        <option value="*"><%= get_lang("contains the phrase")%></option> 
    3737                                        <option value="!*"><%= get_lang("doesn't contain the phrase")%></option> 
     
    4545                                <label class="small"><%= get_lang("Subject")%></label> 
    4646                                <select name="criteriaOperator[]"> 
    47                                         <option value="="><%= get_lang("is equal to")%></option> 
     47                                        <option value="="><%= get_lang("contains")%></option> 
    4848                                        <option value="*"><%= get_lang("contains the phrase")%></option> 
    4949                                        <option value="!*"><%= get_lang("doesn't contain the phrase")%></option> 
     
    5858                                <label class="small"><%= get_lang("Message")%></label> 
    5959                                <select name="criteriaOperator[]"> 
    60                                         <option value="="><%= get_lang("is equal to")%></option> 
     60                                        <option value="="><%= get_lang("contains")%></option> 
    6161                                        <option value="*"><%= get_lang("contains the phrase")%></option> 
    6262                                        <option value="!*"><%= get_lang("doesn't contain the phrase")%></option> 
     
    144144                        <fieldset> 
    145145                                <input type="radio" name="actionType[]" value="fileintoTrash" onchange="$('.ui-widget-content :checkbox').parent().removeClass(' hidden');"/> 
    146                                 <label><%= get_lang("Seen")%></label> 
     146                                <label><%= get_lang("Trash")%></label> 
    147147                                <input type="hidden" name="actionParameter[]" value="Trash"/> 
    148148                        </fieldset> 
     
    157157                                <input type="hidden" name="actionParameter[]" value="INBOX"/> 
    158158                        </fieldset> 
    159                         <!-- 
     159                         
     160                         
     161                         
    160162                        <fieldset class="fields-search-messages"> 
    161163                                <label>Clique no botão "Buscar" para verificar se existem mensagens na sua Caixa de Entrada que  
     
    165167                        <table class="hidden fields-search-messages-grid" id="fields-search-messages-grid"><tr><td/></tr></table> 
    166168                        <div class="hidden fields-search-messages-grid-pager" id="fields-search-messages-grid-pager"></div> 
    167                         --> 
     169                         
     170                         
     171                         
    168172                        <div class="menu-container">     
    169173                                <a class="button back"   href="#" >&laquo; <%= get_lang("Previous")%></a> 
  • trunk/prototype/modules/filters/filters.js

    r5801 r5862  
    154154      } 
    155155 
     156          var apply_messages_ = keys(selectedMessages); 
     157          delete selectedMessages;  
     158 
    156159      return { 
    157160                //id: form.name, 
     
    199202                }), 
    200203                enabled : false, 
    201                 applyMessages: allMessages? !$.isEmptyObject( selectedMessages ) ? 
    202                 keys( selectedMessages ) : allMessages : "" 
    203                  
     204                //applyMessages: allMessages? !$.isEmptyObject( selectedMessages ) ? 
     205                //keys( selectedMessages ) : allMessages : "" 
     206                applyMessages: apply_messages_  
     207                //applyMessages: "" 
    204208      }; 
    205209  }, 
    206210   
    207211  encoder: function( filters ){ 
    208          
    209212        var rules = []; 
    210213 
     
    215218 
    216219  } 
     220   
    217221}); 
    218222 
     
    681685                                        { name: email, isExact: false,  
    682686                                                criteria:{ 0: {value: email, operator: "=", field: "from"} }, 
    683                                                 /* To-do: Arrumar para popular a tela com o reject, pois não há essa opção na interface. */ 
    684687                                                actions: { 0: {parameter: "INBOX/Spam", type: "fileinto"}},  
    685688                                                enabled: true,  
     
    885888                        }).end().filter(".cancel").click(function(){ 
    886889                                DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
    887                         }).end().filter(".submit").click(function(){ 
     890                        }).end().filter(".submit").click(function() { 
    888891                                if(valid_save()) 
    889892                                        $(this).submit(); 
     
    893896                                        DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
    894897                                }); 
    895                         }); 
    896                 });      
     898                        }).end().filter('.button.search').click(function() {                             
     899                                /* Valida se o usuário preencheu as informações */ 
     900                                if(valid_save()) 
     901                                {        
     902                                        var criteria_list          = list_container.find('[name="criteriaValue[]"]'); 
     903                                        var criteria_operator_list = list_container.find('[name="criteriaOperator[]"]'); 
     904                                        var criteria_value = ""; 
     905                                        var criteria = ""; 
     906                                        $.each(criteria_list, function(index, value){ 
     907                                                criteria += $.trim($(criteria_list[index]).val()) + ","; 
     908                                        }); 
     909                                        var criteria_ = criteria.split(","); 
     910                                        var criteria_operator  = ""; 
     911                                        $.each(criteria_operator_list, function(index, value){ 
     912                                                criteria_operator += $.trim($(criteria_list[index]).val()) != "" ? index + "," : ","; 
     913                                                criteria_value    += $.trim($(criteria_operator_list[index]).val()) + ","; 
     914                                        }); 
     915                                        var criteria_operator_  = criteria_operator.split(","); 
     916                                        var criteria_value_     = criteria_value.split(","); 
     917                                        var options = ["from", "to", "subject", "body", "size"]; 
     918                                        var criterias_ = new Array(); 
     919                                        var j = 0;               
     920                                        for (i in criteria_) { 
     921                                                if(criteria_[i] != "") { 
     922                                                        (j == 0) ? criterias_[j] = {"0": options[i], "1": criteria_value_[i], "2": criteria_[i]} : criterias_[j] = {"0": "OR", "1": options[i], "2": criteria_value_[i], "3": criteria_[i]};  
     923                                                        j++; 
     924                                                }        
     925                                        } 
     926                                        showGridButton = $(this).parent(); 
     927                                        $.ajax({   
     928                                                url: DataLayer.basePath + 'folder/INBOX/message&' +  $.param( {"filter": criterias_} ), 
     929                                                dataType: 'json', 
     930                                                success: function(data){         
     931                                                        allMessages = data; 
     932                                                        var parametro = ""; 
     933                                                        (data != false) ? parametro = {"filter": [ "msgNumber", "IN", data ]} : parametro = {"filter": criterias_}; 
     934                                                         
     935                                                        grid = showGridButton.addClass('hidden') 
     936                                                        .siblings(".fields-search-messages-grid, .fields-search-messages-grid-pager") 
     937                                                        .removeClass('hidden').filter(".fields-search-messages-grid").jqGrid({ 
     938                                                                //url: DataLayer.basePath + 'folder/INBOX/message&' +  $.param( {"filter": [ "msgNumber", "IN", data ]} ), 
     939                                                                url: DataLayer.basePath + 'folder/INBOX/message&' +  $.param( parametro ), 
     940                                                                datatype: "json", 
     941                                                                mtype: 'GET', 
     942                                                                colNames:['#', ' ', 'De', 'Assunto', 'Data', 'Tamanho'], 
     943                                                                colModel:[ 
     944                                                                        {name:'msg_number',index:'msg_number', width:45, hidden:true, sortable:false}, 
     945                                                                        {name:'flags',index:'msg_number', width:40, sortable:false, formatter:flags2Class}, 
     946                                                                        {name:'from.name',index:'msg_number', width:130, sortable:false}, 
     947                                                                        {name:'subject',index:'subject', width:250, sortable:false}, 
     948                                                                        {name:'timestamp',index:'timestamp', width:65, align:"center", sortable:false, formatter:date2Time}, 
     949                                                                        {name:'size',index:'size', width:50, align:"right", sortable:false, formatter:bytes2Size} 
     950                                                                ], 
     951                                                                jsonReader : { 
     952                                                                        root:"rows", 
     953                                                                        page: "page", 
     954                                                                        total: "total", 
     955                                                                        records: "records", 
     956                                                                        repeatitems: false, 
     957                                                                        id: "0" 
     958                                                                }, 
     959                                                                rowNum:10, 
     960                                                                //rowList:[10,25,50], 
     961                                                                rowList:[10], 
     962                                                                pager: '#fields-search-messages-grid-pager', 
     963                                                                sortname: 'id', 
     964                                                                viewrecords: true, 
     965                                                                sortorder: "desc", 
     966                                                                multiselect: true, 
     967                                                                autowidth: true, 
     968                                                                height:40, 
     969                                                                loadComplete: function(data) { 
     970                                                          //                            // aplica o contador 
     971                                                          //                            jQuery('.timable').each(function (i) { 
     972                                                          //                                    jQuery(this).countdown({ 
     973                                                          //                                            since: new Date(parseInt(this.title)),  
     974                                                          //                                            significant: 1, 
     975                                                          //                                            layout: 'h&aacute; {d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}',  
     976                                                          //                                            description: ' atr&aacute;s' 
     977                                                          //                                    }); 
     978                                                          //                            }); 
     979                                                                }, 
     980                                                                onSelectRow: function (id, selected) { 
     981                                                                        if( selected )  
     982                                                                        { 
     983                                                                                selectedMessages[ id ] = true; 
     984                                                                        } 
     985                                                                        else 
     986                                                                        { 
     987                                                                                delete selectedMessages[ id ]; 
     988                                                                        } 
     989                                                                }, 
     990                                                                caption: 'Mensagens que atendem aos crit&eacute;rios' 
     991                                                        }); // end jqGrid 
     992                                                } // end success 
     993                                        }); // end ajax 
     994                                }  
     995                                else 
     996                                { 
     997                                        return; 
     998                                } 
     999                        }); // end function click 
     1000                });     // end DataLayer.render 
    8971001        }); 
    8981002        list_container.parent().find(".button.add.vacation").click(function(){ 
  • trunk/prototype/modules/filters/interceptors/FilterMapping.php

    r5747 r5862  
    5050* @license    http://www.gnu.org/copyleft/gpl.html GPL 
    5151* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    52 * @author     Airton Bordin Junior 
    53 * @author     Gustavo Pereira dos Santos 
     52* @author     Airton Bordin Junior <airton@prognus.com.br> 
     53* @author     Gustavo Pereira dos Santos <gustavo@prognus.com.br> 
    5454* @version    1.0 
    5555* @since      Classe disponibilizada na versão 2.4 
     
    6767        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    6868        * @sponsor    Caixa EconÃŽmica Federal 
    69         * @author     Airton Bordin Junior 
    70         * @author         Gustavo Pereira dos Santos     
     69        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     70        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    7171        * @param      <Array> <$rules> <Array com as regras do usuário> 
    7272        * @return     <Regra de acordo com a sintaxe do Sieve> 
     
    109109                        $data['isExact'] == 'false' ?  $script_match .= 'if anyof (' : $script_match .= 'if allof ('; 
    110110 
    111  
    112111                        if( is_array($criteria) ) 
    113112                        foreach ($criteria as $j => $value); 
    114113                        {                                        
    115                                   
     114 
    116115                                switch($criteria[$j]['field']) { 
    117116                                        case 'To':     
     
    174173                                        /*  
    175174                                           TO-DO: 
    176                                            Arrrumar regra do "não contém". 
     175                                           Inconsistência na regra do "não contém". 
    177176                                        */ 
    178177                                        case '!*': 
     
    232231                                $i++; 
    233232                        $script_match = ""; 
    234                         $script_criteria = ""; 
    235                          
     233                        $script_criteria = "";   
     234                        $data['applyMessages'] = "";                                                     
    236235                } 
    237236 
     
    258257 
    259258                $content = $script_begin . $script_header . $script_rules . "\r\n\r\n#PseudoScript#" . "\r\n#" . $json_data; 
    260                 //$content = "";  
    261259 
    262260                return( $content ); 
     
    269267        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    270268        * @sponsor    Caixa EconÃŽmica Federal 
    271         * @author     Airton Bordin Junior 
    272         * @author         Gustavo Pereira dos Santos     
     269        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     270        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    273271        * @param      <$scriptName> <Regras do usuário> 
    274272        * @return     <Regra do usuário parseada> 
     
    285283 
    286284        // Recebe o tamanho do script, pela primeira linha; 
    287         $this->size = trim($size_rule); 
     285        //$this->size = trim($size_rule); 
    288286 
    289287        // Verifica a composição do script; */ 
    290          $line = array_shift($lines); 
     288        $line = array_shift($lines); 
    291289 
    292290        // Variaveis para a regra e o campo ferias; 
    293         $regexps = array('^ *##PSEUDO', '^ *#rule', '^ *#vacation', '^ *#mode'); 
     291        $regexps = array('##PSEUDO', '#rule', '#vacation', '#mode'); 
    294292        $retorno['rule'] = array(); 
    295293 
    296294        $line = array_shift($lines); 
    297         while (isset($line)) { 
     295        while (isset($line)) {  
    298296            foreach ($regexps as $regp) { 
    299                 if (preg_match("/$regp/i", $line)) { 
     297                if (preg_match("/$regp/i", $line)) {  
    300298                    // Recebe todas as regras criadas no servidor; 
    301                     if (preg_match("/^ *#rule&&/i", $line)) { 
    302                         $retorno['rule'][] = $line . "\n"; 
     299                    if (preg_match("/#rule&&/i", $line)) { 
     300                        $retorno['rule'][] = ltrim($line) . "\n";                           
    303301                    } 
    304302                } 
     
    319317        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    320318        * @sponsor    Caixa EconÃŽmica Federal 
    321         * @author     Airton Bordin Junior 
    322         * @author         Gustavo Pereira dos Santos     
     319        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     320        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    323321        * @param      <String> <$script> <Script Sieve com as regras do usuário> 
    324322        * @return     <Regras do usuário em Array> 
     
    327325        public function parseSieveScript( $script ) 
    328326        { 
    329                 /* 
     327                /* Faz a verificação por filtros criados com a funcionalidade antiga */ 
    330328                $old_rule = strripos($script, "##PSEUDO script start"); 
    331329                 
    332330                if($old_rule) { 
    333                          
    334                         $parsed_rule = $this->readOldScript($old_script); 
    335                         $array_rule = explode("&&", $parsed_rule['rule'][0]); 
    336  
    337                         $old_retorno = array(); 
    338                         $old_retorno['isExact'] = false; 
    339                         $old_retorno['name'] = $array_rule[1]; 
    340                         $old_retorno['criteria'] = array(); 
    341                         $old_retorno['criteria'][0] = array(); 
    342                         $old_retorno['criteria'][0]['value'] = $array_rule[5]; 
    343                         $old_retorno['criteria'][0]['operator'] = '='; 
    344                         $old_retorno['criteria'][0]['field'] = 'subject'; 
    345                         $old_retorno['actions'] = array(); 
    346                         $old_retorno['actions'][0] = array(); 
    347                         $old_retorno['actions'][0]['parameter'] = $array_rule[7]; 
    348                         $old_retorno['actions'][0]['type'] = $array_rule[6]; 
    349                         $old_retorno['enabled'] = true; 
    350                         $old_retorno['id'] = $array_rule[1]; 
    351                         $old_retorno['applyMessages'] = ''; 
    352  
    353                         return $old_retorno; 
     331                        $parsed_rule = $this->readOldScript($script); 
     332                        $old_rules = array();  
     333                        $j = 0; 
     334                        foreach ($parsed_rule['rule'] as $i => $value) { 
     335                                 
     336                                $array_rule = explode("&&", $parsed_rule['rule'][$i]); 
     337 
     338                                /* TO-DO: Ver as actions possíveis além de reject e fileinto */ 
     339                                switch($array_rule[6]) { 
     340                                        case 'reject': 
     341                                                $action_type      = 'reject'; 
     342                                                $action_parameter = $array_rule[7]; 
     343                                                break; 
     344                                        case 'folder': 
     345                                                $action_type      = 'fileinto'; 
     346                                                $action_parameter = $array_rule[7]; 
     347                                                break; 
     348                                } 
     349 
     350                                if($array_rule[3] != "") { 
     351                                        $criteria_value = $array_rule[3]; 
     352                                        $criteria_operator = '='; 
     353                                        $criteria_field = 'from'; 
     354                                }  
     355                                else 
     356                                { 
     357                                        $criteria_value = $array_rule[5]; 
     358                                        $criteria_operator = '='; 
     359                                        $criteria_field = 'subject'; 
     360                                } 
     361 
     362                                $old_retorno = array(); 
     363                                $old_retorno['isExact']                                 = true; 
     364                                $old_retorno['name']                                    = 'regra_migrada_' . $array_rule[1]; 
     365                                $old_retorno['criteria']                                = array(); 
     366                                $old_retorno['criteria'][0]                     = array(); 
     367                                $old_retorno['criteria'][0]['value']    = $criteria_value; 
     368                                $old_retorno['criteria'][0]['operator'] = $criteria_operator; 
     369                                $old_retorno['criteria'][0]['field']    = $criteria_field; 
     370                                $old_retorno['actions']                 = array(); 
     371                                $old_retorno['actions'][0]              = array(); 
     372                                $old_retorno['actions'][0]['parameter'] = $action_parameter; 
     373                                $old_retorno['actions'][0]['type']      = $action_type; 
     374                                $old_retorno['enabled']                 = ($array_rule[2] == 'ENABLED') ? true: false; 
     375                                $old_retorno['id']                      = 'regra_migrada_' . $array_rule[1]; 
     376                                $old_retorno['applyMessages']           = ''; 
     377 
     378                                $old_rules[$j] = $old_retorno; 
     379                                $j++; 
     380                        }                        
     381                        return $old_rules; 
    354382                } 
    355                 */ 
     383                /* Não tem regra antiga */ 
    356384                $pos = strripos($script, "#PseudoScript#"); 
    357385                $pseudo_script = substr( $script, $pos+17 ); 
    358386 
    359387                $return = json_decode( $pseudo_script, true ); 
    360  
     388         
    361389                return $return; 
    362390        } 
     
    370398        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    371399        * @sponsor    Caixa EconÃŽmica Federal 
    372         * @author     Airton Bordin Junior 
    373         * @author         Gustavo Pereira dos Santos     
     400        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     401        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    374402        * @access     <public> 
    375403        */ 
     
    386414        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    387415        * @sponsor    Caixa EconÃŽmica Federal 
    388         * @author     Airton Bordin Junior 
    389         * @author         Gustavo Pereira dos Santos     
     416        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     417        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    390418        * @return     <Regras do usuário> 
    391419        * @access     <public> 
     
    398426                        $this->rules = array(); 
    399427                } 
     428                 
    400429                return( $this->rules ); 
    401430        } 
     
    408437        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    409438        * @sponsor    Caixa EconÃŽmica Federal 
    410         * @author     Airton Bordin Junior 
    411         * @author         Gustavo Pereira dos Santos     
     439        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     440        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    412441        * @param      <$uri>  
    413442        * @param      <$result>  
     
    418447        public function applySieveFilter( &$uri , &$result , &$criteria , $original  ) 
    419448        { 
    420                 /* 
    421                 $result['id'] = $uri['id']; 
    422                 $rule_apply = array();  
    423449                 
    424                 $filter = Controller::read($uri); 
    425                 $filter_ = $this->parseSieveScript($filter['content']); 
    426                  
    427                 foreach ($filter_ as $f_) { 
    428                         if($f_['id'] == $uri['id']) {  
    429                                 $rule_apply     = $f_; 
     450                //if()                   
     451                //{                                              
     452                        $result['id'] = $uri['id']; 
     453                        $rule_apply = array();  
     454                         
     455                        $filter = Controller::read($uri); 
     456                        $filter_ = $this->parseSieveScript($filter['content']); 
     457                         
     458                        foreach ($filter_ as $f_) { 
     459                                if($f_['id'] == $uri['id']) {  
     460                                        $rule_apply     = $f_; 
     461                                } 
    430462                        } 
    431                 } 
    432                  
    433                 $actions = array(); 
    434                 $actions['type']      = $rule_apply['actions'][0]['type']; 
    435                 $actions['parameter'] = $rule_apply['actions'][0]['parameter']; 
    436                  
    437                 $messages = $rule_apply['applyMessages']; 
    438                    
    439                            
    440                 $proc = array(); 
    441                 $proc['keep'] = false; 
    442                 */       
    443                  
    444                 //$imap = Controller::service( 'Imap' ); 
    445                 //$imap->apliSieveFilter($original['properties']['applyMessages'] , $proc );  
    446                 //$imap->apliSieveFilter($messages , $actions );  
    447                 //return $result; 
     463                                         
     464                        $actions = array(); 
     465                        $actions['type']      = $rule_apply['actions'][0]['type']; 
     466                        $actions['parameter'] = $rule_apply['actions'][0]['parameter']; 
     467                        /* Hardcoded */ 
     468                        $actions['keep']      = false; 
     469 
     470                        $messages_to_apply = array();                    
     471 
     472                        $messages = $rule_apply['applyMessages']; 
     473                        /*         
     474                        $proc = array(); 
     475                        $proc['keep'] = false; 
     476                                  
     477                        */ 
     478                        $imap = Controller::service( 'Imap' ); 
     479                        $imap->apliSieveFilter($messages , $actions);  
     480                        return $result; 
     481                //} 
    448482        } 
    449483 
     
    455489        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    456490        * @sponsor    Caixa EconÃŽmica Federal 
    457         * @author     Airton Bordin Junior 
    458         * @author         Gustavo Pereira dos Santos     
     491        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     492        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    459493        * @param      <$uri>  
    460494        * @param      <$result>  
     
    476510        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    477511        * @sponsor    Caixa EconÃŽmica Federal 
    478         * @author     Airton Bordin Junior 
    479         * @author         Gustavo Pereira dos Santos     
     512        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     513        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    480514        * @param      <$uri>  
    481515        * @param      <$result>  
     
    510544        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    511545        * @sponsor    Caixa EconÃŽmica Federal 
    512         * @author     Airton Bordin Junior 
    513         * @author         Gustavo Pereira dos Santos     
     546        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     547        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    514548        * @param      <$uri>  
    515549        * @param      <$result>  
     
    554588        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    555589        * @sponsor    Caixa EconÃŽmica Federal 
    556         * @author     Airton Bordin Junior 
    557         * @author         Gustavo Pereira dos Santos     
     590        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     591        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    558592        * @param      <$uri>  
    559593        * @param      <$result>  
     
    580614        * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    581615        * @sponsor    Caixa EconÃŽmica Federal 
    582         * @author     Airton Bordin Junior 
    583         * @author         Gustavo Pereira dos Santos     
     616        * @author     Airton Bordin Junior <airton@prognus.com.br> 
     617        * @author         Gustavo Pereira dos Santos <gustavo@prognus.com.br>    
    584618        * @param      <$uri>  
    585619        * @param      <$result>  
Note: See TracChangeset for help on using the changeset viewer.