diff options
Diffstat (limited to 'src/chat-server/chathandler.cpp')
-rw-r--r-- | src/chat-server/chathandler.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/chat-server/chathandler.cpp b/src/chat-server/chathandler.cpp index 482e1b2f..fcd4a28f 100644 --- a/src/chat-server/chathandler.cpp +++ b/src/chat-server/chathandler.cpp @@ -149,10 +149,6 @@ void ChatHandler::processMessage(NetComputer *comp, MessageIn &message) handleRegisterChannelMessage(computer, message); break; - case PCMSG_UNREGISTER_CHANNEL: - handleUnregisterChannelMessage(computer, message); - break; - case PCMSG_ENTER_CHANNEL: handleEnterChannelMessage(computer, message); break; @@ -380,52 +376,6 @@ ChatHandler::handleRegisterChannelMessage(ChatClient &client, MessageIn &msg) client.send(reply); } -void -ChatHandler::handleUnregisterChannelMessage(ChatClient &client, MessageIn &msg) -{ - MessageOut reply(CPMSG_UNREGISTER_CHANNEL_RESPONSE); - - short channelId = msg.readShort(); - ChatChannel *channel = chatChannelManager->getChannel(channelId); - - if (!channel) - { - reply.writeByte(ERRMSG_INVALID_ARGUMENT); - } - else if (!channel->canJoin()) - { - reply.writeByte(ERRMSG_INSUFFICIENT_RIGHTS); - } - else - { - // We first see if the user is the admin (first user) of the channel - const ChatChannel::ChannelUsers &userList = channel->getUserList(); - ChatChannel::ChannelUsers::const_iterator i = userList.begin(); - - if (*i != &client) - { - reply.writeByte(ERRMSG_INSUFFICIENT_RIGHTS); - } - else - { - // Make every user quit the channel - warnUsersAboutPlayerEventInChat( - channel, "", CHAT_EVENT_LEAVING_PLAYER); - - if (chatChannelManager->removeChannel(channelId)) - { - reply.writeByte(ERRMSG_OK); - } - else - { - reply.writeByte(ERRMSG_FAILURE); - } - } - } - - client.send(reply); -} - void ChatHandler::handleEnterChannelMessage(ChatClient &client, MessageIn &msg) { MessageOut reply(CPMSG_ENTER_CHANNEL_RESPONSE); @@ -843,22 +793,6 @@ void ChatHandler::sendGuildRejoin(ChatClient &client) } } -void ChatHandler::sendUserJoined(ChatChannel *channel, const std::string &name) -{ - MessageOut msg(CPMSG_USERJOINED); - msg.writeShort(channel->getId()); - msg.writeString(name); - sendInChannel(channel, msg); -} - -void ChatHandler::sendUserLeft(ChatChannel *channel, const std::string &name) -{ - MessageOut msg(CPMSG_USERLEFT); - msg.writeShort(channel->getId()); - msg.writeString(name); - sendInChannel(channel, msg); -} - ChatChannel* ChatHandler::joinGuildChannel(const std::string &guildName, ChatClient &client) { // Automatically make the character join the guild chat channel |