aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs27
1 files changed, 16 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 49b2b5c..fc7d63a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Cache;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
43using GridRegion = OpenSim.Services.Interfaces.GridRegion;
43 44
44namespace OpenSim.Region.CoreModules.Avatar.Friends 45namespace OpenSim.Region.CoreModules.Avatar.Friends
45{ 46{
@@ -108,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
108 private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>(); 109 private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>();
109 private IMessageTransferModule m_TransferModule = null; 110 private IMessageTransferModule m_TransferModule = null;
110 111
111 private IGridServices m_gridServices = null; 112 private IGridService m_gridServices = null;
112 113
113 #region IRegionModule Members 114 #region IRegionModule Members
114 115
@@ -142,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
142 if (m_scenes.Count > 0) 143 if (m_scenes.Count > 0)
143 { 144 {
144 m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>(); 145 m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>();
145 m_gridServices = m_initialScene.CommsManager.GridService; 146 m_gridServices = m_initialScene.GridService;
146 } 147 }
147 if (m_TransferModule == null) 148 if (m_TransferModule == null)
148 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); 149 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work");
@@ -171,7 +172,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
171 List<UUID> tpdAway = new List<UUID>(); 172 List<UUID> tpdAway = new List<UUID>();
172 173
173 // destRegionHandle is a region on another server 174 // destRegionHandle is a region on another server
174 RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle); 175 uint x = 0, y = 0;
176 Utils.LongToUInts(destRegionHandle, out x, out y);
177 GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
175 if (info != null) 178 if (info != null)
176 { 179 {
177 string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; 180 string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk";
@@ -223,7 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
223 public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID) 226 public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID)
224 { 227 {
225 // destRegionHandle is a region on another server 228 // destRegionHandle is a region on another server
226 RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle); 229 uint x = 0, y = 0;
230 Utils.LongToUInts(destRegionHandle, out x, out y);
231 GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
227 if (info == null) 232 if (info == null)
228 { 233 {
229 m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle); 234 m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle);
@@ -492,7 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
492 { 497 {
493 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId); 498 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId);
494 } 499 }
495 } 500 }
496 501
497 #region FriendRequestHandling 502 #region FriendRequestHandling
498 503
@@ -503,7 +508,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
503 508
504 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38 509 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38
505 { 510 {
506 // fromAgentName is the *destination* name (the friend we offer friendship to) 511 // fromAgentName is the *destination* name (the friend we offer friendship to)
507 ScenePresence initiator = GetAnyPresenceFromAgentID(new UUID(im.fromAgentID)); 512 ScenePresence initiator = GetAnyPresenceFromAgentID(new UUID(im.fromAgentID));
508 im.fromAgentName = initiator != null ? initiator.Name : "(hippo)"; 513 im.fromAgentName = initiator != null ? initiator.Name : "(hippo)";
509 514
@@ -523,13 +528,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
523 /// Invoked when a user offers a friendship. 528 /// Invoked when a user offers a friendship.
524 /// </summary> 529 /// </summary>
525 /// 530 ///
526 /// <param name="im"></param> 531 /// <param name="im"></param>
527 /// <param name="client"></param> 532 /// <param name="client"></param>
528 private void FriendshipOffered(GridInstantMessage im) 533 private void FriendshipOffered(GridInstantMessage im)
529 { 534 {
530 // this is triggered by the initiating agent: 535 // this is triggered by the initiating agent:
531 // A local agent offers friendship to some possibly remote friend. 536 // A local agent offers friendship to some possibly remote friend.
532 // A IM is triggered, processed here and sent to the friend (possibly in a remote region). 537 // A IM is triggered, processed here and sent to the friend (possibly in a remote region).
533 538
534 m_log.DebugFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}", 539 m_log.DebugFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}",
535 im.fromAgentID, im.fromAgentName, im.toAgentID, im.imSessionID, im.message, im.offline); 540 im.fromAgentID, im.fromAgentName, im.toAgentID, im.imSessionID, im.message, im.offline);
@@ -554,7 +559,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
554 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 559 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
555 } 560 }
556 ); 561 );
557 } 562 }
558 } 563 }
559 564
560 /// <summary> 565 /// <summary>
@@ -565,7 +570,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
565 private void FriendshipAccepted(IClientAPI client, GridInstantMessage im) 570 private void FriendshipAccepted(IClientAPI client, GridInstantMessage im)
566 { 571 {
567 m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})", 572 m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})",
568 client.AgentId, im.fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog); 573 client.AgentId, im.fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog);
569 } 574 }
570 575
571 /// <summary> 576 /// <summary>
@@ -597,7 +602,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
597 delegate(bool success) { 602 delegate(bool success) {
598 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 603 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
599 } 604 }
600 ); 605 );
601 } 606 }
602 607
603 private void OnGridInstantMessage(GridInstantMessage msg) 608 private void OnGridInstantMessage(GridInstantMessage msg)