aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2012-03-17 10:48:22 -0700
committerDiva Canto2012-03-17 10:48:22 -0700
commit1a4fdd26663fc6cfdcc76adb86d9babbd657a55d (patch)
tree7e7081631ca7eece5ef63a43dbe63755dc0cb955 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-1a4fdd26663fc6cfdcc76adb86d9babbd657a55d.zip
opensim-SC_OLD-1a4fdd26663fc6cfdcc76adb86d9babbd657a55d.tar.gz
opensim-SC_OLD-1a4fdd26663fc6cfdcc76adb86d9babbd657a55d.tar.bz2
opensim-SC_OLD-1a4fdd26663fc6cfdcc76adb86d9babbd657a55d.tar.xz
Moved HandleAvatarPickerRequest from the generic Scene.PacketHandlers to the UserManagementModule where it belongs. No functional changes.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs62
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
3 files changed, 62 insertions, 55 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 554af14..39e0661 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -38,6 +38,7 @@ using OpenSim.Services.Interfaces;
38using OpenSim.Services.Connectors.Hypergrid; 38using OpenSim.Services.Connectors.Hypergrid;
39 39
40using OpenMetaverse; 40using OpenMetaverse;
41using OpenMetaverse.Packets;
41using log4net; 42using log4net;
42using Nini.Config; 43using Nini.Config;
43 44
@@ -149,7 +150,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
149 150
150 void EventManager_OnNewClient(IClientAPI client) 151 void EventManager_OnNewClient(IClientAPI client)
151 { 152 {
153 client.OnConnectionClosed += new Action<IClientAPI>(HandleConnectionClosed);
152 client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); 154 client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest);
155 client.OnAvatarPickerRequest += new AvatarPickerRequest(HandleAvatarPickerRequest);
156 }
157
158 void HandleConnectionClosed(IClientAPI client)
159 {
160 client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest);
161 client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest);
153 } 162 }
154 163
155 void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) 164 void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
@@ -170,6 +179,59 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
170 } 179 }
171 } 180 }
172 181
182 public void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)
183 {
184 //EventManager.TriggerAvatarPickerRequest();
185
186 List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query);
187
188 if (accounts == null)
189 return;
190
191 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
192 // TODO: don't create new blocks if recycling an old packet
193
194 AvatarPickerReplyPacket.DataBlock[] searchData =
195 new AvatarPickerReplyPacket.DataBlock[accounts.Count];
196 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
197
198 agentData.AgentID = avatarID;
199 agentData.QueryID = RequestID;
200 replyPacket.AgentData = agentData;
201 //byte[] bytes = new byte[AvatarResponses.Count*32];
202
203 int i = 0;
204 foreach (UserAccount item in accounts)
205 {
206 UUID translatedIDtem = item.PrincipalID;
207 searchData[i] = new AvatarPickerReplyPacket.DataBlock();
208 searchData[i].AvatarID = translatedIDtem;
209 searchData[i].FirstName = Utils.StringToBytes((string)item.FirstName);
210 searchData[i].LastName = Utils.StringToBytes((string)item.LastName);
211 i++;
212 }
213 if (accounts.Count == 0)
214 {
215 searchData = new AvatarPickerReplyPacket.DataBlock[0];
216 }
217 replyPacket.Data = searchData;
218
219 AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs();
220 agent_data.AgentID = replyPacket.AgentData.AgentID;
221 agent_data.QueryID = replyPacket.AgentData.QueryID;
222
223 List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>();
224 for (i = 0; i < replyPacket.Data.Length; i++)
225 {
226 AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs();
227 data_arg.AvatarID = replyPacket.Data[i].AvatarID;
228 data_arg.FirstName = replyPacket.Data[i].FirstName;
229 data_arg.LastName = replyPacket.Data[i].LastName;
230 data_args.Add(data_arg);
231 }
232 client.SendAvatarPickerReply(agent_data, data_args);
233 }
234
173 #endregion Event Handlers 235 #endregion Event Handlers
174 236
175 private void CacheCreators(SceneObjectGroup sog) 237 private void CacheCreators(SceneObjectGroup sog)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 3355ebe..87ffc74 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -339,59 +339,6 @@ namespace OpenSim.Region.Framework.Scenes
339 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); 339 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
340 } 340 }
341 341
342 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)
343 {
344 //EventManager.TriggerAvatarPickerRequest();
345
346 List<UserAccount> accounts = UserAccountService.GetUserAccounts(RegionInfo.ScopeID, query);
347
348 if (accounts == null)
349 return;
350
351 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
352 // TODO: don't create new blocks if recycling an old packet
353
354 AvatarPickerReplyPacket.DataBlock[] searchData =
355 new AvatarPickerReplyPacket.DataBlock[accounts.Count];
356 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
357
358 agentData.AgentID = avatarID;
359 agentData.QueryID = RequestID;
360 replyPacket.AgentData = agentData;
361 //byte[] bytes = new byte[AvatarResponses.Count*32];
362
363 int i = 0;
364 foreach (UserAccount item in accounts)
365 {
366 UUID translatedIDtem = item.PrincipalID;
367 searchData[i] = new AvatarPickerReplyPacket.DataBlock();
368 searchData[i].AvatarID = translatedIDtem;
369 searchData[i].FirstName = Utils.StringToBytes((string) item.FirstName);
370 searchData[i].LastName = Utils.StringToBytes((string) item.LastName);
371 i++;
372 }
373 if (accounts.Count == 0)
374 {
375 searchData = new AvatarPickerReplyPacket.DataBlock[0];
376 }
377 replyPacket.Data = searchData;
378
379 AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs();
380 agent_data.AgentID = replyPacket.AgentData.AgentID;
381 agent_data.QueryID = replyPacket.AgentData.QueryID;
382
383 List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>();
384 for (i = 0; i < replyPacket.Data.Length; i++)
385 {
386 AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs();
387 data_arg.AvatarID = replyPacket.Data[i].AvatarID;
388 data_arg.FirstName = replyPacket.Data[i].FirstName;
389 data_arg.LastName = replyPacket.Data[i].LastName;
390 data_args.Add(data_arg);
391 }
392 client.SendAvatarPickerReply(agent_data, data_args);
393 }
394
395 public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, 342 public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID,
396 UUID itemID) 343 UUID itemID)
397 { 344 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0042f7b..0706905 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2767,7 +2767,6 @@ namespace OpenSim.Region.Framework.Scenes
2767 { 2767 {
2768 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; 2768 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
2769 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2769 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
2770 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
2771 client.OnSetStartLocationRequest += SetHomeRezPoint; 2770 client.OnSetStartLocationRequest += SetHomeRezPoint;
2772 client.OnRegionHandleRequest += RegionHandleRequest; 2771 client.OnRegionHandleRequest += RegionHandleRequest;
2773 } 2772 }
@@ -2893,7 +2892,6 @@ namespace OpenSim.Region.Framework.Scenes
2893 { 2892 {
2894 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; 2893 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
2895 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 2894 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
2896 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
2897 client.OnSetStartLocationRequest -= SetHomeRezPoint; 2895 client.OnSetStartLocationRequest -= SetHomeRezPoint;
2898 client.OnRegionHandleRequest -= RegionHandleRequest; 2896 client.OnRegionHandleRequest -= RegionHandleRequest;
2899 } 2897 }