summaryrefslogtreecommitdiff
path: root/src/commandhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-26 09:42:43 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-26 09:42:43 -0600
commit9e4a8ea095a1a0613d7b128f4e29c69643137b07 (patch)
tree82dfb0a17dfc3439554efc77a3d18bf5165cebc3 /src/commandhandler.cpp
parentcdcadf6e99a6deaa5b929cdec9736ab1fb280f65 (diff)
downloadmana-9e4a8ea095a1a0613d7b128f4e29c69643137b07.tar.gz
mana-9e4a8ea095a1a0613d7b128f4e29c69643137b07.tar.bz2
mana-9e4a8ea095a1a0613d7b128f4e29c69643137b07.tar.xz
mana-9e4a8ea095a1a0613d7b128f4e29c69643137b07.zip
Add ChannelTab for chat channels
This fixes TMWServ compilation form the previous commit.
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r--src/commandhandler.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index e5f26444..1156cb38 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -26,6 +26,7 @@
#include "game.h"
#include "localplayer.h"
+#include "gui/widgets/channeltab.h"
#include "gui/chat.h"
#ifdef TMWSERV_SUPPORT
@@ -410,12 +411,14 @@ void CommandHandler::handleListChannels()
void CommandHandler::handleListUsers()
{
- Net::ChatServer::getUserList(chatWindow->getFocused());
+ Net::ChatServer::getUserList(chatWindow->getFocused()->getCaption());
}
void CommandHandler::handleTopic(const std::string &args)
{
- if (Channel *channel = channelManager->findByName(chatWindow->getFocused()))
+ ChannelTab *tab = dynamic_cast<ChannelTab*>(chatWindow->getFocused());
+ Channel *channel = tab ? tab->getChannel() : NULL;
+ if (channel)
{
Net::ChatServer::setChannelTopic(channel->getId(), args);
}
@@ -427,7 +430,9 @@ void CommandHandler::handleTopic(const std::string &args)
void CommandHandler::handleQuit()
{
- if (Channel *channel = channelManager->findByName(chatWindow->getFocused()))
+ ChannelTab *tab = dynamic_cast<ChannelTab*>(chatWindow->getFocused());
+ Channel *channel = tab ? tab->getChannel() : NULL;
+ if (channel)
{
Net::ChatServer::quitChannel(channel->getId());
}
@@ -439,7 +444,9 @@ void CommandHandler::handleQuit()
void CommandHandler::handleOp(const std::string &args)
{
- if (Channel *channel = channelManager->findByName(chatWindow->getFocused()))
+ ChannelTab *tab = dynamic_cast<ChannelTab*>(chatWindow->getFocused());
+ Channel *channel = tab ? tab->getChannel() : NULL;
+ if (channel)
{
// set the user mode 'o' to op a user
if (args != "")
@@ -455,7 +462,9 @@ void CommandHandler::handleOp(const std::string &args)
void CommandHandler::handleKick(const std::string &args)
{
- if (Channel *channel = channelManager->findByName(chatWindow->getFocused()))
+ ChannelTab *tab = dynamic_cast<ChannelTab*>(chatWindow->getFocused());
+ Channel *channel = tab ? tab->getChannel() : NULL;
+ if (channel)
{
if (args != "")
{