593 const char validSequence[6] =
"cHhhr";
594 const char* validSequenceIterator = validSequence;
598 std::istringstream::pos_type startPos = 0;
604 if (validSequence == validSequenceIterator)
608 startPos =
_iss.tellg() - std::istringstream::pos_type(1);
612 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly",
_iss.str().c_str());
617 if (
_iss.peek() ==
'\0')
619 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'",
_iss.str().c_str());
633 if (commandChar == *validSequenceIterator)
635 if (validSequenceIterator == validSequence+4)
636 validSequenceIterator = validSequence;
638 ++validSequenceIterator;
642 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'",
_iss.str().c_str(), *validSequenceIterator, commandChar);
646 else if (validSequence != validSequenceIterator)
649 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence",
_iss.str().c_str());
658 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color",
_iss.str().c_str());
667 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly",
_iss.str().c_str());
671 if (strcmp(buffer,
"item") == 0)
673 else if (strcmp(buffer,
"quest") == 0)
675 else if (strcmp(buffer,
"trade") == 0)
677 else if (strcmp(buffer,
"talent") == 0)
679 else if (strcmp(buffer,
"spell") == 0)
681 else if (strcmp(buffer,
"enchant") == 0)
683 else if (strcmp(buffer,
"achievement") == 0)
685 else if (strcmp(buffer,
"glyph") == 0)
689 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'",
_iss.str().c_str(), buffer);
699 if (*validSequenceIterator ==
'h')
702 if (
_iss.get() !=
'[')
704 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['",
_iss.str().c_str());
707 _iss.getline(buffer, 256,
']');
710 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly",
_iss.str().c_str());
728 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): got invalid command |%c",
_iss.str().c_str(), commandChar);
734 if (validSequence != validSequenceIterator)
736 TC_LOG_TRACE(
"chat.system",
"ChatHandler::isValidChatMessage('%s'): EOF in active sequence",
_iss.str().c_str());
Definition: ChatLink.h:154
virtual bool ValidateName(char *buffer, const char *context)=0
Definition: ChatLink.cpp:99
Definition: ChatLink.h:92
Definition: ChatLink.h:79
arena_t NULL
Definition: jemalloc_internal.h:624
virtual bool Initialize(std::istringstream &iss)=0
#define DELIMITER
Definition: ChatLink.cpp:96
#define PIPE_CHAR
Definition: ChatLink.cpp:97
Definition: ChatLink.h:121
Definition: ChatLink.h:58
bool ReadHex(std::istringstream &iss, uint32 &res, uint32 length)
Definition: ChatLink.cpp:86
#define TC_LOG_TRACE(filterType__,...)
Definition: Log.h:195
Definition: ChatLink.h:38
uint32_t uint32
Definition: Define.h:150
Definition: ChatLink.h:104
Definition: ChatLink.h:146
void SetBounds(std::istringstream::pos_type startPos, std::istringstream::pos_type endPos)
Definition: ChatLink.h:45
void SetColor(uint32 color)
Definition: ChatLink.h:43
Definition: ChatLink.h:134