fix for #104226. instead of using "Mailbeep" (the windows system sound for new mail notification)

use "_moz_mailbeep".  on windows, we map this to "MailBeep" (so it works on win2k and win98)
and on mac we use sfraser's code to go to internet config.  (nothing on linux yet, that's another bug)
r=pinkerton, sr=sfraser

also, fix #104252.  selectively notify folder listeners.  when we register the folder listener
with the mail session, we pass in flags for what types of things we care about.
this reduces the notifications, especially those across XPConnect.
r=bienvenu, sr=mscott
This commit is contained in:
sspitzer%netscape.com 2001-10-11 20:45:44 +00:00
Родитель 85218be2b8
Коммит ef119303bf
16 изменённых файлов: 139 добавлений и 148 удалений

Просмотреть файл

@ -40,44 +40,55 @@
interface nsIFolder;
typedef unsigned long folderListenerNotifyFlagValue;
[scriptable, uuid(d4ff86da-1dd1-11b2-a6f6-9fcd348bcc34)]
interface nsIFolderListener : nsISupports {
void OnItemAdded(in nsISupports parentItem,
const folderListenerNotifyFlagValue added = 0x1;
void OnItemAdded(in nsISupports parentItem,
in nsISupports item,
in string viewString);
void OnItemRemoved(in nsISupports parentItem,
const folderListenerNotifyFlagValue removed = 0x2;
void OnItemRemoved(in nsISupports parentItem,
in nsISupports item,
in string viewString);
void OnItemPropertyChanged(in nsISupports item,
const folderListenerNotifyFlagValue propertyChanged = 0x4;
void OnItemPropertyChanged(in nsISupports item,
in nsIAtom property,
in string oldValue,
in string newValue);
void OnItemIntPropertyChanged(in nsISupports item,
const folderListenerNotifyFlagValue intPropertyChanged = 0x8;
void OnItemIntPropertyChanged(in nsISupports item,
in nsIAtom property,
in long oldValue,
in long newValue);
void OnItemBoolPropertyChanged(in nsISupports item,
const folderListenerNotifyFlagValue boolPropertyChanged = 0x10;
void OnItemBoolPropertyChanged(in nsISupports item,
in nsIAtom property,
in boolean oldValue,
in boolean newValue);
const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20;
void OnItemUnicharPropertyChanged(in nsISupports item,
in nsIAtom property,
in wstring oldValue,
in wstring newValue);
void OnItemPropertyFlagChanged(in nsISupports item,
const folderListenerNotifyFlagValue propertyFlagChanged = 0x40;
void OnItemPropertyFlagChanged(in nsISupports item,
in nsIAtom property,
in unsigned long oldFlag,
in unsigned long newFlag);
const folderListenerNotifyFlagValue event = 0x80;
void OnItemEvent(in nsIFolder item, in nsIAtom event);
const folderListenerNotifyFlagValue all = 0xFFFFFFFF;
// void OnFolderLoaded(in nsIFolder aFolder);
// void OnDeleteOrMoveMessagesCompleted(in nsIFolder aFolder);
};

Просмотреть файл

@ -56,10 +56,8 @@ interface nsIMsgWindow;
[scriptable, uuid(D5124440-D59E-11d2-806A-006008128C4E)]
interface nsIMsgMailSession : nsISupports {
void Shutdown();
void AddFolderListener(in nsIFolderListener listener);
void AddFolderListener(in nsIFolderListener listener, in folderListenerNotifyFlagValue notifyFlags);
void RemoveFolderListener(in nsIFolderListener listener);
readonly attribute nsIMsgWindow topmostMsgWindow;

Просмотреть файл

@ -189,10 +189,6 @@ function ChangeFolderByURI(uri, viewType, viewFlags, sortType, sortOrder)
HideAccountCentral();
}
if (showPerformance) {
gBeforeFolderLoadTime = new Date();
}
gCurrentLoadingFolderURI = uri;
gNextMessageAfterDelete = null; // forget what message to select, if any

Просмотреть файл

@ -35,40 +35,34 @@ var gNextMessageViewIndexAfterDelete = -1;
var folderListener = {
OnItemAdded: function(parentItem, item, view) {},
OnItemRemoved: function(parentItem, item, view)
{
var parentFolderResource = parentItem.QueryInterface(Components.interfaces.nsIRDFResource);
if(!parentFolderResource)
return;
OnItemRemoved: function(parentItem, item, view) {
var parentFolderResource = parentItem.QueryInterface(Components.interfaces.nsIRDFResource);
if(!parentFolderResource)
return;
var parentURI = parentFolderResource.Value;
if(parentURI != gCurrentFolderUri)
return;
var parentURI = parentFolderResource.Value;
if(parentURI != gCurrentFolderUri)
return;
var deletedMessageHdr = item.QueryInterface(Components.interfaces.nsIMsgDBHdr);
var deletedMessageHdr = item.QueryInterface(Components.interfaces.nsIMsgDBHdr);
if (extractMsgKeyFromURI() == deletedMessageHdr.messageKey)
gCurrentMessageIsDeleted = true;
},
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemIntPropertyChanged: function(item, property, oldValue, newValue)
{
},
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
gCurrentMessageIsDeleted = true;
},
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) { },
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemEvent: function(folder, event) {
if (event.GetUnicode() == "DeleteOrMoveMsgCompleted") {
HandleDeleteOrMoveMsgCompleted(folder);
}
else if (event.GetUnicode() == "DeleteOrMoveMsgFailed") {
HandleDeleteOrMoveMsgFailed(folder);
}
if (event.GetUnicode() == "DeleteOrMoveMsgCompleted") {
HandleDeleteOrMoveMsgCompleted(folder);
}
else if (event.GetUnicode() == "DeleteOrMoveMsgFailed") {
HandleDeleteOrMoveMsgFailed(folder);
}
}
}
function nsMsgDBViewCommandUpdater()
@ -157,9 +151,11 @@ function OnLoadMessageWindow()
OnLoadMsgHeaderPane();
try {
mailSession.AddFolderListener(folderListener);
} catch (ex) {
dump("Error adding to session\n");
var nsIFolderListener = Components.interfaces.nsIFolderListener;
var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event;
mailSession.AddFolderListener(folderListener, notifyFlags);
} catch (ex) {
dump("Error adding to session: " +ex + "\n");
}
var originalView = null;

Просмотреть файл

@ -24,8 +24,6 @@
/* This is where functions related to the 3 pane window are kept */
var showPerformance = false;
var gFolderOutliner;
var gMessagePane;
var gMessagePaneFrame;
@ -60,49 +58,41 @@ var gDisplayStartupPage = false;
// the folderListener object
var folderListener = {
OnItemAdded: function(parentItem, item, view) {},
OnItemAdded: function(parentItem, item, view) { },
OnItemRemoved: function(parentItem, item, view){},
OnItemRemoved: function(parentItem, item, view) { },
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemPropertyChanged: function(item, property, oldValue, newValue) { },
OnItemIntPropertyChanged: function(item, property, oldValue, newValue)
{
var currentLoadedFolder = GetThreadPaneFolder();
if (!currentLoadedFolder) return;
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
var currentLoadedFolder = GetThreadPaneFolder();
if (!currentLoadedFolder) return;
var currentURI = currentLoadedFolder.URI;
var currentURI = currentLoadedFolder.URI;
//if we don't have a folder loaded, don't bother.
if(currentURI) {
if(property.GetUnicode() == "TotalMessages" || property.GetUnicode() == "TotalUnreadMessages") {
var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder);
if(folder) {
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
if(folderResource) {
var folderURI = folderResource.Value;
if(currentURI == folderURI) {
UpdateStatusMessageCounts(folder);
}
}
}
}
}
},
//if we don't have a folder loaded, don't bother.
if(currentURI)
{
if(property.GetUnicode() == "TotalMessages" || property.GetUnicode() == "TotalUnreadMessages")
{
var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder);
if(folder)
{
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
if(folderResource)
{
var folderURI = folderResource.Value;
if(currentURI == folderURI)
{
UpdateStatusMessageCounts(folder);
}
}
}
}
}
},
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) { },
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue) { },
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) { },
OnItemEvent: function(folder, event) {
var eventType = event.GetUnicode();
if (eventType == "FolderLoaded") {
if (folder) {
var resource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
@ -146,10 +136,6 @@ var folderListener = {
if(uri == gCurrentLoadingFolderURI) {
gCurrentLoadingFolderURI = "";
//Now let's select the first new message if there is one
var beforeScrollToNew;
if(showPerformance) {
beforeScrollToNew = new Date();
}
if (!scrolled) {
// if we didn't just scroll, scroll to the first new message
// don't select it though
@ -160,15 +146,6 @@ var folderListener = {
EnsureRowInThreadOutlinerIsVisible(0);
}
}
if(showPerformance) {
var afterScrollToNew = new Date();
var timeToScroll = (afterScrollToNew.getTime() - beforeScrollToNew.getTime())/1000;
var afterFolderLoadTime = new Date();
var timeToLoad = (afterFolderLoadTime.getTime() - gBeforeFolderLoadTime.getTime())/1000;
dump("Time to load " + uri + " is " + timeToLoad + " seconds\n");
dump("of which scrolling to new is " + timeToScroll + " seconds\n");
}
SetBusyCursor(window, false);
}
}
@ -418,12 +395,6 @@ var gThreePaneIncomingServerListener = {
/* Functions related to startup */
function OnLoadMessenger()
{
showPerformance = pref.GetBoolPref('mail.showMessengerPerformance');
var beforeLoadMessenger;
if(showPerformance) {
beforeLoadMessenger = new Date();
}
AddMailOfflineObserver();
CreateMailWindowGlobals();
Create3PaneGlobals();
@ -499,12 +470,6 @@ function OnLoadMessenger()
//Set focus to the Thread Pane the first time the window is opened.
SetFocusThreadPane();
if(showPerformance) {
var afterLoadMessenger = new Date();
var timeToLoad = (afterLoadMessenger.getTime() - beforeLoadMessenger.getTime())/1000;
dump("Time in OnLoadMessger is " + timeToLoad + " seconds\n");
}
}
function OnUnloadMessenger()
@ -651,7 +616,9 @@ function AddToSession()
try {
var mailSession = Components.classes[mailSessionContractID].getService(Components.interfaces.nsIMsgMailSession);
mailSession.AddFolderListener(folderListener);
var nsIFolderListener = Components.interfaces.nsIFolderListener;
var notifyFlags = nsIFolderListener.intPropertyChanged | nsIFolderListener.event;
mailSession.AddFolderListener(folderListener, notifyFlags);
} catch (ex) {
dump("Error adding to session\n");
}

Просмотреть файл

@ -471,7 +471,9 @@ function setupDatasource() {
gSearchSessionFolderListener = gSearchSession.QueryInterface(Components.interfaces.nsIFolderListener);
gMailSession = Components.classes[mailSessionContractID].getService(Components.interfaces.nsIMsgMailSession);
gMailSession.AddFolderListener(gSearchSessionFolderListener);
var nsIFolderListener = Components.interfaces.nsIFolderListener;
var notifyFlags = nsIFolderListener.event;
gMailSession.AddFolderListener(gSearchSessionFolderListener, notifyFlags);
// the datasource is a listener on the search results
gViewSearchListener = gSearchView.QueryInterface(Components.interfaces.nsIMsgSearchNotify);

Просмотреть файл

@ -189,7 +189,7 @@ nsMessengerWinIntegration::Init()
NS_ENSURE_SUCCESS(rv,rv);
// because we care if the unread total count changes
rv = mailSession->AddFolderListener(this);
rv = mailSession->AddFolderListener(this, nsIFolderListener::boolPropertyChanged | nsIFolderListener::intPropertyChanged);
NS_ENSURE_SUCCESS(rv,rv);
// get current profile name to fill in commandliner.

Просмотреть файл

@ -265,14 +265,21 @@ nsresult nsMsgFolderDataSource::Init()
{
nsresult rv;
rv = nsMsgRDFDataSource::Init();
rv = nsMsgRDFDataSource::Init();
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgMailSession> mailSession =
do_GetService(kMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv))
mailSession->AddFolderListener(this);
do_GetService(kMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv))
mailSession->AddFolderListener(this,
nsIFolderListener::added |
nsIFolderListener::removed |
nsIFolderListener::intPropertyChanged |
nsIFolderListener::boolPropertyChanged |
nsIFolderListener::unicharPropertyChanged |
nsIFolderListener::propertyFlagChanged);
return NS_OK;
}

Просмотреть файл

@ -78,7 +78,6 @@ nsresult nsMsgMailSession::Init()
rv = NS_NewISupportsArray(getter_AddRefs(mWindows));
return rv;
}
nsresult nsMsgMailSession::Shutdown()
@ -87,12 +86,13 @@ nsresult nsMsgMailSession::Shutdown()
}
NS_IMETHODIMP nsMsgMailSession::AddFolderListener(nsIFolderListener * listener)
NS_IMETHODIMP nsMsgMailSession::AddFolderListener(nsIFolderListener * listener, PRUint32 notifyFlags)
{
NS_ASSERTION(mListeners, "no listeners");
if (!mListeners) return NS_ERROR_FAILURE;
mListeners->AppendElement(listener);
mListenerNotifyFlags.Add(notifyFlags);
return NS_OK;
}
@ -100,7 +100,13 @@ NS_IMETHODIMP nsMsgMailSession::RemoveFolderListener(nsIFolderListener * listene
{
NS_ASSERTION(mListeners, "no listeners");
if (!mListeners) return NS_ERROR_FAILURE;
PRInt32 index;
nsresult rv = mListeners->GetIndexOf(listener, &index);
NS_ENSURE_SUCCESS(rv,rv);
mListenerNotifyFlags.RemoveAt(index);
mListeners->RemoveElement(listener);
return NS_OK;
@ -124,10 +130,12 @@ nsMsgMailSession::OnItemPropertyChanged(nsISupports *item,
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::propertyChanged) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemPropertyChanged(item, property, oldValue, newValue);
}
}
return NS_OK;
@ -152,10 +160,12 @@ nsMsgMailSession::OnItemUnicharPropertyChanged(nsISupports *item,
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::unicharPropertyChanged) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemUnicharPropertyChanged(item, property, oldValue, newValue);
}
}
return NS_OK;
@ -180,10 +190,12 @@ nsMsgMailSession::OnItemIntPropertyChanged(nsISupports *item,
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::intPropertyChanged) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemIntPropertyChanged(item, property, oldValue, newValue);
}
}
return NS_OK;
@ -208,10 +220,12 @@ nsMsgMailSession::OnItemBoolPropertyChanged(nsISupports *item,
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::boolPropertyChanged) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemBoolPropertyChanged(item, property, oldValue, newValue);
}
}
return NS_OK;
@ -223,26 +237,26 @@ nsMsgMailSession::OnItemPropertyFlagChanged(nsISupports *item,
PRUint32 oldValue,
PRUint32 newValue)
{
nsresult rv;
PRUint32 count;
nsresult rv;
PRUint32 count;
NS_ASSERTION(mListeners, "no listeners");
if (!mListeners) return NS_ERROR_FAILURE;
NS_ASSERTION(mListeners, "no listeners");
if (!mListeners) return NS_ERROR_FAILURE;
rv = mListeners->Count(&count);
if (NS_FAILED(rv)) return rv;
rv = mListeners->Count(&count);
if (NS_FAILED(rv)) return rv;
for(PRUint32 i = 0; i < count; i++)
{
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemPropertyFlagChanged(item, property, oldValue, newValue);
}
return NS_OK;
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::propertyFlagChanged) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemPropertyFlagChanged(item, property, oldValue, newValue);
}
}
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::OnItemAdded(nsISupports *parentItem, nsISupports *item, const char* viewString)
@ -259,10 +273,12 @@ NS_IMETHODIMP nsMsgMailSession::OnItemAdded(nsISupports *parentItem, nsISupports
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::added) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemAdded(parentItem, item, viewString);
}
}
return NS_OK;
@ -283,10 +299,12 @@ NS_IMETHODIMP nsMsgMailSession::OnItemRemoved(nsISupports *parentItem, nsISuppor
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::removed) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
NS_ASSERTION(listener, "listener is null");
if (!listener) return NS_ERROR_FAILURE;
listener->OnItemRemoved(parentItem, item, viewString);
}
}
return NS_OK;
@ -307,9 +325,11 @@ NS_IMETHODIMP nsMsgMailSession::OnItemEvent(nsIFolder *aFolder,
for(PRUint32 i = 0; i < count; i++)
{
if (mListenerNotifyFlags[i] & nsIFolderListener::event) {
nsCOMPtr<nsIFolderListener> listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i));
if(listener)
listener->OnItemEvent(aFolder, aEvent);
}
}
return NS_OK;
}

Просмотреть файл

@ -68,10 +68,11 @@ public:
nsresult Init();
protected:
nsCOMPtr<nsISupportsArray> mListeners;
nsUInt32Array mListenerNotifyFlags;
nsCOMPtr<nsISupportsArray> mWindows;
// stick this here temporarily
nsCOMPtr <nsIMsgWindow> m_temporaryMsgWindow;
};

Просмотреть файл

@ -148,7 +148,7 @@ nsresult nsMsgNotificationManager::Init()
nsCOMPtr<nsIMsgMailSession> mailSession =
do_GetService(kMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv))
rv = mailSession->AddFolderListener(this);
rv = mailSession->AddFolderListener(this, nsIFolderListener::propertyChanged | nsIFolderListener::propertyFlagChanged);
if(NS_FAILED(rv))
return rv;

Просмотреть файл

@ -92,7 +92,7 @@ nsresult nsStatusBarBiffManager::Init()
nsCOMPtr<nsIMsgMailSession> mailSession =
do_GetService(kMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv))
mailSession->AddFolderListener(this);
mailSession->AddFolderListener(this, nsIFolderListener::propertyFlagChanged);
mInitialized = PR_TRUE;
return NS_OK;
@ -121,7 +121,7 @@ nsresult nsStatusBarBiffManager::PerformStatusBarBiff(PRUint32 newBiffFlag)
if (NS_SUCCEEDED(rv) && playSoundOnBiff) {
nsCOMPtr<nsISound> sound = do_CreateInstance("@mozilla.org/sound;1");
if (sound) {
rv = sound->PlaySystemSound("Mailbeep");
rv = sound->PlaySystemSound("_moz_mailbeep");
}
}
}

Просмотреть файл

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
pref("mailnews.logComposePerformance", false);
pref("mail.showMessengerPerformance", false);
pref("mail.wrap_long_lines", true);
pref("news.wrap_long_lines", true);
@ -316,12 +315,7 @@ pref("mail.enable_autocomplete",true);
pref("mailnews.html_domains","");
pref("mailnews.plaintext_domains","");
// the ui will eventually use these three prefs:
pref("mail.biff.play_sound",true);
pref("mail.biff.use_default_sound",true);
pref("mail.biff.sound_file","");
// must be an URL. (provide this back door for mac users, until we have a UI
pref("mail.biff.default_sound_url","");
pref("mail.content_disposition_type", 0);

Просмотреть файл

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
pref("mailnews.logComposePerformance", false);
pref("mail.showMessengerPerformance", false);
pref("mail.wrap_long_lines", true);
pref("news.wrap_long_lines", true);
@ -316,12 +315,7 @@ pref("mail.enable_autocomplete",true);
pref("mailnews.html_domains","");
pref("mailnews.plaintext_domains","");
// the ui will eventually use these three prefs:
pref("mail.biff.play_sound",true);
pref("mail.biff.use_default_sound",true);
pref("mail.biff.sound_file","");
// must be an URL. (provide this back door for mac users, until we have a UI
pref("mail.biff.default_sound_url","");
pref("mail.content_disposition_type", 0);

Просмотреть файл

@ -429,7 +429,7 @@ nsSound::GetSoundResourceName(const char* inSoundName, StringPtr outResourceName
outResourceName[0] = 0;
// if it's the special mail beep sound, get the real sound name from IC
if (nsCRT::strcmp("Mailbeep", inSoundName) == 0)
if (nsCRT::strcmp("_moz_mailbeep", inSoundName) == 0)
{
nsCOMPtr <nsIInternetConfigService> icService = do_GetService(NS_INTERNETCONFIGSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))

Просмотреть файл

@ -161,7 +161,12 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const char *aSoundAlias)
{
PurgeLastSound();
::PlaySound(aSoundAlias, nsnull, SND_ALIAS | SND_ASYNC);
if (nsCRT::strcmp("_moz_mailbeep", aSoundAlias) == 0) {
::PlaySound("MailBeep", nsnull, SND_ALIAS | SND_ASYNC);
}
else {
::PlaySound(aSoundAlias, nsnull, SND_ALIAS | SND_ASYNC);
}
return NS_OK;
}