49 static const uint16_t _messages[] = {
89 event.setString(
"nick", nick);
90 event.setString(
"error",
strprintf(
_(
"Whisper could "
91 "not be sent, %s is offline."), nick.c_str()));
98 event.setString(
"nick", nick);
99 event.setString(
"error",
strprintf(
_(
"Whisper could "
100 "not be sent, ignored by %s."), nick.c_str()));
112 if (chatMsgLength <= 0)
119 if (chatMsg.compare(0, 3,
"\302\202!") == 0)
122 if (nick !=
"Server")
126 if (chatMsg.find(
"!selllist ") == 0 ||
127 chatMsg.find(
"!buylist ") == 0 ||
128 chatMsg.find(
"!buyitem ") == 0 ||
129 chatMsg.find(
"!sellitem ") == 0)
135 event.setString(
"nick", nick);
136 event.setString(
"message", chatMsg);
154 if (!being || chatMsgLength <= 0)
159 std::string::size_type pos = chatMsg.find(
" : ", 0);
160 std::string sender_name = ((pos == std::string::npos)
161 ?
"" : chatMsg.substr(0, pos));
163 if (sender_name != being->
getName()
167 sender_name = being->
getName();
171 chatMsg.erase(0, pos + 3);
190 if (chatMsg.compare(0, 2,
"\302\202") == 0)
195 std::string reducedMessage = chatMsg;
196 chatMsg = sender_name;
199 chatMsg += reducedMessage;
202 event.setString(
"message", chatMsg);
203 event.setString(
"text", reducedMessage);
204 event.setString(
"nick", sender_name);
205 event.setInt(
"beingId", beingId);
206 event.setInt(
"permissions", perms);
217 if (chatMsgLength <= 0)
224 std::string::size_type pos = chatMsg.find(
" : ", 0);
225 std::string mes = chatMsg;
227 if (pos != std::string::npos)
228 chatMsg.erase(0, pos + 3);
233 event.setString(
"message", mes);
234 event.setString(
"text", chatMsg);
245 event.setString(
"message", chatMsg);
254 if (chatMsgLength <= 0)
266 int count = (length - 4) / 31;
267 std::vector<Avatar*> players;
269 for (
int i = 0; i < count; i++)
277 auto *avatar =
new Avatar(nick);
278 avatar->setOnline(
true);
279 players.push_back(avatar);
290static void sendChatMessage(
const std::string &mes)
294 outMsg.writeInt16(mes.length() + 4 + 1);
295 outMsg.writeString(mes, mes.length() + 1);
303 sendChatMessage(text);
310 std::string action =
strprintf(
"*%s*", text.c_str());
316 const std::string &text)
332 const std::string &password)
ActorSpriteManager * actorSpriteManager
Being * findBeing(int id) const
Returns a specific Being, by id;.
Type getType() const final
Returns the type of the ActorSprite.
const std::string & getName() const
Returns the name of the being.
const uint16_t * handledMessages
unsigned int getDefault() const
Retrieves the default permissions.
bool hasPermission(Being *being, unsigned int flags)
Tests whether the player in question is being ignored for any of the actions in the specified flags.
unsigned int checkPermissionSilently(const std::string &player_name, unsigned int flags)
Determines whether the player in question is being ignored, filtered by the specified flags.
void setPlayersOnline(const std::vector< Avatar * > &players)
void requestOnlineList() override
void channelList() override
void userList(const std::string &channel) override
void privateMessage(const std::string &recipient, const std::string &text) override
void setUserMode(int channelId, const std::string &name, int mode) override
void kickUser(int channelId, const std::string &name) override
void handleMessage(MessageIn &msg) override
void me(const std::string &text) override
std::queue< std::string > mSentWhispers
void quitChannel(int channelId) override
void sendToChannel(int channelId, const std::string &text) override
void setChannelTopic(int channelId, const std::string &text) override
void enterChannel(const std::string &channel, const std::string &password) override
void talk(const std::string &text) override
Used for parsing an incoming message from eAthena.
std::string readString(int length=-1)
Reads a string.
uint16_t readInt16()
Reads an unsigned 16-bit integer from the message.
uint8_t readInt8()
Reads an unsigned 8-bit integer from the message.
uint16_t getId() const
Returns the message ID.
uint32_t readInt32()
Reads an unsigned 32-bit integer from the message.
Used for building an outgoing message to eAthena.
void writeInt16(uint16_t value)
Writes an unsigned 16-bit integer to the message.
void writeString(const std::string &string, int length=-1)
Writes a string.
void serverNotice(const std::string &message)
SocialWindow * socialWindow
LocalPlayer * local_player
Net::ChatHandler * chatHandler
ManaServ::LoginHandler * loginHandler
LoginHandler * getLoginHandler()
Warning: buffers and other variables are shared, so there can be only one connection active at a time...
PlayerRelationsManager player_relations
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.
std::string & trim(std::string &str)
Trims spaces off the end and the beginning of the given string.
std::string & removeColors(std::string &msg)
Removes colors from a string.