aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorMelanie2012-03-21 00:26:02 +0000
committerMelanie2012-03-21 00:26:02 +0000
commitee9210f656f754e2caa40cb6ff39463cbf286347 (patch)
tree8097bad8a37e210bfbdeff113a9ab00d853ad9ac /OpenSim/Region/CoreModules/Framework
parentMerge branch 'master' into careminster (diff)
parentRefix the fixed fix! (diff)
downloadopensim-SC-ee9210f656f754e2caa40cb6ff39463cbf286347.zip
opensim-SC-ee9210f656f754e2caa40cb6ff39463cbf286347.tar.gz
opensim-SC-ee9210f656f754e2caa40cb6ff39463cbf286347.tar.bz2
opensim-SC-ee9210f656f754e2caa40cb6ff39463cbf286347.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs102
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs21
2 files changed, 81 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index 8077a7a..4eecaa2 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -71,52 +71,90 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
71 71
72 protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users) 72 protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users)
73 { 73 {
74 string[] words = query.Split(new char[] { ' ' }); 74 if (query.Contains("@")) // First.Last@foo.com, maybe?
75
76 for (int i = 0; i < words.Length; i++)
77 { 75 {
78 if (words[i].Length < 3) 76 string[] words = query.Split(new char[] { '@' });
77 if (words.Length != 2)
79 { 78 {
80 if (i != words.Length - 1) 79 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", query);
81 Array.Copy(words, i + 1, words, i, words.Length - i - 1); 80 return;
82 Array.Resize(ref words, words.Length - 1);
83 } 81 }
84 }
85 82
86 if (words.Length == 0 || words.Length > 2) 83 words[0] = words[0].Trim(); // it has at least 1
87 return; 84 words[1] = words[1].Trim();
88 85
89 if (words.Length == 2) // First.Last @foo.com, maybe? 86 if (words[0] == String.Empty) // query was @foo.com?
90 {
91 bool found = false;
92 foreach (UserData d in m_UserCache.Values)
93 { 87 {
94 if (d.LastName.StartsWith("@") && 88 foreach (UserData d in m_UserCache.Values)
95 (d.FirstName.ToLower().Equals(words[0].ToLower()) ||
96 d.LastName.ToLower().Equals(words[1].ToLower())))
97 { 89 {
98 users.Add(d); 90 if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower()))
99 found = true; 91 users.Add(d);
100 break;
101 } 92 }
93
94 // We're done
95 return;
102 } 96 }
103 if (!found) // This is it! Let's ask the other world 97
104 { 98 // words.Length == 2 and words[0] != string.empty
105 // TODO 99 // first.last@foo.com ?
106 //UserAgentServiceConnector uasConn = new UserAgentServiceConnector(words[0]);
107 //uasConn.GetUserInfo(...);
108 }
109 }
110 else
111 {
112 foreach (UserData d in m_UserCache.Values) 100 foreach (UserData d in m_UserCache.Values)
113 { 101 {
114 if (d.LastName.StartsWith("@") && 102 if (d.LastName.StartsWith("@") &&
115 (d.FirstName.ToLower().StartsWith(query.ToLower()) || 103 d.FirstName.ToLower().Equals(words[0].ToLower()) &&
116 d.LastName.ToLower().StartsWith(query.ToLower()))) 104 d.LastName.ToLower().Equals("@" + words[1].ToLower()))
105 {
117 users.Add(d); 106 users.Add(d);
107 // It's cached. We're done
108 return;
109 }
110 }
111
112 // This is it! Let's ask the other world
113 if (words[0].Contains("."))
114 {
115 string[] names = words[0].Split(new char[] { '.' });
116 if (names.Length >= 2)
117 {
118
119 string uriStr = "http://" + words[1];
120 // Let's check that the last name is a valid address
121 try
122 {
123 new Uri(uriStr);
124 }
125 catch (UriFormatException)
126 {
127 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
128 return;
129 }
130
131 UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
132 UUID userID = uasConn.GetUUID(names[0], names[1]);
133 if (!userID.Equals(UUID.Zero))
134 {
135 UserData ud = new UserData();
136 ud.Id = userID;
137 ud.FirstName = words[0];
138 ud.LastName = "@" + words[1];
139 users.Add(ud);
140 AddUser(userID, names[0], names[1], uriStr);
141 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
142 }
143 else
144 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
145 }
118 } 146 }
119 } 147 }
148 //else
149 //{
150 // foreach (UserData d in m_UserCache.Values)
151 // {
152 // if (d.LastName.StartsWith("@") &&
153 // (d.FirstName.ToLower().StartsWith(query.ToLower()) ||
154 // d.LastName.ToLower().StartsWith(query.ToLower())))
155 // users.Add(d);
156 // }
157 //}
120 } 158 }
121 159
122 } 160 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 23ef0fc..0397478 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -183,7 +183,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
183 List<UserData> users = new List<UserData>(); 183 List<UserData> users = new List<UserData>();
184 if (accs != null) 184 if (accs != null)
185 { 185 {
186 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Found {0} users", accs.Count);
187 foreach (UserAccount acc in accs) 186 foreach (UserAccount acc in accs)
188 { 187 {
189 UserData ud = new UserData(); 188 UserData ud = new UserData();
@@ -300,7 +299,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
300 299
301 public string GetUserName(UUID uuid) 300 public string GetUserName(UUID uuid)
302 { 301 {
303 //m_log.DebugFormat("[XXX] GetUserName {0}", uuid);
304 string[] names = GetUserNames(uuid); 302 string[] names = GetUserNames(uuid);
305 if (names.Length == 2) 303 if (names.Length == 2)
306 { 304 {
@@ -341,9 +339,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
341 339
342 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) 340 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
343 { 341 {
344 m_log.DebugFormat( 342 //m_log.DebugFormat(
345 "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", 343 // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
346 serverType, userdata.HomeURL, userID); 344 // serverType, userdata.HomeURL, userID);
347 345
348 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); 346 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
349 userdata.ServerURLs = uConn.GetServerURLs(userID); 347 userdata.ServerURLs = uConn.GetServerURLs(userID);
@@ -402,11 +400,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
402 400
403 public void AddUser(UUID uuid, string first, string last, string homeURL) 401 public void AddUser(UUID uuid, string first, string last, string homeURL)
404 { 402 {
403 // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
404
405 AddUser(uuid, homeURL + ";" + first + " " + last); 405 AddUser(uuid, homeURL + ";" + first + " " + last);
406 } 406 }
407 407
408 public void AddUser (UUID id, string creatorData) 408 public void AddUser (UUID id, string creatorData)
409 { 409 {
410 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
411
410 UserData oldUser; 412 UserData oldUser;
411 //lock the whole block - prevent concurrent update 413 //lock the whole block - prevent concurrent update
412 lock (m_UserCache) 414 lock (m_UserCache)
@@ -432,9 +434,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
432 return; 434 return;
433 } 435 }
434 } 436 }
435// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
436 437
437 UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); 438 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
438 439
439 if (account != null) 440 if (account != null)
440 { 441 {
@@ -483,9 +484,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
483 lock (m_UserCache) 484 lock (m_UserCache)
484 m_UserCache[user.Id] = user; 485 m_UserCache[user.Id] = user;
485 486
486// m_log.DebugFormat( 487 //m_log.DebugFormat(
487// "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", 488 // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
488// user.Id, user.FirstName, user.LastName, user.HomeURL); 489 // user.Id, user.FirstName, user.LastName, user.HomeURL);
489 } 490 }
490 491
491 public bool IsLocalGridUser(UUID uuid) 492 public bool IsLocalGridUser(UUID uuid)