aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs73
1 files changed, 47 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 47fbeb4..342b3c5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -32,7 +32,7 @@ using OpenMetaverse;
32using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Services.Interfaces;
36 36
37namespace OpenSim.Region.Framework.Scenes 37namespace OpenSim.Region.Framework.Scenes
38{ 38{
@@ -331,14 +331,16 @@ namespace OpenSim.Region.Framework.Scenes
331 { 331 {
332 //EventManager.TriggerAvatarPickerRequest(); 332 //EventManager.TriggerAvatarPickerRequest();
333 333
334 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); 334 List<UserAccount> accounts = UserAccountService.GetUserAccounts(RegionInfo.ScopeID, query);
335 AvatarResponses = m_sceneGridService.GenerateAgentPickerRequestResponse(RequestID, query); 335
336 if (accounts == null)
337 return;
336 338
337 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); 339 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
338 // TODO: don't create new blocks if recycling an old packet 340 // TODO: don't create new blocks if recycling an old packet
339 341
340 AvatarPickerReplyPacket.DataBlock[] searchData = 342 AvatarPickerReplyPacket.DataBlock[] searchData =
341 new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; 343 new AvatarPickerReplyPacket.DataBlock[accounts.Count];
342 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); 344 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
343 345
344 agentData.AgentID = avatarID; 346 agentData.AgentID = avatarID;
@@ -347,16 +349,16 @@ namespace OpenSim.Region.Framework.Scenes
347 //byte[] bytes = new byte[AvatarResponses.Count*32]; 349 //byte[] bytes = new byte[AvatarResponses.Count*32];
348 350
349 int i = 0; 351 int i = 0;
350 foreach (AvatarPickerAvatar item in AvatarResponses) 352 foreach (UserAccount item in accounts)
351 { 353 {
352 UUID translatedIDtem = item.AvatarID; 354 UUID translatedIDtem = item.PrincipalID;
353 searchData[i] = new AvatarPickerReplyPacket.DataBlock(); 355 searchData[i] = new AvatarPickerReplyPacket.DataBlock();
354 searchData[i].AvatarID = translatedIDtem; 356 searchData[i].AvatarID = translatedIDtem;
355 searchData[i].FirstName = Utils.StringToBytes((string) item.firstName); 357 searchData[i].FirstName = Utils.StringToBytes((string) item.FirstName);
356 searchData[i].LastName = Utils.StringToBytes((string) item.lastName); 358 searchData[i].LastName = Utils.StringToBytes((string) item.LastName);
357 i++; 359 i++;
358 } 360 }
359 if (AvatarResponses.Count == 0) 361 if (accounts.Count == 0)
360 { 362 {
361 searchData = new AvatarPickerReplyPacket.DataBlock[0]; 363 searchData = new AvatarPickerReplyPacket.DataBlock[0];
362 } 364 }
@@ -415,7 +417,24 @@ namespace OpenSim.Region.Framework.Scenes
415 } 417 }
416 ); 418 );
417 } 419 }
418 420
421 public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
422 {
423 if (LibraryService != null && (LibraryService.LibraryRootFolder.Owner == uuid))
424 {
425 remote_client.SendNameReply(uuid, "Mr", "OpenSim");
426 }
427 else
428 {
429 string[] names = GetUserNames(uuid);
430 if (names.Length == 2)
431 {
432 remote_client.SendNameReply(uuid, names[0], names[1]);
433 }
434
435 }
436 }
437
419 /// <summary> 438 /// <summary>
420 /// Handle a fetch inventory request from the client 439 /// Handle a fetch inventory request from the client
421 /// </summary> 440 /// </summary>
@@ -424,7 +443,7 @@ namespace OpenSim.Region.Framework.Scenes
424 /// <param name="ownerID"></param> 443 /// <param name="ownerID"></param>
425 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID) 444 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
426 { 445 {
427 if (ownerID == CommsManager.UserProfileCacheService.LibraryRoot.Owner) 446 if (LibraryService != null && LibraryService.LibraryRootFolder != null && ownerID == LibraryService.LibraryRootFolder.Owner)
428 { 447 {
429 //m_log.Debug("request info for library item"); 448 //m_log.Debug("request info for library item");
430 return; 449 return;
@@ -458,13 +477,14 @@ namespace OpenSim.Region.Framework.Scenes
458 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. 477 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
459 // can be handled transparently). 478 // can be handled transparently).
460 InventoryFolderImpl fold = null; 479 InventoryFolderImpl fold = null;
461 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) 480 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
462 { 481 if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
463 remoteClient.SendInventoryFolderDetails( 482 {
464 fold.Owner, folderID, fold.RequestListOfItems(), 483 remoteClient.SendInventoryFolderDetails(
465 fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems); 484 fold.Owner, folderID, fold.RequestListOfItems(),
466 return; 485 fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
467 } 486 return;
487 }
468 488
469 // We're going to send the reply async, because there may be 489 // We're going to send the reply async, because there may be
470 // an enormous quantity of packets -- basically the entire inventory! 490 // an enormous quantity of packets -- basically the entire inventory!
@@ -512,15 +532,16 @@ namespace OpenSim.Region.Framework.Scenes
512 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. 532 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
513 // can be handled transparently). 533 // can be handled transparently).
514 InventoryFolderImpl fold; 534 InventoryFolderImpl fold;
515 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) 535 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
516 { 536 if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
517 version = 0; 537 {
518 InventoryCollection ret = new InventoryCollection(); 538 version = 0;
519 ret.Folders = new List<InventoryFolderBase>(); 539 InventoryCollection ret = new InventoryCollection();
520 ret.Items = fold.RequestListOfItems(); 540 ret.Folders = new List<InventoryFolderBase>();
541 ret.Items = fold.RequestListOfItems();
521 542
522 return ret; 543 return ret;
523 } 544 }
524 545
525 InventoryCollection contents = new InventoryCollection(); 546 InventoryCollection contents = new InventoryCollection();
526 547