diff options
Diffstat (limited to 'src/connectionhandler.cpp')
-rw-r--r-- | src/connectionhandler.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/connectionhandler.cpp b/src/connectionhandler.cpp index c7a3d49b..a336a842 100644 --- a/src/connectionhandler.cpp +++ b/src/connectionhandler.cpp @@ -323,10 +323,11 @@ void ConnectionHandler::makeUsersLeaveChannel(const short channelId) MessageOut result; result.writeShort(SMSG_QUIT_CHANNEL_RESPONSE); result.writeByte(CHATCNL_OUT_OK); + + const std::vector<tmwserv::BeingPtr> beingList = + chatChannelManager->getUserListInChannel(channelId); for (NetComputers::iterator i = clients.begin(); i != clients.end();i++) { - const std::vector<tmwserv::BeingPtr> beingList = - chatChannelManager->getUserListInChannel(channelId); // If the being is in the channel, send it the 'leave now' packet for (std::vector<tmwserv::BeingPtr>::const_iterator j = beingList.begin(); j != beingList.end(); j++) @@ -338,3 +339,28 @@ void ConnectionHandler::makeUsersLeaveChannel(const short channelId) } } } + +void ConnectionHandler::warnUsersAboutPlayerEventInChat(const short channelId, + const std::string& userName, + const char eventId) +{ + MessageOut result; + result.writeShort(SMSG_UPDATE_CHANNEL_RESPONSE); + result.writeByte(eventId); + result.writeString(userName); + + const std::vector<tmwserv::BeingPtr> beingList = + chatChannelManager->getUserListInChannel(channelId); + for (NetComputers::iterator i = clients.begin(); i != clients.end();i++) + { + // If the being is in the channel, send it the 'eventId' packet + for (std::vector<tmwserv::BeingPtr>::const_iterator j = beingList.begin(); + j != beingList.end(); j++) + { + if ((*i)->getCharacter().get() == (*j).get() ) + { + (*i)->send(result.getPacket()); + } + } + } +} |