summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-17 00:55:22 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-17 00:55:22 +0300
commit3a7313c027407e3b35360a021c72fe78f181d81d (patch)
treebb313b81c7feb42c2a0b5855c1eca00ef2d7c1b1
parent1307b14ff24f3935fa58aef405ffb246c0741336 (diff)
downloadmv-3a7313c027407e3b35360a021c72fe78f181d81d.tar.gz
mv-3a7313c027407e3b35360a021c72fe78f181d81d.tar.bz2
mv-3a7313c027407e3b35360a021c72fe78f181d81d.tar.xz
mv-3a7313c027407e3b35360a021c72fe78f181d81d.zip
Remove getter for chatHandler.
-rw-r--r--src/actions/actions.cpp6
-rw-r--r--src/actions/chat.cpp4
-rw-r--r--src/actions/commands.cpp14
-rw-r--r--src/auctionmanager.cpp8
-rw-r--r--src/being/localplayer.cpp4
-rw-r--r--src/client.cpp4
-rw-r--r--src/gui/widgets/tabs/chattab.cpp2
-rw-r--r--src/gui/widgets/tabs/whispertab.cpp4
-rw-r--r--src/gui/windows/chatwindow.cpp2
-rw-r--r--src/gui/windows/shopwindow.cpp8
-rw-r--r--src/guildmanager.cpp4
-rw-r--r--src/net/chathandler.h2
-rw-r--r--src/net/ea/adminhandler.cpp14
-rw-r--r--src/net/ea/buysellhandler.cpp8
-rw-r--r--src/net/eathena/pethandler.cpp2
-rw-r--r--src/net/net.cpp6
-rw-r--r--src/net/net.h2
-rw-r--r--src/net/tmwa/adminhandler.cpp6
-rw-r--r--src/net/tmwa/pethandler.cpp2
-rw-r--r--src/utils/chatutils.cpp6
20 files changed, 52 insertions, 56 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index d087f39e7..6175ec904 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -649,7 +649,7 @@ impHandler(where)
impHandler0(who)
{
- Net::getChatHandler()->who();
+ chatHandler->who();
return true;
}
@@ -946,13 +946,13 @@ impHandler0(dump)
impHandler0(serverIgnoreAll)
{
- Net::getChatHandler()->ignoreAll();
+ chatHandler->ignoreAll();
return true;
}
impHandler0(serverUnIgnoreAll)
{
- Net::getChatHandler()->unIgnoreAll();
+ chatHandler->unIgnoreAll();
return true;
}
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 3d12d99e1..3c6b4f7fc 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -53,7 +53,7 @@ static void outString(const ChatTab *const tab,
{
if (!tab)
{
- Net::getChatHandler()->me(def, GENERAL_CHANNEL);
+ chatHandler->me(def, GENERAL_CHANNEL);
return;
}
@@ -85,7 +85,7 @@ static void outString(const ChatTab *const tab,
break;
}
default:
- Net::getChatHandler()->me(def, GENERAL_CHANNEL);
+ chatHandler->me(def, GENERAL_CHANNEL);
break;
}
}
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index c7e12af88..a1ae6b32c 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -630,7 +630,7 @@ impHandler(testParticle)
impHandler(talkRaw)
{
- Net::getChatHandler()->talkRaw(event.args);
+ chatHandler->talkRaw(event.args);
return true;
}
@@ -638,21 +638,21 @@ impHandler(talkPet)
{
// in future probably need add channel detection
if (!localPlayer->getPets().empty())
- Net::getChatHandler()->talkPet(event.args, GENERAL_CHANNEL);
+ chatHandler->talkPet(event.args, GENERAL_CHANNEL);
else
- Net::getChatHandler()->talk(event.args, GENERAL_CHANNEL);
+ chatHandler->talk(event.args, GENERAL_CHANNEL);
return true;
}
impHandler(gm)
{
- Net::getChatHandler()->talk("@wgm " + event.args, GENERAL_CHANNEL);
+ chatHandler->talk("@wgm " + event.args, GENERAL_CHANNEL);
return true;
}
impHandler(hack)
{
- Net::getChatHandler()->sendRaw(event.args);
+ chatHandler->sendRaw(event.args);
return true;
}
@@ -676,7 +676,7 @@ impHandler(serverIgnoreWhisper)
if (args.empty())
return false;
- Net::getChatHandler()->ignore(args);
+ chatHandler->ignore(args);
return true;
}
@@ -686,7 +686,7 @@ impHandler(serverUnIgnoreWhisper)
if (args.empty())
return false;
- Net::getChatHandler()->unIgnore(args);
+ chatHandler->unIgnore(args);
return true;
}
diff --git a/src/auctionmanager.cpp b/src/auctionmanager.cpp
index 2d02870f3..b9029c25c 100644
--- a/src/auctionmanager.cpp
+++ b/src/auctionmanager.cpp
@@ -61,8 +61,8 @@ void AuctionManager::init()
void AuctionManager::send(const std::string &msg)
{
- if (Net::getChatHandler())
- Net::getChatHandler()->privateMessage("AuctionBot", msg);
+ if (chatHandler)
+ chatHandler->privateMessage("AuctionBot", msg);
}
/*
@@ -84,6 +84,6 @@ void AuctionManager::reload()
void AuctionManager::sendMail(const std::string &mail)
{
- if (Net::getChatHandler())
- Net::getChatHandler()->privateMessage("AuctionBot", "!mail " + mail);
+ if (chatHandler)
+ chatHandler->privateMessage("AuctionBot", "!mail " + mail);
}
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index a4faa0496..aa92cf6d7 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2511,7 +2511,7 @@ void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick)
if (!tab)
{
- Net::getChatHandler()->privateMessage(nick, msg);
+ chatHandler->privateMessage(nick, msg);
if (localChatTab)
{
localChatTab->chatLog(std::string(getName()).append(
@@ -2522,7 +2522,7 @@ void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick)
{
if (tab->getNoAway())
return;
- Net::getChatHandler()->privateMessage(nick, msg);
+ chatHandler->privateMessage(nick, msg);
tab->chatLog(getName(), msg);
}
mAfkTime = time;
diff --git a/src/client.cpp b/src/client.cpp
index 40466638c..8f0827d44 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -619,8 +619,8 @@ void Client::gameClear()
if (Net::getLoginHandler())
Net::getLoginHandler()->clearWorlds();
- if (Net::getChatHandler())
- Net::getChatHandler()->clear();
+ if (chatHandler)
+ chatHandler->clear();
delete2(ipc);
diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp
index d699b29fe..54d675a85 100644
--- a/src/gui/widgets/tabs/chattab.cpp
+++ b/src/gui/widgets/tabs/chattab.cpp
@@ -434,7 +434,7 @@ void ChatTab::clearText()
void ChatTab::handleInput(const std::string &msg)
{
- Net::getChatHandler()->talk(ChatWindow::doReplace(msg),
+ chatHandler->talk(ChatWindow::doReplace(msg),
mChannelName);
}
diff --git a/src/gui/widgets/tabs/whispertab.cpp b/src/gui/widgets/tabs/whispertab.cpp
index a67b9450c..6c89a887b 100644
--- a/src/gui/widgets/tabs/whispertab.cpp
+++ b/src/gui/widgets/tabs/whispertab.cpp
@@ -53,7 +53,7 @@ void WhisperTab::handleInput(const std::string &msg)
{
std::string newMsg;
newMsg = ChatWindow::doReplace(msg);
- Net::getChatHandler()->privateMessage(mNick, newMsg);
+ chatHandler->privateMessage(mNick, newMsg);
if (localPlayer)
chatLog(localPlayer->getName(), newMsg);
@@ -77,7 +77,7 @@ void WhisperTab::handleCommand(const std::string &msg)
if (type == "me")
{
std::string str = strprintf("*%s*", args.c_str());
- Net::getChatHandler()->privateMessage(mNick, str);
+ chatHandler->privateMessage(mNick, str);
if (localPlayer)
chatLog(localPlayer->getName(), str);
else
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 9644b5a7c..318c89332 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1074,7 +1074,7 @@ void ChatWindow::addWhisper(const std::string &restrict nick,
{
if (own == ChatMsgType::BY_PLAYER)
{
- Net::getChatHandler()->privateMessage(nick, mes);
+ chatHandler->privateMessage(nick, mes);
// TRANSLATORS: chat message
localChatTab->chatLog(strprintf(_("Whispering to %s: %s"),
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 3645ccc9b..e846e0dce 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -261,12 +261,12 @@ void ShopWindow::action(const ActionEvent &event)
else if (eventId == "auction buy" && mBuyShopItems
&& mBuyShopItems->getNumberOfElements() > 0)
{
- Net::getChatHandler()->privateMessage("AuctionBot", "!pull4144 seek");
+ chatHandler->privateMessage("AuctionBot", "!pull4144 seek");
}
else if (eventId == "auction sell" && mSellShopItems
&& mSellShopItems->getNumberOfElements() > 0)
{
- Net::getChatHandler()->privateMessage("AuctionBot", "!pull4144 offer");
+ chatHandler->privateMessage("AuctionBot", "!pull4144 offer");
}
if (mSelectedItem < 1)
@@ -543,7 +543,7 @@ void ShopWindow::announce(ShopItems *const list, const int mode)
}
}
- Net::getChatHandler()->talk(data, GENERAL_CHANNEL);
+ chatHandler->talk(data, GENERAL_CHANNEL);
}
void ShopWindow::giveList(const std::string &nick, const int mode)
@@ -635,7 +635,7 @@ void ShopWindow::sendMessage(const std::string &nick,
}
if (config.getBoolValue("hideShopMessages"))
- Net::getChatHandler()->privateMessage(nick, data);
+ chatHandler->privateMessage(nick, data);
else
chatWindow->addWhisper(nick, data, ChatMsgType::BY_PLAYER);
}
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 152b2b168..446e55801 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -117,7 +117,7 @@ void GuildManager::reload()
void GuildManager::send(const std::string &msg)
{
- Net::getChatHandler()->privateMessage("guild", msg);
+ chatHandler->privateMessage("guild", msg);
}
void GuildManager::chat(const std::string &msg)
@@ -125,7 +125,7 @@ void GuildManager::chat(const std::string &msg)
if (!localPlayer || !mTab)
return;
- Net::getChatHandler()->privateMessage("guild", msg);
+ chatHandler->privateMessage("guild", msg);
mTab->chatLog(localPlayer->getName(), msg);
}
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index 86ff5eecd..bf4863b66 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -76,4 +76,6 @@ class ChatHandler notfinal
} // namespace Net
+extern Net::ChatHandler *chatHandler;
+
#endif // NET_CHATHANDLER_H
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 71ca80846..550e96065 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -37,7 +37,7 @@ namespace Ea
void AdminHandler::kickName(const std::string &name) const
{
- Net::getChatHandler()->talk("@kick " + name, GENERAL_CHANNEL);
+ chatHandler->talk("@kick " + name, GENERAL_CHANNEL);
}
void AdminHandler::ban(const int playerId A_UNUSED) const
@@ -47,7 +47,7 @@ void AdminHandler::ban(const int playerId A_UNUSED) const
void AdminHandler::banName(const std::string &name) const
{
- Net::getChatHandler()->talk("@ban " + name, GENERAL_CHANNEL);
+ chatHandler->talk("@ban " + name, GENERAL_CHANNEL);
}
void AdminHandler::unban(const int playerId A_UNUSED) const
@@ -57,17 +57,17 @@ void AdminHandler::unban(const int playerId A_UNUSED) const
void AdminHandler::unbanName(const std::string &name) const
{
- Net::getChatHandler()->talk("@unban " + name, GENERAL_CHANNEL);
+ chatHandler->talk("@unban " + name, GENERAL_CHANNEL);
}
void AdminHandler::reviveName(const std::string &name) const
{
- Net::getChatHandler()->talk("@revive " + name, GENERAL_CHANNEL);
+ chatHandler->talk("@revive " + name, GENERAL_CHANNEL);
}
void AdminHandler::ipcheckName(const std::string &name) const
{
- Net::getChatHandler()->talk("@ipcheck " + name, GENERAL_CHANNEL);
+ chatHandler->talk("@ipcheck " + name, GENERAL_CHANNEL);
}
void AdminHandler::createItems(const int id, const int color,
@@ -75,12 +75,12 @@ void AdminHandler::createItems(const int id, const int color,
{
if (!Net::getServerFeatures()->haveItemColors())
{
- Net::getChatHandler()->talk(strprintf("@item %d %d",
+ chatHandler->talk(strprintf("@item %d %d",
id, amount), GENERAL_CHANNEL);
}
else
{
- Net::getChatHandler()->talk(strprintf("@item %d %d %d",
+ chatHandler->talk(strprintf("@item %d %d %d",
id, color, amount), GENERAL_CHANNEL);
}
}
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index 0e3687aa3..6bdc33305 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -66,7 +66,7 @@ void BuySellHandler::requestSellList(const std::string &nick) const
if (config.getBoolValue("hideShopMessages"))
{
- Net::getChatHandler()->privateMessage(nick, data);
+ chatHandler->privateMessage(nick, data);
}
else
{
@@ -85,7 +85,7 @@ void BuySellHandler::requestBuyList(const std::string &nick) const
if (config.getBoolValue("hideShopMessages"))
{
- Net::getChatHandler()->privateMessage(nick, data);
+ chatHandler->privateMessage(nick, data);
}
else
{
@@ -107,7 +107,7 @@ void BuySellHandler::sendBuyRequest(const std::string &nick,
item->getId(), item->getPrice(), amount);
if (config.getBoolValue("hideShopMessages"))
- Net::getChatHandler()->privateMessage(nick, data);
+ chatHandler->privateMessage(nick, data);
else
chatWindow->addWhisper(nick, data, ChatMsgType::BY_PLAYER);
}
@@ -126,7 +126,7 @@ void BuySellHandler::sendSellRequest(const std::string &nick,
item->getId(), item->getPrice(), amount);
if (config.getBoolValue("hideShopMessages"))
- Net::getChatHandler()->privateMessage(nick, data);
+ chatHandler->privateMessage(nick, data);
else
chatWindow->addWhisper(nick, data, ChatMsgType::BY_PLAYER);
}
diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp
index bf453055e..1485c1de0 100644
--- a/src/net/eathena/pethandler.cpp
+++ b/src/net/eathena/pethandler.cpp
@@ -82,7 +82,7 @@ void PetHandler::emote(const uint8_t emoteId, const int petId A_UNUSED)
if (mRandCounter > 10000)
mRandCounter = 1000;
- Net::getChatHandler()->talk(strprintf("\302\202\302e%dz%d",
+ chatHandler->talk(strprintf("\302\202\302e%dz%d",
static_cast<int>(emoteId), mRandCounter), GENERAL_CHANNEL);
}
diff --git a/src/net/net.cpp b/src/net/net.cpp
index f4736a01c..aa89e39fe 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -45,6 +45,7 @@ namespace Net
class BuySellHandler;
class CashShopHandler;
class CharServerHandler;
+ class ChatHandler;
}
Net::AdminHandler *adminHandler = nullptr;
@@ -70,11 +71,6 @@ Net::CashShopHandler *cashShopHandler = nullptr;
Net::FamilyHandler *familyHandler = nullptr;
Net::BankHandler *bankHandler = nullptr;
-Net::ChatHandler *Net::getChatHandler()
-{
- return chatHandler;
-}
-
Net::GameHandler *Net::getGameHandler()
{
return gameHandler;
diff --git a/src/net/net.h b/src/net/net.h
index 56c091924..11f605252 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -36,7 +36,6 @@
namespace Net
{
-class ChatHandler;
class FamilyHandler;
class GameHandler;
class GeneralHandler;
@@ -52,7 +51,6 @@ class SkillHandler;
class TradeHandler;
class ServerFeatures;
-ChatHandler *getChatHandler() A_WARN_UNUSED;
GameHandler *getGameHandler() A_WARN_UNUSED;
GeneralHandler *getGeneralHandler() A_WARN_UNUSED;
GuildHandler *getGuildHandler() A_WARN_UNUSED;
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index 19238f2ef..44b6f9038 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -106,7 +106,7 @@ void AdminHandler::kickAll() const
void AdminHandler::warp(const std::string &map, const int x, const int y) const
{
- Net::getChatHandler()->talk(strprintf(
+ chatHandler->talk(strprintf(
"@warp %s %d %d", map.c_str(), x, y), GENERAL_CHANNEL);
}
@@ -120,12 +120,12 @@ void AdminHandler::resetSkills() const
void AdminHandler::gotoName(const std::string &name) const
{
- Net::getChatHandler()->talk("@goto " + name, GENERAL_CHANNEL);
+ chatHandler->talk("@goto " + name, GENERAL_CHANNEL);
}
void AdminHandler::recallName(const std::string &name) const
{
- Net::getChatHandler()->talk("@recall " + name, GENERAL_CHANNEL);
+ chatHandler->talk("@recall " + name, GENERAL_CHANNEL);
}
void AdminHandler::mute(const Being *const being A_UNUSED,
diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp
index 0ca5f7c63..a071d1289 100644
--- a/src/net/tmwa/pethandler.cpp
+++ b/src/net/tmwa/pethandler.cpp
@@ -70,7 +70,7 @@ void PetHandler::emote(const uint8_t emoteId, const int petId A_UNUSED)
if (mRandCounter > 10000)
mRandCounter = 1000;
- Net::getChatHandler()->talk(strprintf("\302\202\302e%dz%d",
+ chatHandler->talk(strprintf("\302\202\302e%dz%d",
static_cast<int>(emoteId), mRandCounter), GENERAL_CHANNEL);
}
diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp
index 79251a24b..a3322a370 100644
--- a/src/utils/chatutils.cpp
+++ b/src/utils/chatutils.cpp
@@ -48,7 +48,7 @@ void outStringNormal(ChatTab *const tab,
if (!tab)
{
- Net::getChatHandler()->talk(str, GENERAL_CHANNEL);
+ chatHandler->talk(str, GENERAL_CHANNEL);
return;
}
@@ -82,11 +82,11 @@ void outStringNormal(ChatTab *const tab,
const WhisperTab *const whisper
= static_cast<const WhisperTab *const>(tab);
tab->chatLog(localPlayer->getName(), str);
- Net::getChatHandler()->privateMessage(whisper->getNick(), str);
+ chatHandler->privateMessage(whisper->getNick(), str);
break;
}
default:
- Net::getChatHandler()->talk(def, GENERAL_CHANNEL);
+ chatHandler->talk(def, GENERAL_CHANNEL);
break;
}
}