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;3{| 9lNr!2ڧT=y_ȴ)'njaݴd:C ֏Qb}r8yhY,ABY5Ms)ɂȌ9%;w:CŻE&I5)銹L>ޯ%v ^iLGZc2GΠ'MnB2uWyC)טN.օ=RHudCWjnDv뵲D\($PT{` N<1FZ =mӫ87bBgЈU~eb)Lb@$#*;W@G_ ~;Utݮ ^d`&%7RN&kHJ< 4;u&nX䄧{.KՃ:!İoWQ>MF.uyAoOYY- Yx4l%&ܧ4ZɨFoԼ=u0nA7>EBhMSq7GV+dJFlMrϨb}P&IZ2vmU,I< 0cݦ_y3ϊaδ. {>ޯ%=HS5L< !Xd^0Փ+ەhXLLd2_id, 'id' => $field_id, 'value' => 1]); $content = $input->show($this->rc->config->get($key)) . ' ' . html::a(['href' => '#', 'onclick' => 'newmail_notifier_test_'.$type.'(); return false'], $this->gettext('test')); $args['blocks']['new_message']['options'][$key] = [ 'title' => html::label($field_id, rcube::Q($this->gettext($type))), 'content' => $content ]; } } $type = 'desktop_timeout'; $key = 'newmail_notifier_' . $type; if (!in_array($key, $dont_override)) { $field_id = '_' . $key; $select = new html_select(['name' => $field_id, 'id' => $field_id, 'class' => 'custom-select']); foreach ([5, 10, 15, 30, 45, 60] as $sec) { $label = $this->rc->gettext(['name' => 'afternseconds', 'vars' => ['n' => $sec]]); $select->add($label, $sec); } $args['blocks']['new_message']['options'][$key] = [ 'title' => html::label($field_id, rcube::Q($this->gettext('desktoptimeout'))), 'content' => $select->show((int) $this->rc->config->get($key)) ]; } return $args; } /** * Handler for user preferences save (preferences_save hook) */ function prefs_save($args) { if ($args['section'] != 'mailbox') { return $args; } // Load configuration $this->load_config(); // Check that configuration is not disabled $dont_override = (array) $this->rc->config->get('dont_override', []); foreach (['basic', 'desktop', 'sound'] as $type) { $key = 'newmail_notifier_' . $type; if (!in_array($key, $dont_override)) { $args['prefs'][$key] = !empty(rcube_utils::get_input_value('_' . $key, rcube_utils::INPUT_POST)); } } $option = 'newmail_notifier_desktop_timeout'; if (!in_array($option, $dont_override)) { if ($value = (int) rcube_utils::get_input_value('_' . $option, rcube_utils::INPUT_POST)) { $args['prefs'][$option] = $value; } } return $args; } /** * Handler for new message action (new_messages hook) */ function notify($args) { // Already notified or unexpected input if ($this->notified || empty($args['diff']['new'])) { return $args; } $mbox = $args['mailbox']; $storage = $this->rc->get_storage(); $delimiter = $storage->get_hierarchy_delimiter(); // Skip exception (sent/drafts) folders (and their subfolders) foreach ($this->exceptions as $folder) { if (strpos($mbox.$delimiter, $folder.$delimiter) === 0) { return $args; } } // Check if any of new messages is UNSEEN $deleted = $this->rc->config->get('skip_deleted') ? 'UNDELETED ' : ''; $search = $deleted . 'UNSEEN UID ' . $args['diff']['new']; $unseen = $storage->search_once($mbox, $search); if ($unseen->count()) { $this->notified = true; $this->rc->output->set_env('newmail_notifier_timeout', $this->rc->config->get('newmail_notifier_desktop_timeout')); $this->rc->output->command('plugin.newmail_notifier', [ 'basic' => $this->opt['basic'], 'sound' => $this->opt['sound'], 'desktop' => $this->opt['desktop'], ] ); } return $args; } }