summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-04-16 10:10:50 -0600
committerJared Adams <jaxad0127@gmail.com>2009-04-16 10:10:50 -0600
commit736795a624ae5f04b11fa284cb8a4b14579c1766 (patch)
tree6c7c70926959ff23831002a06ea82c17cadc3188 /src/net
parente8dd52d8264cd0eec1f5d32c1f809a164e2d2f59 (diff)
downloadmana-736795a624ae5f04b11fa284cb8a4b14579c1766.tar.gz
mana-736795a624ae5f04b11fa284cb8a4b14579c1766.tar.bz2
mana-736795a624ae5f04b11fa284cb8a4b14579c1766.tar.xz
mana-736795a624ae5f04b11fa284cb8a4b14579c1766.zip
Rehash CommandHandler a bit, it's now fully merged
Tabs can now interract with CommandHandler and define their own commands in a seemless way. Most channel-related commands have been moved into ChannelTab, the close command is now in the WhisperTab, and eAthena's party tab now shows all standard commands.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/chathandler.cpp16
-rw-r--r--src/net/ea/gui/partytab.cpp42
-rw-r--r--src/net/ea/gui/partytab.h5
3 files changed, 26 insertions, 37 deletions
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 997881f8..626f1048 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -200,43 +200,43 @@ void ChatHandler::privateMessage(const std::string &recipient,
void ChatHandler::channelList()
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
void ChatHandler::enterChannel(const std::string &channel,
const std::string &password)
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
void ChatHandler::quitChannel(int channelId)
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
void ChatHandler::sendToChannel(int channelId, const std::string &text)
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
void ChatHandler::userList(const std::string &channel)
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
void ChatHandler::setChannelTopic(int channelId, const std::string &text)
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
void ChatHandler::setUserMode(int channelId, const std::string &name, int mode)
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
void ChatHandler::kickUser(int channelId, const std::string &name)
{
- // TODO
+ localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
} // namespace EAthena
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index 5f6da0f9..e9651af9 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -46,24 +46,20 @@ void PartyTab::handleInput(const std::string &msg)
Net::getPartyHandler()->chat(msg);
}
-void PartyTab::handleCommand(std::string msg)
+void PartyTab::showHelp()
{
- std::string::size_type pos = msg.find(' ');
- std::string type(msg, 0, pos);
- std::string args(msg, pos == std::string::npos ? msg.size() : pos + 1);
+ chatLog(_("/help > Display this help."));
+ chatLog(_("/create > Create a new party"));
+ chatLog(_("/new > Alias of create"));
+ chatLog(_("/invite > Invite a player to your party"));
+ chatLog(_("/leave > Leave the party you are in"));
+}
+bool PartyTab::handleCommand(std::string type, std::string args)
+{
if (type == "help")
{
- if (args == "")
- {
- chatLog(_("-- Help --"));
- chatLog(_("/help > Display this help."));
- chatLog(_("/create > Create a new party"));
- chatLog(_("/new > Alias of create"));
- chatLog(_("/invite > Invite a player to your party"));
- chatLog(_("/leave > Leave the party you are in"));
- }
- else if (args == "create" || args == "new")
+ if (args == "create" || args == "new")
{
chatLog(_("Command: /new <party-name>"));
chatLog(_("Command: /create <party-name>"));
@@ -83,18 +79,8 @@ void PartyTab::handleCommand(std::string msg)
chatLog(_("Command: /leave"));
chatLog(_("This command causes the player to leave the party."));
}
- else if (args == "help")
- {
- chatLog(_("Command: /help"));
- chatLog(_("This command displays a list of all commands available."));
- chatLog(_("Command: /help <command>"));
- chatLog(_("This command displays help on <command>."));
- }
else
- {
- chatLog(_("Unknown command."));
- chatLog(_("Type /help for a list of commands."));
- }
+ return false;
}
else if (type == "create" || type == "new")
{
@@ -121,7 +107,7 @@ void PartyTab::handleCommand(std::string msg)
*/
}
else
- {
- chatLog("Unknown command");
- }
+ return false;
+
+ return true;
}
diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h
index bf9413d0..fac4061b 100644
--- a/src/net/ea/gui/partytab.h
+++ b/src/net/ea/gui/partytab.h
@@ -33,9 +33,12 @@ class PartyTab : public ChatTab
PartyTab();
~PartyTab();
+ void showHelp();
+
+ bool handleCommand(std::string type, std::string args);
+
protected:
void handleInput(const std::string &msg);
- void handleCommand(std::string msg);
};
extern PartyTab *partyTab;