diff options
author | Diva Canto | 2013-07-28 09:54:34 -0700 |
---|---|---|
committer | Diva Canto | 2013-07-28 09:54:34 -0700 |
commit | 6be614ba844ee988859fe7f63db76ef13b9f4962 (patch) | |
tree | 9134b6598ecfdfef424f012783799fd3b602c268 | |
parent | This makes group search work (Groups V2). (diff) | |
download | opensim-SC_OLD-6be614ba844ee988859fe7f63db76ef13b9f4962.zip opensim-SC_OLD-6be614ba844ee988859fe7f63db76ef13b9f4962.tar.gz opensim-SC_OLD-6be614ba844ee988859fe7f63db76ef13b9f4962.tar.bz2 opensim-SC_OLD-6be614ba844ee988859fe7f63db76ef13b9f4962.tar.xz |
This makes people search work.
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 53bd2e2..295ad64 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -46,6 +46,8 @@ using log4net; | |||
46 | using Nini.Config; | 46 | using Nini.Config; |
47 | using Mono.Addins; | 47 | using Mono.Addins; |
48 | 48 | ||
49 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; | ||
50 | |||
49 | namespace OpenSim.Region.CoreModules.Framework.UserManagement | 51 | namespace OpenSim.Region.CoreModules.Framework.UserManagement |
50 | { | 52 | { |
51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")] | 53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")] |
@@ -98,6 +100,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
98 | scene.RegisterModuleInterface<IPeople>(this); | 100 | scene.RegisterModuleInterface<IPeople>(this); |
99 | scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); | 101 | scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); |
100 | scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); | 102 | scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); |
103 | scene.EventManager.OnMakeRootAgent += new Action<ScenePresence>(EventManager_OnMakeRootAgent); | ||
104 | scene.EventManager.OnMakeChildAgent += new EventManager.OnMakeChildAgentDelegate(EventManager_OnMakeChildAgent); | ||
101 | } | 105 | } |
102 | } | 106 | } |
103 | 107 | ||
@@ -153,6 +157,43 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
153 | client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest); | 157 | client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest); |
154 | } | 158 | } |
155 | 159 | ||
160 | void EventManager_OnMakeRootAgent(ScenePresence sp) | ||
161 | { | ||
162 | sp.ControllingClient.OnDirFindQuery += OnDirFindQuery; | ||
163 | } | ||
164 | |||
165 | void EventManager_OnMakeChildAgent(ScenePresence sp) | ||
166 | { | ||
167 | sp.ControllingClient.OnDirFindQuery -= OnDirFindQuery; | ||
168 | } | ||
169 | |||
170 | void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) | ||
171 | { | ||
172 | if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People) | ||
173 | { | ||
174 | if (string.IsNullOrEmpty(queryText)) | ||
175 | remoteClient.SendDirPeopleReply(queryID, new DirPeopleReplyData[0]); | ||
176 | |||
177 | List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, queryText); | ||
178 | DirPeopleReplyData[] hits = new DirPeopleReplyData[accounts.Count]; | ||
179 | int i = 0; | ||
180 | foreach (UserAccount acc in accounts) | ||
181 | { | ||
182 | DirPeopleReplyData d = new DirPeopleReplyData(); | ||
183 | d.agentID = acc.PrincipalID; | ||
184 | d.firstName = acc.FirstName; | ||
185 | d.lastName = acc.LastName; | ||
186 | d.online = false; | ||
187 | |||
188 | hits[i++] = d; | ||
189 | } | ||
190 | |||
191 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order | ||
192 | remoteClient.SendDirPeopleReply(queryID, hits); | ||
193 | } | ||
194 | |||
195 | } | ||
196 | |||
156 | void HandleUUIDNameRequest(UUID uuid, IClientAPI client) | 197 | void HandleUUIDNameRequest(UUID uuid, IClientAPI client) |
157 | { | 198 | { |
158 | // m_log.DebugFormat( | 199 | // m_log.DebugFormat( |