mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
This commit is contained in:
@@ -71,52 +71,90 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users)
|
||||
{
|
||||
string[] words = query.Split(new char[] { ' ' });
|
||||
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
if (query.Contains("@")) // First.Last@foo.com, maybe?
|
||||
{
|
||||
if (words[i].Length < 3)
|
||||
string[] words = query.Split(new char[] { '@' });
|
||||
if (words.Length != 2)
|
||||
{
|
||||
if (i != words.Length - 1)
|
||||
Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
||||
Array.Resize(ref words, words.Length - 1);
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", query);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (words.Length == 0 || words.Length > 2)
|
||||
return;
|
||||
words[0] = words[0].Trim(); // it has at least 1
|
||||
words[1] = words[1].Trim();
|
||||
|
||||
if (words.Length == 2) // First.Last @foo.com, maybe?
|
||||
{
|
||||
bool found = false;
|
||||
if (words[0] == String.Empty) // query was @foo.com?
|
||||
{
|
||||
foreach (UserData d in m_UserCache.Values)
|
||||
{
|
||||
if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower()))
|
||||
users.Add(d);
|
||||
}
|
||||
|
||||
// We're done
|
||||
return;
|
||||
}
|
||||
|
||||
// words.Length == 2 and words[0] != string.empty
|
||||
// first.last@foo.com ?
|
||||
foreach (UserData d in m_UserCache.Values)
|
||||
{
|
||||
if (d.LastName.StartsWith("@") &&
|
||||
(d.FirstName.ToLower().Equals(words[0].ToLower()) ||
|
||||
d.LastName.ToLower().Equals(words[1].ToLower())))
|
||||
if (d.LastName.StartsWith("@") &&
|
||||
d.FirstName.ToLower().Equals(words[0].ToLower()) &&
|
||||
d.LastName.ToLower().Equals("@" + words[1].ToLower()))
|
||||
{
|
||||
users.Add(d);
|
||||
found = true;
|
||||
break;
|
||||
// It's cached. We're done
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!found) // This is it! Let's ask the other world
|
||||
|
||||
// This is it! Let's ask the other world
|
||||
if (words[0].Contains("."))
|
||||
{
|
||||
// TODO
|
||||
//UserAgentServiceConnector uasConn = new UserAgentServiceConnector(words[0]);
|
||||
//uasConn.GetUserInfo(...);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (UserData d in m_UserCache.Values)
|
||||
{
|
||||
if (d.LastName.StartsWith("@") &&
|
||||
(d.FirstName.ToLower().StartsWith(query.ToLower()) ||
|
||||
d.LastName.ToLower().StartsWith(query.ToLower())))
|
||||
users.Add(d);
|
||||
string[] names = words[0].Split(new char[] { '.' });
|
||||
if (names.Length >= 2)
|
||||
{
|
||||
|
||||
string uriStr = "http://" + words[1];
|
||||
// Let's check that the last name is a valid address
|
||||
try
|
||||
{
|
||||
new Uri(uriStr);
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
|
||||
return;
|
||||
}
|
||||
|
||||
UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
|
||||
UUID userID = uasConn.GetUUID(names[0], names[1]);
|
||||
if (!userID.Equals(UUID.Zero))
|
||||
{
|
||||
UserData ud = new UserData();
|
||||
ud.Id = userID;
|
||||
ud.FirstName = words[0];
|
||||
ud.LastName = "@" + words[1];
|
||||
users.Add(ud);
|
||||
AddUser(userID, names[0], names[1], uriStr);
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// foreach (UserData d in m_UserCache.Values)
|
||||
// {
|
||||
// if (d.LastName.StartsWith("@") &&
|
||||
// (d.FirstName.ToLower().StartsWith(query.ToLower()) ||
|
||||
// d.LastName.ToLower().StartsWith(query.ToLower())))
|
||||
// users.Add(d);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -183,7 +183,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
List<UserData> users = new List<UserData>();
|
||||
if (accs != null)
|
||||
{
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Found {0} users", accs.Count);
|
||||
foreach (UserAccount acc in accs)
|
||||
{
|
||||
UserData ud = new UserData();
|
||||
@@ -300,7 +299,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
public string GetUserName(UUID uuid)
|
||||
{
|
||||
//m_log.DebugFormat("[XXX] GetUserName {0}", uuid);
|
||||
string[] names = GetUserNames(uuid);
|
||||
if (names.Length == 2)
|
||||
{
|
||||
@@ -341,9 +339,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
|
||||
serverType, userdata.HomeURL, userID);
|
||||
//m_log.DebugFormat(
|
||||
// "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
|
||||
// serverType, userdata.HomeURL, userID);
|
||||
|
||||
UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
|
||||
userdata.ServerURLs = uConn.GetServerURLs(userID);
|
||||
@@ -402,11 +400,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last, string homeURL)
|
||||
{
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
|
||||
|
||||
AddUser(uuid, homeURL + ";" + first + " " + last);
|
||||
}
|
||||
|
||||
public void AddUser (UUID id, string creatorData)
|
||||
{
|
||||
//m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
|
||||
|
||||
UserData oldUser;
|
||||
//lock the whole block - prevent concurrent update
|
||||
lock (m_UserCache)
|
||||
@@ -432,9 +434,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
return;
|
||||
}
|
||||
}
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
|
||||
|
||||
UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
|
||||
|
||||
if (account != null)
|
||||
{
|
||||
@@ -483,9 +484,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
lock (m_UserCache)
|
||||
m_UserCache[user.Id] = user;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
|
||||
// user.Id, user.FirstName, user.LastName, user.HomeURL);
|
||||
//m_log.DebugFormat(
|
||||
// "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
|
||||
// user.Id, user.FirstName, user.LastName, user.HomeURL);
|
||||
}
|
||||
|
||||
public bool IsLocalGridUser(UUID uuid)
|
||||
|
||||
Reference in New Issue
Block a user