diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-04-16 22:17:20 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-04-19 19:11:59 +0200 |
commit | e9eda63dcad0b842d637c13e415ef4f751ea2adf (patch) | |
tree | e92b8580a4027cdb8893e628e93d3bcd80790675 /src/net/manaserv/guildhandler.cpp | |
parent | 0a9bcdc30ce9db0e53da02211ec548f529245c99 (diff) | |
download | mana-e9eda63dcad0b842d637c13e415ef4f751ea2adf.tar.gz mana-e9eda63dcad0b842d637c13e415ef4f751ea2adf.tar.bz2 mana-e9eda63dcad0b842d637c13e415ef4f751ea2adf.tar.xz mana-e9eda63dcad0b842d637c13e415ef4f751ea2adf.zip |
Client side fix for manaserv guild system
- kick code untested because no kick button exists yet
Reviewed-by: bjorn.
Diffstat (limited to 'src/net/manaserv/guildhandler.cpp')
-rw-r--r-- | src/net/manaserv/guildhandler.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index a8e662ec..1378d205 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -62,6 +62,7 @@ GuildHandler::GuildHandler() CPMSG_GUILD_INVITED, CPMSG_GUILD_REJOIN, CPMSG_GUILD_QUIT_RESPONSE, + CPMSG_GUILD_KICK_NOTIFICATION, 0 }; handledMessages = _messages; @@ -91,11 +92,20 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) case CPMSG_GUILD_INVITE_RESPONSE: { logger->log("Received CPMSG_GUILD_INVITE_RESPONSE"); - if (msg.readInt8() == ERRMSG_OK) + const unsigned char response = msg.readInt8(); + if (response == ERRMSG_OK) { // TODO - Acknowledge invite was sent SERVER_NOTICE(_("Invite sent.")) } + else if (response == ERRMSG_ALREADY_MEMBER) + { + SERVER_NOTICE(_("Invited player is already in that guild.")); + } + else if (response == ERRMSG_LIMIT_REACHED) + { + SERVER_NOTICE(_("Invited player can't join another guild.")); + } } break; case CPMSG_GUILD_ACCEPT_RESPONSE: @@ -235,6 +245,23 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) } } } break; + case CPMSG_GUILD_KICK_NOTIFICATION: + { + logger->log("Received CPMSG_GUILD_KICK_NOTIFICATION"); + + const int guildId = msg.readInt16(); + std::string player = msg.readString(); + Guild *guild = local_player->getGuild(guildId); + if (guild) + { + Channel *channel = channelManager->findByName(guild->getName()); + channelManager->removeChannel(channel); + local_player->removeGuild(guildId); + SERVER_NOTICE(strprintf( + _("Player %s kicked you out of guild %s"), + player.c_str(), guild->getName().c_str())); + } + } break; } } @@ -283,9 +310,10 @@ void GuildHandler::invite(int guildId, Being *being) void GuildHandler::inviteResponse(int guildId, bool response) { - /*MessageOut msg(PCMSG_GUILD_ACCEPT); - msg.writeString(name); - chatServerConnection->send(msg);*/ + MessageOut msg(PCMSG_GUILD_ACCEPT); + msg.writeInt16(guildId); + msg.writeInt8(response ? 1 : 0); + chatServerConnection->send(msg); } void GuildHandler::leave(int guildId) |