aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs76
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs20
2 files changed, 54 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index 66de8e4..4eecaa2 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -71,43 +71,52 @@ 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 { 87 {
91 bool found = false; 88 foreach (UserData d in m_UserCache.Values)
89 {
90 if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower()))
91 users.Add(d);
92 }
93
94 // We're done
95 return;
96 }
97
98 // words.Length == 2 and words[0] != string.empty
99 // first.last@foo.com ?
92 foreach (UserData d in m_UserCache.Values) 100 foreach (UserData d in m_UserCache.Values)
93 { 101 {
94 if (d.LastName.StartsWith("@") && 102 if (d.LastName.StartsWith("@") &&
95 d.FirstName.ToLower().Equals(words[0].ToLower()) && 103 d.FirstName.ToLower().Equals(words[0].ToLower()) &&
96 d.LastName.ToLower().Equals(words[1].ToLower())) 104 d.LastName.ToLower().Equals("@" + words[1].ToLower()))
97 { 105 {
98 users.Add(d); 106 users.Add(d);
99 found = true; 107 // It's cached. We're done
100 break; 108 return;
101 } 109 }
102 } 110 }
103 111
104 if (!found && words[1].StartsWith("@") && words[0].Contains(".")) // This is it! Let's ask the other world 112 // This is it! Let's ask the other world
113 if (words[0].Contains("."))
105 { 114 {
106 string[] names = words[0].Split(new char[] { '.' }); 115 string[] names = words[0].Split(new char[] { '.' });
107 if (names.Length >= 2) 116 if (names.Length >= 2)
108 { 117 {
109 118
110 string uriStr = "http://" + words[1].Substring(1); // remove the @ 119 string uriStr = "http://" + words[1];
111 // Let's check that the last name is a valid address 120 // Let's check that the last name is a valid address
112 try 121 try
113 { 122 {
@@ -115,6 +124,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
115 } 124 }
116 catch (UriFormatException) 125 catch (UriFormatException)
117 { 126 {
127 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
118 return; 128 return;
119 } 129 }
120 130
@@ -125,26 +135,26 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
125 UserData ud = new UserData(); 135 UserData ud = new UserData();
126 ud.Id = userID; 136 ud.Id = userID;
127 ud.FirstName = words[0]; 137 ud.FirstName = words[0];
128 ud.LastName = words[1]; 138 ud.LastName = "@" + words[1];
129 users.Add(ud); 139 users.Add(ud);
130 AddUser(userID, ud.FirstName, ud.LastName, uriStr); 140 AddUser(userID, names[0], names[1], uriStr);
131 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0} {1} found", words[0], words[1]); 141 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
132 } 142 }
133 else 143 else
134 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0} {1} not found", words[0], words[1]); 144 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
135 } 145 }
136 } 146 }
137 } 147 }
138 else 148 //else
139 { 149 //{
140 foreach (UserData d in m_UserCache.Values) 150 // foreach (UserData d in m_UserCache.Values)
141 { 151 // {
142 if (d.LastName.StartsWith("@") && 152 // if (d.LastName.StartsWith("@") &&
143 (d.FirstName.ToLower().StartsWith(query.ToLower()) || 153 // (d.FirstName.ToLower().StartsWith(query.ToLower()) ||
144 d.LastName.ToLower().StartsWith(query.ToLower()))) 154 // d.LastName.ToLower().StartsWith(query.ToLower())))
145 users.Add(d); 155 // users.Add(d);
146 } 156 // }
147 } 157 //}
148 } 158 }
149 159
150 } 160 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index cb562a2..0397478 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -299,7 +299,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
299 299
300 public string GetUserName(UUID uuid) 300 public string GetUserName(UUID uuid)
301 { 301 {
302 //m_log.DebugFormat("[XXX] GetUserName {0}", uuid);
303 string[] names = GetUserNames(uuid); 302 string[] names = GetUserNames(uuid);
304 if (names.Length == 2) 303 if (names.Length == 2)
305 { 304 {
@@ -340,9 +339,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
340 339
341 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) 340 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
342 { 341 {
343 m_log.DebugFormat( 342 //m_log.DebugFormat(
344 "[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}",
345 serverType, userdata.HomeURL, userID); 344 // serverType, userdata.HomeURL, userID);
346 345
347 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); 346 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
348 userdata.ServerURLs = uConn.GetServerURLs(userID); 347 userdata.ServerURLs = uConn.GetServerURLs(userID);
@@ -401,11 +400,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
401 400
402 public void AddUser(UUID uuid, string first, string last, string homeURL) 401 public void AddUser(UUID uuid, string first, string last, string homeURL)
403 { 402 {
403 // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
404
404 AddUser(uuid, homeURL + ";" + first + " " + last); 405 AddUser(uuid, homeURL + ";" + first + " " + last);
405 } 406 }
406 407
407 public void AddUser (UUID id, string creatorData) 408 public void AddUser (UUID id, string creatorData)
408 { 409 {
410 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
411
409 UserData oldUser; 412 UserData oldUser;
410 //lock the whole block - prevent concurrent update 413 //lock the whole block - prevent concurrent update
411 lock (m_UserCache) 414 lock (m_UserCache)
@@ -431,9 +434,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
431 return; 434 return;
432 } 435 }
433 } 436 }
434// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
435 437
436 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);
437 439
438 if (account != null) 440 if (account != null)
439 { 441 {
@@ -482,9 +484,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
482 lock (m_UserCache) 484 lock (m_UserCache)
483 m_UserCache[user.Id] = user; 485 m_UserCache[user.Id] = user;
484 486
485// m_log.DebugFormat( 487 //m_log.DebugFormat(
486// "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", 488 // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
487// user.Id, user.FirstName, user.LastName, user.HomeURL); 489 // user.Id, user.FirstName, user.LastName, user.HomeURL);
488 } 490 }
489 491
490 public bool IsLocalGridUser(UUID uuid) 492 public bool IsLocalGridUser(UUID uuid)