summaryrefslogtreecommitdiff
path: root/src/net/tmwserv/chathandler.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/net/tmwserv/chathandler.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/net/tmwserv/chathandler.cpp')
-rw-r--r--src/net/tmwserv/chathandler.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/net/tmwserv/chathandler.cpp b/src/net/tmwserv/chathandler.cpp
index 2dfb4b5e..5a0730a6 100644
--- a/src/net/tmwserv/chathandler.cpp
+++ b/src/net/tmwserv/chathandler.cpp
@@ -21,7 +21,7 @@
#include "chathandler.h"
-#include <SDL_types.h>
+//#include <SDL_types.h>
#include <string>
#include <iostream>
@@ -34,6 +34,7 @@
#include "../../channel.h"
#include "../../channelmanager.h"
+#include "../../gui/widgets/channeltab.h"
#include "../../gui/chat.h"
#include "../../gui/guildwindow.h"
@@ -131,7 +132,7 @@ void ChatHandler::handleEnterChannelResponse(MessageIn &msg)
std::string announcement = msg.readString();
Channel *channel = new Channel(channelId, channelName, announcement);
channelManager->addChannel(channel);
- chatWindow->createNewChannelTab(channelName);
+ chatWindow->addTab(new ChannelTab(channel));
chatWindow->chatLog("Topic: " + announcement, BY_CHANNEL, channelName);
std::string user;
@@ -181,8 +182,8 @@ void ChatHandler::handlePrivateMessage(MessageIn &msg)
if (!chatWindow->tabExists(userNick))
{
- chatWindow->createNewChannelTab(userNick);
-
+ // TODO: proper whisper tabs
+ //chatWindow->createNewChannelTab(userNick);
}
chatWindow->chatLog(userNick + ": " + chatMsg, BY_OTHER, userNick);
}
@@ -199,7 +200,8 @@ void ChatHandler::handleChatMessage(MessageIn &msg)
std::string userNick = msg.readString();
std::string chatMsg = msg.readString();
- chatWindow->sendToChannel(channelId, userNick, chatMsg);
+ Channel *channel = channelManager->findById(channelId);
+ channel->getTab()->chatLog(userNick, chatMsg);
}
void ChatHandler::handleQuitChannelResponse(MessageIn &msg)
@@ -207,8 +209,9 @@ void ChatHandler::handleQuitChannelResponse(MessageIn &msg)
if(msg.readInt8() == ERRMSG_OK)
{
short channelId = msg.readInt16();
+ Channel *channel = channelManager->findById(channelId);
// remove the chat tab
- chatWindow->removeChannel(channelId);
+ chatWindow->removeTab(channel->getTab());
}
}