diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/guildhandler.cpp | 27 | ||||
-rw-r--r-- | src/net/guildhandler.h | 8 |
2 files changed, 20 insertions, 15 deletions
diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index 5bacaaa1..88528584 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -37,6 +37,7 @@ #include "chatserver/guild.h" #include "../gui/guildwindow.h" +#include "../gui/chat.h" #include "../guild.h" #include "../log.h" #include "../localplayer.h" @@ -67,10 +68,8 @@ void GuildHandler::handleMessage(MessageIn &msg) logger->log("Received CPMSG_GUILD_CREATE_RESPONSE"); if(msg.readInt8() == ERRMSG_OK) { - short guildId = msg.readInt16(); - std::string guildName = msg.readString(); // TODO - Acknowledge guild was created - joinedGuild(guildId, guildName, true); + joinedGuild(msg); } } break; @@ -89,9 +88,7 @@ void GuildHandler::handleMessage(MessageIn &msg) if(msg.readInt8() == ERRMSG_OK) { // TODO - Acknowledge accepted into guild - short guildId = msg.readInt16(); - std::string guildName = msg.readString(); - joinedGuild(guildId, guildName, false); + joinedGuild(msg); } } break; @@ -131,20 +128,28 @@ void GuildHandler::handleMessage(MessageIn &msg) case CPMSG_GUILD_REJOIN: { logger->log("Received CPMSG_GUILD_REJOIN"); - std::string guildName = msg.readString(); - short guildId = msg.readInt16(); - bool leader = msg.readInt8(); - joinedGuild(guildId, guildName, leader); + joinedGuild(msg); } break; } } -void GuildHandler::joinedGuild(short guildId, const std::string &guildName, bool leader) +void GuildHandler::joinedGuild(MessageIn &msg) { + std::string guildName = msg.readString(); + short guildId = msg.readInt16(); + bool leader = msg.readInt8(); + short channelId = msg.readInt16(); + // Add guild to player and create new guild tab Guild *guild = player_node->addGuild(guildId, leader); guild->setName(guildName); guildWindow->newGuildTab(guildName); guildWindow->requestMemberList(guildId); + + // Automatically create the guild channel + // COMMENT: Should this go here?? + chatWindow->addChannel(channelId, guildName); + chatWindow->createNewChannelTab(guildName); + chatWindow->chatLog("Guild Channel", BY_SERVER, guildName); } diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index c76682b2..5ac0a52e 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -3,7 +3,7 @@ * A file part of The Mana World * * Created by David Athay on 01/03/2007. - * + * * Copyright (c) 2007, The Mana World Development Team * All rights reserved. * @@ -39,11 +39,11 @@ class GuildHandler : public MessageHandler { public: GuildHandler(); - + void handleMessage(MessageIn &msg); - + protected: - void joinedGuild(short guildId, const std::string &guildName, bool leader); + void joinedGuild(MessageIn &msg); }; #endif |