summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/adminhandler.h20
-rw-r--r--src/net/chathandler.h5
-rw-r--r--src/net/ea/adminhandler.cpp16
-rw-r--r--src/net/ea/adminhandler.h4
-rw-r--r--src/net/ea/chathandler.cpp11
-rw-r--r--src/net/ea/chathandler.h9
-rw-r--r--src/net/ea/maphandler.cpp6
-rw-r--r--src/net/ea/maphandler.h4
-rw-r--r--src/net/net.cpp18
-rw-r--r--src/net/tmwserv/adminhandler.cpp85
-rw-r--r--src/net/tmwserv/adminhandler.h57
-rw-r--r--src/net/tmwserv/chathandler.cpp64
-rw-r--r--src/net/tmwserv/chathandler.h31
-rw-r--r--src/net/tmwserv/maphandler.cpp58
-rw-r--r--src/net/tmwserv/maphandler.h47
15 files changed, 404 insertions, 31 deletions
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index c6073b4f..ee046323 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -28,25 +28,25 @@ namespace Net {
class AdminHandler
{
public:
- virtual void announce(const std::string &text) {}
+ virtual void announce(const std::string &text) = 0;
- virtual void localAnnounce(const std::string &text) {}
+ virtual void localAnnounce(const std::string &text) = 0;
- virtual void hide(bool hide) {}
+ virtual void hide(bool hide) = 0;
- virtual void kick(int playerId) {}
+ virtual void kick(int playerId) = 0;
- virtual void kick(const std::string &name) {}
+ virtual void kick(const std::string &name) = 0;
- virtual void ban(int playerId) {}
+ virtual void ban(int playerId) = 0;
- virtual void ban(const std::string &name) {}
+ virtual void ban(const std::string &name) = 0;
- virtual void unban(int playerId) {}
+ virtual void unban(int playerId) = 0;
- virtual void unban(const std::string &name) {}
+ virtual void unban(const std::string &name) = 0;
- virtual void mute(int playerId, int type, int limit) {}
+ virtual void mute(int playerId, int type, int limit) = 0;
// TODO
};
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index 56707cd2..20feee58 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -37,13 +37,14 @@ class ChatHandler
virtual void channelList() = 0;
- virtual void enterChannel(int channelId, const std::string &password) = 0;
+ virtual void enterChannel(const std::string &channel,
+ const std::string &password) = 0;
virtual void quitChannel(int channelId) = 0;
virtual void sendToChannel(int channelId, const std::string &text) = 0;
- virtual void userList(int channelId) = 0;
+ virtual void userList(const std::string &channel) = 0;
virtual void setChannelTopic(int channelId, const std::string &text) = 0;
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 04c946c0..c84cdea3 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -40,7 +40,11 @@
#include <string>
-AdminHandler *adminHandler;
+extern Net::ChatHandler *chatHandler;
+
+Net::AdminHandler *adminHandler;
+
+namespace EAthena {
AdminHandler::AdminHandler()
{
@@ -99,7 +103,9 @@ void AdminHandler::kick(const std::string &name)
}
void AdminHandler::ban(int playerId)
-{}
+{
+ // Not supported
+}
void AdminHandler::ban(const std::string &name)
{
@@ -107,7 +113,9 @@ void AdminHandler::ban(const std::string &name)
}
void AdminHandler::unban(int playerId)
-{}
+{
+ // Not supported
+}
void AdminHandler::unban(const std::string &name)
{
@@ -123,3 +131,5 @@ void AdminHandler::mute(int playerId, int type, int limit)
outMsg.writeInt8(type);
outMsg.writeInt16(limit);
}
+
+} // namespace EAthena
diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h
index a7db0113..6ef4f76a 100644
--- a/src/net/ea/adminhandler.h
+++ b/src/net/ea/adminhandler.h
@@ -26,6 +26,8 @@
#include "net/messagehandler.h"
#include "net/net.h"
+namespace EAthena {
+
class AdminHandler : public MessageHandler, public Net::AdminHandler
{
public:
@@ -54,6 +56,6 @@ class AdminHandler : public MessageHandler, public Net::AdminHandler
void mute(int playerId, int type, int limit);
};
-extern AdminHandler *adminHandler;
+} // namespace EAthena
#endif // NET_EA_ADMINHANDLER_H
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 3abf2b24..13593ed1 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -42,7 +42,9 @@
#define SERVER_NAME "Server"
-ChatHandler *chatHandler;
+Net::ChatHandler *chatHandler;
+
+namespace EAthena {
ChatHandler::ChatHandler()
{
@@ -201,7 +203,8 @@ void ChatHandler::channelList()
// TODO
}
-void ChatHandler::enterChannel(int channelId, const std::string &password)
+void ChatHandler::enterChannel(const std::string &channel,
+ const std::string &password)
{
// TODO
}
@@ -216,7 +219,7 @@ void ChatHandler::sendToChannel(int channelId, const std::string &text)
// TODO
}
-void ChatHandler::userList(int channelId)
+void ChatHandler::userList(const std::string &channel)
{
// TODO
}
@@ -235,3 +238,5 @@ void ChatHandler::kickUser(int channelId, const std::string &name)
{
// TODO
}
+
+} // namespace EAthena
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index 6ca71b80..a907535e 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -26,6 +26,8 @@
#include "net/messagehandler.h"
#include "net/net.h"
+namespace EAthena {
+
class ChatHandler : public MessageHandler, public Net::ChatHandler
{
public:
@@ -42,13 +44,14 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler
void channelList();
- void enterChannel(int channelId, const std::string &password);
+ void enterChannel(const std::string &channel,
+ const std::string &password);
void quitChannel(int channelId);
void sendToChannel(int channelId, const std::string &text);
- void userList(int channelId);
+ void userList(const std::string &channel);
void setChannelTopic(int channelId, const std::string &text);
@@ -57,6 +60,6 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler
void kickUser(int channelId, const std::string &name);
};
-extern ChatHandler *chatHandler;
+} // namespace EAthena
#endif // NET_EA_CHATHANDLER_H
diff --git a/src/net/ea/maphandler.cpp b/src/net/ea/maphandler.cpp
index d12106d6..6912176f 100644
--- a/src/net/ea/maphandler.cpp
+++ b/src/net/ea/maphandler.cpp
@@ -35,7 +35,9 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
-MapHandler *mapHandler;
+Net::MapHandler *mapHandler;
+
+namespace EAthena {
MapHandler::MapHandler()
{
@@ -127,3 +129,5 @@ void MapHandler::ping(int tick)
MessageOut msg(CMSG_CLIENT_PING);
msg.writeInt32(tick);
}
+
+} // namespace EAthena
diff --git a/src/net/ea/maphandler.h b/src/net/ea/maphandler.h
index d4ccdbe2..205ee18d 100644
--- a/src/net/ea/maphandler.h
+++ b/src/net/ea/maphandler.h
@@ -26,6 +26,8 @@
#include "net/messagehandler.h"
#include "net/net.h"
+namespace EAthena {
+
class MapHandler : public MessageHandler, public Net::MapHandler
{
public:
@@ -44,6 +46,6 @@ class MapHandler : public MessageHandler, public Net::MapHandler
void ping(int tick);
};
-extern MapHandler *mapHandler;
+} // namespace EAthena
#endif // NET_EA_MAPHANDLER_H
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 2d894119..255b6ab9 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -35,9 +35,15 @@
#include "net/skillhandler.h"
#include "net/tradehandler.h"
+#include "net/tmwserv/adminhandler.h"
+#include "net/tmwserv/chathandler.h"
#include "net/tmwserv/inventoryhandler.h"
+#include "net/tmwserv/maphandler.h"
#include "net/tmwserv/npchandler.h"
+
+#include "net/ea/adminhandler.h"
#include "net/ea/inventoryhandler.h"
+#include "net/ea/maphandler.h"
#include "net/ea/npchandler.h"
#ifdef TMWSERV_SUPPORT
@@ -48,13 +54,15 @@
#include "net/ea/tradehandler.h"
#endif
+extern Net::AdminHandler *adminHandler;
+extern Net::ChatHandler *chatHandler;
extern Net::InventoryHandler *inventoryHandler;
+extern Net::MapHandler *mapHandler;
extern Net::NpcHandler *npcHandler;
Net::AdminHandler *Net::getAdminHandler()
{
- // TODO
- return 0;
+ return adminHandler;
}
Net::CharHandler *Net::getCharHandler()
@@ -65,8 +73,7 @@ Net::CharHandler *Net::getCharHandler()
Net::ChatHandler *Net::getChatHandler()
{
- // TODO
- return 0;
+ return chatHandler;
}
Net::GeneralHandler *Net::getGeneralHandler()
@@ -94,8 +101,7 @@ Net::LoginHandler *Net::getLoginHandler()
Net::MapHandler *Net::getMapHandler()
{
- // TODO
- return 0;
+ return mapHandler;
}
Net::NpcHandler *Net::getNpcHandler()
diff --git a/src/net/tmwserv/adminhandler.cpp b/src/net/tmwserv/adminhandler.cpp
new file mode 100644
index 00000000..e1e3b074
--- /dev/null
+++ b/src/net/tmwserv/adminhandler.cpp
@@ -0,0 +1,85 @@
+/*
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "net/tmwserv/adminhandler.h"
+
+#include "net/tmwserv/chatserver/chatserver.h"
+
+Net::AdminHandler *adminHandler;
+
+namespace TmwServ {
+
+AdminHandler::AdminHandler()
+{
+ adminHandler = this;
+}
+
+void AdminHandler::announce(const std::string &text)
+{
+ Net::ChatServer::announce(text);
+}
+
+void AdminHandler::localAnnounce(const std::string &text)
+{
+ // TODO
+}
+
+void AdminHandler::hide(bool hide)
+{
+ // TODO
+}
+
+void AdminHandler::kick(int playerId)
+{
+ // TODO
+}
+
+void AdminHandler::kick(const std::string &name)
+{
+ // TODO
+}
+
+void AdminHandler::ban(int playerId)
+{
+ // TODO
+}
+
+void AdminHandler::ban(const std::string &name)
+{
+ // TODO
+}
+
+void AdminHandler::unban(int playerId)
+{
+ // TODO
+}
+
+void AdminHandler::unban(const std::string &name)
+{
+ // TODO
+}
+
+void AdminHandler::mute(int playerId, int type, int limit)
+{
+ // TODO
+}
+
+} // namespace TmwServ
diff --git a/src/net/tmwserv/adminhandler.h b/src/net/tmwserv/adminhandler.h
new file mode 100644
index 00000000..0b83dfce
--- /dev/null
+++ b/src/net/tmwserv/adminhandler.h
@@ -0,0 +1,57 @@
+/*
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef NET_TMWSERV_ADMINHANDLER_H
+#define NET_TMWSERV_ADMINHANDLER_H
+
+#include "net/adminhandler.h"
+
+namespace TmwServ {
+
+class AdminHandler : public Net::AdminHandler
+{
+ public:
+ AdminHandler();
+
+ void announce(const std::string &text);
+
+ void localAnnounce(const std::string &text);
+
+ void hide(bool hide);
+
+ void kick(int playerId);
+
+ void kick(const std::string &name);
+
+ void ban(int playerId);
+
+ void ban(const std::string &name);
+
+ void unban(int playerId);
+
+ void unban(const std::string &name);
+
+ void mute(int playerId, int type, int limit);
+};
+
+} // namespace TmwServ
+
+#endif
diff --git a/src/net/tmwserv/chathandler.cpp b/src/net/tmwserv/chathandler.cpp
index 1c537e30..febffa12 100644
--- a/src/net/tmwserv/chathandler.cpp
+++ b/src/net/tmwserv/chathandler.cpp
@@ -23,6 +23,10 @@
#include "net/tmwserv/protocol.h"
+#include "net/tmwserv/chatserver/chatserver.h"
+
+#include "net/tmwserv/gameserver/player.h"
+
#include "net/messagein.h"
#include "being.h"
@@ -42,6 +46,10 @@
extern Being *player_node;
+Net::ChatHandler *chatHandler;
+
+namespace TmwServ {
+
ChatHandler::ChatHandler()
{
static const Uint16 _messages[] = {
@@ -283,3 +291,59 @@ void ChatHandler::handleChannelEvent(MessageIn &msg)
}
}
+void ChatHandler::talk(const std::string &text)
+{
+ Net::GameServer::Player::say(text);
+}
+
+void ChatHandler::me(const std::string &text)
+{
+ // TODO
+}
+
+void ChatHandler::privateMessage(const std::string &recipient, const std::string &text)
+{
+ Net::ChatServer::privMsg(recipient, text);
+}
+
+void ChatHandler::channelList()
+{
+ Net::ChatServer::getChannelList();
+}
+
+void ChatHandler::enterChannel(const std::string &channel, const std::string &password)
+{
+ Net::ChatServer::enterChannel(channel, password);
+}
+
+void ChatHandler::quitChannel(int channelId)
+{
+ Net::ChatServer::quitChannel(channelId);
+}
+
+void ChatHandler::sendToChannel(int channelId, const std::string &text)
+{
+ Net::ChatServer::chat(channelId, text);
+}
+
+void ChatHandler::userList(const std::string &channel)
+{
+ Net::ChatServer::getUserList(channel);
+}
+
+void ChatHandler::setChannelTopic(int channelId, const std::string &text)
+{
+ Net::ChatServer::setChannelTopic(channelId, text);
+}
+
+void ChatHandler::setUserMode(int channelId, const std::string &name, int mode)
+{
+ Net::ChatServer::setUserMode(channelId, name, mode);
+}
+
+void ChatHandler::kickUser(int channelId, const std::string &name)
+{
+ Net::ChatServer::kickUser(channelId, name);
+}
+
+} // namespace TmwServ
diff --git a/src/net/tmwserv/chathandler.h b/src/net/tmwserv/chathandler.h
index f0604da8..05f5243d 100644
--- a/src/net/tmwserv/chathandler.h
+++ b/src/net/tmwserv/chathandler.h
@@ -22,9 +22,12 @@
#ifndef NET_TMWSERV_CHATHANDLER_H
#define NET_TMWSERV_CHATHANDLER_H
+#include "net/chathandler.h"
#include "net/messagehandler.h"
-class ChatHandler : public MessageHandler
+namespace TmwServ {
+
+class ChatHandler : public MessageHandler, public Net::ChatHandler
{
public:
ChatHandler();
@@ -33,6 +36,30 @@ class ChatHandler : public MessageHandler
* Handle the given message appropriately.
*/
void handleMessage(MessageIn &msg);
+
+ void talk(const std::string &text);
+
+ void me(const std::string &text);
+
+ void privateMessage(const std::string &recipient,
+ const std::string &text);
+
+ void channelList();
+
+ void enterChannel(const std::string &channel,
+ const std::string &password);
+
+ void quitChannel(int channelId);
+
+ void sendToChannel(int channelId, const std::string &text);
+
+ void userList(const std::string &channel);
+
+ void setChannelTopic(int channelId, const std::string &text);
+
+ void setUserMode(int channelId, const std::string &name, int mode);
+
+ void kickUser(int channelId, const std::string &name);
private:
/**
@@ -81,4 +108,6 @@ class ChatHandler : public MessageHandler
void handleChannelEvent(MessageIn &msg);
};
+} // namespace TmwServ
+
#endif
diff --git a/src/net/tmwserv/maphandler.cpp b/src/net/tmwserv/maphandler.cpp
new file mode 100644
index 00000000..bbdb873e
--- /dev/null
+++ b/src/net/tmwserv/maphandler.cpp
@@ -0,0 +1,58 @@
+/*
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "net/tmwserv/maphandler.h"
+
+Net::MapHandler *mapHandler;
+
+namespace TmwServ {
+
+MapHandler::MapHandler()
+{
+ mapHandler = this;
+}
+
+void MapHandler::connect(LoginData *loginData)
+{
+ // TODO
+}
+
+void MapHandler::mapLoaded(const std::string &mapName)
+{
+ // TODO
+}
+
+void MapHandler::who()
+{
+ // TODO
+}
+
+void MapHandler::quit()
+{
+ // TODO
+}
+
+void MapHandler::ping(int tick)
+{
+ // TODO
+}
+
+} // namespace TmwServ
diff --git a/src/net/tmwserv/maphandler.h b/src/net/tmwserv/maphandler.h
new file mode 100644
index 00000000..649feda6
--- /dev/null
+++ b/src/net/tmwserv/maphandler.h
@@ -0,0 +1,47 @@
+/*
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef NET_TMWSERV_MAPHANDLER_H
+#define NET_TMWSERV_MAPHANDLER_H
+
+#include "net/maphandler.h"
+
+namespace TmwServ {
+
+class MapHandler : public Net::MapHandler
+{
+ public:
+ MapHandler();
+
+ void connect(LoginData *loginData);
+
+ void mapLoaded(const std::string &mapName);
+
+ void who();
+
+ void quit();
+
+ void ping(int tick);
+};
+
+} // namespace TmwServ
+
+#endif