Roundcube Community Forum

SVN Releases => Requests => Topic started by: Stevie on February 22, 2007, 07:07:09 PM

Title: Sound on new mail
Post by: Stevie on February 22, 2007, 07:07:09 PM
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!
Title: Re: Sound on new mail
Post by: sreenu9 on February 23, 2007, 12:09:19 PM
dear,

can u upload that code and sound for us in the post.
Title: Re: Sound on new mail
Post by: peterhob on February 23, 2007, 04:47:53 PM
yeah this would be nice to have...
Title: Re: Sound on new mail
Post by: Stevie on February 24, 2007, 11:14:07 AM
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 (http://neoboffins.com/webmail/rc/program/newEmail.swf) (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.
Title: Re: Sound on new mail
Post by: eghigo on February 24, 2007, 03:00:41 PM
In my system don't work !  :-\
Title: Re: Sound on new mail
Post by: Stevie on February 24, 2007, 04:13:47 PM
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.
Title: Re: Sound on new mail
Post by: eghigo on February 25, 2007, 02:16:48 PM
Ok.. ! ;)
Title: Re: Sound on new mail
Post by: peterhob on February 26, 2007, 10:58:29 AM
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!
Title: Re: Sound on new mail
Post by: dave1978 on February 08, 2008, 03:49:44 PM
anyone updated this to work on the latest version?