aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorroot2010-09-17 01:50:48 +0200
committerMelanie2010-09-17 01:57:26 +0100
commit7762301cea99215df4068cca71b78335df5a4a40 (patch)
tree4423c7a47e4305881f1c1aa9472d965027336314 /OpenSim/Region/CoreModules
parentFixed a regression in SOG.Copy() (diff)
downloadopensim-SC-7762301cea99215df4068cca71b78335df5a4a40.zip
opensim-SC-7762301cea99215df4068cca71b78335df5a4a40.tar.gz
opensim-SC-7762301cea99215df4068cca71b78335df5a4a40.tar.bz2
opensim-SC-7762301cea99215df4068cca71b78335df5a4a40.tar.xz
Revert "* Changed 11 calls for session info to the more optimized API method"
This reverts commit 5dc9ea2f2487804d788b4b80d40d91bd792de4c2. Also makes online indicators and IM more robust
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs103
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs13
2 files changed, 83 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 4e4eee9..7a21d5e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -317,7 +317,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
317 continue; 317 continue;
318 318
319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); 319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
320 PresenceInfo presence = PresenceService.GetAgent(fromAgentID); 320
321 PresenceInfo presence = null;
322 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
323 if (presences != null && presences.Length > 0)
324 presence = presences[0];
325 if (presence != null)
326 im.offline = 0;
321 327
322 im.fromAgentID = fromAgentID.Guid; 328 im.fromAgentID = fromAgentID.Guid;
323 im.fromAgentName = account.FirstName + " " + account.LastName; 329 im.fromAgentName = account.FirstName + " " + account.LastName;
@@ -430,13 +436,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
430 return; 436 return;
431 437
432 // The friend is not here [as root]. Let's forward. 438 // The friend is not here [as root]. Let's forward.
433 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 439 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
434 if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check 440 if (friendSessions != null && friendSessions.Length > 0)
435 { 441 {
436 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 442 PresenceInfo friendSession = null;
437 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); 443 foreach (PresenceInfo pinfo in friendSessions)
438 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); 444 if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
445 {
446 friendSession = pinfo;
447 break;
448 }
449
450 if (friendSession != null)
451 {
452 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
453 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
454 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
455 }
439 } 456 }
457
458 // Friend is not online. Ignore.
440 } 459 }
441 else 460 else
442 { 461 {
@@ -477,11 +496,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
477 return; 496 return;
478 497
479 // The prospective friend is not here [as root]. Let's forward. 498 // The prospective friend is not here [as root]. Let's forward.
480 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 499 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
481 if (friendSession != null) 500 if (friendSessions != null && friendSessions.Length > 0)
482 { 501 {
483 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 502 PresenceInfo friendSession = friendSessions[0];
484 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); 503 if (friendSession != null)
504 {
505 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
506 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
507 }
485 } 508 }
486 // If the prospective friend is not online, he'll get the message upon login. 509 // If the prospective friend is not online, he'll get the message upon login.
487 } 510 }
@@ -508,12 +531,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
508 } 531 }
509 532
510 // The friend is not here 533 // The friend is not here
511 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 534 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
512 if (friendSession != null) 535 if (friendSessions != null && friendSessions.Length > 0)
513 { 536 {
514 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 537 PresenceInfo friendSession = friendSessions[0];
515 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 538 if (friendSession != null)
516 client.SendAgentOnline(new UUID[] { friendID }); 539 {
540 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
541 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
542 client.SendAgentOnline(new UUID[] { friendID });
543 }
517 } 544 }
518 } 545 }
519 546
@@ -532,14 +559,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
532 if (LocalFriendshipDenied(agentID, client.Name, friendID)) 559 if (LocalFriendshipDenied(agentID, client.Name, friendID))
533 return; 560 return;
534 561
535 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 562 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
536 if (friendSession != null) 563 if (friendSessions != null && friendSessions.Length > 0)
537 { 564 {
538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 565 PresenceInfo friendSession = friendSessions[0];
539 if (region != null) 566 if (friendSession != null)
540 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 567 {
541 else 568 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
542 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); 569 if (region != null)
570 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
571 else
572 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
573 }
543 } 574 }
544 } 575 }
545 576
@@ -561,11 +592,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
561 if (LocalFriendshipTerminated(exfriendID)) 592 if (LocalFriendshipTerminated(exfriendID))
562 return; 593 return;
563 594
564 PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); 595 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
565 if (friendSession != null) 596 if (friendSessions != null && friendSessions.Length > 0)
566 { 597 {
567 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 598 PresenceInfo friendSession = friendSessions[0];
568 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); 599 if (friendSession != null)
600 {
601 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
602 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
603 }
569 } 604 }
570 } 605 }
571 606
@@ -604,13 +639,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
604 if (LocalGrantRights(requester, target, myFlags, rights)) 639 if (LocalGrantRights(requester, target, myFlags, rights))
605 return; 640 return;
606 641
607 PresenceInfo friendSession = PresenceService.GetAgent(target); 642 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
608 if (friendSession != null) 643 if (friendSessions != null && friendSessions.Length > 0)
609 { 644 {
610 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 645 PresenceInfo friendSession = friendSessions[0];
611 // TODO: You might want to send the delta to save the lookup 646 if (friendSession != null)
612 // on the other end!! 647 {
613 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); 648 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
649 // TODO: You might want to send the delta to save the lookup
650 // on the other end!!
651 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
652 }
614 } 653 }
615 } 654 }
616 } 655 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 43bbf0d..9b1222b 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -498,7 +498,18 @@ 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 upd = PresenceService.GetAgent(toAgentID); 501 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
502 if (presences != null && presences.Length > 0)
503 {
504 foreach (PresenceInfo p in presences)
505 {
506 if (p.RegionID != UUID.Zero)
507 {
508 upd = p;
509 break;
510 }
511 }
512 }
502 513
503 if (upd != null) 514 if (upd != null)
504 { 515 {