diff options
4 files changed, 37 insertions, 81 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 6f044cb..1c1ba2d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -348,10 +348,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
348 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); | 348 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); |
349 | im.fromAgentName = account.FirstName + " " + account.LastName; | 349 | im.fromAgentName = account.FirstName + " " + account.LastName; |
350 | 350 | ||
351 | PresenceInfo presence = null; | 351 | PresenceInfo presence = PresenceService.GetAgent(new UUID(im.fromAgentID)); |
352 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); | ||
353 | if (presences != null && presences.Length > 0) | ||
354 | presence = presences[0]; | ||
355 | if (presence != null) | 352 | if (presence != null) |
356 | im.offline = 0; | 353 | im.offline = 0; |
357 | 354 | ||
@@ -470,26 +467,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
470 | return; | 467 | return; |
471 | 468 | ||
472 | // The friend is not here [as root]. Let's forward. | 469 | // The friend is not here [as root]. Let's forward. |
473 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 470 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
474 | if (friendSessions != null && friendSessions.Length > 0) | 471 | if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check |
475 | { | 472 | { |
476 | PresenceInfo friendSession = null; | 473 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
477 | foreach (PresenceInfo pinfo in friendSessions) | 474 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); |
478 | if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad | 475 | m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); |
479 | { | ||
480 | friendSession = pinfo; | ||
481 | break; | ||
482 | } | ||
483 | |||
484 | if (friendSession != null) | ||
485 | { | ||
486 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
487 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); | ||
488 | m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); | ||
489 | } | ||
490 | } | 476 | } |
491 | |||
492 | // Friend is not online. Ignore. | ||
493 | } | 477 | } |
494 | else | 478 | else |
495 | m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); | 479 | m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); |
@@ -528,15 +512,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
528 | return; | 512 | return; |
529 | 513 | ||
530 | // The prospective friend is not here [as root]. Let's forward. | 514 | // The prospective friend is not here [as root]. Let's forward. |
531 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 515 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
532 | if (friendSessions != null && friendSessions.Length > 0) | 516 | if (friendSession != null) |
533 | { | 517 | { |
534 | PresenceInfo friendSession = friendSessions[0]; | 518 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
535 | if (friendSession != null) | 519 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); |
536 | { | ||
537 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
538 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); | ||
539 | } | ||
540 | } | 520 | } |
541 | // If the prospective friend is not online, he'll get the message upon login. | 521 | // If the prospective friend is not online, he'll get the message upon login. |
542 | } | 522 | } |
@@ -563,16 +543,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
563 | } | 543 | } |
564 | 544 | ||
565 | // The friend is not here | 545 | // The friend is not here |
566 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 546 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
567 | if (friendSessions != null && friendSessions.Length > 0) | 547 | if (friendSession != null) |
568 | { | 548 | { |
569 | PresenceInfo friendSession = friendSessions[0]; | 549 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
570 | if (friendSession != null) | 550 | m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); |
571 | { | 551 | client.SendAgentOnline(new UUID[] { friendID }); |
572 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
573 | m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); | ||
574 | client.SendAgentOnline(new UUID[] { friendID }); | ||
575 | } | ||
576 | } | 552 | } |
577 | } | 553 | } |
578 | 554 | ||
@@ -591,18 +567,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
591 | if (LocalFriendshipDenied(agentID, client.Name, friendID)) | 567 | if (LocalFriendshipDenied(agentID, client.Name, friendID)) |
592 | return; | 568 | return; |
593 | 569 | ||
594 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 570 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); |
595 | if (friendSessions != null && friendSessions.Length > 0) | 571 | if (friendSession != null) |
596 | { | 572 | { |
597 | PresenceInfo friendSession = friendSessions[0]; | 573 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
598 | if (friendSession != null) | 574 | if (region != null) |
599 | { | 575 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); |
600 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 576 | else |
601 | if (region != null) | 577 | m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); |
602 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); | ||
603 | else | ||
604 | m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); | ||
605 | } | ||
606 | } | 578 | } |
607 | } | 579 | } |
608 | 580 | ||
@@ -624,15 +596,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
624 | if (LocalFriendshipTerminated(exfriendID)) | 596 | if (LocalFriendshipTerminated(exfriendID)) |
625 | return; | 597 | return; |
626 | 598 | ||
627 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); | 599 | PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); |
628 | if (friendSessions != null && friendSessions.Length > 0) | 600 | if (friendSession != null) |
629 | { | 601 | { |
630 | PresenceInfo friendSession = friendSessions[0]; | 602 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
631 | if (friendSession != null) | 603 | m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); |
632 | { | ||
633 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
634 | m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); | ||
635 | } | ||
636 | } | 604 | } |
637 | } | 605 | } |
638 | 606 | ||
@@ -669,17 +637,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
669 | if (LocalGrantRights(requester, target, myFlags, rights)) | 637 | if (LocalGrantRights(requester, target, myFlags, rights)) |
670 | return; | 638 | return; |
671 | 639 | ||
672 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); | 640 | PresenceInfo friendSession = PresenceService.GetAgent(target); |
673 | if (friendSessions != null && friendSessions.Length > 0) | 641 | if (friendSession != null) |
674 | { | 642 | { |
675 | PresenceInfo friendSession = friendSessions[0]; | 643 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
676 | if (friendSession != null) | 644 | // TODO: You might want to send the delta to save the lookup |
677 | { | 645 | // on the other end!! |
678 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 646 | m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); |
679 | // TODO: You might want to send the delta to save the lookup | ||
680 | // on the other end!! | ||
681 | m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); | ||
682 | } | ||
683 | } | 647 | } |
684 | } | 648 | } |
685 | } | 649 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 730cc77..13bae2e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -498,9 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
498 | if (lookupAgent) | 498 | if (lookupAgent) |
499 | { | 499 | { |
500 | // Non-cached user agent lookup. | 500 | // Non-cached user agent lookup. |
501 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); | 501 | upd = PresenceService.GetAgent(toAgentID); |
502 | if (presences != null && presences.Length > 0) | ||
503 | upd = presences[0]; | ||
504 | 502 | ||
505 | if (upd != null) | 503 | if (upd != null) |
506 | { | 504 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b51b410..a9c5d10 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3971,9 +3971,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3971 | } | 3971 | } |
3972 | 3972 | ||
3973 | 3973 | ||
3974 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); | 3974 | pinfo = World.PresenceService.GetAgent(uuid); |
3975 | if (pinfos != null && pinfos.Length > 0) | ||
3976 | pinfo = pinfos[0]; | ||
3977 | 3975 | ||
3978 | ce = new UserInfoCacheEntry(); | 3976 | ce = new UserInfoCacheEntry(); |
3979 | ce.time = Util.EnvironmentTickCount(); | 3977 | ce.time = Util.EnvironmentTickCount(); |
@@ -3991,11 +3989,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3991 | 3989 | ||
3992 | if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) | 3990 | if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) |
3993 | { | 3991 | { |
3994 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); | 3992 | pinfo = World.PresenceService.GetAgent(uuid); |
3995 | if (pinfos != null && pinfos.Length > 0) | ||
3996 | pinfo = pinfos[0]; | ||
3997 | else | ||
3998 | pinfo = null; | ||
3999 | 3993 | ||
4000 | ce.time = Util.EnvironmentTickCount(); | 3994 | ce.time = Util.EnvironmentTickCount(); |
4001 | ce.pinfo = pinfo; | 3995 | ce.pinfo = pinfo; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 0ef4974..b7e8538 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs | |||
@@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
291 | // Check if the user is online | 291 | // Check if the user is online |
292 | if (client.Scene is Scene) | 292 | if (client.Scene is Scene) |
293 | { | 293 | { |
294 | OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); | 294 | OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID); |
295 | if (presences != null && presences.Length > 0) | 295 | if (presence != null) |
296 | flags |= ProfileFlags.Online; | 296 | flags |= ProfileFlags.Online; |
297 | } | 297 | } |
298 | 298 | ||