Changeset 4596 in subversion


Ignore:
Timestamp:
Mar 7, 2011 9:22:11 AM (2 years ago)
Author:
alec
Message:
  • Fix saving of a script using flags extension on servers with imap4flags support (#1487825)
Location:
trunk/plugins/managesieve
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/managesieve/Changelog

    r4562 r4596  
     1* version 4.1 [2011-03-07] 
     2----------------------------------------------------------- 
    13- Fix fileinto target is always INBOX (#1487776) 
    24- Fix escaping of backslash character in quoted strings (#1487780) 
     
    46  or UTF-8 characters (dovecot's implementation bug workaround) 
    57  in script names 
     8- Fix saving of a script using flags extension on servers with imap4flags support (#1487825) 
    69 
    710* version 4.0 [2011-02-10] 
  • trunk/plugins/managesieve/lib/rcube_sieve.php

    r4524 r4596  
    3232    public $current;                // name of currently loaded script 
    3333    private $disabled;              // array of disabled extensions 
     34    private $exts;                  // array of supported extensions 
    3435 
    3536 
     
    7475        } 
    7576 
     77        $this->exts     = $this->get_extensions(); 
    7678        $this->disabled = $disabled; 
    7779    } 
     
    192194    public function get_extensions() 
    193195    { 
     196        if ($this->exts) 
     197            return $this->exts; 
     198     
    194199        if (!$this->sieve) 
    195200            return $this->_set_error(SIEVE_ERROR_INTERNAL); 
     
    281286    { 
    282287        // try to parse from Roundcube format 
    283         $script = new rcube_sieve_script($txt, $this->disabled); 
     288        $script = new rcube_sieve_script($txt, $this->disabled, $this->exts); 
    284289 
    285290        // ... else try to import from different formats 
    286291        if (empty($script->content)) { 
    287292            $script = $this->_import_rules($txt); 
    288             $script = new rcube_sieve_script($script, $this->disabled); 
     293            $script = new rcube_sieve_script($script, $this->disabled, $this->exts); 
    289294        } 
    290295 
  • trunk/plugins/managesieve/lib/rcube_sieve_script.php

    r4558 r4596  
    2727    ); 
    2828 
     29    private $capabilities; 
     30 
    2931    /** 
    3032     * Object constructor 
    3133     * 
    3234     * @param  string  Script's text content 
    33      * @param  array   Disabled extensions 
    34      */ 
    35     public function __construct($script, $disabled=null) 
     35     * @param  array   List of disabled extensions 
     36     * @param  array   List of capabilities supported by server 
     37     */ 
     38    public function __construct($script, $disabled=null, $capabilities=null) 
    3639    { 
    3740        if (!empty($disabled)) { 
     
    4548        } 
    4649 
    47         $this->content = $this->_parse_text($script); 
     50        $this->capabilities = $capabilities; 
     51        $this->content      = $this->_parse_text($script); 
    4852    } 
    4953 
     
    217221                case 'setflag': 
    218222                case 'removeflag': 
    219                     if (!empty($action['mode']) && strtolower($action['mode']) == 'imap4flags') 
     223                    if (is_array($this->capabilities) && in_array('imap4flags', $this->capabilities)) 
    220224                        array_push($exts, 'imap4flags'); 
    221225                    else 
  • trunk/plugins/managesieve/managesieve.php

    r4536 r4596  
    535535                    } 
    536536                    $this->form['actions'][$i]['target'] = $_target; 
    537                     if (in_array('imap4flags', $this->exts)) { 
    538                         $this->form['actions'][$i]['mode'] = 'imap4flags'; 
    539                     } 
    540537                    break; 
    541538 
     
    10861083            . $this->error_class($id, 'action', 'flags', 'action_flags') . '>'; 
    10871084        foreach ($flags as $fidx => $flag) { 
    1088             $out .= '<nobr><input type="checkbox" name="_action_flags[' .$id .'][]" value="' . $flag . '"' 
     1085            $out .= '<input type="checkbox" name="_action_flags[' .$id .'][]" value="' . $flag . '"' 
    10891086                . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' 
    1090                 . Q($this->gettext('flag'.$fidx)) .'</nobr> '; 
     1087                . Q($this->gettext('flag'.$fidx)) .'<br>'; 
    10911088        } 
    10921089        $out .= '</div>'; 
Note: See TracChangeset for help on using the changeset viewer.