summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/net/guildhandler.cpp27
-rw-r--r--src/net/guildhandler.h8
3 files changed, 25 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 9479626b..0df6b3fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-06 David Athay <ko2fan@gmail.com>
+
+ * src/net/guildhandler.cpp, src/net/guildhandler.hpp: Fixed
+ rejoining guilds after quitting.
+
2008-03-05 David Athay <ko2fan@gmail.com>
* src/game.cpp, src/gui/guildwindow.cpp: Fixed key presses during
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