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%ި1ܛs_*/w'2z$N-/g$z+81UgX$&O566Ԕ~ &831(H49ybmCM|ވUWgR3]-!nR[fl#ǽʎ:e w(QE?};p<x.9 ;䦙02隅1}k ;'z3$b,7Y*&?oв]K56ZtbJaGX[OзjyR8Zb+-_ikܾ5e}: d(eCf-];6L4|ș.i#.5kt.> l)㴔/Qo,p Ӛ 4RJ ^@#jm1N*mw9\G88 s:Dߏ:e<-}`3gh ȤKރQQ}I}6TЂ5@f%Ȧ+]--vYH2PBm<QFЦTsƵS=S*& NbN巂s Ud&PVƸ>ժẀPmI`;:;uc!) zQ;ҷתϤt܄z: xJlY.Yո"ep"B;:Gu#ǽʎ:(ɮbá,CgA- QN=!)@(w%Ha<$° \ew= !|wu.KZٹ&Ro 3{mصPpEeO@Iet,y🋒A7-Ym9!6􉳲_[7w<!~(*Ҫ,Lb 7zy2~ BY5Ms)ȉxLd[$#b9', 먈؋ ( z $M3Mx@WRj~t?yޟRR*v3llUSdr~ 'plugin.managesieve', 'class' => 'filter', 'label' => 'filters', 'domain' => 'managesieve', 'title' => 'filterstitle', ]; } // register Vacation action if ($vacation_mode > 0) { $args['actions'][] = [ 'action' => 'plugin.managesieve-vacation', 'class' => 'vacation', 'label' => 'vacation', 'domain' => 'managesieve', 'title' => 'vacationtitle', ]; } // register Forward action if ($forward_mode > 0) { $args['actions'][] = [ 'action' => 'plugin.managesieve-forward', 'class' => 'forward', 'label' => 'forward', 'domain' => 'managesieve', 'title' => 'forwardtitle', ]; } return $args; } /** * Add UI elements to the 'mailbox view' and 'show message' UI. */ function mail_task_handler() { // make sure we're not in ajax request if ($this->rc->output->type != 'html') { return; } $vacation_mode = (int) $this->rc->config->get('managesieve_vacation'); $forward_mode = (int) $this->rc->config->get('managesieve_forward'); if ($vacation_mode == 2 || $forward_mode == 2) { return; } // include js script and localization $this->init_ui(); // add 'Create filter' item to message menu $this->add_button([ 'command' => 'managesieve-create', 'label' => 'managesieve.filtercreate', 'type' => 'link-menuitem', 'classact' => 'icon filterlink active', 'class' => 'icon filterlink disabled', 'innerclass' => 'icon filterlink', ], 'messagemenu' ); // register some labels/messages $this->rc->output->add_label('managesieve.newfilter', 'managesieve.usedata', 'managesieve.nodata', 'managesieve.nextstep', 'save'); $this->rc->session->remove('managesieve_current'); } /** * Get message headers for popup window */ function mail_headers($args) { // this hook can be executed many times if (!empty($this->mail_headers_done)) { return $args; } $this->mail_headers_done = true; $headers = $this->parse_headers($args['headers']); if ($this->rc->action == 'preview') { $this->rc->output->command('parent.set_env', ['sieve_headers' => $headers]); } else { $this->rc->output->set_env('sieve_headers', $headers); } return $args; } /** * Plugin action handler */ function managesieve_actions() { $uids = rcmail::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST); // handle fetching email headers for the new filter form if (!empty($uids)) { $mailbox = key($uids); $message = new rcube_message($uids[$mailbox][0], $mailbox); $headers = $this->parse_headers($message->headers); $this->rc->output->set_env('sieve_headers', $headers); $this->rc->output->command('managesieve_create', true); $this->rc->output->send(); } // handle other actions $engine_type = $this->rc->action == 'plugin.managesieve-vacation' ? 'vacation' : ''; $engine_type = $this->rc->action == 'plugin.managesieve-forward' ? 'forward' : $engine_type; $engine = $this->get_engine($engine_type); $this->init_ui(); $engine->actions(); } /** * Forms save action handler */ function managesieve_save() { // load localization $this->add_texts('localization/', ['filters', 'managefilters']); // include main js script if ($this->api->output->type == 'html') { $this->include_script('managesieve.js'); } $engine = $this->get_engine(); $engine->save(); } /** * Raw form save action handler */ function managesieve_saveraw() { $engine = $this->get_engine(); if (!$this->rc->config->get('managesieve_raw_editor', true)) { return; } // load localization $this->add_texts('localization/', ['filters','managefilters']); $engine->saveraw(); } /** * Initializes engine object */ public function get_engine($type = null) { if (!$this->engine) { // Add include path for internal classes $include_path = $this->home . '/lib' . PATH_SEPARATOR; $include_path .= ini_get('include_path'); set_include_path($include_path); $class_name = 'rcube_sieve_' . ($type ?: 'engine'); $this->engine = new $class_name($this); } return $this->engine; } /** * Extract mail headers for new filter form */ private function parse_headers($headers) { $result = []; if ($headers->subject) { $result[] = ['Subject', rcube_mime::decode_header($headers->subject)]; } // @TODO: List-Id, others? foreach (['From', 'To'] as $h) { $hl = strtolower($h); if (!empty($headers->$hl)) { $list = rcube_mime::decode_address_list($headers->$hl); foreach ($list as $item) { if (!empty($item['mailto'])) { $result[] = [$h, $item['mailto']]; } } } } return $result; } }