diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-26 09:42:43 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-26 09:42:43 -0600 |
commit | 9e4a8ea095a1a0613d7b128f4e29c69643137b07 (patch) | |
tree | 82dfb0a17dfc3439554efc77a3d18bf5165cebc3 /src/net/tmwserv | |
parent | cdcadf6e99a6deaa5b929cdec9736ab1fb280f65 (diff) | |
download | mana-client-9e4a8ea095a1a0613d7b128f4e29c69643137b07.tar.gz mana-client-9e4a8ea095a1a0613d7b128f4e29c69643137b07.tar.bz2 mana-client-9e4a8ea095a1a0613d7b128f4e29c69643137b07.tar.xz mana-client-9e4a8ea095a1a0613d7b128f4e29c69643137b07.zip |
Add ChannelTab for chat channels
This fixes TMWServ compilation form the previous commit.
Diffstat (limited to 'src/net/tmwserv')
-rw-r--r-- | src/net/tmwserv/chathandler.cpp | 15 | ||||
-rw-r--r-- | src/net/tmwserv/guildhandler.cpp | 8 |
2 files changed, 14 insertions, 9 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()); } } diff --git a/src/net/tmwserv/guildhandler.cpp b/src/net/tmwserv/guildhandler.cpp index b3ddec6c..5927f175 100644 --- a/src/net/tmwserv/guildhandler.cpp +++ b/src/net/tmwserv/guildhandler.cpp @@ -28,8 +28,9 @@ #include "chatserver/chatserver.h" #include "chatserver/guild.h" -#include "../../gui/guildwindow.h" +#include "../../gui/widgets/channeltab.h" #include "../../gui/chat.h" +#include "../../gui/guildwindow.h" #include "../../guild.h" #include "../../log.h" #include "../../localplayer.h" @@ -208,7 +209,8 @@ void GuildHandler::handleMessage(MessageIn &msg) Guild *guild = player_node->getGuild(guildId); if (guild) { - chatWindow->removeChannel(guild->getName()); + Channel *channel = channelManager->findByName(guild->getName()); + chatWindow->removeTab(channel->getTab()); guildWindow->removeTab(guildId); player_node->removeGuild(guildId); } @@ -235,6 +237,6 @@ void GuildHandler::joinedGuild(MessageIn &msg) // COMMENT: Should this go here?? Channel *channel = new Channel(channelId, guildName, announcement); channelManager->addChannel(channel); - chatWindow->createNewChannelTab(guildName); + chatWindow->addTab(new ChannelTab(channel)); chatWindow->chatLog("Topic: " + announcement, BY_CHANNEL, guildName); } |