summaryrefslogtreecommitdiff
path: root/src/net/chatserver
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-02-28 12:31:04 +0000
committerDavid Athay <ko2fan@gmail.com>2008-02-28 12:31:04 +0000
commitfb3cbeddd6f5d59e3f83da059b2a1d4bed2cb80f (patch)
tree65e3086f341bb92154e99806f3b6255d9696ed4b /src/net/chatserver
parentac2de5e0bd7dfc79e344b6724ee6a13db9994aa4 (diff)
downloadmana-client-fb3cbeddd6f5d59e3f83da059b2a1d4bed2cb80f.tar.gz
mana-client-fb3cbeddd6f5d59e3f83da059b2a1d4bed2cb80f.tar.bz2
mana-client-fb3cbeddd6f5d59e3f83da059b2a1d4bed2cb80f.tar.xz
mana-client-fb3cbeddd6f5d59e3f83da059b2a1d4bed2cb80f.zip
Work in Progress commit of guilds.
Diffstat (limited to 'src/net/chatserver')
-rw-r--r--src/net/chatserver/guild.cpp74
-rw-r--r--src/net/chatserver/guild.h60
2 files changed, 134 insertions, 0 deletions
diff --git a/src/net/chatserver/guild.cpp b/src/net/chatserver/guild.cpp
new file mode 100644
index 00000000..441a52c2
--- /dev/null
+++ b/src/net/chatserver/guild.cpp
@@ -0,0 +1,74 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+
+#include "guild.h"
+
+#include "internal.h"
+
+#include "../connection.h"
+#include "../messageout.h"
+#include "../protocol.h"
+
+#include "../../log.h"
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
diff --git a/src/net/chatserver/guild.h b/src/net/chatserver/guild.h
new file mode 100644
index 00000000..849cd0a4
--- /dev/null
+++ b/src/net/chatserver/guild.h
@@ -0,0 +1,60 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+
+#ifndef _TMW_NET_CHATSERVER_GUILD_H
+#define _TMW_NET_CHATSERVER_GUILD_H
+
+#include <iosfwd>
+
+namespace Net
+{
+ namespace ChatServer
+ {
+ namespace Guild
+ {
+ /**
+ * 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);
+ }
+ }
+}
+
+#endif
+