summaryrefslogtreecommitdiffstats
path: root/src/CompositeChat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/CompositeChat.h')
-rw-r--r--src/CompositeChat.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/CompositeChat.h b/src/CompositeChat.h
index 5b9c5f612..1ad196f1d 100644
--- a/src/CompositeChat.h
+++ b/src/CompositeChat.h
@@ -38,6 +38,7 @@ public:
ptUrl,
ptRunCommand,
ptSuggestCommand,
+ ptShowAchievement,
} ;
class cBasePart
@@ -46,6 +47,7 @@ public:
ePartType m_PartType;
AString m_Text;
AString m_Style;
+ AString m_AdditionalStyleData;
cBasePart(ePartType a_PartType, const AString & a_Text, const AString & a_Style = "");
@@ -106,6 +108,15 @@ public:
public:
cSuggestCommandPart(const AString & a_Text, const AString & a_Command, const AString & a_Style = "");
} ;
+
+ class cShowAchievementPart :
+ public cBasePart
+ {
+ typedef cBasePart super;
+ public:
+ AString m_PlayerName;
+ cShowAchievementPart(const AString & a_PlayerName, const AString & a_Achievement, const AString & a_Style = "");
+ } ;
typedef std::vector<cBasePart *> cParts;
@@ -148,13 +159,20 @@ public:
/** Adds a part that suggests a command (enters it into the chat message area, but doesn't send) when clicked.
The default style is underlined yellow text. */
void AddSuggestCommandPart(const AString & a_Text, const AString & a_SuggestedCommand, const AString & a_Style = "u@b");
+
+ /** Adds a part that fully formats a specified achievement using client translatable strings
+ Takes achievement name and player awarded to. Displays as {player} has earned the achievement {achievement_name}.
+ */
+ void AddShowAchievementPart(const AString & a_PlayerName, const AString & a_Achievement, const AString & a_Style = "");
/** Parses text into various parts, adds those.
Recognizes "http:" and "https:" URLs and @color-codes. */
void ParseText(const AString & a_ParseText);
- /** Sets the message type, which is indicated by prefixes added to the message when serializing. */
- void SetMessageType(eMessageType a_MessageType);
+ /** Sets the message type, which is indicated by prefixes added to the message when serializing
+ Takes optional AdditionalMessageTypeData to set m_AdditionalMessageTypeData. See said variable for more documentation.
+ */
+ void SetMessageType(eMessageType a_MessageType, const AString & a_AdditionalMessageTypeData = "");
/** Adds the "underline" style to each part that is an URL. */
void UnderlineUrls(void);
@@ -163,6 +181,9 @@ public:
/** Returns the message type set previously by SetMessageType(). */
eMessageType GetMessageType(void) const { return m_MessageType; }
+
+ /** Returns additional data pertaining to message type, for example, the name of a mtPrivateMsg sender */
+ AString GetAdditionalMessageTypeData(void) const { return m_AdditionalMessageTypeData; }
/** Returns the text from the parts that comprises the human-readable data.
Used for older protocols that don't support composite chat
@@ -184,6 +205,9 @@ protected:
/** The message type, as indicated by prefixes. */
eMessageType m_MessageType;
+ /** Additional data pertaining to message type, for example, the name of a mtPrivateMsg sender */
+ AString m_AdditionalMessageTypeData;
+
/** Adds a_AddStyle to a_Style; overwrites the existing style if appropriate.
If the style already contains something that a_AddStyle overrides, it is erased first. */