diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index dc9d0498cb..a6b75099bd 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -78,6 +78,7 @@ set(viewer_SOURCE_FILES
floatermedialists.cpp
fscontactsfloater.cpp
fsareasearch.cpp
+ fskeywords.cpp
llagent.cpp
llagentaccess.cpp
llagentcamera.cpp
@@ -640,6 +641,7 @@ set(viewer_HEADER_FILES
floatermedialists.h
fscontactsfloater.h
fsareasearch.h
+ fskeywords.h
llagent.h
llagentaccess.h
llagentcamera.h
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 43d62860f2..cd84cc00dd 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -298,6 +298,100 @@
0
+
+ PhoenixKeywordOn
+
+ PhoenixKeywordInChat
+
+ PhoenixKeywordInIM
+
+ PhoenixKeywords
+
+ PhoenixKeywordPlaySound
+
+ PhoenixKeywordSound
+
+ PhoenixKeywordChangeColor
+
+ PhoenixKeywordColor
+
diff --git a/indra/newview/fskeywords.cpp b/indra/newview/fskeywords.cpp
new file mode 100644
index 0000000000..d0b1fb0a67
--- /dev/null
+++ b/indra/newview/fskeywords.cpp
@@ -0,0 +1,59 @@
+
+#include "llviewerprecompiledheaders.h"
+
+#include "fskeywords.h"
+#include "llui.h"
+#include "llviewercontrol.h"
+
+#include
+//#include //for boost::ifind_first
+
+
+FSKeywords::FSKeywords()
+{
+ gSavedPerAccountSettings.getControl("PhoenixKeywords")->getSignal()->connect(boost::bind(&FSKeywords::updateKeywords, this));
+ updateKeywords();
+}
+
+FSKeywords::~FSKeywords()
+{
+}
+
+void FSKeywords::updateKeywords()
+{
+ std::string s = gSavedPerAccountSettings.getString("PhoenixKeywords");
+ LLStringUtil::toLower(s);
+ boost::regex re(",");
+ boost::sregex_token_iterator begin(s.begin(), s.end(), re, -1), end;
+ mWordList.clear();
+ while(begin != end)
+ {
+ mWordList.push_back(*begin++);
+ }
+}
+
+bool FSKeywords::chatContainsKeyword(const LLChat& chat, bool is_local)
+{
+ static LLCachedControl sPhoenixKeywordOn(gSavedPerAccountSettings, "PhoenixKeywordOn", false);
+ static LLCachedControl sPhoenixKeywordInChat(gSavedPerAccountSettings, "PhoenixKeywordInChat", false);
+ static LLCachedControl sPhoenixKeywordInIM(gSavedPerAccountSettings, "PhoenixKeywordInIM", false);
+ if (!sPhoenixKeywordOn ||
+ (is_local && !sPhoenixKeywordInChat) ||
+ (!is_local && !sPhoenixKeywordInIM))
+ return FALSE;
+
+ std::string source(chat.mText);
+ LLStringUtil::toLower(source);
+
+ for(U32 i=0; i < mWordList.size(); i++)
+ {
+ if(source.find(mWordList[i]) != std::string::npos)
+ {
+ if(gSavedPerAccountSettings.getBOOL("PhoenixKeywordPlaySound"))
+ LLUI::sAudioCallback(LLUUID(gSavedPerAccountSettings.getString("PhoenixKeywordSound")));
+
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/indra/newview/fskeywords.h b/indra/newview/fskeywords.h
new file mode 100644
index 0000000000..e35a5f33a5
--- /dev/null
+++ b/indra/newview/fskeywords.h
@@ -0,0 +1,22 @@
+
+#include "llsingleton.h"
+#include "llstring.h"
+#include "llchat.h"
+
+class LLViewerRegion;
+
+
+class FSKeywords : public LLSingleton
+{
+public:
+ FSKeywords();
+ virtual ~FSKeywords();
+
+ void updateKeywords();
+ bool chatContainsKeyword(const LLChat& chat, bool is_local);
+
+private:
+ std::vector mWordList;
+
+
+};
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index d0575bf7b9..2627df9b27 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -791,7 +791,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
LLColor4 txt_color = LLUIColorTable::instance().getColor("White");
LLColor4 header_name_color = LLUIColorTable::instance().getColor("ChatNameColor");
- LLViewerChat::getChatColor(chat,txt_color);
+ LLViewerChat::getChatColor(chat,txt_color,false);
LLFontGL* fontp = LLViewerChat::getChatFont();
std::string font_name = LLFontGL::nameFromFont(fontp);
std::string font_size = LLFontGL::sizeFromFont(fontp);
diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp
index 0af850a46b..bc5581a2ef 100644
--- a/indra/newview/llviewerchat.cpp
+++ b/indra/newview/llviewerchat.cpp
@@ -32,11 +32,12 @@
#include "lluicolortable.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llinstantmessage.h" //SYSTEM_FROM
+#include "fskeywords.h"
// LLViewerChat
//static
-void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color)
+void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color, bool is_local)
{
if(chat.mMuted)
{
@@ -84,6 +85,17 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color)
r_color.setToWhite();
}
+ //Keyword alerts -KC
+ if ((gAgentID != chat.mFromID) && FSKeywords::getInstance()->chatContainsKeyword(chat, is_local))
+ {
+ static LLCachedControl sPhoenixKeywordChangeColor(gSavedPerAccountSettings, "PhoenixKeywordChangeColor");
+ if (sPhoenixKeywordChangeColor)
+ {
+ static LLCachedControl sPhoenixKeywordColor(gSavedPerAccountSettings, "PhoenixKeywordColor");
+ r_color = sPhoenixKeywordColor;
+ }
+ }
+
if (!chat.mPosAgent.isExactlyZero())
{
LLVector3 pos_agent = gAgent.getPositionAgent();
diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h
index a9f9a98960..be90bf1afc 100644
--- a/indra/newview/llviewerchat.h
+++ b/indra/newview/llviewerchat.h
@@ -35,7 +35,7 @@
class LLViewerChat
{
public:
- static void getChatColor(const LLChat& chat, LLColor4& r_color);
+ static void getChatColor(const LLChat& chat, LLColor4& r_color, bool is_local = true);
static void getChatColor(const LLChat& chat, std::string& r_color_name, F32& r_color_alpha);
static LLFontGL* getChatFont();
static S32 getChatFontSize();