Author Topic: Sound on new mail  (Read 9141 times)

Offline Stevie

  • Jr. Member
  • **
  • Posts: 29
Sound on new mail
« 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!

Offline sreenu9

  • Newbie
  • *
  • Posts: 1
Re: Sound on new mail
« Reply #1 on: February 23, 2007, 12:09:19 PM »
dear,

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

Offline peterhob

  • Jr. Member
  • **
  • Posts: 12
Re: Sound on new mail
« Reply #2 on: February 23, 2007, 04:47:53 PM »
yeah this would be nice to have...
Roundcube SVN 606, with the 'sound on new email' modification.

Offline Stevie

  • Jr. Member
  • **
  • Posts: 29
Re: Sound on new mail
« Reply #3 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.

Code: [Select]
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:

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

Code: [Select]
$OUTPUT->include_script('newAlert.js');
Save that.

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

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

Code: [Select]
$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.

Offline eghigo

  • Newbie
  • *
  • Posts: 7
Re: Sound on new mail
« Reply #4 on: February 24, 2007, 03:00:41 PM »
In my system don't work !  :-\

Offline Stevie

  • Jr. Member
  • **
  • Posts: 29
Re: Sound on new mail
« Reply #5 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:
Code: [Select]
$OUTPUT->include_script('emailAlert.js');
Change it to:
Code: [Select]
$OUTPUT->include_script('newAlert.js');
I've changed my first post, so no one else needs to change this.

Offline eghigo

  • Newbie
  • *
  • Posts: 7
Re: Sound on new mail
« Reply #6 on: February 25, 2007, 02:16:48 PM »
Ok.. ! ;)

Offline peterhob

  • Jr. Member
  • **
  • Posts: 12
Re: Sound on new mail
« Reply #7 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!
Roundcube SVN 606, with the 'sound on new email' modification.

Offline dave1978

  • Newbie
  • *
  • Posts: 9
Re: Sound on new mail
« Reply #8 on: February 08, 2008, 03:49:44 PM »
anyone updated this to work on the latest version?