From e55ed9a138e97f6fba5e3b6858a755f8a50197d2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 29 May 2014 19:32:58 +0300 Subject: Move from client packets limiter related code into separate file. --- src/gui/windows/npcdialog.cpp | 11 ++++++----- src/gui/windows/whoisonline.cpp | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 47ad71f32..11ba96933 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -57,6 +57,7 @@ #include "net/net.h" #include "net/npchandler.h" +#include "net/packetlimiter.h" #include "utils/copynpaste.h" #include "utils/delete2.h" @@ -282,7 +283,7 @@ void NpcDialog::action(const ActionEvent &event) { if (mActionState == NPC_ACTION_NEXT) { - if (!client->limitPackets(PACKET_NPC_NEXT)) + if (!PacketLimiter::limitPackets(PACKET_NPC_NEXT)) return; nextDialog(); @@ -307,7 +308,7 @@ void NpcDialog::action(const ActionEvent &event) if (selectedIndex >= static_cast(mItems.size()) || selectedIndex < 0 - || !client->limitPackets(PACKET_NPC_INPUT)) + || !PacketLimiter::limitPackets(PACKET_NPC_INPUT)) { return; } @@ -320,7 +321,7 @@ void NpcDialog::action(const ActionEvent &event) } case NPC_INPUT_STRING: { - if (!client->limitPackets(PACKET_NPC_INPUT)) + if (!PacketLimiter::limitPackets(PACKET_NPC_INPUT)) return; printText = mTextField->getText(); Net::getNpcHandler()->stringInput(mNpcId, printText); @@ -328,7 +329,7 @@ void NpcDialog::action(const ActionEvent &event) } case NPC_INPUT_INTEGER: { - if (!client->limitPackets(PACKET_NPC_INPUT)) + if (!PacketLimiter::limitPackets(PACKET_NPC_INPUT)) return; printText = strprintf("%d", mIntField->getValue()); Net::getNpcHandler()->integerInput( @@ -337,7 +338,7 @@ void NpcDialog::action(const ActionEvent &event) } case NPC_INPUT_ITEM: { - if (!client->limitPackets(PACKET_NPC_INPUT)) + if (!PacketLimiter::limitPackets(PACKET_NPC_INPUT)) return; std::string str; diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 0cb2fd5d5..ff2f15427 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -45,6 +45,7 @@ #include "net/download.h" #include "net/net.h" +#include "net/packetlimiter.h" #include "net/playerhandler.h" #include "utils/gettext.h" @@ -590,7 +591,7 @@ void WhoIsOnline::download() } else { - if (client->limitPackets(PACKET_ONLINELIST)) + if (PacketLimiter::limitPackets(PACKET_ONLINELIST)) Net::getPlayerHandler()->requestOnlineList(); } } @@ -688,7 +689,7 @@ void WhoIsOnline::action(const ActionEvent &event) } else { - if (client->limitPackets(PACKET_ONLINELIST)) + if (PacketLimiter::limitPackets(PACKET_ONLINELIST)) { mUpdateTimer = cur_time; Net::getPlayerHandler()->requestOnlineList(); -- cgit v1.2.3-70-g09d2