summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoderic Morris <roderic@ccs.neu.edu>2008-07-07 16:59:55 +0000
committerRoderic Morris <roderic@ccs.neu.edu>2008-07-07 16:59:55 +0000
commite91747e5025d5e37b2b856e30d6fb5da6968364c (patch)
treef80189890a67d1dca30b82c3c774d185cc3572fa /src
parent9bf9b2c706290b61af0f66f11ff1b3cd37d72904 (diff)
downloadmana-client-e91747e5025d5e37b2b856e30d6fb5da6968364c.tar.gz
mana-client-e91747e5025d5e37b2b856e30d6fb5da6968364c.tar.bz2
mana-client-e91747e5025d5e37b2b856e30d6fb5da6968364c.tar.xz
mana-client-e91747e5025d5e37b2b856e30d6fb5da6968364c.zip
get rid of channel registering related code
Diffstat (limited to 'src')
-rw-r--r--src/commandhandler.cpp38
-rw-r--r--src/commandhandler.h5
-rw-r--r--src/net/chathandler.cpp34
-rw-r--r--src/net/chathandler.h5
-rw-r--r--src/net/chatserver/chatserver.cpp11
-rw-r--r--src/net/chatserver/chatserver.h3
-rw-r--r--src/net/protocol.h2
7 files changed, 8 insertions, 90 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 1dadc236..8f0aa907 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -57,12 +57,6 @@ void CommandHandler::handleCommand(const std::string &command)
{
handleMsg(args);
}
- /*
- else if (type == "channel")
- {
- handleChannel(args);
- }
- */
else if (type == "join")
{
handleJoin(args);
@@ -119,8 +113,7 @@ void CommandHandler::handleHelp(const std::string &args)
chatWindow->chatLog("/msg > Send a private message to a user");
chatWindow->chatLog("/list > Display all public channels");
chatWindow->chatLog("/users > Lists the users in the current channel");
-// chatWindow->chatLog("/channel > Register a new channel");
- chatWindow->chatLog("/join > Join an already registered channel");
+ chatWindow->chatLog("/join > Join or create a channel");
chatWindow->chatLog("/topic > Set the topic of the current channel");
chatWindow->chatLog("/quit > Leave a channel");
chatWindow->chatLog("/admin > Send a command to the server (GM only)");
@@ -157,6 +150,7 @@ void CommandHandler::handleHelp(const std::string &args)
{
chatWindow->chatLog("Command: /join <channel>");
chatWindow->chatLog("This command makes you enter <channel>.");
+ chatWindow->chatLog("If <channel> doesn't exist, it's created.");
}
else if (args == "list")
{
@@ -177,6 +171,12 @@ void CommandHandler::handleHelp(const std::string &args)
chatWindow->chatLog("If the <nick> has spaces in it, enclose it in "
"double quotes (\").");
}
+ else if (args == "quit")
+ {
+ chatWindow->chatLog("Command: /quit");
+ chatWindow->chatLog("This command leaves the current channel.");
+ chatWindow->chatLog("If you're the last person in the channel, it will be deleted.");
+ }
else if (args == "topic")
{
chatWindow->chatLog("Command: /topic <message>");
@@ -223,28 +223,6 @@ void CommandHandler::handleMsg(const std::string &args)
Net::ChatServer::privMsg(recipient, text);
}
-void CommandHandler::handleChannel(const std::string &args)
-{
- std::string::size_type pos = args.find(" ");
- std::string name(args, 0, pos);
- std::string password;
- std::string announcement;
- if(pos == std::string::npos)
- {
- password = std::string();
- announcement = std::string();
- }
- else
- {
- password = std::string(args, pos + 1, args.find(" ", pos + 1) - pos - 1);
- pos = args.find("\"");
- announcement = std::string(args, pos == std::string::npos ? args.size() :
- pos + 1, args.size() - pos - 2);
- }
- chatWindow->chatLog("Requesting to register channel " + name);
- Net::ChatServer::registerChannel(name, announcement, password);
-}
-
void CommandHandler::handleJoin(const std::string &args)
{
std::string::size_type pos = args.find(' ');
diff --git a/src/commandhandler.h b/src/commandhandler.h
index 5c019450..0e8d9dd7 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -74,11 +74,6 @@ class CommandHandler
void handleMsg(const std::string &args);
/**
- * Handle a channel command.
- */
- void handleChannel(const std::string &args);
-
- /**
* Handle a join command.
*/
void handleJoin(const std::string &args);
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp
index ce4a91da..43ca5a71 100644
--- a/src/net/chathandler.cpp
+++ b/src/net/chathandler.cpp
@@ -47,7 +47,6 @@ ChatHandler::ChatHandler()
{
static const Uint16 _messages[] = {
GPMSG_SAY,
- CPMSG_REGISTER_CHANNEL_RESPONSE,
CPMSG_ENTER_CHANNEL_RESPONSE,
CPMSG_LIST_CHANNELS_RESPONSE,
CPMSG_PUBMSG,
@@ -69,10 +68,6 @@ void ChatHandler::handleMessage(MessageIn &msg)
handleGameChatMessage(msg);
break;
- case CPMSG_REGISTER_CHANNEL_RESPONSE:
- handleRegisterChannelResponse(msg);
- break;
-
case CPMSG_ENTER_CHANNEL_RESPONSE:
handleEnterChannelResponse(msg);
break;
@@ -131,35 +126,6 @@ void ChatHandler::handleGameChatMessage(MessageIn &msg)
}
}
-void ChatHandler::handleRegisterChannelResponse(MessageIn &msg)
-{
- char error = msg.readInt8();
- if(error == ERRMSG_OK)
- {
- short channelId = msg.readInt16();
- std::string channelName = msg.readString();
- std::string channelAnnouncement = msg.readString();
- chatWindow->chatLog("Registered Channel " + channelName);
- channelManager->addChannel(new Channel(channelId,
- channelName,
- channelAnnouncement));
- chatWindow->createNewChannelTab(channelName);
- chatWindow->chatLog("Topic: " + channelAnnouncement, BY_CHANNEL, channelName);
-
- }
- else
- {
- if (error == ERRMSG_INVALID_ARGUMENT)
- {
- chatWindow->chatLog("Error registering channel - Invalid Channel Name given", BY_SERVER);
- }
- else
- {
- chatWindow->chatLog("Error registering channel", BY_SERVER);
- }
- }
-}
-
void ChatHandler::handleEnterChannelResponse(MessageIn &msg)
{
if(msg.readInt8() == ERRMSG_OK)
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index 874998d9..7ca4d50d 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -43,11 +43,6 @@ class ChatHandler : public MessageHandler
void handleGameChatMessage(MessageIn &msg);
/**
- * Handle channel registration responses.
- */
- void handleRegisterChannelResponse(MessageIn &msg);
-
- /**
* Handle channel entry responses.
*/
void handleEnterChannelResponse(MessageIn &msg);
diff --git a/src/net/chatserver/chatserver.cpp b/src/net/chatserver/chatserver.cpp
index c6df7c83..a2dbefbb 100644
--- a/src/net/chatserver/chatserver.cpp
+++ b/src/net/chatserver/chatserver.cpp
@@ -80,17 +80,6 @@ void Net::ChatServer::privMsg(const std::string &recipient,
connection->send(msg);
}
-void Net::ChatServer::registerChannel(const std::string &name,
- const std::string &topic, const std::string &password)
-{
- MessageOut msg(PCMSG_REGISTER_CHANNEL);
- msg.writeString(name);
- msg.writeString(topic);
- msg.writeString(password);
-
- connection->send(msg);
-}
-
void Net::ChatServer::enterChannel(const std::string &channel, const std::string &password)
{
MessageOut msg(PCMSG_ENTER_CHANNEL);
diff --git a/src/net/chatserver/chatserver.h b/src/net/chatserver/chatserver.h
index dac19e88..56ad46ca 100644
--- a/src/net/chatserver/chatserver.h
+++ b/src/net/chatserver/chatserver.h
@@ -42,9 +42,6 @@ namespace Net
void privMsg(const std::string &recipient, const std::string &text);
- void registerChannel(const std::string &name,
- const std::string &topic, const std::string &password);
-
void enterChannel(const std::string &channel, const std::string &password);
void quitChannel(short channel);
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 76a8ffab..89713591 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -163,8 +163,6 @@ enum {
PCMSG_ANNOUNCE = 0x0411, // S text
PCMSG_PRIVMSG = 0x0412, // S user, S text
// -- Channeling
- PCMSG_REGISTER_CHANNEL = 0x0420, // S name, S topic, S password
- CPMSG_REGISTER_CHANNEL_RESPONSE = 0x0421, // B error, W id, S name, S topic
CPMSG_CHANNEL_EVENT = 0x0430, // W channel, B event, S info
PCMSG_ENTER_CHANNEL = 0x0440, // S channel, S password
CPMSG_ENTER_CHANNEL_RESPONSE = 0x0441, // B error, W id, S name, S topic, S userlist