summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client.cpp9
-rw-r--r--src/client.h1
-rw-r--r--src/gui/whoisonline.cpp11
3 files changed, 15 insertions, 6 deletions
diff --git a/src/client.cpp b/src/client.cpp
index d8bb747fb..fefb5bc71 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2055,6 +2055,11 @@ void Client::initPacketLimiter()
mPacketLimits[PACKET_STOPATTACK].cntLimit = 1;
mPacketLimits[PACKET_STOPATTACK].cnt = 0;
+ mPacketLimits[PACKET_ONLINELIST].timeLimit = 1800;
+ mPacketLimits[PACKET_ONLINELIST].lastTime = 0;
+ mPacketLimits[PACKET_ONLINELIST].cntLimit = 1;
+ mPacketLimits[PACKET_ONLINELIST].cnt = 0;
+
if (!mServerConfigDir.empty())
{
std::string packetLimitsName =
@@ -2091,7 +2096,7 @@ void Client::initPacketLimiter()
mPacketLimits[f].timeLimit = atoi(line);
}
inPacketFile.close();
- if (ver < 3)
+ if (ver < 4)
writePacketLimits(packetLimitsName);
}
}
@@ -2106,7 +2111,7 @@ void Client::writePacketLimits(std::string packetLimitsName)
outPacketFile.close();
return;
}
- outPacketFile << "3" << std::endl;
+ outPacketFile << "4" << std::endl;
for (int f = 0; f < PACKET_SIZE; f ++)
{
outPacketFile << toString(mPacketLimits[f].timeLimit)
diff --git a/src/client.h b/src/client.h
index b3fc0d676..3bcc5f597 100644
--- a/src/client.h
+++ b/src/client.h
@@ -131,6 +131,7 @@ enum PacketTypes
PACKET_DIRECTION = 8,
PACKET_ATTACK = 9,
PACKET_STOPATTACK = 10,
+ PACKET_ONLINELIST = 11,
PACKET_SIZE
};
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index fde0f08da..6004f706e 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -536,7 +536,8 @@ void WhoIsOnline::download()
}
else
{
- Net::getPlayerHandler()->requestOnlineList();
+ if (Client::limitPackets(PACKET_ONLINELIST))
+ Net::getPlayerHandler()->requestOnlineList();
}
}
@@ -618,9 +619,11 @@ void WhoIsOnline::action(const gcn::ActionEvent &event)
}
else
{
- mUpdateTimer = cur_time - 20;
- Net::getPlayerHandler()->requestOnlineList();
- setCaption(_("Who Is Online - Update"));
+ if (Client::limitPackets(PACKET_ONLINELIST))
+ {
+ mUpdateTimer = cur_time;
+ Net::getPlayerHandler()->requestOnlineList();
+ }
}
}
}