cCompositeChat message type is now formatted
This commit is contained in:
parent
42c36429d7
commit
3a9543178a
|
@ -80,9 +80,9 @@ public:
|
||||||
static AString GenerateOfflineUUID(const AString & a_Username); // tolua_export
|
static AString GenerateOfflineUUID(const AString & a_Username); // tolua_export
|
||||||
|
|
||||||
/** Formats the type of message with the proper color and prefix for sending to the client. **/
|
/** Formats the type of message with the proper color and prefix for sending to the client. **/
|
||||||
AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData);
|
static AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData);
|
||||||
|
|
||||||
AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2);
|
static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2);
|
||||||
|
|
||||||
void Kick(const AString & a_Reason); // tolua_export
|
void Kick(const AString & a_Reason); // tolua_export
|
||||||
void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication
|
void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication
|
||||||
|
|
|
@ -299,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_MessageType = a_MessageType;
|
||||||
|
m_AdditionalMessageTypeData = a_AdditionalMessageTypeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
ePartType m_PartType;
|
ePartType m_PartType;
|
||||||
AString m_Text;
|
AString m_Text;
|
||||||
AString m_Style;
|
AString m_Style;
|
||||||
|
AString m_AdditionalStyleData;
|
||||||
|
|
||||||
cBasePart(ePartType a_PartType, const AString & a_Text, const AString & a_Style = "");
|
cBasePart(ePartType a_PartType, const AString & a_Text, const AString & a_Style = "");
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ public:
|
||||||
void ParseText(const AString & a_ParseText);
|
void ParseText(const AString & a_ParseText);
|
||||||
|
|
||||||
/** Sets the message type, which is indicated by prefixes added to the message when serializing. */
|
/** Sets the message type, which is indicated by prefixes added to the message when serializing. */
|
||||||
void SetMessageType(eMessageType a_MessageType);
|
void SetMessageType(eMessageType a_MessageType, const AString & a_AdditionalMessageTypeata = "");
|
||||||
|
|
||||||
/** Adds the "underline" style to each part that is an URL. */
|
/** Adds the "underline" style to each part that is an URL. */
|
||||||
void UnderlineUrls(void);
|
void UnderlineUrls(void);
|
||||||
|
@ -178,6 +179,9 @@ public:
|
||||||
|
|
||||||
/** Returns the message type set previously by SetMessageType(). */
|
/** Returns the message type set previously by SetMessageType(). */
|
||||||
eMessageType GetMessageType(void) const { return m_MessageType; }
|
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.
|
/** Returns the text from the parts that comprises the human-readable data.
|
||||||
Used for older protocols that don't support composite chat
|
Used for older protocols that don't support composite chat
|
||||||
|
@ -199,6 +203,9 @@ protected:
|
||||||
/** The message type, as indicated by prefixes. */
|
/** The message type, as indicated by prefixes. */
|
||||||
eMessageType m_MessageType;
|
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.
|
/** 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. */
|
If the style already contains something that a_AddStyle overrides, it is erased first. */
|
||||||
|
|
|
@ -234,7 +234,7 @@ void cProtocol172::SendChat(const cCompositeChat & a_Message)
|
||||||
|
|
||||||
// Compose the complete Json string to send:
|
// Compose the complete Json string to send:
|
||||||
Json::Value msg;
|
Json::Value msg;
|
||||||
msg["text"] = ""; // The client crashes without this
|
msg["text"] = cClientHandle::FormatMessageType(m_Client->GetPlayer()->GetWorld()->ShouldUseChatPrefixes(), a_Message.GetMessageType(), a_Message.GetAdditionalMessageTypeData()); // The client crashes without this field being present
|
||||||
const cCompositeChat::cParts & Parts = a_Message.GetParts();
|
const cCompositeChat::cParts & Parts = a_Message.GetParts();
|
||||||
for (cCompositeChat::cParts::const_iterator itr = Parts.begin(), end = Parts.end(); itr != end; ++itr)
|
for (cCompositeChat::cParts::const_iterator itr = Parts.begin(), end = Parts.end(); itr != end; ++itr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user