More Growl/Keyword refactoring:
* Remove the Growl keyword alert from LLViewerChat::getChatColor() again - this still might get called up to 3 times per message * Move the Growl keyword alert back into FSKeywords::notify() where it belongs * Explicitly wire up Growl keyword alerts in radar notifications in FSRadar::radarAlertMsg() If there are particular system messages that should be checked for keywords as well, wire them up in the correct place instead of using LLViewerChat::getChatColor() that will result in an incorrect behavior of * not playing the keyword alert sound * being checked only at the time somebody calls LLViewerChat::getChatColor (Console output, nearby chat floater becoming visible etc.) * getting called multiple times
parent
1462f7b70e
commit
6ffbf0d049
|
|
@ -27,6 +27,7 @@
|
|||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "fskeywords.h"
|
||||
#include "growlmanager.h"
|
||||
#include "llagent.h"
|
||||
#include "llchat.h"
|
||||
#include "llinstantmessage.h"
|
||||
|
|
@ -80,6 +81,12 @@ bool FSKeywords::chatContainsKeyword(const LLChat& chat, bool is_local)
|
|||
static LLCachedControl<bool> sFSKeywordCaseSensitive(gSavedPerAccountSettings, "FSKeywordCaseSensitive", false);
|
||||
static LLCachedControl<bool> sFSKeywordMatchWholeWords(gSavedPerAccountSettings, "FSKeywordMatchWholeWords", false);
|
||||
|
||||
// Don't check if message is from us - unless it's a radar notification
|
||||
if (chat.mFromID == gAgentID && chat.mFromName != SYSTEM_FROM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sFSKeywordOn ||
|
||||
(is_local && !sFSKeywordInChat) ||
|
||||
(!is_local && !sFSKeywordInIM))
|
||||
|
|
@ -130,6 +137,22 @@ void FSKeywords::notify(const LLChat& chat)
|
|||
{
|
||||
LLUI::sAudioCallback(LLUUID(gSavedSettings.getString("UISndFSKeywordSound")));
|
||||
}
|
||||
|
||||
static LLCachedControl<bool> FSEnableGrowl(gSavedSettings, "FSEnableGrowl");
|
||||
if (FSEnableGrowl)
|
||||
{
|
||||
std::string msg = chat.mFromName;
|
||||
std::string prefix = chat.mText.substr(0, 4);
|
||||
if (prefix == "/me " || prefix == "/me'")
|
||||
{
|
||||
msg = msg + chat.mText.substr(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = msg + ": " + chat.mText;
|
||||
}
|
||||
gGrowlManager->notify("Keyword Alert", msg, GROWL_KEYWORD_ALERT_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
// newview
|
||||
#include "fscommon.h"
|
||||
#include "fskeywords.h"
|
||||
#include "fslslbridge.h"
|
||||
#include "fslslbridgerequest.h"
|
||||
#include "fswsassetblacklist.h"
|
||||
|
|
@ -164,6 +165,11 @@ void FSRadar::radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name,
|
|||
// FS:LO FIRE-1439 - Clickable avatar names on local chat radar crossing reports
|
||||
LLSD args;
|
||||
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
|
||||
|
||||
if (FSKeywords::getInstance()->chatContainsKeyword(chat, true))
|
||||
{
|
||||
FSKeywords::notify(chat);
|
||||
}
|
||||
} // <FS:CR />
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ const U64 GROWL_THROTTLE_TIME = 1000000; // Maximum spam rate (in microseconds).
|
|||
const F32 GROWL_THROTTLE_CLEANUP_PERIOD = 300; // How often we clean up the list (in seconds).
|
||||
const int GROWL_MAX_BODY_LENGTH = 255; // Arbitrary.
|
||||
const std::string GROWL_IM_MESSAGE_TYPE = "Instant Message received";
|
||||
const std::string GROWL_KEYWORD_ALERT_TYPE = "Keyword Alert";
|
||||
|
||||
class GrowlManager : public LLEventTimer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
#include "rlvhandler.h"
|
||||
|
||||
#include "lfsimfeaturehandler.h" // <FS:CR> Opensim
|
||||
#include "growlmanager.h" // <FS:LO> Growl include
|
||||
|
||||
|
||||
// LLViewerChat
|
||||
|
|
@ -120,24 +119,8 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color, bool is_l
|
|||
}
|
||||
|
||||
//Keyword alerts -KC
|
||||
if ((gAgentID != chat.mFromID || chat.mFromName == SYSTEM_FROM) && FSKeywords::getInstance()->chatContainsKeyword(chat, is_local))
|
||||
if (FSKeywords::getInstance()->chatContainsKeyword(chat, is_local))
|
||||
{
|
||||
static LLCachedControl<bool> FSEnableGrowl(gSavedSettings, "FSEnableGrowl");
|
||||
if (FSEnableGrowl)
|
||||
{
|
||||
std::string msg = chat.mFromName;
|
||||
std::string prefix = chat.mText.substr(0, 4);
|
||||
if (prefix == "/me " || prefix == "/me'")
|
||||
{
|
||||
msg = msg + chat.mText.substr(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = msg + ": " + chat.mText;
|
||||
}
|
||||
gGrowlManager->notify("Keyword Alert", msg, "Keyword Alert");
|
||||
}
|
||||
|
||||
static LLCachedControl<bool> sFSKeywordChangeColor(gSavedPerAccountSettings, "FSKeywordChangeColor");
|
||||
if (sFSKeywordChangeColor)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue