diff options
author | David Athay <ko2fan@gmail.com> | 2008-08-13 15:28:07 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-08-13 15:28:07 +0000 |
commit | b9d9ae443874efd4968a6efcf5ce050f213c497b (patch) | |
tree | 453d80d3e1d251efb60968c36023413cb4faf452 /src/commandhandler.cpp | |
parent | 47247ac4e2f0860a34106f4b69049d91003ced29 (diff) | |
download | mana-b9d9ae443874efd4968a6efcf5ce050f213c497b.tar.gz mana-b9d9ae443874efd4968a6efcf5ce050f213c497b.tar.bz2 mana-b9d9ae443874efd4968a6efcf5ce050f213c497b.tar.xz mana-b9d9ae443874efd4968a6efcf5ce050f213c497b.zip |
Added permission levels to guilds, and operator permissions to channels.
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r-- | src/commandhandler.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 8e6003f9..7ec48f46 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -89,6 +89,10 @@ void CommandHandler::handleCommand(const std::string &command) { handleParty(args); } + else if (type == "op") + { + handleOp(args); + } else { chatWindow->chatLog("Unknown command"); @@ -161,6 +165,13 @@ void CommandHandler::handleHelp(const std::string &args) chatWindow->chatLog("This command makes you enter <channel>."); chatWindow->chatLog("If <channel> doesn't exist, it's created."); } + else if (args == "kick") + { + chatWindow->chatLog("Command: /kick <nick>"); + chatWindow->chatLog("This command makes <nick> leave the channel."); + chatWindow->chatLog("If the <nick> has spaces in it, enclose it in " + "double quotes (\")."); + } else if (args == "list") { chatWindow->chatLog("Command: /list"); @@ -173,6 +184,15 @@ void CommandHandler::handleHelp(const std::string &args) chatWindow->chatLog("If the <nick> has spaces in it, enclose it in " "double quotes (\")."); } + else if (args == "op") + { + chatWindow->chatLog("Command: /op <nick>"); + chatWindow->chatLog("This command makes <nick> a channel operator."); + chatWindow->chatLog("If the <nick> has spaces in it, enclose it in " + "double quotes (\")."); + chatWindow->chatLog("Channel operators can kick and op other users " + "from the channel."); + } else if (args == "party") { chatWindow->chatLog("Command: /party <nick>"); @@ -287,3 +307,34 @@ void CommandHandler::handleParty(const std::string &args) player_node->inviteToParty(args); } } + +void CommandHandler::handleOp(const std::string &args) +{ + if (Channel *channel = channelManager->findByName(chatWindow->getFocused())) + { + // set the user mode 'o' to op a user + if (args != "") + { + Net::ChatServer::setUserMode(channel->getId(), args, 'o'); + } + } + else + { + chatWindow->chatLog("Unable to set this user's mode", BY_CHANNEL); + } +} + +void CommandHandler::handleKick(const std::string &args) +{ + if (Channel *channel = channelManager->findByName(chatWindow->getFocused())) + { + if (args != "") + { + Net::ChatServer::kickUser(channel->getId(), args); + } + } + else + { + chatWindow->chatLog("Unable to kick user", BY_CHANNEL); + } +} |