summaryrefslogtreecommitdiffstats
path: root/src/CompositeChat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/CompositeChat.cpp')
-rw-r--r--src/CompositeChat.cpp81
1 files changed, 78 insertions, 3 deletions
diff --git a/src/CompositeChat.cpp b/src/CompositeChat.cpp
index a917ee70f..a3612983a 100644
--- a/src/CompositeChat.cpp
+++ b/src/CompositeChat.cpp
@@ -112,8 +112,8 @@ cCompositeChat::cCompositeChat(void) :
-cCompositeChat::cCompositeChat(const AString & a_ParseText) :
- m_MessageType(mtCustom)
+cCompositeChat::cCompositeChat(const AString & a_ParseText, eMessageType a_MessageType) :
+ m_MessageType(a_MessageType)
{
ParseText(a_ParseText);
}
@@ -189,6 +189,15 @@ void cCompositeChat::AddSuggestCommandPart(const AString & a_Text, const AString
+void cCompositeChat::AddShowAchievementPart(const AString & a_PlayerName, const AString & a_Achievement, const AString & a_Style)
+{
+ m_Parts.push_back(new cShowAchievementPart(a_PlayerName, a_Achievement, a_Style));
+}
+
+
+
+
+
void cCompositeChat::ParseText(const AString & a_ParseText)
{
size_t len = a_ParseText.length();
@@ -290,9 +299,10 @@ void cCompositeChat::ParseText(const AString & a_ParseText)
-void cCompositeChat::SetMessageType(eMessageType a_MessageType)
+void cCompositeChat::SetMessageType(eMessageType a_MessageType, const AString & a_AdditionalMessageTypeData)
{
m_MessageType = a_MessageType;
+ m_AdditionalMessageTypeData = a_AdditionalMessageTypeData;
}
@@ -314,6 +324,58 @@ void cCompositeChat::UnderlineUrls(void)
+AString cCompositeChat::ExtractText(void) const
+{
+ AString Msg;
+ for (cParts::const_iterator itr = m_Parts.begin(), end = m_Parts.end(); itr != end; ++itr)
+ {
+ switch ((*itr)->m_PartType)
+ {
+ case ptText:
+ case ptClientTranslated:
+ case ptRunCommand:
+ case ptSuggestCommand:
+ {
+ Msg.append((*itr)->m_Text);
+ break;
+ }
+ case ptUrl:
+ {
+ Msg.append(((cUrlPart *)(*itr))->m_Url);
+ break;
+ }
+ } // switch (PartType)
+ } // for itr - m_Parts[]
+ return Msg;
+}
+
+
+
+
+
+cMCLogger::eLogLevel cCompositeChat::MessageTypeToLogLevel(eMessageType a_MessageType)
+{
+ switch (a_MessageType)
+ {
+ case mtCustom: return cMCLogger::llRegular;
+ case mtFailure: return cMCLogger::llWarning;
+ case mtInformation: return cMCLogger::llInfo;
+ case mtSuccess: return cMCLogger::llRegular;
+ case mtWarning: return cMCLogger::llWarning;
+ case mtFatal: return cMCLogger::llError;
+ case mtDeath: return cMCLogger::llRegular;
+ case mtPrivateMessage: return cMCLogger::llRegular;
+ case mtJoin: return cMCLogger::llRegular;
+ case mtLeave: return cMCLogger::llRegular;
+ }
+ ASSERT(!"Unhandled MessageType");
+ return cMCLogger::llError;
+}
+
+
+
+
+
void cCompositeChat::AddStyle(AString & a_Style, const AString & a_AddStyle)
{
if (a_AddStyle.empty())
@@ -424,3 +486,16 @@ cCompositeChat::cSuggestCommandPart::cSuggestCommandPart(const AString & a_Text,
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cCompositeChat::cShowAchievementPart:
+
+cCompositeChat::cShowAchievementPart::cShowAchievementPart(const AString & a_PlayerName, const AString & a_Achievement, const AString & a_Style) :
+ super(ptShowAchievement, a_Achievement, a_Style),
+ m_PlayerName(a_PlayerName)
+{
+}
+
+
+
+