diff options
author | David Athay <ko2fan@gmail.com> | 2008-03-12 10:44:11 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-03-12 10:44:11 +0000 |
commit | 3a275cc81fe9aa1cb6736cdf12211e13e93cf2cf (patch) | |
tree | 7908381183fea865b53814e591aceae17c7a6cc2 /src/net | |
parent | 16e99dc852affbc8b149d35037694dcdd25948e6 (diff) | |
download | mana-client-3a275cc81fe9aa1cb6736cdf12211e13e93cf2cf.tar.gz mana-client-3a275cc81fe9aa1cb6736cdf12211e13e93cf2cf.tar.bz2 mana-client-3a275cc81fe9aa1cb6736cdf12211e13e93cf2cf.tar.xz mana-client-3a275cc81fe9aa1cb6736cdf12211e13e93cf2cf.zip |
Added ability to quit guilds.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/chatserver/guild.cpp | 26 | ||||
-rw-r--r-- | src/net/chatserver/guild.h | 11 | ||||
-rw-r--r-- | src/net/guildhandler.cpp | 14 | ||||
-rw-r--r-- | src/net/guildhandler.h | 2 |
4 files changed, 40 insertions, 13 deletions
diff --git a/src/net/chatserver/guild.cpp b/src/net/chatserver/guild.cpp index 441a52c2..c1114065 100644 --- a/src/net/chatserver/guild.cpp +++ b/src/net/chatserver/guild.cpp @@ -36,9 +36,9 @@ void Net::ChatServer::Guild::createGuild(const std::string &name) { logger->log("Sending PCMSG_GUILD_CREATE"); MessageOut msg(PCMSG_GUILD_CREATE); - + msg.writeString(name); - + Net::ChatServer::connection->send(msg); } @@ -46,10 +46,10 @@ void Net::ChatServer::Guild::invitePlayer(const std::string &name, short guildId { logger->log("Sending PCMSG_GUILD_INVITE"); MessageOut msg(PCMSG_GUILD_INVITE); - + msg.writeInt16(guildId); msg.writeString(name); - + Net::ChatServer::connection->send(msg); } @@ -57,9 +57,9 @@ void Net::ChatServer::Guild::acceptInvite(const std::string &name) { logger->log("Sending PCMSG_GUILD_ACCEPT"); MessageOut msg(PCMSG_GUILD_ACCEPT); - + msg.writeString(name); - + Net::ChatServer::connection->send(msg); } @@ -67,8 +67,18 @@ void Net::ChatServer::Guild::getGuildMembers(short guildId) { logger->log("Sending PCMSG_GUILD_GET_MEMBERS"); MessageOut msg(PCMSG_GUILD_GET_MEMBERS); - + msg.writeInt16(guildId); - + + Net::ChatServer::connection->send(msg); +} + +void Net::ChatServer::Guild::quitGuild(short guildId) +{ + logger->log("Sending PCMSG_GUILD_QUIT"); + MessageOut msg(PCMSG_GUILD_QUIT); + + msg.writeInt16(guildId); + Net::ChatServer::connection->send(msg); } diff --git a/src/net/chatserver/guild.h b/src/net/chatserver/guild.h index 849cd0a4..5800c738 100644 --- a/src/net/chatserver/guild.h +++ b/src/net/chatserver/guild.h @@ -37,21 +37,26 @@ namespace Net * Create guild. */ void createGuild(const std::string &name); - + /** * Invite a player to your guild. */ void invitePlayer(const std::string &name, short guildId); - + /** * Accept an invite another player has sent to join their guild. */ void acceptInvite(const std::string &name); - + /** * Get a list of members in a guild. */ void getGuildMembers(short guildId); + + /** + * Quit guild. + */ + void quitGuild(short guildId); } } } diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index 88528584..0b36f8e4 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -25,8 +25,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE * - * $Id$ + * $Id:$ */ + #include <iostream> #include "guildhandler.h" @@ -53,6 +54,7 @@ GuildHandler::GuildHandler() CPMSG_GUILD_LEFT, CPMSG_GUILD_INVITED, CPMSG_GUILD_REJOIN, + CPMSG_GUILD_QUIT_RESPONSE, 0 }; handledMessages = _messages; @@ -131,6 +133,16 @@ void GuildHandler::handleMessage(MessageIn &msg) joinedGuild(msg); } break; + + case CPMSG_GUILD_QUIT_RESPONSE: + { + logger->log("Received CPMSG_GUILD_QUIT_RESPONSE"); + + if (msg.readInt8() == ERRMSG_OK) + { + guildWindow->removeTab(); + } + } break; } } diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index 5ac0a52e..ec5780fc 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE * - * $Id$ + * $Id:$ */ #ifndef _TMW_NET_GUILDHANDLER_H |