summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am4
-rw-r--r--src/channel.cpp5
-rw-r--r--src/commandhandler.cpp52
-rw-r--r--src/engine.cpp9
-rw-r--r--src/game.cpp10
-rw-r--r--src/gui/popupmenu.cpp2
-rw-r--r--src/gui/widgets/channeltab.cpp12
-rw-r--r--src/gui/widgets/chattab.cpp14
-rw-r--r--src/gui/widgets/whispertab.cpp13
-rw-r--r--src/main.cpp2
-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
25 files changed, 439 insertions, 119 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a7060318..5fa55bc0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -402,6 +402,8 @@ tmw_SOURCES += \
net/tmwserv/gameserver/internal.h \
net/tmwserv/gameserver/player.cpp \
net/tmwserv/gameserver/player.h \
+ net/tmwserv/adminhandler.cpp \
+ net/tmwserv/adminhandler.h \
net/tmwserv/beinghandler.cpp \
net/tmwserv/beinghandler.h \
net/tmwserv/buysellhandler.cpp \
@@ -426,6 +428,8 @@ tmw_SOURCES += \
net/tmwserv/loginhandler.h \
net/tmwserv/logouthandler.cpp \
net/tmwserv/logouthandler.h \
+ net/tmwserv/maphandler.cpp \
+ net/tmwserv/maphandler.h \
net/tmwserv/network.cpp \
net/tmwserv/network.h \
net/tmwserv/npchandler.cpp \
diff --git a/src/channel.cpp b/src/channel.cpp
index 1f9bde2b..a98d315c 100644
--- a/src/channel.cpp
+++ b/src/channel.cpp
@@ -21,11 +21,6 @@
#include "channel.h"
-#ifdef TMWSERV_SUPPORT
-#include "net/tmwserv/chatserver/chatserver.h"
-#include "net/tmwserv/gameserver/player.h"
-#endif
-
Channel::Channel(short id,
const std::string &name,
const std::string &announcement) :
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 7e177ab5..6fc28978 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -30,15 +30,10 @@
#include "gui/widgets/chattab.h"
#include "gui/chat.h"
+#include "net/adminhandler.h"
+#include "net/chathandler.h"
+#include "net/maphandler.h"
#include "net/net.h"
-#ifdef TMWSERV_SUPPORT
-#include "net/tmwserv/chatserver/chatserver.h"
-#include "net/tmwserv/gameserver/player.h"
-#else
-#include "net/ea/adminhandler.h"
-#include "net/ea/chathandler.h"
-#include "net/ea/maphandler.h"
-#endif
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -73,7 +68,6 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
{
handleMsg(args, tab);
}
-#ifdef TMWSERV_SUPPORT
else if (type == "join")
{
handleJoin(args, tab);
@@ -106,7 +100,6 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
{
handleKick(args, tab);
}
-#endif
else if (type == "party")
{
handleParty(args, tab);
@@ -135,12 +128,7 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
void CommandHandler::handleAnnounce(const std::string &args, ChatTab *tab)
{
- // Net::getAdminHandler()->announce(args);
-#ifdef TMWSERV_SUPPORT
- Net::ChatServer::announce(args);
-#else
- adminHandler->announce(args);
-#endif
+ Net::getAdminHandler()->announce(args);
}
void CommandHandler::handleHelp(const std::string &args, ChatTab *tab)
@@ -319,12 +307,7 @@ void CommandHandler::handleWhere(const std::string &args, ChatTab *tab)
void CommandHandler::handleWho(const std::string &args, ChatTab *tab)
{
- // Net::getMapHandler()->who();
-#ifdef TMWSERV_SUPPORT
- //TODO
-#else
- mapHandler->who();
-#endif
+ Net::getMapHandler()->who();
}
void CommandHandler::handleMsg(const std::string &args, ChatTab *tab)
@@ -382,25 +365,23 @@ void CommandHandler::handleClear(const std::string &args, ChatTab *tab)
chatWindow->clearTab();
}
-#ifdef TMWSERV_SUPPORT
-
void CommandHandler::handleJoin(const std::string &args, ChatTab *tab)
{
std::string::size_type pos = args.find(' ');
std::string name(args, 0, pos);
std::string password(args, pos+1);
tab->chatLog("Requesting to join channel " + name);
- Net::ChatServer::enterChannel(name, password);
+ Net::getChatHandler()->enterChannel(name, password);
}
void CommandHandler::handleListChannels(const std::string &args, ChatTab *tab)
{
- Net::ChatServer::getChannelList();
+ Net::getChatHandler()->channelList();
}
void CommandHandler::handleListUsers(const std::string &args, ChatTab *tab)
{
- Net::ChatServer::getUserList(chatWindow->getFocused()->getCaption());
+ Net::getChatHandler()->userList(chatWindow->getFocused()->getCaption());
}
void CommandHandler::handleTopic(const std::string &args, ChatTab *tab)
@@ -409,7 +390,7 @@ void CommandHandler::handleTopic(const std::string &args, ChatTab *tab)
Channel *channel = channelTab ? channelTab->getChannel() : NULL;
if (channel)
{
- Net::ChatServer::setChannelTopic(channel->getId(), args);
+ Net::getChatHandler()->setChannelTopic(channel->getId(), args);
}
else
{
@@ -423,7 +404,7 @@ void CommandHandler::handleQuit(const std::string &args, ChatTab *tab)
Channel *channel = channelTab ? channelTab->getChannel() : NULL;
if (channel)
{
- Net::ChatServer::quitChannel(channel->getId());
+ Net::getChatHandler()->quitChannel(channel->getId());
}
else
{
@@ -440,7 +421,7 @@ void CommandHandler::handleOp(const std::string &args, ChatTab *tab)
// set the user mode 'o' to op a user
if (args != "")
{
- Net::ChatServer::setUserMode(channel->getId(), args, 'o');
+ Net::getChatHandler()->setUserMode(channel->getId(), args, 'o');
}
}
else
@@ -457,7 +438,7 @@ void CommandHandler::handleKick(const std::string &args, ChatTab *tab)
{
if (args != "")
{
- Net::ChatServer::kickUser(channel->getId(), args);
+ Net::getChatHandler()->kickUser(channel->getId(), args);
}
}
else
@@ -466,8 +447,6 @@ void CommandHandler::handleKick(const std::string &args, ChatTab *tab)
}
}
-#endif
-
void CommandHandler::handleParty(const std::string &args, ChatTab *tab)
{
#ifdef TMWSERV_SUPPORT
@@ -482,12 +461,7 @@ void CommandHandler::handleParty(const std::string &args, ChatTab *tab)
void CommandHandler::handleMe(const std::string &args, ChatTab *tab)
{
- // Net::getChatHandler()->me(args);
-#ifdef TMWSERV_SUPPORT
- // TODO
-#else
- chatHandler->me(args);
-#endif
+ Net::getChatHandler()->me(args);
}
void CommandHandler::handleRecord(const std::string &args, ChatTab *tab)
diff --git a/src/engine.cpp b/src/engine.cpp
index faa6a452..7ad2fa38 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -33,10 +33,8 @@
#include "gui/minimap.h"
#include "gui/viewport.h"
+#include "net/maphandler.h"
#include "net/net.h"
-#ifdef EATHENA_SUPPORT
-#include "net/ea/maphandler.h"
-#endif
#include "resources/mapreader.h"
#include "resources/monsterdb.h"
@@ -139,10 +137,7 @@ bool Engine::changeMap(const std::string &mapPath)
mCurrentMap = newMap;
- // Net::getMapHandler()->mapLoaded(mapPath);
-#ifdef EATHENA_SUPPORT
- mapHandler->mapLoaded(mapPath);
-#endif
+ Net::getMapHandler()->mapLoaded(mapPath);
return true;
}
diff --git a/src/game.cpp b/src/game.cpp
index 4cdada3e..768b3c06 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -85,6 +85,9 @@
#include "gui/storagewindow.h"
#endif
+#include "net/maphandler.h"
+#include "net/net.h"
+
#include "net/tmwserv/inventoryhandler.h"
#include "net/ea/inventoryhandler.h"
@@ -361,16 +364,17 @@ Game::Game():
Game::Game(Network *network):
mNetwork(network),
mBeingHandler(new BeingHandler(config.getValue("EnableSync", 0) == 1)),
- mAdminHandler(new AdminHandler),
+ mAdminHandler(new EAthena::AdminHandler),
mEquipmentHandler(new EquipmentHandler),
mSkillHandler(new SkillHandler),
#endif
mPartyHandler(new PartyHandler),
mBuySellHandler(new BuySellHandler),
- mChatHandler(new ChatHandler),
#ifdef TMWSERV_SUPPORT
+ mChatHandler(new TmwServ::ChatHandler),
mInventoryHandler(new TmwServ::InventoryHandler),
#else
+ mChatHandler(new EAthena::ChatHandler),
mInventoryHandler(new EAthena::InventoryHandler),
#endif
mItemHandler(new ItemHandler),
@@ -453,7 +457,7 @@ Game::Game(Network *network):
* packet is handled by the older version, but its response
* is ignored by the client
*/
- mapHandler->ping(tick_time);
+ Net::getMapHandler()->ping(tick_time);
map_path = map_path.substr(0, map_path.rfind("."));
engine->changeMap(map_path);
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 37b5f8fd..ac941db0 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -304,7 +304,7 @@ void PopupMenu::handleLink(const std::string &link)
(being->getType() == Being::PLAYER ||
being->getType() == Being::MONSTER))
{
- adminHandler->kick(being->getId());
+ Net::getAdminHandler()->kick(being->getId());
}
#endif
diff --git a/src/gui/widgets/channeltab.cpp b/src/gui/widgets/channeltab.cpp
index 6425293c..edc0473c 100644
--- a/src/gui/widgets/channeltab.cpp
+++ b/src/gui/widgets/channeltab.cpp
@@ -23,12 +23,8 @@
#include "channel.h"
-#ifdef TMWSERV_SUPPORT
-#include "net/tmwserv/chatserver/chatserver.h"
-#include "net/tmwserv/gameserver/player.h"
-#else
-
-#endif
+#include "net/chathandler.h"
+#include "net/net.h"
ChannelTab::ChannelTab(Channel *channel) : ChatTab(channel->getName()),
mChannel(channel)
@@ -41,7 +37,5 @@ ChannelTab::~ChannelTab()
}
void ChannelTab::handleInput(const std::string &msg) {
-#ifdef TMSERV_SUPPORT
- Net::ChatServer::chat(getId(), msg);
-#endif
+ Net::getChatHandler()->sendToChannel(getChannel()->getId(), msg);
}
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index bd0504b5..88d62076 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -30,13 +30,8 @@
#include "gui/recorder.h"
#include "gui/scrollarea.h"
+#include "net/chathandler.h"
#include "net/net.h"
-#ifdef TMWSERV_SUPPORT
-#include "net/tmwserv/chatserver/chatserver.h"
-#include "net/tmwserv/gameserver/player.h"
-#else
-#include "net/ea/chathandler.h"
-#endif
#include "resources/iteminfo.h"
#include "resources/itemdb.h"
@@ -276,12 +271,7 @@ void ChatTab::clearText()
}
void ChatTab::handleInput(const std::string &msg) {
- // Net::getChatHandler()->talk(msg);
-#ifdef TMWSERV_SUPPORT
- Net::GameServer::Player::say(msg);
-#else
- chatHandler->talk(msg);
-#endif
+ Net::getChatHandler()->talk(msg);
}
void ChatTab::handleCommand(std::string msg)
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index a641f0ad..d69a495c 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -25,12 +25,8 @@
#include "gui/palette.h"
+#include "net/chathandler.h"
#include "net/net.h"
-#ifdef TMWSERV_SUPPORT
-#include "net/tmwserv/chatserver/chatserver.h"
-#else
-#include "net/ea/chathandler.h"
-#endif
#include "utils/gettext.h"
#include "utils/strprintf.h"
@@ -53,12 +49,7 @@ void WhisperTab::handleInput(const std::string &msg) {
return;
}
- // Net::getChatHandler()->privateMessage(mNick, msg);
-#ifdef TMWSERV_SUPPORT
- Net::ChatServer::privMsg(mNick, msg);
-#else
- chatHandler->privateMessage(mNick, msg);
-#endif
+ Net::getChatHandler()->privateMessage(mNick, msg);
chatLog(strprintf(_("%s: %s"), player_node->getName().c_str(),
msg.c_str()), BY_PLAYER, false);
diff --git a/src/main.cpp b/src/main.cpp
index 97cf39d4..feca4fa4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -826,7 +826,7 @@ static void mapLogin(Network *network, LoginData *loginData)
logger->log("Trying to connect to map server...");
logger->log("Map: %s", map_path.c_str());
- MapHandler *mapHandler = new MapHandler;
+ EAthena::MapHandler *mapHandler = new EAthena::MapHandler;
network->connect(loginData->hostname, loginData->port);
//network->registerHandler(mapHandler);
network->registerHandler(mapHandler);
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