diff options
author | thomascube <thomas@roundcube.net> | 2012-03-31 12:25:48 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2012-03-31 12:25:48 +0000 |
commit | 48e9c14ebded89d858c8be0333f77f77a81b0877 (patch) | |
tree | e97fd2ea338eea2dbe5f3fb7431e73f44cb8bf18 /plugins/newmail_notifier | |
parent | 13db9ee199b0a452a6efaf09e6f7c5a76f739ef5 (diff) |
Move plugins repository into roundcubemail root folder; svn:externals are not defined anymore
Diffstat (limited to 'plugins/newmail_notifier')
-rw-r--r-- | plugins/newmail_notifier/config.inc.php.dist | 12 | ||||
-rw-r--r-- | plugins/newmail_notifier/favicon.ico | bin | 0 -> 1734 bytes | |||
-rw-r--r-- | plugins/newmail_notifier/localization/de_CH.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/de_DE.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/en_US.inc | 13 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/ja_JP.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/lv_LV.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/pl_PL.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/pt_BR.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/ru_RU.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/sv_SE.inc | 27 | ||||
-rw-r--r-- | plugins/newmail_notifier/mail.png | bin | 0 -> 1408 bytes | |||
-rw-r--r-- | plugins/newmail_notifier/newmail_notifier.js | 120 | ||||
-rw-r--r-- | plugins/newmail_notifier/newmail_notifier.php | 178 | ||||
-rw-r--r-- | plugins/newmail_notifier/package.xml | 70 | ||||
-rw-r--r-- | plugins/newmail_notifier/sound.wav | bin | 0 -> 10444 bytes |
16 files changed, 609 insertions, 0 deletions
diff --git a/plugins/newmail_notifier/config.inc.php.dist b/plugins/newmail_notifier/config.inc.php.dist new file mode 100644 index 000000000..067fe19f1 --- /dev/null +++ b/plugins/newmail_notifier/config.inc.php.dist @@ -0,0 +1,12 @@ +<?php + +// Enables basic notification +$rcmail_config['newmail_notifier_basic'] = false; + +// Enables sound notification +$rcmail_config['newmail_notifier_sound'] = false; + +// Enables desktop notification +$rcmail_config['newmail_notifier_desktop'] = false; + +?> diff --git a/plugins/newmail_notifier/favicon.ico b/plugins/newmail_notifier/favicon.ico Binary files differnew file mode 100644 index 000000000..86e10c1c7 --- /dev/null +++ b/plugins/newmail_notifier/favicon.ico diff --git a/plugins/newmail_notifier/localization/de_CH.inc b/plugins/newmail_notifier/localization/de_CH.inc new file mode 100644 index 000000000..4ce6134d1 --- /dev/null +++ b/plugins/newmail_notifier/localization/de_CH.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/de_CH/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = 'Anzeige im Browser bei neuer Nachricht'; +$labels['desktop'] = 'Desktop-Benachrichtigung bei neuer Nachricht'; +$labels['sound'] = 'Akustische Meldung bei neuer Nachricht'; +$labels['test'] = 'Test'; +$labels['title'] = 'Neue E-Mail!'; +$labels['body'] = 'Sie haben eine neue Nachricht'; +$labels['testbody'] = 'Dies ist eine Testbenachrichtigung'; +$labels['desktopdisabled'] = 'Desktop-Benachrichtigungen sind deaktiviert.'; +$labels['desktopunsupported'] = 'Ihr Browser unterstützt keine Desktop-Benachrichtigungen.'; + diff --git a/plugins/newmail_notifier/localization/de_DE.inc b/plugins/newmail_notifier/localization/de_DE.inc new file mode 100644 index 000000000..f49eb4929 --- /dev/null +++ b/plugins/newmail_notifier/localization/de_DE.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/de_DE/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = 'Benachrichtigung im Browser bei neuer Nachricht'; +$labels['desktop'] = 'Desktop-Benachrichtigung bei neuer Nachricht'; +$labels['sound'] = 'Akustische Meldung bei neuer Nachricht'; +$labels['test'] = 'Test'; +$labels['title'] = 'Neue E-Mail!'; +$labels['body'] = 'Sie haben eine neue Nachricht'; +$labels['testbody'] = 'Dies ist eine Testbenachrichtigung'; +$labels['desktopdisabled'] = 'Desktop-Benachrichtigungen sind deaktiviert.'; +$labels['desktopunsupported'] = 'Ihr Browser unterstützt keine Desktop-Benachrichtigungen.'; + diff --git a/plugins/newmail_notifier/localization/en_US.inc b/plugins/newmail_notifier/localization/en_US.inc new file mode 100644 index 000000000..3017c43dc --- /dev/null +++ b/plugins/newmail_notifier/localization/en_US.inc @@ -0,0 +1,13 @@ +<?php + +$labels['basic'] = 'Display browser notifications on new message'; +$labels['desktop'] = 'Display desktop notifications on new message'; +$labels['sound'] = 'Play the sound on new message'; +$labels['test'] = 'Test'; +$labels['title'] = 'New Email!'; +$labels['body'] = 'You\'ve received a new message.'; +$labels['testbody'] = 'This is a test notification.'; +$labels['desktopdisabled'] = 'Desktop notifications are disabled in your browser.'; +$labels['desktopunsupported'] = 'Your browser does not support desktop notifications.'; + +?> diff --git a/plugins/newmail_notifier/localization/ja_JP.inc b/plugins/newmail_notifier/localization/ja_JP.inc new file mode 100644 index 000000000..f01fd7591 --- /dev/null +++ b/plugins/newmail_notifier/localization/ja_JP.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/ja_JP/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = '新しいメッセージの通知をブラウザーに表示する'; +$labels['desktop'] = '新しいメッセージの通知をデスクトップに表示する'; +$labels['sound'] = '新しいメッセージが届くと音を再生する'; +$labels['test'] = 'テスト'; +$labels['title'] = '新しいメールです!'; +$labels['body'] = '新しいメッセージを受信しました。'; +$labels['testbody'] = 'これはテスト通知です。'; +$labels['desktopdisabled'] = 'ブラウザーでデスクトップ通知が無効になっています。'; +$labels['desktopunsupported'] = 'ブラウザーがデスクトップ通知をサポートしていません。'; + diff --git a/plugins/newmail_notifier/localization/lv_LV.inc b/plugins/newmail_notifier/localization/lv_LV.inc new file mode 100644 index 000000000..0459d723b --- /dev/null +++ b/plugins/newmail_notifier/localization/lv_LV.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/lv_LV/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = 'Attēlot paziņojumu pie jaunas vēstules saņemšanas'; +$labels['desktop'] = 'Attēlot darbvirsmas paziņojumu pie jaunas vēstules saņemšanas'; +$labels['sound'] = 'Atskaņot skaņas signālu pie jaunas vēstules saņemšanas'; +$labels['test'] = 'Test'; +$labels['title'] = 'Jauns E-pasts!'; +$labels['body'] = 'Jūs esat saņēmis jaunu e-pastu.'; +$labels['testbody'] = 'Šis ir testa paziņojums.'; +$labels['desktopdisabled'] = 'Darbvirsmas paziņojumi ir atslēgti Jūsu pārlūkprogrammā.'; +$labels['desktopunsupported'] = 'Jūsu pārlūkprogramma neatbalsta darbvirsmas paziņojumus.'; + diff --git a/plugins/newmail_notifier/localization/pl_PL.inc b/plugins/newmail_notifier/localization/pl_PL.inc new file mode 100644 index 000000000..711dcc550 --- /dev/null +++ b/plugins/newmail_notifier/localization/pl_PL.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/pl_PL/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = 'Wyświetlaj powiadomienia o nadejściu nowej wiadomości w przeglądarce'; +$labels['desktop'] = 'Wyświetlaj powiadomienia o nadejściu nowej wiadomości na pulpicie'; +$labels['sound'] = 'Odtwarzaj dźwięk o nadejściu nowej wiadomości'; +$labels['test'] = 'Testuj powiadomienie'; +$labels['title'] = 'Nowa wiadomość!'; +$labels['body'] = 'Nadeszła nowa wiadomość.'; +$labels['testbody'] = 'To jest testowe powiadomienie.'; +$labels['desktopdisabled'] = 'Powiadomienia na pulpicie zostały zablokowane w twojej przeglądarce.'; +$labels['desktopunsupported'] = 'Twoja przeglądarka nie obsługuje powiadomień na pulpicie.'; + diff --git a/plugins/newmail_notifier/localization/pt_BR.inc b/plugins/newmail_notifier/localization/pt_BR.inc new file mode 100644 index 000000000..600a3ff1a --- /dev/null +++ b/plugins/newmail_notifier/localization/pt_BR.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/pt_BR/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = 'Exibir notificação quando uma nova mensagem chegar'; +$labels['desktop'] = 'Exibir notificação no desktop quando uma nova mensagem chegar'; +$labels['sound'] = 'Alerta sonoro quando uma nova mensagem chegar'; +$labels['test'] = 'Testar'; +$labels['title'] = 'Novo Email!'; +$labels['body'] = 'Você recebeu uma nova mensagem.'; +$labels['testbody'] = 'Essa é uma notificação de teste.'; +$labels['desktopdisabled'] = 'As notificações no desktop estão desabilitadas no seu navegador.'; +$labels['desktopunsupported'] = 'Seu navegador não suporta notificações no desktop'; + diff --git a/plugins/newmail_notifier/localization/ru_RU.inc b/plugins/newmail_notifier/localization/ru_RU.inc new file mode 100644 index 000000000..b95a60bf7 --- /dev/null +++ b/plugins/newmail_notifier/localization/ru_RU.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/ru_RU/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = 'Показывать в браузере уведомление о приходе нового сообщения'; +$labels['desktop'] = 'Показывать на рабочем столе уведомление о приходе нового сообщения'; +$labels['sound'] = 'Подавать звуковой сигнал о приходе нового сообщения'; +$labels['test'] = 'Проверить'; +$labels['title'] = 'Свежая почта!'; +$labels['body'] = 'Вы получили новое сообщение.'; +$labels['testbody'] = 'Это тестовое уведомление.'; +$labels['desktopdisabled'] = 'В Вашем браузере отключены уведомления на рабочем столе.'; +$labels['desktopunsupported'] = 'Ваш браузер не поддерживает уведомления на рабочем столе.'; + diff --git a/plugins/newmail_notifier/localization/sv_SE.inc b/plugins/newmail_notifier/localization/sv_SE.inc new file mode 100644 index 000000000..b1c92ed79 --- /dev/null +++ b/plugins/newmail_notifier/localization/sv_SE.inc @@ -0,0 +1,27 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | localization/sv_SE/labels.inc | + | | + | Language file of the Roundcube Webmail client | + | Copyright (C) 2012, The Roundcube Dev Team | + | Licensed under the GNU General Public License | + | | + +-----------------------------------------------------------------------+ + | Author: Jonas Nasholm <Unknown> | + +-----------------------------------------------------------------------+ + @version $Id$ +*/ + +$labels = array(); +$labels['basic'] = 'Avisera nytt meddelande i webbläsaren'; +$labels['desktop'] = 'Avisera nytt meddelande på skrivbordet'; +$labels['sound'] = 'Avisera nytt meddelande med ljudsignal'; +$labels['test'] = 'Prova'; +$labels['title'] = 'Nytt meddelande!'; +$labels['body'] = 'Du har mottagit ett nytt meddelande.'; +$labels['testbody'] = 'Denna avisering är ett prov.'; +$labels['desktopdisabled'] = 'Avisering på skrivbordet är avstängt i webbläsaren.'; +$labels['desktopunsupported'] = 'Avisering på skrivbordet stöds inte av webbläsaren.'; + diff --git a/plugins/newmail_notifier/mail.png b/plugins/newmail_notifier/mail.png Binary files differnew file mode 100644 index 000000000..79f3a5311 --- /dev/null +++ b/plugins/newmail_notifier/mail.png diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js new file mode 100644 index 000000000..7c9b55ded --- /dev/null +++ b/plugins/newmail_notifier/newmail_notifier.js @@ -0,0 +1,120 @@ +/** + * New Mail Notifier plugin script + * + * @version @package_version@ + * @author Aleksander Machniak <alec@alec.pl> + */ + +if (window.rcmail && rcmail.env.task == 'mail') { + rcmail.addEventListener('plugin.newmail_notifier', newmail_notifier_run); + rcmail.addEventListener('actionbefore', newmail_notifier_stop); + rcmail.addEventListener('init', function() { + // bind to messages list select event, so favicon will be reverted on message preview too + if (rcmail.message_list) + rcmail.message_list.addEventListener('select', newmail_notifier_stop); + }); +} + +// Executes notification methods +function newmail_notifier_run(prop) +{ + if (prop.basic) + newmail_notifier_basic(); + if (prop.sound) + newmail_notifier_sound(); + if (prop.desktop) + newmail_notifier_desktop(rcmail.gettext('body', 'newmail_notifier')); +} + +// Stops notification +function newmail_notifier_stop(prop) +{ + // revert original favicon + if (rcmail.env.favicon_href && (!prop || prop.action != 'check-recent')) { + $('<link rel="shortcut icon" href="'+rcmail.env.favicon_href+'"/>').replaceAll('link[rel="shortcut icon"]'); + rcmail.env.favicon_href = null; + } +} + +// Basic notification: window.focus and favicon change +function newmail_notifier_basic() +{ + var w = rcmail.is_framed() ? window.parent : window; + + w.focus(); + + // we cannot simply change a href attribute, we must to replace the link element (at least in FF) + var link = $('<link rel="shortcut icon" href="plugins/newmail_notifier/favicon.ico"/>'), + oldlink = $('link[rel="shortcut icon"]', w.document); + + rcmail.env.favicon_href = oldlink.attr('href'); + link.replaceAll(oldlink); +} + +// Sound notification +function newmail_notifier_sound() +{ + var elem, src = 'plugins/newmail_notifier/sound.wav'; + + // HTML5 + try { + elem = $('<audio src="' + src + '" />'); + elem.get(0).play(); + } + // old method + catch (e) { + elem = $('<embed id="sound" src="' + src + '" hidden=true autostart=true loop=false />'); + elem.appendTo($('body')); + window.setTimeout("$('#sound').remove()", 5000); + } +} + +// Desktop notification (need Chrome or Firefox with a plugin) +function newmail_notifier_desktop(body) +{ + var dn = window.webkitNotifications; + + if (dn && !dn.checkPermission()) { + if (rcmail.newmail_popup) + rcmail.newmail_popup.cancel(); + var popup = window.webkitNotifications.createNotification('plugins/newmail_notifier/mail.png', + rcmail.gettext('title', 'newmail_notifier'), body); + popup.onclick = function() { + this.cancel(); + } + popup.show(); + setTimeout(function() { popup.cancel(); }, 10000); // close after 10 seconds + rcmail.newmail_popup = popup; + return true; + } + + return false; +} + +function newmail_notifier_test_desktop() +{ + var dn = window.webkitNotifications, + txt = rcmail.gettext('testbody', 'newmail_notifier'); + + if (dn) { + if (!dn.checkPermission()) + newmail_notifier_desktop(txt); + else + dn.requestPermission(function() { + if (!newmail_notifier_desktop(txt)) + rcmail.display_message(rcmail.gettext('desktopdisabled', 'newmail_notifier'), 'error'); + }); + } + else + rcmail.display_message(rcmail.gettext('desktopunsupported', 'newmail_notifier'), 'error'); +} + +function newmail_notifier_test_basic() +{ + newmail_notifier_basic(); +} + +function newmail_notifier_test_sound() +{ + newmail_notifier_sound(); +} diff --git a/plugins/newmail_notifier/newmail_notifier.php b/plugins/newmail_notifier/newmail_notifier.php new file mode 100644 index 000000000..20ffac8ce --- /dev/null +++ b/plugins/newmail_notifier/newmail_notifier.php @@ -0,0 +1,178 @@ +<?php + +/** + * New Mail Notifier plugin + * + * Supports three methods of notification: + * 1. Basic - focus browser window and change favicon + * 2. Sound - play wav file + * 3. Desktop - display desktop notification (using webkitNotifications feature, + * supported by Chrome and Firefox with 'HTML5 Notifications' plugin) + * + * @version @package_version@ + * @author Aleksander Machniak <alec@alec.pl> + * + * + * Copyright (C) 2011, Kolab Systems AG + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +class newmail_notifier extends rcube_plugin +{ + public $task = 'mail|settings'; + + private $rc; + private $notified; + + /** + * Plugin initialization + */ + function init() + { + $this->rc = rcmail::get_instance(); + + // Preferences hooks + if ($this->rc->task == 'settings') { + $this->add_hook('preferences_list', array($this, 'prefs_list')); + $this->add_hook('preferences_save', array($this, 'prefs_save')); + } + else { // if ($this->rc->task == 'mail') { + $this->add_hook('new_messages', array($this, 'notify')); + // add script when not in ajax and not in frame + if (is_a($this->rc->output, 'rcube_template') && empty($_REQUEST['_framed'])) { + $this->add_texts('localization/'); + $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.body'); + $this->include_script('newmail_notifier.js'); + } + } + } + + /** + * Handler for user preferences form (preferences_list hook) + */ + function prefs_list($args) + { + if ($args['section'] != 'mailbox') { + return $args; + } + + // Load configuration + $this->load_config(); + + // Load localization and configuration + $this->add_texts('localization/'); + + if (!empty($_REQUEST['_framed'])) { + $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.testbody', + 'newmail_notifier.desktopunsupported', 'newmail_notifier.desktopenabled', 'newmail_notifier.desktopdisabled'); + $this->include_script('newmail_notifier.js'); + } + + // Check that configuration is not disabled + $dont_override = (array) $this->rc->config->get('dont_override', array()); + + foreach (array('basic', 'desktop', 'sound') as $type) { + $key = 'newmail_notifier_' . $type; + if (!in_array($key, $dont_override)) { + $field_id = '_' . $key; + $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1)); + $content = $input->show($this->rc->config->get($key)) + . ' ' . html::a(array('href' => '#', 'onclick' => 'newmail_notifier_test_'.$type.'()'), + $this->gettext('test')); + + $args['blocks']['new_message']['options'][$key] = array( + 'title' => html::label($field_id, Q($this->gettext($type))), + 'content' => $content + ); + } + } + + 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', array()); + + foreach (array('basic', 'desktop', 'sound') as $type) { + $key = 'newmail_notifier_' . $type; + if (!in_array($key, $dont_override)) { + $args['prefs'][$key] = get_input_value('_'.$key, RCUBE_INPUT_POST) ? true : false; + } + } + + return $args; + } + + /** + * Handler for new message action (new_messages hook) + */ + function notify($args) + { + // Already notified or non-automatic check + if ($this->notified || !empty($_GET['_refresh'])) { + return $args; + } + + // Get folders to skip checking for + if (empty($this->exceptions)) { + $this->delimiter = $this->rc->storage->get_hierarchy_delimiter(); + + $exceptions = array('drafts_mbox', 'sent_mbox', 'trash_mbox'); + foreach ($exceptions as $folder) { + $folder = $this->rc->config->get($folder); + if (strlen($folder) && $folder != 'INBOX') { + $this->exceptions[] = $folder; + } + } + } + + $mbox = $args['mailbox']; + + // Skip exception (sent/drafts) folders (and their subfolders) + foreach ($this->exceptions as $folder) { + if (strpos($mbox.$this->delimiter, $folder.$this->delimiter) === 0) { + return $args; + } + } + + $this->notified = true; + + // Load configuration + $this->load_config(); + + $basic = $this->rc->config->get('newmail_notifier_basic'); + $sound = $this->rc->config->get('newmail_notifier_sound'); + $desktop = $this->rc->config->get('newmail_notifier_desktop'); + + if ($basic || $sound || $desktop) { + $this->rc->output->command('plugin.newmail_notifier', + array('basic' => $basic, 'sound' => $sound, 'desktop' => $desktop)); + } + + return $args; + } +} diff --git a/plugins/newmail_notifier/package.xml b/plugins/newmail_notifier/package.xml new file mode 100644 index 000000000..d3de25fb3 --- /dev/null +++ b/plugins/newmail_notifier/package.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.0" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 + http://pear.php.net/dtd/tasks-1.0.xsd + http://pear.php.net/dtd/package-2.0 + http://pear.php.net/dtd/package-2.0.xsd"> + <name>newmail_notifier</name> + <channel>pear.roundcube.net</channel> + <summary>Displays notification about a new mail</summary> + <description> + Supports three methods of notification: + 1. Basic - focus browser window and change favicon + 2. Sound - play wav file + 3. Desktop - display desktop notification (using webkitNotifications feature, + supported by Chrome and Firefox with 'HTML5 Notifications' plugin). + </description> + <lead> + <name>Aleksander Machniak</name> + <user>alec</user> + <email>alec@alec.pl</email> + <active>yes</active> + </lead> + <date>2012-02-07</date> + <version> + <release>0.4</release> + <api>0.3</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> + <notes>-</notes> + <contents> + <dir baseinstalldir="/" name="/"> + <file name="newmail_notifier.php" role="php"> + <tasks:replace from="@name@" to="name" type="package-info"/> + <tasks:replace from="@package_version@" to="version" type="package-info"/> + </file> + <file name="newmail_notifier.js" role="data"> + <tasks:replace from="@name@" to="name" type="package-info"/> + <tasks:replace from="@package_version@" to="version" type="package-info"/> + </file> + <file name="config.inc.php.dist" role="data"></file> + <file name="favicon.ico" role="data"></file> + <file name="mail.png" role="data"></file> + <file name="sound.wav" role="data"></file> + <file name="localization/de_CH.inc" role="data"></file> + <file name="localization/de_DE.inc" role="data"></file> + <file name="localization/en_US.inc" role="data"></file> + <file name="localization/ja_JP.inc" role="data"></file> + <file name="localization/lv_LV.inc" role="data"></file> + <file name="localization/pl_PL.inc" role="data"></file> + <file name="localization/pt_BR.inc" role="data"></file> + <file name="localization/ru_RU.inc" role="data"></file> + <file name="localization/sv_SE.inc" role="data"></file> + </dir> + <!-- / --> + </contents> + <dependencies> + <required> + <php> + <min>5.2.1</min> + </php> + <pearinstaller> + <min>1.7.0</min> + </pearinstaller> + </required> + </dependencies> + <phprelease/> +</package> diff --git a/plugins/newmail_notifier/sound.wav b/plugins/newmail_notifier/sound.wav Binary files differnew file mode 100644 index 000000000..72d3dd857 --- /dev/null +++ b/plugins/newmail_notifier/sound.wav |