From: <rds...@us...> - 2008-01-21 07:38:33
|
Revision: 683 http://planeshift.svn.sourceforge.net/planeshift/?rev=683&view=rev Author: rdschulz Date: 2008-01-20 23:38:36 -0800 (Sun, 20 Jan 2008) Log Message: ----------- *** 2008-01-20 by Roland Schulz - add feature request FS#718, remaining ban time is now shown for /info. Thanks peeg. Modified Paths: -------------- trunk/docs/history.txt trunk/src/server/adminmanager.cpp Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2008-01-21 05:56:30 UTC (rev 682) +++ trunk/docs/history.txt 2008-01-21 07:38:36 UTC (rev 683) @@ -1,3 +1,7 @@ +*** 2008-01-20 by Roland Schulz +- add feature request FS#718, remaining ban time is now shown for /info. + Thanks peeg. + *** 2008-01-20 by Anders Reggestad - Added test to check if the last attacker on a target where a one of your pets to allow you to attack. This should fix FS#946. Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2008-01-21 05:56:30 UTC (rev 682) +++ trunk/src/server/adminmanager.cpp 2008-01-21 07:38:36 UTC (rev 683) @@ -1546,6 +1546,10 @@ csString name, ipAddress, securityLevel; int playerId = 0, accountId = 0; float timeConnected = 0.0f; + + bool banned = false; + time_t banTimeLeft; + int daysLeft = 0, hoursLeft = 0, minsLeft = 0; if (target) // Online { @@ -1608,7 +1612,24 @@ securityLevel.Format("%d",GetTrueSecurityLevel(accountId)); } } - + BanEntry* ban = psserver->GetAuthServer()->GetBanManager()->GetBanByAccount(accountId); + if(ban) + { + time_t now = time(0); + if(ban->end > now) + { + banTimeLeft = ban->end - now; + banned = true; + + banTimeLeft = banTimeLeft / 60; // don't care about seconds + minsLeft = banTimeLeft % 60; + banTimeLeft = banTimeLeft / 60; + hoursLeft = banTimeLeft % 24; + banTimeLeft = banTimeLeft / 24; + daysLeft = banTimeLeft; + } + } + if (playerId != 0) { csString info; @@ -1626,8 +1647,13 @@ info.AppendFmt("total time connected is %1.1f hours", timeConnected ); - info.AppendFmt(" has had %d exploits flagged", client->GetFlagCount()); + info.AppendFmt(" has had %d exploits flagged.", client->GetFlagCount()); + if(banned) + { + info.AppendFmt(" The player's account is banned! Time left: %d days, %d hours, %d minutes.", daysLeft, hoursLeft, minsLeft); + } + psserver->SendSystemInfo(client->GetClientNum(),info); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |