aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2013-05-07 18:01:48 -0700
committerDiva Canto2013-05-07 18:01:48 -0700
commite92c05ebbdc44084326c3dcfa0a2ca0958e4b5e6 (patch)
tree00f06fd1fabe55c5d579f4c33964f5ecbce13e46 /OpenSim/Region/CoreModules
parentBulletSim: normalize quaternian rotations when building compound linksets. (diff)
downloadopensim-SC_OLD-e92c05ebbdc44084326c3dcfa0a2ca0958e4b5e6.zip
opensim-SC_OLD-e92c05ebbdc44084326c3dcfa0a2ca0958e4b5e6.tar.gz
opensim-SC_OLD-e92c05ebbdc44084326c3dcfa0a2ca0958e4b5e6.tar.bz2
opensim-SC_OLD-e92c05ebbdc44084326c3dcfa0a2ca0958e4b5e6.tar.xz
Added AvatarPickerSearch capability handler.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs72
2 files changed, 39 insertions, 35 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index 8ce20e9..fac93e6 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
70 70
71 #endregion ISharedRegionModule 71 #endregion ISharedRegionModule
72 72
73 protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users) 73 protected override void AddAdditionalUsers(string query, List<UserData> users)
74 { 74 {
75 if (query.Contains("@")) // First.Last@foo.com, maybe? 75 if (query.Contains("@")) // First.Last@foo.com, maybe?
76 { 76 {
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 7b823ba..6847e57 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -46,17 +46,8 @@ using Mono.Addins;
46 46
47namespace OpenSim.Region.CoreModules.Framework.UserManagement 47namespace OpenSim.Region.CoreModules.Framework.UserManagement
48{ 48{
49 public class UserData
50 {
51 public UUID Id { get; set; }
52 public string FirstName { get; set; }
53 public string LastName { get; set; }
54 public string HomeURL { get; set; }
55 public Dictionary<string, object> ServerURLs { get; set; }
56 }
57
58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")] 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")]
59 public class UserManagementModule : ISharedRegionModule, IUserManagement 50 public class UserManagementModule : ISharedRegionModule, IUserManagement, IPeople
60 { 51 {
61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
62 53
@@ -101,6 +92,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
101 m_Scenes.Add(scene); 92 m_Scenes.Add(scene);
102 93
103 scene.RegisterModuleInterface<IUserManagement>(this); 94 scene.RegisterModuleInterface<IUserManagement>(this);
95 scene.RegisterModuleInterface<IPeople>(this);
104 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); 96 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
105 scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); 97 scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded);
106 } 98 }
@@ -181,29 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
181 173
182 m_log.DebugFormat("[USER MANAGEMENT MODULE]: HandleAvatarPickerRequest for {0}", query); 174 m_log.DebugFormat("[USER MANAGEMENT MODULE]: HandleAvatarPickerRequest for {0}", query);
183 175
184 // searhc the user accounts service 176 List<UserData> users = GetUserData(query, 500, 1);
185 List<UserAccount> accs = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query);
186
187 List<UserData> users = new List<UserData>();
188 if (accs != null)
189 {
190 foreach (UserAccount acc in accs)
191 {
192 UserData ud = new UserData();
193 ud.FirstName = acc.FirstName;
194 ud.LastName = acc.LastName;
195 ud.Id = acc.PrincipalID;
196 users.Add(ud);
197 }
198 }
199
200 // search the local cache
201 foreach (UserData data in m_UserCache.Values)
202 if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
203 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
204 users.Add(data);
205
206 AddAdditionalUsers(avatarID, query, users);
207 177
208 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); 178 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
209 // TODO: don't create new blocks if recycling an old packet 179 // TODO: don't create new blocks if recycling an old packet
@@ -249,12 +219,46 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
249 client.SendAvatarPickerReply(agent_data, data_args); 219 client.SendAvatarPickerReply(agent_data, data_args);
250 } 220 }
251 221
252 protected virtual void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users) 222 protected virtual void AddAdditionalUsers(string query, List<UserData> users)
253 { 223 {
254 } 224 }
255 225
256 #endregion Event Handlers 226 #endregion Event Handlers
257 227
228 #region IPeople
229
230 public List<UserData> GetUserData(string query, int page_size, int page_number)
231 {
232 // search the user accounts service
233 List<UserAccount> accs = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query);
234
235 List<UserData> users = new List<UserData>();
236 if (accs != null)
237 {
238 foreach (UserAccount acc in accs)
239 {
240 UserData ud = new UserData();
241 ud.FirstName = acc.FirstName;
242 ud.LastName = acc.LastName;
243 ud.Id = acc.PrincipalID;
244 users.Add(ud);
245 }
246 }
247
248 // search the local cache
249 foreach (UserData data in m_UserCache.Values)
250 if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
251 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
252 users.Add(data);
253
254 AddAdditionalUsers(query, users);
255
256 return users;
257
258 }
259
260 #endregion IPeople
261
258 private void CacheCreators(SceneObjectGroup sog) 262 private void CacheCreators(SceneObjectGroup sog)
259 { 263 {
260 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification); 264 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification);