mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Remove bad string splitting
Thanks to Makpptfox at getmangos.eu for report
This commit is contained in:
@@ -35,9 +35,21 @@ bool Eluna::OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player
|
||||
START_HOOK_WITH_RETVAL(ADDON_EVENT_ON_MESSAGE, true);
|
||||
Push(sender);
|
||||
Push(type);
|
||||
const char* c_msg = msg.c_str();
|
||||
Push(strtok((char*)c_msg, "\t")); // prefix
|
||||
Push(strtok(NULL, "")); // msg
|
||||
|
||||
auto delimeter_position = msg.find('\t');
|
||||
if (delimeter_position == std::string::npos)
|
||||
{
|
||||
Push(msg); // prefix
|
||||
Push(); // msg
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string prefix = msg.substr(0, delimeter_position);
|
||||
std::string content = msg.substr(delimeter_position + 1, std::string::npos);
|
||||
Push(prefix);
|
||||
Push(content);
|
||||
}
|
||||
|
||||
if (receiver)
|
||||
Push(receiver);
|
||||
else if (guild)
|
||||
|
||||
Reference in New Issue
Block a user