Roundcube Community Forum

 

Sound on new mail

Started by Stevie, February 22, 2007, 07:07:09 PM

Previous topic - Next topic

Stevie

Hi,

Ever since I've been downloading the SVN releases I've been altering the code to add in my own ding sound when a new e-mail arrives.

I think it would be a good idea to add it as it's very useful. Maybe an option in the preferences settings for those who don't want a sound as well.

I've been using a flash sound rather than anything that needs a browser plug-in or whatever. I just think it's much easier to load a flash file than a specific .wav, .mp3, etc.

Tell me what you think and if you add it.. fab!

sreenu9

dear,

can u upload that code and sound for us in the post.

peterhob

yeah this would be nice to have...
Roundcube SVN 606, with the 'sound on new email' modification.

Stevie

Alright. It does work in IE7, IE6 and FireFox, but I have not used it for more than a few minutes in IE so do report back if there's crashes.

Save the below code as newAlert.js and upload it to your /pogram/js/ directory.

function makeDing()
{
var flashObject = document.createElement("embed");

flashObject.setAttribute("type", "application/x-shockwave-flash");
flashObject.setAttribute("id", "makeNewDing");
flashObject.setAttribute("src", "./program/newEmail.swf");
flashObject.setAttribute("width", "1");
flashObject.setAttribute("height", "1");

document.body.appendChild(flashObject);
}

Edit main.inc in the /program/include/ directory. Find this line:

$OUTPUT->include_script('app.js');
Add this line after it:

$OUTPUT->include_script('newAlert.js');
Save that.

Find the file check_recent.inc in the /program/steps/mail/ directory and find the line:

$commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota());
After that line add:

$commands .= "makeDing();\n";
Save that.

Next download this .swf file here (right click > save as). Upload it to the directory /program/

Refresh (F5) your webmail page and send a new e-mail to yourself to test if it works.

eghigo

In my system don't work !  :-\

Stevie

Quote from: eghigo In my system don't work !  :-\

Hi, sorry. My fault.

Find this line in your file:
$OUTPUT->include_script('emailAlert.js');
Change it to:
$OUTPUT->include_script('newAlert.js');
I've changed my first post, so no one else needs to change this.


peterhob

Tested it on SVN versons 495 en 498 with no problems.
Would be nice to see it included in the next svn version.

Solid piece of work!
Roundcube SVN 606, with the 'sound on new email' modification.

dave1978

anyone updated this to work on the latest version?