Honor agent limit for region crossings and teleports

avinationmerge
Melanie 2011-04-21 22:34:49 +02:00
parent 204b8b7b7e
commit 282e116f94
2 changed files with 25 additions and 10 deletions

View File

@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL
{ {
string[] words = query.Split(new char[] {' '}); string[] words = query.Split(new char[] {' '});
bool valid = false;
for (int i = 0 ; i < words.Length ; i++) for (int i = 0 ; i < words.Length ; i++)
{ {
if (words[i].Length < 3) if (words[i].Length > 2)
{ valid = true;
if (i != words.Length - 1) // if (words[i].Length < 3)
Array.Copy(words, i + 1, words, i, words.Length - i - 1); // {
Array.Resize(ref words, words.Length - 1); // if (i != words.Length - 1)
} // Array.Copy(words, i + 1, words, i, words.Length - i - 1);
// Array.Resize(ref words, words.Length - 1);
// }
} }
if (words.Length == 0) if ((!valid) || words.Length == 0)
return new UserAccountData[0]; return new UserAccountData[0];
if (words.Length > 2) if (words.Length > 2)
@ -67,14 +71,14 @@ namespace OpenSim.Data.MySQL
if (words.Length == 1) if (words.Length == 1)
{ {
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm); cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); cmd.Parameters.AddWithValue("?search", words[0] + "%");
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
} }
else else
{ {
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast)", m_Realm); cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast)", m_Realm);
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%");
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); cmd.Parameters.AddWithValue("?searchLast", words[1] + "%");
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
} }

View File

@ -5191,6 +5191,17 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
int num = m_sceneGraph.GetNumberOfScenePresences();
if (num >= RegionInfo.RegionSettings.AgentLimit)
{
if (!Permissions.IsAdministrator(cAgentData.AgentID))
{
reason = "The region is full";
return false;
}
}
if (!AuthorizeUser(agentID, out reason)) if (!AuthorizeUser(agentID, out reason))
{ {
// m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);