Roundcube Community Forum

 

New plugin: html5_notifier (desktop notification)

Started by tist, August 26, 2011, 10:27:23 AM

Previous topic - Next topic

tist

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

SKaero

Great idea! I'll try it out with my next RC install, the english language files look good to me.

ABerglund

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

Tayku

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! :)

tist

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

tist

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

Tayku

#6
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?

Tayku


tist

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

Tayku

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.

tist

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

Tayku

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 ...)

tist

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...

Tayku

#13
@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.

tist

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