diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-16 10:10:50 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-16 10:10:50 -0600 |
commit | 736795a624ae5f04b11fa284cb8a4b14579c1766 (patch) | |
tree | 6c7c70926959ff23831002a06ea82c17cadc3188 /src/gui/widgets/channeltab.cpp | |
parent | e8dd52d8264cd0eec1f5d32c1f809a164e2d2f59 (diff) | |
download | mana-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/gui/widgets/channeltab.cpp')
-rw-r--r-- | src/gui/widgets/channeltab.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/gui/widgets/channeltab.cpp b/src/gui/widgets/channeltab.cpp index edc0473c..0bafc10f 100644 --- a/src/gui/widgets/channeltab.cpp +++ b/src/gui/widgets/channeltab.cpp @@ -26,6 +26,8 @@ #include "net/chathandler.h" #include "net/net.h" +#include "utils/gettext.h" + ChannelTab::ChannelTab(Channel *channel) : ChatTab(channel->getName()), mChannel(channel) { @@ -39,3 +41,88 @@ ChannelTab::~ChannelTab() void ChannelTab::handleInput(const std::string &msg) { Net::getChatHandler()->sendToChannel(getChannel()->getId(), msg); } + +void ChannelTab::showHelp() +{ + chatLog(_("/users > Lists the users in the current channel")); + chatLog(_("/topic > Set the topic of the current channel")); + chatLog(_("/quit > Leave a channel")); + chatLog(_("/op > Make a user a channel operator")); + chatLog(_("/kick > Kick a user from the channel")); +} + +bool ChannelTab::handleCommand(std::string type, std::string args) +{ + if (type == "help") + { + if (args == "users") + { + chatLog(_("Command: /users")); + chatLog(_("This command shows the users in this channel.")); + } + else if (args == "topic") + { + chatLog(_("Command: /topic <message>")); + chatLog(_("This command sets the topic to <message>.")); + } + else if (args == "quit") + { + chatLog(_("Command: /quit")); + chatLog(_("This command leaves the current channel.")); + chatLog(_("If you're the last person in the channel, it will be deleted.")); + } + else if (args == "op") + { + chatLog(_("Command: /op <nick>")); + chatLog(_("This command makes <nick> a channel operator.")); + chatLog(_("If the <nick> has spaces in it, enclose it in " + "double quotes (\").")); + chatLog(_("Channel operators can kick and op other users " + "from the channel.")); + } + else if (args == "kick") + { + chatLog(_("Command: /kick <nick>")); + chatLog(_("This command makes <nick> leave the channel.")); + chatLog(_("If the <nick> has spaces in it, enclose it in " + "double quotes (\").")); + } + else + return false; + } + else if (type == "users") + { + Net::getChatHandler()->userList(mChannel->getName()); + } + else if (type == "topic") + { + Net::getChatHandler()->setChannelTopic(mChannel->getId(), args); + } + else if (type == "topic") + { + Net::getChatHandler()->setChannelTopic(mChannel->getId(), args); + } + else if (type == "quit") + { + Net::getChatHandler()->quitChannel(mChannel->getId()); + } + else if (type == "op") + { + // set the user mode 'o' to op a user + if (args != "") + Net::getChatHandler()->setUserMode(mChannel->getId(), args, 'o'); + else + chatLog(_("Need a user to op!"), BY_CHANNEL); + } + else if (type == "kick") + { + if (args != "") + Net::getChatHandler()->kickUser(mChannel->getId(), args); + else + chatLog(_("Need a user to kick!"), BY_CHANNEL); + } + else + return false; + + return true; +} |