summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoderic Morris <roderic@ccs.neu.edu>2008-06-10 12:58:04 +0000
committerRoderic Morris <roderic@ccs.neu.edu>2008-06-10 12:58:04 +0000
commitcf26f99ed46ee2ac7e3f830e8e55a286ca1770b0 (patch)
tree645164c38dd9887d5b78930626e480165c878b9f
parent6aabeb561db6cdda61a9dff00fd75e9c0efffc23 (diff)
downloadmanaserv-cf26f99ed46ee2ac7e3f830e8e55a286ca1770b0.tar.gz
manaserv-cf26f99ed46ee2ac7e3f830e8e55a286ca1770b0.tar.bz2
manaserv-cf26f99ed46ee2ac7e3f830e8e55a286ca1770b0.tar.xz
manaserv-cf26f99ed46ee2ac7e3f830e8e55a286ca1770b0.zip
update chat packet defs, get rid of unused functions
-rw-r--r--ChangeLog6
-rw-r--r--src/chat-server/chathandler.cpp66
-rw-r--r--src/chat-server/chathandler.hpp22
-rw-r--r--src/defines.h19
4 files changed, 13 insertions, 100 deletions
diff --git a/ChangeLog b/ChangeLog
index d7404f8e..6a523fe7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-10 Roderic Morris <roderic@ccs.neu.edu>
+
+ * src/chat-server/chathandler.cpp, src/chat-server/chathandler.hpp,
+ src/defines.h: Update chat packet definitions, get rid of old unused
+ functions.
+
2008-06-09 Roderic Morris <roderic@ccs.neu.edu>
* src/chat-server/chatchannelmanager.cpp: List channels that can
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
diff --git a/src/chat-server/chathandler.hpp b/src/chat-server/chathandler.hpp
index 4e5b48b0..6a0cbc01 100644
--- a/src/chat-server/chathandler.hpp
+++ b/src/chat-server/chathandler.hpp
@@ -161,12 +161,6 @@ class ChatHandler : public ConnectionHandler
handleRegisterChannelMessage(ChatClient &client, MessageIn &msg);
/**
- * Deal with channel unregistering.
- */
- void
- handleUnregisterChannelMessage(ChatClient &client, MessageIn &msg);
-
- /**
* Deal with player entering channel.
*/
void
@@ -277,22 +271,6 @@ class ChatHandler : public ConnectionHandler
void sendInChannel(ChatChannel *channel, MessageOut &msg);
/**
- * Send user joined message.
- *
- * @param channel the channel to send the message in, must not be NULL
- * @param name the name of the user who joined
- */
- void sendUserJoined(ChatChannel *channel, const std::string &name);
-
- /**
- * Send user left message.
- *
- * @param channel the channel to send the message in, must not be NULL
- * @param name the name of the user who left
- */
- void sendUserLeft(ChatChannel *channel, const std::string &name);
-
- /**
* Retrieves the guild channel or creates one automatically
* Automatically makes client join it
* @param The name of the guild (and therefore the channel)
diff --git a/src/defines.h b/src/defines.h
index 17cafca1..57c45e96 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -218,22 +218,17 @@ enum {
PCMSG_ANNOUNCE = 0x0411, // S text
PCMSG_PRIVMSG = 0x0412, // S user, S text
// -- Channeling
- PCMSG_REGISTER_CHANNEL = 0x0420, // B pub/priv, S name, S announcement, S password
- CPMSG_REGISTER_CHANNEL_RESPONSE = 0x0421, // B error, W id
- PCMSG_UNREGISTER_CHANNEL = 0x0422, // W channel
- CPMSG_UNREGISTER_CHANNEL_RESPONSE = 0x0423, // B error
+ PCMSG_REGISTER_CHANNEL = 0x0420, // S name, S announcement, S password
+ CPMSG_REGISTER_CHANNEL_RESPONSE = 0x0421, // B error, W id, S name, S announcement
CPMSG_CHANNEL_EVENT = 0x0430, // W channel, B event, S user
PCMSG_ENTER_CHANNEL = 0x0440, // S channel, S password
- CPMSG_ENTER_CHANNEL_RESPONSE = 0x0441, // B error, W channel
- CPMSG_JOINED_CHANNEL = 0x0442, // S channel, W channel id
- PCMSG_QUIT_CHANNEL = 0x0443, // W channel
- CPMSG_QUIT_CHANNEL_RESPONSE = 0x0444, // B error
+ CPMSG_ENTER_CHANNEL_RESPONSE = 0x0441, // B error, W id, S name, S announcement, S userlist
+ PCMSG_QUIT_CHANNEL = 0x0443, // W channel id
+ CPMSG_QUIT_CHANNEL_RESPONSE = 0x0444, // B error, W channel id
PCMSG_LIST_CHANNELS = 0x0445, // -
- CPMSG_LIST_CHANNELS_RESPONSE = 0x0446, // W number of channels, S channels
- CPMSG_USERJOINED = 0x0450, // W channel, S name
- CPMSG_USERLEFT = 0x0451, // W channel, S name
+ CPMSG_LIST_CHANNELS_RESPONSE = 0x0446, // S names, W number of users
PCMSG_LIST_CHANNELUSERS = 0x0460, // S channel
- CPMSG_LIST_CHANNELUSERS_RESPONSE = 0x0461, // S users
+ CPMSG_LIST_CHANNELUSERS_RESPONSE = 0x0461, // S channel, S users
// Inter-server
GAMSG_REGISTER = 0x0500, // S address, W port, { W map id }*