summaryrefslogtreecommitdiff
path: root/plugins/newmail_notifier
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/newmail_notifier')
-rw-r--r--plugins/newmail_notifier/config.inc.php.dist6
-rw-r--r--plugins/newmail_notifier/localization/ast.inc28
-rw-r--r--plugins/newmail_notifier/localization/bg_BG.inc28
-rw-r--r--plugins/newmail_notifier/localization/el_GR.inc27
-rw-r--r--plugins/newmail_notifier/localization/en_US.inc2
-rw-r--r--plugins/newmail_notifier/localization/es_AR.inc27
-rw-r--r--plugins/newmail_notifier/localization/eu_ES.inc27
-rw-r--r--plugins/newmail_notifier/localization/lb_LU.inc3
-rw-r--r--plugins/newmail_notifier/localization/lv_LV.inc16
-rw-r--r--plugins/newmail_notifier/localization/ro_RO.inc4
-rw-r--r--plugins/newmail_notifier/localization/ti.inc27
-rw-r--r--plugins/newmail_notifier/newmail_notifier.js110
-rw-r--r--plugins/newmail_notifier/newmail_notifier.php85
-rw-r--r--plugins/newmail_notifier/package.xml8
-rw-r--r--plugins/newmail_notifier/sound.mp3bin0 -> 7488 bytes
15 files changed, 244 insertions, 154 deletions
diff --git a/plugins/newmail_notifier/config.inc.php.dist b/plugins/newmail_notifier/config.inc.php.dist
index cdb563c40..067fe19f1 100644
--- a/plugins/newmail_notifier/config.inc.php.dist
+++ b/plugins/newmail_notifier/config.inc.php.dist
@@ -1,12 +1,12 @@
<?php
// Enables basic notification
-$config['newmail_notifier_basic'] = false;
+$rcmail_config['newmail_notifier_basic'] = false;
// Enables sound notification
-$config['newmail_notifier_sound'] = false;
+$rcmail_config['newmail_notifier_sound'] = false;
// Enables desktop notification
-$config['newmail_notifier_desktop'] = false;
+$rcmail_config['newmail_notifier_desktop'] = false;
?>
diff --git a/plugins/newmail_notifier/localization/ast.inc b/plugins/newmail_notifier/localization/ast.inc
new file mode 100644
index 000000000..3c5c192e0
--- /dev/null
+++ b/plugins/newmail_notifier/localization/ast.inc
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | plugins/newmail_notifier/localization/<lang>.inc |
+ | |
+ | Localization file of the Roundcube Webmail New Mail Notifier plugin |
+ | Copyright (C) 2012-2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ +-----------------------------------------------------------------------+
+
+ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
+*/
+$labels['basic'] = 'Amosar notificaciones del navegador cuando aporte un mensaxe nuevu';
+$labels['desktop'] = 'Amosar notificaciones del escritoriu cuando aporte un mensaxe nuevu';
+$labels['sound'] = 'Reproducir soníu cuando aporte un mensaxe nuevu';
+$labels['test'] = 'Prueba';
+$labels['title'] = '¡Mensaxe nuevu!';
+$labels['body'] = 'Recibisti un mensaxe nuevu';
+$labels['testbody'] = 'Esta ye una notificación de pruebes';
+$labels['desktopdisabled'] = 'Les notificaciones d\'escritoriu tán deshabilitaes nel to navegador.';
+$labels['desktopunsupported'] = 'El to navegador nun sofita notificaciones d\'escritoriu.';
+$labels['desktoptimeout'] = 'Zarrar notificación d\'escritoriu';
+?>
diff --git a/plugins/newmail_notifier/localization/bg_BG.inc b/plugins/newmail_notifier/localization/bg_BG.inc
new file mode 100644
index 000000000..15791dd93
--- /dev/null
+++ b/plugins/newmail_notifier/localization/bg_BG.inc
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | plugins/newmail_notifier/localization/<lang>.inc |
+ | |
+ | Localization file of the Roundcube Webmail New Mail Notifier plugin |
+ | Copyright (C) 2012-2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ +-----------------------------------------------------------------------+
+
+ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
+*/
+$labels['basic'] = 'Показва известия в браузъра при ново писмо';
+$labels['desktop'] = 'Показва известия на работния плот при ново писмо';
+$labels['sound'] = 'Възпроизведи звук при ново писмо';
+$labels['test'] = 'Тест';
+$labels['title'] = 'Ново писмо!';
+$labels['body'] = 'Получихте ново писмо.';
+$labels['testbody'] = 'Това е тестово известие.';
+$labels['desktopdisabled'] = 'Известията на работния плот са изключени за Вашия браузър.';
+$labels['desktopunsupported'] = 'Вашият браузър не поддържа известия на работния плот.';
+$labels['desktoptimeout'] = 'Затваряне на известие на работния плот';
+?>
diff --git a/plugins/newmail_notifier/localization/el_GR.inc b/plugins/newmail_notifier/localization/el_GR.inc
new file mode 100644
index 000000000..5f41bc974
--- /dev/null
+++ b/plugins/newmail_notifier/localization/el_GR.inc
@@ -0,0 +1,27 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | plugins/newmail_notifier/localization/<lang>.inc |
+ | |
+ | Localization file of the Roundcube Webmail New Mail Notifier plugin |
+ | Copyright (C) 2012-2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ +-----------------------------------------------------------------------+
+
+ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
+*/
+$labels['basic'] = 'Εμφανίση ειδοποιήσεων πρόγραμματος περιήγησης στο νέο μήνυμα';
+$labels['desktop'] = 'Εμφάνιση ειδοποιήσεων στην επιφάνεια εργασίας για νέο μήνυμα ';
+$labels['sound'] = 'Ηχητική ειδοποίηση κατά την λήψη νέων μηνυμάτων';
+$labels['test'] = 'Δοκιμη';
+$labels['title'] = 'Nεο Email!';
+$labels['body'] = 'Έχετε λάβει ένα νέο μήνυμα.';
+$labels['testbody'] = 'Αυτή είναι μια δοκιμή ειδοποίησης.';
+$labels['desktopdisabled'] = 'Οι κοινοποιήσεις Desktop ειναι απενεργοποιημένη στον περιηγητή σας.';
+$labels['desktopunsupported'] = 'Ο περιηγητής σας δεν υποστηρίζει ειδοποιήσεις στην επιφάνεια εργασίας.';
+?>
diff --git a/plugins/newmail_notifier/localization/en_US.inc b/plugins/newmail_notifier/localization/en_US.inc
index 7c1c5cf3f..da8340b80 100644
--- a/plugins/newmail_notifier/localization/en_US.inc
+++ b/plugins/newmail_notifier/localization/en_US.inc
@@ -5,7 +5,7 @@
| plugins/newmail_notifier/localization/<lang>.inc |
| |
| Localization file of the Roundcube Webmail New Mail Notifier plugin |
- | Copyright (C) 2012-2013, The Roundcube Dev Team |
+ | Copyright (C) 2012, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
diff --git a/plugins/newmail_notifier/localization/es_AR.inc b/plugins/newmail_notifier/localization/es_AR.inc
new file mode 100644
index 000000000..682d79ef4
--- /dev/null
+++ b/plugins/newmail_notifier/localization/es_AR.inc
@@ -0,0 +1,27 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | plugins/newmail_notifier/localization/<lang>.inc |
+ | |
+ | Localization file of the Roundcube Webmail New Mail Notifier plugin |
+ | Copyright (C) 2012-2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ +-----------------------------------------------------------------------+
+
+ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
+*/
+$labels['basic'] = 'Mostrar notificación cuando haya nuevos mensajes';
+$labels['desktop'] = 'Mostrar notificación en escritorio cuando haya nuevos mensajes';
+$labels['sound'] = 'Reproducir sonido cuando haya nuevos mensajes';
+$labels['test'] = 'Prueba';
+$labels['title'] = 'Correo nuevo!';
+$labels['body'] = 'Has recibido correo nuevo';
+$labels['testbody'] = 'Esta es una notificación de prueba';
+$labels['desktopdisabled'] = 'Las notificaciones en escritorio están deshabilitadas en tu navegador';
+$labels['desktopunsupported'] = 'Tu navegador no soporta notificaciones en escritorio';
+?>
diff --git a/plugins/newmail_notifier/localization/eu_ES.inc b/plugins/newmail_notifier/localization/eu_ES.inc
new file mode 100644
index 000000000..7d7d90408
--- /dev/null
+++ b/plugins/newmail_notifier/localization/eu_ES.inc
@@ -0,0 +1,27 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | plugins/newmail_notifier/localization/<lang>.inc |
+ | |
+ | Localization file of the Roundcube Webmail New Mail Notifier plugin |
+ | Copyright (C) 2012-2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ +-----------------------------------------------------------------------+
+
+ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
+*/
+$labels['basic'] = 'Bistaratu nabigatzailearen jakinarazpenak mezu berrian';
+$labels['desktop'] = 'Bistaratu sistemaren jakinarazpenak mezu berrian';
+$labels['sound'] = 'Jo soinu bat mezu berriarekin';
+$labels['test'] = 'Testa';
+$labels['title'] = 'ePosta berria';
+$labels['body'] = 'Mezu berria jaso duzu';
+$labels['testbody'] = 'Hau jakinarazpen proba bat da';
+$labels['desktopdisabled'] = 'Sistemaren jakinarazpenak ezgaituak daude zure nabigatzailean';
+$labels['desktopunsupported'] = 'Zure nabigatzaileak ez ditu sistemaren jakinarazpenak onartzen.';
+?>
diff --git a/plugins/newmail_notifier/localization/lb_LU.inc b/plugins/newmail_notifier/localization/lb_LU.inc
index c4b014819..8e6f5f603 100644
--- a/plugins/newmail_notifier/localization/lb_LU.inc
+++ b/plugins/newmail_notifier/localization/lb_LU.inc
@@ -15,7 +15,6 @@
For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
*/
-
$labels['basic'] = 'Browser-Notifikatioun bei neiem Message uweisen';
$labels['desktop'] = 'Desktop-Notifikatioun bei neiem Message uweisen';
$labels['sound'] = 'Dësen Toun bei neiem Message spillen';
@@ -25,5 +24,5 @@ $labels['body'] = 'Du hues en neie Message kritt.';
$labels['testbody'] = 'Dëst ass eng Test-Benoorichtegung.';
$labels['desktopdisabled'] = 'Desktop-Notifikatioune sinn an dengem Browser ausgeschalt.';
$labels['desktopunsupported'] = 'Däi Browser ënnerstëtzt keng Desktop-Notifikatiounen.';
-
+$labels['desktoptimeout'] = 'Browser-Notifikatioun zoumaachen';
?>
diff --git a/plugins/newmail_notifier/localization/lv_LV.inc b/plugins/newmail_notifier/localization/lv_LV.inc
index da9603cd5..9df738b25 100644
--- a/plugins/newmail_notifier/localization/lv_LV.inc
+++ b/plugins/newmail_notifier/localization/lv_LV.inc
@@ -16,14 +16,14 @@
For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
*/
-$labels['basic'] = 'Saņemot jaunu vēstuli, parādīt paziņojumu';
-$labels['desktop'] = 'Saņemot jaunu vēstuli, parādīt darbavirsmas paziņojumu';
-$labels['sound'] = 'Saņemot jaunu vēstuli, atskaņot skaņas signālu';
-$labels['test'] = 'Pārbaudīt';
-$labels['title'] = 'Jauns e-pasts!';
-$labels['body'] = 'Jūs esat saņēmis jaunu vēstuli.';
+$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'] = 'Darbavirsmas paziņojumi Jūsu pārlūkprogrammā ir atslēgti.';
-$labels['desktopunsupported'] = 'Jūsu pārlūkprogramma neatbalsta darbavirsmas paziņojumus.';
+$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/ro_RO.inc b/plugins/newmail_notifier/localization/ro_RO.inc
index c78c7e081..b27e506ab 100644
--- a/plugins/newmail_notifier/localization/ro_RO.inc
+++ b/plugins/newmail_notifier/localization/ro_RO.inc
@@ -19,11 +19,11 @@
$labels['basic'] = 'Afişează notificări în browser la mesaj nou.';
$labels['desktop'] = 'Afişează notificări desktop la mesaj nou.';
$labels['sound'] = 'Redă un sunet la mesaj nou.';
-$labels['test'] = 'Test';
+$labels['test'] = 'Testează';
$labels['title'] = 'E-mail nou!';
$labels['body'] = 'Ai primit un mesaj nou.';
$labels['testbody'] = 'Aceasta este o notificare de test.';
$labels['desktopdisabled'] = 'Notificările desktop sunt dezactivate în browser.';
-$labels['desktopunsupported'] = 'Browser-ul nu suportă notificări desktop.';
+$labels['desktopunsupported'] = 'Browser-ul dumneavoastră nu suportă notificări desktop.';
?>
diff --git a/plugins/newmail_notifier/localization/ti.inc b/plugins/newmail_notifier/localization/ti.inc
new file mode 100644
index 000000000..17b8e7361
--- /dev/null
+++ b/plugins/newmail_notifier/localization/ti.inc
@@ -0,0 +1,27 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | plugins/newmail_notifier/localization/<lang>.inc |
+ | |
+ | Localization file of the Roundcube Webmail New Mail Notifier plugin |
+ | Copyright (C) 2012-2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ +-----------------------------------------------------------------------+
+
+ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-newmail_notifier/
+*/
+$labels['basic'] = 'ሓዱሽ መል እኽቲ ጠቆምቲ አብ ጎስጓሲ ይርአ';
+$labels['desktop'] = 'ሓዱሽ መል እኽቲ ጠቆምቲ ኣብ ደስክቶፕ ይርአ';
+$labels['sound'] = 'ሓዱሽ መል እኽቲ ምስዝመጽእ ድምጺ ይሰማዕ';
+$labels['test'] = 'ፈተነ';
+$labels['title'] = 'ሓድሽ ኢደብዳበ!';
+$labels['body'] = 'ሓድሽ ኢደብዳበ በጺሑ አሎ::';
+$labels['testbody'] = 'እዚ ጥቆማ ንፈተን ዝተገብረ እዩ::';
+$labels['desktopdisabled'] = 'ናይ ደስክቶፕ ጠቆምቲ ተኸልኪሎማ አለዉ::';
+$labels['desktopunsupported'] = 'እዚ ጎስጓሲ ናይ ደስክቶፕ ጠቆምቲ ኣይተገጠመሉን::';
+?>
diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js
index b00f33d10..45238eb56 100644
--- a/plugins/newmail_notifier/newmail_notifier.js
+++ b/plugins/newmail_notifier/newmail_notifier.js
@@ -34,13 +34,6 @@ function newmail_notifier_stop(prop)
$('<link rel="shortcut icon" href="'+rcmail.env.favicon_href+'"/>').replaceAll('link[rel="shortcut icon"]');
rcmail.env.favicon_changed = 0;
}
-
- // Remove IE icon overlay if we're pinned to Taskbar
- try {
- if(window.external.msIsSiteMode()) {
- window.external.msSiteModeClearIconOverlay();
- }
- } catch(e) {}
}
// Basic notification: window.focus and favicon change
@@ -59,13 +52,6 @@ function newmail_notifier_basic()
rcmail.env.favicon_changed = 1;
link.replaceAll(oldlink);
-
- // Add IE icon overlay if we're pinned to Taskbar
- try {
- if (window.external.msIsSiteMode()) {
- window.external.msSiteModeSetIconOverlay('plugins/newmail_notifier/overlay.ico', rcmail.gettext('title', 'newmail_notifier'));
- }
- } catch(e) {}
}
// Sound notification
@@ -86,79 +72,44 @@ function newmail_notifier_sound()
}
}
-// Desktop notification
-// - Require Chrome or Firefox latest version (22+) / 21.0 or older with a plugin
+// Desktop notification (need Chrome or Firefox with a plugin)
function newmail_notifier_desktop(body)
{
-
-/**
- * Fix: As of 17 June 2013, Chrome/Chromium does not implement Notification.permission correctly that
- * it gives 'undefined' until an object has been created:
- * https://code.google.com/p/chromium/issues/detail?id=163226
- *
- */
- try {
- if (Notification.permission == 'granted' || Notification.permission == undefined) {
- var popup = new Notification(rcmail.gettext('title', 'newmail_notifier'), {
- dir: "auto",
- lang: "",
- body: body,
- tag: "newmail_notifier",
- icon: "plugins/newmail_notifier/mail.png",
- });
- popup.onclick = function() {
- this.close();
- }
- setTimeout(function() { popup.close(); }, 10000); // close after 10 seconds
- if (popup.permission == 'granted') return true;
- }
- }
- catch (e) {
- 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;
+ 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 txt = rcmail.gettext('testbody', 'newmail_notifier');
+ var dn = window.webkitNotifications,
+ txt = rcmail.gettext('testbody', 'newmail_notifier');
- // W3C draft implementation (with fix for Chrome/Chromium)
- try {
- var testNotification = new window.Notification(txt, {tag: "newmail_notifier"}); // Try to show a test message
- if (Notification.permission !== 'granted' || (testNotification.permission && testNotification.permission !== 'granted'))
- newmail_notifier_desktop_authorize();
- }
- // webkit implementation
- catch (e) {
- var dn = window.webkitNotifications;
- 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');
- });
- }
+ if (dn) {
+ if (!dn.checkPermission())
+ newmail_notifier_desktop(txt);
else
- // Everything fails, means the browser has no support
- rcmail.display_message(rcmail.gettext('desktopunsupported', 'newmail_notifier'), 'error');
+ 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()
@@ -170,12 +121,3 @@ function newmail_notifier_test_sound()
{
newmail_notifier_sound();
}
-
-function newmail_notifier_desktop_authorize() {
- Notification.requestPermission(function(perm) {
- if (perm == 'denied')
- rcmail.display_message(rcmail.gettext('desktopdisabled', 'newmail_notifier'), 'error');
- if (perm == 'granted')
- newmail_notifier_test_desktop(); // Test again, which should show test message
- });
-}
diff --git a/plugins/newmail_notifier/newmail_notifier.php b/plugins/newmail_notifier/newmail_notifier.php
index ca1c2ff67..2c7ba949d 100644
--- a/plugins/newmail_notifier/newmail_notifier.php
+++ b/plugins/newmail_notifier/newmail_notifier.php
@@ -15,18 +15,18 @@
*
* 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 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * 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, see http://www.gnu.org/licenses/.
+ * 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
@@ -35,9 +35,6 @@ class newmail_notifier extends rcube_plugin
private $rc;
private $notified;
- private $opt = array();
- private $exceptions = array();
-
/**
* Plugin initialization
@@ -52,34 +49,13 @@ class newmail_notifier extends rcube_plugin
$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 ($this->rc->output->type == 'html' && empty($_REQUEST['_framed'])) {
$this->add_texts('localization/');
$this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.body');
$this->include_script('newmail_notifier.js');
}
-
- if ($this->rc->action == 'refresh') {
- // Load configuration
- $this->load_config();
-
- $this->opt['basic'] = $this->rc->config->get('newmail_notifier_basic');
- $this->opt['sound'] = $this->rc->config->get('newmail_notifier_sound');
- $this->opt['desktop'] = $this->rc->config->get('newmail_notifier_desktop');
-
- if (!empty($this->opt)) {
- // Get folders to skip checking for
- $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;
- }
- }
-
- $this->add_hook('new_messages', array($this, 'notify'));
- }
- }
}
}
@@ -117,7 +93,7 @@ class newmail_notifier extends rcube_plugin
$this->gettext('test'));
$args['blocks']['new_message']['options'][$key] = array(
- 'title' => html::label($field_id, rcube::Q($this->gettext($type))),
+ 'title' => html::label($field_id, Q($this->gettext($type))),
'content' => $content
);
}
@@ -144,7 +120,7 @@ class newmail_notifier extends rcube_plugin
foreach (array('basic', 'desktop', 'sound') as $type) {
$key = 'newmail_notifier_' . $type;
if (!in_array($key, $dont_override)) {
- $args['prefs'][$key] = rcube_utils::get_input_value('_'.$key, rcube_utils::INPUT_POST) ? true : false;
+ $args['prefs'][$key] = get_input_value('_'.$key, RCUBE_INPUT_POST) ? true : false;
}
}
@@ -156,36 +132,45 @@ class newmail_notifier extends rcube_plugin
*/
function notify($args)
{
- // Already notified or unexpected input
- if ($this->notified || empty($args['diff']['new'])) {
+ // Already notified or non-automatic check
+ if ($this->notified || !empty($_GET['_refresh'])) {
return $args;
}
- $mbox = $args['mailbox'];
- $storage = $this->rc->get_storage();
- $delimiter = $storage->get_hierarchy_delimiter();
+ // 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.$delimiter, $folder.$delimiter) === 0) {
+ if (strpos($mbox.$this->delimiter, $folder.$this->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);
+ $this->notified = true;
+
+ // Load configuration
+ $this->load_config();
- if ($unseen->count()) {
- $this->notified = true;
+ $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' => $this->opt['basic'],
- 'sound' => $this->opt['sound'],
- 'desktop' => $this->opt['desktop'],
- ));
+ array('basic' => $basic, 'sound' => $sound, 'desktop' => $desktop));
}
return $args;
diff --git a/plugins/newmail_notifier/package.xml b/plugins/newmail_notifier/package.xml
index b8ef34933..d3de25fb3 100644
--- a/plugins/newmail_notifier/package.xml
+++ b/plugins/newmail_notifier/package.xml
@@ -19,16 +19,16 @@
<email>alec@alec.pl</email>
<active>yes</active>
</lead>
- <date>2013-03-16</date>
+ <date>2012-02-07</date>
<version>
- <release>0.5</release>
- <api>0.5</api>
+ <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.html">GNU GPLv3+</license>
+ <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
<notes>-</notes>
<contents>
<dir baseinstalldir="/" name="/">
diff --git a/plugins/newmail_notifier/sound.mp3 b/plugins/newmail_notifier/sound.mp3
new file mode 100644
index 000000000..3b494a94d
--- /dev/null
+++ b/plugins/newmail_notifier/sound.mp3
Binary files differ