summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-03-06 15:07:47 +0000
committerDavid Athay <ko2fan@gmail.com>2008-03-06 15:07:47 +0000
commit15014d358424bf5f74a2d9b7afd08692b591a448 (patch)
tree9c360d9cf5ff69b572ef8387ba00230fb1d7de63 /src/net
parent431a0b17e7eee6b27f98b74f4d073f2131a089dd (diff)
downloadmana-15014d358424bf5f74a2d9b7afd08692b591a448.tar.gz
mana-15014d358424bf5f74a2d9b7afd08692b591a448.tar.bz2
mana-15014d358424bf5f74a2d9b7afd08692b591a448.tar.xz
mana-15014d358424bf5f74a2d9b7afd08692b591a448.zip
Fixed rejoining guilds after closing client
Diffstat (limited to 'src/net')
-rw-r--r--src/net/guildhandler.cpp27
-rw-r--r--src/net/guildhandler.h8
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