Author Topic: New plugin: html5_notifier (desktop notification)  (Read 35353 times)

Offline tist

  • Jr. Member
  • **
  • Posts: 13
New plugin: html5_notifier (desktop notification)
« on: August 26, 2011, 10:27:23 AM »
Hi there :D

The last two days I developed a new plugin for roundcube. It displays desktop notifications like the ones you might know from Google Mail. Just keep RC open in a (minimized) tab and enjoy getting notifications every time a new mail arrives.

http://stremlau.net/html5_notifier/

Here is a screenshot:


Of course it just work in Google Chrome or SRWare Iron, because it's a new feature in HTML5.

Sorry for my bad english, I'm not a native speaker. If someone post a corrected version of the english language-files, I would be pleased.

Regards,
Tilman Stremlau
« Last Edit: October 23, 2011, 04:31:54 PM by tist »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
New plugin: html5_notifier (desktop notification)
« Reply #1 on: August 27, 2011, 04:00:32 PM »
Great idea! I'll try it out with my next RC install, the english language files look good to me.

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
New plugin: html5_notifier (desktop notification)
« Reply #2 on: August 27, 2011, 06:06:56 PM »
I'd definitely consider this if it supported more browsers. Or to be more precise, if more browsers had good HTML5 support.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline Tayku

  • Jr. Member
  • **
  • Posts: 47
New plugin: html5_notifier (desktop notification)
« Reply #3 on: August 28, 2011, 05:49:12 PM »
Hello! This looks like a very convenient plugin. With a popup window, one of the last advantages of Thunderbird (or any desktop mailer) vanishes. And it even looks good.

But unfortunately I can’t get it running. I installed the plugin and activated in the settings. I whitelisted it in SRWare Iron and clicked on test: the test popup works. But I do not get any notification for new mails. What can I do? I also allowed popups for every website but that did not solve it.

Though it is a very nice plugin. I was just on the search for something that gives me a notification, and two days ago you published this. Good timing! :)

Offline tist

  • Jr. Member
  • **
  • Posts: 13
New plugin: html5_notifier (desktop notification)
« Reply #4 on: August 28, 2011, 05:59:07 PM »
Hello!

I use the Plugin hook "new messages" like the sound_notifier Module. This hook is just fired, if the mail arrives in the opened mailbox. So it is necessary to have the inbox opened.
On my opinion this hook should be fired every time you get a mail in any mailbox, because it doesn't make any sense this way. I hope they will change it there is no other possible hook.

Thank you for your good feedback! :D

Offline tist

  • Jr. Member
  • **
  • Posts: 13
New plugin: html5_notifier (desktop notification)
« Reply #5 on: August 28, 2011, 06:01:04 PM »
Hello!

I use the Plugin hook "new messages" like the sound_notifier Module does. This hook is just fired if the mail arrives in the opened mailbox. So it is necessary to have the inbox opened.
On my opinion this hook should be fired every time you get a mail in any mailbox, because it doesn't make any sense this way. I hope they will change it, there is no other possible hook. Another way is to send an extra request to the server, but this would be my last choice :-/

Thank you for your good feedback! :D

Offline Tayku

  • Jr. Member
  • **
  • Posts: 47
New plugin: html5_notifier (desktop notification)
« Reply #6 on: August 29, 2011, 05:26:20 AM »
I had the inbox open, the window was just minimized. I did not get a notification, no matter if the browser window is active or not. How can I test that the plugin “fires”? Could you create a kind of debug version which just puts a message alert or changes the tab title?

Does it work with Roundcube 0.5.4?
« Last Edit: August 29, 2011, 05:30:45 AM by Tayku »

Offline Tayku

  • Jr. Member
  • **
  • Posts: 47
New plugin: html5_notifier (desktop notification)
« Reply #7 on: August 29, 2011, 05:26:50 AM »
Double post – please delete

Offline tist

  • Jr. Member
  • **
  • Posts: 13
New plugin: html5_notifier (desktop notification)
« Reply #8 on: August 29, 2011, 08:44:50 AM »
Maybe you have to set "Check all folders for new messages" to true.

You could debug it by adding "alert('debug');" in the html5_notifier.js after

"function rcmail_show_notification(message)
{"

then a normal Popup should open if the Plugin is fired :D

Could anybody other please test the plugin?

Regards,
Tilman

Offline Tayku

  • Jr. Member
  • **
  • Posts: 47
New plugin: html5_notifier (desktop notification)
« Reply #9 on: August 29, 2011, 10:05:48 AM »
The checkbox was already checked. But I think this is only important if you use mail filters which put the new mails in other folders than inbox. I have such filters, but my test mails were always put in inbox.

I added the alert function to rcmail_show_notification() but it wasn’t called. It’s not fired. :( Perhaps something’s not right in the show_notification function in html5_notifier.php, something that does not work in my configuration.

Offline tist

  • Jr. Member
  • **
  • Posts: 13
New plugin: html5_notifier (desktop notification)
« Reply #10 on: August 29, 2011, 11:08:29 AM »
Try adding

"$RCMAIL->output->command("plugin.showNotification", array(
                    'subject' => "It's a test...",
                    'from' => "Peter",
                    'uid' => "10"
                ));"

after "$RCMAIL = ..." in show_notification() in html5_notifier.php

I don't know how RC manage it, but I read that the RECENT flag doesn't work correct with some IMAP Clients. I could implement a notification showing "You have X new messages" instead of the messages. This sould work, because RC has a special function for this.

Regards,
Tilman

Offline Tayku

  • Jr. Member
  • **
  • Posts: 47
New plugin: html5_notifier (desktop notification)
« Reply #11 on: August 29, 2011, 02:10:16 PM »
So, now that works. :) The notification is fired (with both the debug alert from above and the popup), displaying the test message.
Is it possible not to check the recent flag but to list all unread messages? Or is there another possibility to get the content of the new messages? I mean, if RC has a special function for the number of (really) new messages, why not give the detail information about them?
(But for now, a popup with “x new messages” is better than nothing …)

Offline tist

  • Jr. Member
  • **
  • Posts: 13
New plugin: html5_notifier (desktop notification)
« Reply #12 on: August 30, 2011, 03:36:42 AM »
Ok... to list all unread messages is possible, but I don't know if this would be reasonable... RC compares the higest (newest) IDs of the messages with the last call and get the number of the recent mails this way. Today I will check, if it's possible to use this to show these messages...

Offline Tayku

  • Jr. Member
  • **
  • Posts: 47
New plugin: html5_notifier (desktop notification)
« Reply #13 on: August 30, 2011, 07:08:05 AM »
@tist:
It works! I’m so sorry, I tested the wrong way. :(
I always send a mail from me to me, but in that case, my provider may not have set the recent flag. Now today there was an incoming mail with the popup. Then I tested by sending me a mail from another provider. Works like a charm. :) I’d like to thank you for your patience and tries to find another way.

Now I have to remove the test popup.^^

Is there a way to raise the duration until the popup vanishes? I had a look in Iron’s settings, but could not find one.
Edit: I had a look in html5_notifier.js. There is the popup time. Very nice.
« Last Edit: August 30, 2011, 07:48:01 AM by Tayku »

Offline tist

  • Jr. Member
  • **
  • Posts: 13
New plugin: html5_notifier (desktop notification)
« Reply #14 on: August 30, 2011, 09:37:59 AM »
Thats good :D

What a duration do you prefer? I add to my todo-list to add an option for the duration in the settings :D