aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/HGCommands.cs3
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServices.cs50
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs227
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs22
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs19
9 files changed, 305 insertions, 91 deletions
diff --git a/OpenSim/Region/Application/HGCommands.cs b/OpenSim/Region/Application/HGCommands.cs
index f99c1a5..f503db7 100644
--- a/OpenSim/Region/Application/HGCommands.cs
+++ b/OpenSim/Region/Application/HGCommands.cs
@@ -43,12 +43,11 @@ namespace OpenSim
43 public class HGCommands 43 public class HGCommands
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 public static IHyperlink HGServices = null;
47 46
48 public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, 47 public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
49 StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) 48 StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
50 { 49 {
51 HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); 50 HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager);
52 51
53 return 52 return
54 new HGScene( 53 new HGScene(
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
index 54cde0f..85bfab4 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
@@ -596,16 +596,16 @@ namespace OpenSim.Region.Communications.Hypergrid
596 //m_log.Debug(" >> " + loginParams["region_uuid"] + " <<"); 596 //m_log.Debug(" >> " + loginParams["region_uuid"] + " <<");
597 //m_log.Debug(" --------- ---------------- -------"); 597 //m_log.Debug(" --------- ---------------- -------");
598 598
599 string serverURI = ""; 599 //string serverURI = "";
600 if (u.UserProfile is ForeignUserProfileData) 600 //if (u.UserProfile is ForeignUserProfileData)
601 serverURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI); 601 // serverURI = Util.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI);
602 loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI; 602 //loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI;
603 603
604 serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI); 604 //serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI);
605 loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI; 605 //loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI;
606 606
607 serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI); 607 //serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI);
608 loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI; 608 //loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI;
609 609
610 loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID; 610 loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID;
611 611
@@ -949,33 +949,35 @@ namespace OpenSim.Region.Communications.Hypergrid
949 949
950 protected bool IsComingHome(ForeignUserProfileData userData) 950 protected bool IsComingHome(ForeignUserProfileData userData)
951 { 951 {
952 return (userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI); 952 return false; //(userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI);
953 } 953 }
954 954
955 protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo) 955 protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo)
956 { 956 {
957 if (uinfo.UserProfile == null) 957 return false;
958 return false; 958 //if (uinfo.UserProfile == null)
959 // return false;
959 960
960 string userUserServerURI = String.Empty; 961 //string userUserServerURI = String.Empty;
961 if (uinfo.UserProfile is ForeignUserProfileData) 962 //if (uinfo.UserProfile is ForeignUserProfileData)
962 { 963 //{
963 userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); 964 // userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
964 } 965 //}
965 966
966 return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) && 967 //return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) &&
967 (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI)); 968 // (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI));
968 } 969 }
969 970
970 protected bool IsLocalUser(CachedUserInfo uinfo) 971 protected bool IsLocalUser(CachedUserInfo uinfo)
971 { 972 {
972 if (uinfo == null) 973 return true;
973 return true; 974 //if (uinfo == null)
975 // return true;
974 976
975 if (uinfo.UserProfile is ForeignUserProfileData) 977 //if (uinfo.UserProfile is ForeignUserProfileData)
976 return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); 978 // return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
977 else 979 //else
978 return true; 980 // return true;
979 981
980 } 982 }
981 983
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
index 41f96b3..9bf31a4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 37using OpenSim.Server.Base;
38using OpenSim.Server.Handlers.Base; 38using OpenSim.Server.Handlers.Base;
39using OpenSim.Server.Handlers.Grid; 39using OpenSim.Server.Handlers.Grid;
40using OpenSim.Services.Interfaces;
40using GridRegion = OpenSim.Services.Interfaces.GridRegion; 41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 42
42namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid 43namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
@@ -95,20 +96,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
95 if (!m_Enabled) 96 if (!m_Enabled)
96 return; 97 return;
97 98
98 if (!m_Registered)
99 {
100 m_Registered = true;
101
102 m_log.Info("[HypergridService]: Starting...");
103
104 Object[] args = new Object[] { m_Config, MainServer.Instance };
105
106 m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance);
107 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
108 }
109
110 GridRegion rinfo = new GridRegion(scene.RegionInfo);
111 m_HypergridHandler.AddRegion(rinfo);
112 } 99 }
113 100
114 public void RemoveRegion(Scene scene) 101 public void RemoveRegion(Scene scene)
@@ -122,6 +109,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
122 109
123 public void RegionLoaded(Scene scene) 110 public void RegionLoaded(Scene scene)
124 { 111 {
112 if (!m_Registered)
113 {
114 m_Registered = true;
115
116 m_log.Info("[HypergridService]: Starting...");
117
118 Object[] args = new Object[] { m_Config, MainServer.Instance };
119
120 m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance, scene.RequestModuleInterface<IHyperlinkService>());
121 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
122 }
123
124 GridRegion rinfo = new GridRegion(scene.RegionInfo);
125 m_HypergridHandler.AddRegion(rinfo);
125 } 126 }
126 127
127 #endregion 128 #endregion
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index 0bb4206..52db400 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -31,6 +31,7 @@ using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33 33
34using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -52,10 +53,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
52 private static readonly ILog m_log = 53 private static readonly ILog m_log =
53 LogManager.GetLogger( 54 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 55 MethodBase.GetCurrentMethod().DeclaringType);
56 private static string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI;
55 57
56 private bool m_Enabled = false; 58 private bool m_Enabled = false;
57 private bool m_Initialized = false; 59 private bool m_Initialized = false;
58 60
61 private Scene m_aScene;
62 private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
63
59 private IGridService m_GridServiceConnector; 64 private IGridService m_GridServiceConnector;
60 private HypergridServiceConnector m_HypergridServiceConnector; 65 private HypergridServiceConnector m_HypergridServiceConnector;
61 66
@@ -141,6 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
141 if (!m_Enabled) 146 if (!m_Enabled)
142 return; 147 return;
143 148
149 m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
144 scene.RegisterModuleInterface<IGridService>(this); 150 scene.RegisterModuleInterface<IGridService>(this);
145 scene.RegisterModuleInterface<IHyperlinkService>(this); 151 scene.RegisterModuleInterface<IHyperlinkService>(this);
146 152
@@ -148,6 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
148 154
149 public void RemoveRegion(Scene scene) 155 public void RemoveRegion(Scene scene)
150 { 156 {
157 m_LocalScenes.Remove(scene.RegionInfo.RegionHandle);
151 } 158 }
152 159
153 public void RegionLoaded(Scene scene) 160 public void RegionLoaded(Scene scene)
@@ -157,7 +164,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
157 164
158 if (!m_Initialized) 165 if (!m_Initialized)
159 { 166 {
167 m_aScene = scene;
168 LocalAssetServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
169 LocalInventoryServerURI = m_aScene.CommsManager.NetworkServersInfo.InventoryURL;
170 LocalUserServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
171
160 m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService); 172 m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService);
173
161 HGCommands hgCommands = new HGCommands(this, scene); 174 HGCommands hgCommands = new HGCommands(this, scene);
162 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-region", 175 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-region",
163 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", 176 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
@@ -167,6 +180,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
167 "Unlink a hypergrid region", hgCommands.RunCommand); 180 "Unlink a hypergrid region", hgCommands.RunCommand);
168 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [<x> <y>] <cr>", 181 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
169 "Set local coordinate to map HG regions to", hgCommands.RunCommand); 182 "Set local coordinate to map HG regions to", hgCommands.RunCommand);
183
184 // Yikes!! Remove this as soon as user services get refactored
185 HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI);
186
170 m_Initialized = true; 187 m_Initialized = true;
171 } 188 }
172 } 189 }
@@ -240,7 +257,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
240 // Try the foreign users home collection 257 // Try the foreign users home collection
241 foreach (GridRegion r in m_knownRegions.Values) 258 foreach (GridRegion r in m_knownRegions.Values)
242 if (r.RegionID == regionID) 259 if (r.RegionID == regionID)
243 return m_knownRegions[regionID]; 260 return r;
244 261
245 // Finally, try the normal route 262 // Finally, try the normal route
246 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID); 263 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
@@ -261,7 +278,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
261 foreach (GridRegion r in m_knownRegions.Values) 278 foreach (GridRegion r in m_knownRegions.Values)
262 { 279 {
263 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY)) 280 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
281 {
264 return r; 282 return r;
283 }
265 } 284 }
266 285
267 // Finally, try the normal route 286 // Finally, try the normal route
@@ -328,8 +347,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
328 347
329 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 348 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
330 { 349 {
331 m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo); 350 m_HyperlinkRegions[regionInfo.RegionID] = regionInfo;
332 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 351 m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
333 } 352 }
334 353
335 private void RemoveHyperlinkRegion(UUID regionID) 354 private void RemoveHyperlinkRegion(UUID regionID)
@@ -340,8 +359,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
340 359
341 private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle) 360 private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle)
342 { 361 {
343 m_knownRegions.Add(userID, regionInfo); 362 m_knownRegions[userID] = regionInfo;
344 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 363 m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
345 } 364 }
346 365
347 private void RemoveHyperlinkHomeRegion(UUID regionID) 366 private void RemoveHyperlinkHomeRegion(UUID regionID)
@@ -412,7 +431,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
412 // From the map search and secondlife://blah 431 // From the map search and secondlife://blah
413 public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName) 432 public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
414 { 433 {
415 int xloc = random.Next(0, Int16.MaxValue); 434 int xloc = random.Next(0, Int16.MaxValue) * (int) Constants.RegionSize;
416 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0); 435 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
417 } 436 }
418 437
@@ -563,10 +582,206 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
563 foreach (GridRegion r in m_HyperlinkRegions.Values) 582 foreach (GridRegion r in m_HyperlinkRegions.Values)
564 if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID))) 583 if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
565 return m_HyperlinkHandles[r.RegionID]; 584 return m_HyperlinkHandles[r.RegionID];
585
586 foreach (GridRegion r in m_knownRegions.Values)
587 if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
588 return m_HyperlinkHandles[r.RegionID];
589
566 return handle; 590 return handle;
567 } 591 }
568 592
593 public bool SendUserInformation(GridRegion regInfo, AgentCircuitData agentData)
594 {
595 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
596
597 if ((IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) ||
598 (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo)))
599 {
600 m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
601
602 // Set the position of the region on the remote grid
603 ulong realHandle = FindRegionHandle(regInfo.RegionHandle);
604 uint x = 0, y = 0;
605 Utils.LongToUInts(regInfo.RegionHandle, out x, out y);
606 GridRegion clonedRegion = new GridRegion(regInfo);
607 clonedRegion.RegionLocX = (int)x;
608 clonedRegion.RegionLocY = (int)y;
609
610 // Get the user's home region information
611 GridRegion home = m_aScene.GridService.GetRegionByUUID(m_aScene.RegionInfo.ScopeID, uinfo.UserProfile.HomeRegionID);
612
613 // Get the user's service URLs
614 string serverURI = "";
615 if (uinfo.UserProfile is ForeignUserProfileData)
616 serverURI = Util.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
617 string userServer = (serverURI == "") || (serverURI == null) ? LocalUserServerURI : serverURI;
618
619 string assetServer = Util.ServerURI(uinfo.UserProfile.UserAssetURI);
620 if ((assetServer == null) || (assetServer == ""))
621 assetServer = LocalAssetServerURI;
622
623 string inventoryServer = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
624 if ((inventoryServer == null) || (inventoryServer == ""))
625 inventoryServer = LocalInventoryServerURI;
626
627 if (!m_HypergridServiceConnector.InformRegionOfUser(clonedRegion, agentData, home, userServer, assetServer, inventoryServer))
628 {
629 m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
630 return false;
631 }
632 }
633 //if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
634 //{
635 // m_log.Info("[HGrid]: User seems to be going to foreign region.");
636 // if (!InformRegionOfUser(regInfo, agentData))
637 // {
638 // m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
639 // return false;
640 // }
641 //}
642 //else
643 // m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
644
645 // May need to change agent's name
646 if (IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null))
647 {
648 agentData.firstname = agentData.firstname + "." + agentData.lastname;
649 agentData.lastname = "@" + LocalUserServerURI.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
650 }
651
652 return true;
653 }
654
655 public void AdjustUserInformation(AgentCircuitData agentData)
656 {
657 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
658 if ((uinfo != null) && (uinfo.UserProfile != null) &&
659 (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData)))
660 {
661 //m_log.Debug("---------------> Local User!");
662 string[] parts = agentData.firstname.Split(new char[] { '.' });
663 if (parts.Length == 2)
664 {
665 agentData.firstname = parts[0];
666 agentData.lastname = parts[1];
667 }
668 }
669 //else
670 // m_log.Debug("---------------> Foreign User!");
671 }
672
673 // Check if a local user exists with the same UUID as the incoming foreign user
674 public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
675 {
676 comingHome = false;
677 if (!m_aScene.SceneGridService.RegionLoginsEnabled)
678 return false;
679
680 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
681 if (uinfo != null)
682 {
683 // uh-oh we have a potential intruder
684 if (uinfo.SessionID != sessionID)
685 // can't have a foreigner with a local UUID
686 return false;
687 else
688 // oh, so it's you! welcome back
689 comingHome = true;
690 }
691
692 // OK, user can come in
693 return true;
694 }
695
696 public void AcceptUser(ForeignUserProfileData user, GridRegion home)
697 {
698 m_aScene.CommsManager.UserProfileCacheService.PreloadUserCache(user);
699 ulong realHandle = home.RegionHandle;
700 // Change the local coordinates
701 // X=0 on the map
702 home.RegionLocX = 0;
703 home.RegionLocY = random.Next(0, 10000) * (int)Constants.RegionSize;
704
705 AddHyperlinkHomeRegion(user.ID, home, realHandle);
706
707 DumpUserData(user);
708 DumpRegionData(home);
709
710 }
711
712 public bool IsLocalUser(UUID userID)
713 {
714 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
715 return IsLocalUser(uinfo);
716 }
717
569 #endregion 718 #endregion
570 719
720 #region IHyperlink Misc
721
722 protected bool IsComingHome(ForeignUserProfileData userData)
723 {
724 return (userData.UserServerURI == LocalUserServerURI);
725 }
726
727 // Is the user going back to the home region or the home grid?
728 protected bool IsGoingHome(CachedUserInfo uinfo, GridRegion rinfo)
729 {
730 if (uinfo.UserProfile == null)
731 return false;
732
733 if (!(uinfo.UserProfile is ForeignUserProfileData))
734 // it's a home user, can't be outside to return home
735 return false;
736
737 // OK, it's a foreign user with a ForeignUserProfileData
738 // and is going back to exactly the home region.
739 // We can't check if it's going back to a non-home region
740 // of the home grid. That will be dealt with in the
741 // receiving end
742 return (uinfo.UserProfile.HomeRegionID == rinfo.RegionID);
743 }
744
745 protected bool IsLocalUser(CachedUserInfo uinfo)
746 {
747 if (uinfo == null)
748 return false;
749
750 return !(uinfo.UserProfile is ForeignUserProfileData);
751
752 }
753
754 protected bool IsLocalRegion(ulong handle)
755 {
756 return m_LocalScenes.ContainsKey(handle);
757 }
758
759 private void DumpUserData(ForeignUserProfileData userData)
760 {
761 m_log.Info(" ------------ User Data Dump ----------");
762 m_log.Info(" >> Name: " + userData.FirstName + " " + userData.SurName);
763 m_log.Info(" >> HomeID: " + userData.HomeRegionID);
764 m_log.Info(" >> UserServer: " + userData.UserServerURI);
765 m_log.Info(" >> InvServer: " + userData.UserInventoryURI);
766 m_log.Info(" >> AssetServer: " + userData.UserAssetURI);
767 m_log.Info(" ------------ -------------- ----------");
768 }
769
770 private void DumpRegionData(GridRegion rinfo)
771 {
772 m_log.Info(" ------------ Region Data Dump ----------");
773 m_log.Info(" >> handle: " + rinfo.RegionHandle);
774 m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY);
775 m_log.Info(" >> external host name: " + rinfo.ExternalHostName);
776 m_log.Info(" >> http port: " + rinfo.HttpPort);
777 m_log.Info(" >> external EP address: " + rinfo.ExternalEndPoint.Address);
778 m_log.Info(" >> external EP port: " + rinfo.ExternalEndPoint.Port);
779 m_log.Info(" ------------ -------------- ----------");
780 }
781
782
783 #endregion
784
785
571 } 786 }
572} 787}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index adf747a..696225c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -824,29 +824,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
824 824
825 public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit) 825 public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
826 { 826 {
827 try 827 if (m_hyperlinkService != null)
828 { 828 m_hyperlinkService.SendUserInformation(regInfo, aCircuit);
829 if (m_aScene.SceneGridService is HGSceneCommunicationService)
830 {
831 // big hack for now
832 RegionInfo r = new RegionInfo();
833 r.ExternalHostName = regInfo.ExternalHostName;
834 r.HttpPort = regInfo.HttpPort;
835 r.RegionID = regInfo.RegionID;
836 r.RegionLocX = (uint)regInfo.RegionLocX;
837 r.RegionLocY = (uint)regInfo.RegionLocY;
838 ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(r, aCircuit);
839 }
840 }
841 catch // Bad cast
842 { }
843 829
844 } 830 }
845 831
846 public override void AdjustUserInformation(AgentCircuitData aCircuit) 832 public override void AdjustUserInformation(AgentCircuitData aCircuit)
847 { 833 {
848 if (m_aScene.SceneGridService is HGSceneCommunicationService) 834 if (m_hyperlinkService != null)
849 ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.AdjustUserInformation(aCircuit); 835 m_hyperlinkService.AdjustUserInformation(aCircuit);
850 } 836 }
851 } 837 }
852 838
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 1c66254..fd1a759 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -525,7 +525,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
525 return true; 525 return true;
526 } 526 }
527 527
528 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 528 if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == ""))
529 // this happens in standalone profiles, apparently
530 return true;
531
532 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
533
529 string uri = m_LocalGridInventoryURI.TrimEnd('/'); 534 string uri = m_LocalGridInventoryURI.TrimEnd('/');
530 535
531 if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) 536 if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
@@ -544,7 +549,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
544 if ((uinfo == null) || (uinfo.UserProfile == null)) 549 if ((uinfo == null) || (uinfo.UserProfile == null))
545 return invURI; 550 return invURI;
546 551
547 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 552 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
548 553
549 if ((userInventoryServerURI != null) && 554 if ((userInventoryServerURI != null) &&
550 (userInventoryServerURI != "")) 555 (userInventoryServerURI != ""))
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index e3661fa..436f332 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -137,8 +137,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
137 data.Name = info.RegionName; 137 data.Name = info.RegionName;
138 data.RegionFlags = 0; // TODO not used? 138 data.RegionFlags = 0; // TODO not used?
139 data.WaterHeight = 0; // not used 139 data.WaterHeight = 0; // not used
140 data.X = (ushort)info.RegionLocX; 140 data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
141 data.Y = (ushort)info.RegionLocY; 141 data.Y = (ushort)(info.RegionLocY / Constants.RegionSize);
142 blocks.Add(data); 142 blocks.Add(data);
143 } 143 }
144 } 144 }
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 62efd60..b6fa41d 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Framework.Communications.Clients; 36using OpenSim.Framework.Communications.Clients;
37using OpenSim.Region.Framework.Scenes.Serialization; 37using OpenSim.Region.Framework.Scenes.Serialization;
38using OpenSim.Services.Interfaces;
38 39
39//using HyperGrid.Framework; 40//using HyperGrid.Framework;
40//using OpenSim.Region.Communications.Hypergrid; 41//using OpenSim.Region.Communications.Hypergrid;
@@ -50,6 +51,18 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
50// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); 51// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
51 52
52 private Scene m_scene; 53 private Scene m_scene;
54
55 private IHyperlinkService m_hyper;
56 IHyperlinkService HyperlinkService
57 {
58 get
59 {
60 if (m_hyper == null)
61 m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>();
62 return m_hyper;
63 }
64 }
65
53 #endregion 66 #endregion
54 67
55 #region Constructor 68 #region Constructor
@@ -79,22 +92,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
79// return null; 92// return null;
80// } 93// }
81 94
82 private bool IsLocalUser(UUID userID)
83 {
84 CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
85
86 if (uinfo != null)
87 {
88 if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile))
89 {
90 m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
91 return true;
92 }
93 }
94
95 m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
96 return false;
97 }
98 95
99 public AssetBase FetchAsset(string url, UUID assetID) 96 public AssetBase FetchAsset(string url, UUID assetID)
100 { 97 {
@@ -170,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
170 167
171 public void Get(UUID assetID, UUID ownerID) 168 public void Get(UUID assetID, UUID ownerID)
172 { 169 {
173 if (!IsLocalUser(ownerID)) 170 if (!HyperlinkService.IsLocalUser(ownerID))
174 { 171 {
175 // Get the item from the remote asset server onto the local AssetCache 172 // Get the item from the remote asset server onto the local AssetCache
176 // and place an entry in m_assetMap 173 // and place an entry in m_assetMap
@@ -228,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
228 225
229 public void Post(UUID assetID, UUID ownerID) 226 public void Post(UUID assetID, UUID ownerID)
230 { 227 {
231 if (!IsLocalUser(ownerID)) 228 if (!HyperlinkService.IsLocalUser(ownerID))
232 { 229 {
233 // Post the item from the local AssetCache onto the remote asset server 230 // Post the item from the local AssetCache onto the remote asset server
234 // and place an entry in m_assetMap 231 // and place an entry in m_assetMap
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index ee5eb90..1217f9b 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -38,6 +38,7 @@ using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache; 38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Capabilities; 39using OpenSim.Framework.Capabilities;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Services.Interfaces;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion; 42using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42 43
43namespace OpenSim.Region.Framework.Scenes.Hypergrid 44namespace OpenSim.Region.Framework.Scenes.Hypergrid
@@ -46,11 +47,19 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
46 { 47 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 49
49 public readonly IHyperlink m_hg; 50 private IHyperlinkService m_hg;
51 IHyperlinkService HyperlinkService
52 {
53 get
54 {
55 if (m_hg == null)
56 m_hg = m_scene.RequestModuleInterface<IHyperlinkService>();
57 return m_hg;
58 }
59 }
50 60
51 public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan) 61 public HGSceneCommunicationService(CommunicationsManager commsMan) : base(commsMan)
52 { 62 {
53 m_hg = hg;
54 } 63 }
55 64
56 65
@@ -129,13 +138,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
129 /// Hypergrid mod start 138 /// Hypergrid mod start
130 /// 139 ///
131 /// 140 ///
132 bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle); 141 bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null);
133 bool isHomeUser = true; 142 bool isHomeUser = true;
134 ulong realHandle = regionHandle; 143 ulong realHandle = regionHandle;
135 CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); 144 CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID);
136 if (uinfo != null) 145 if (uinfo != null)
137 { 146 {
138 isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile); 147 isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID);
139 realHandle = m_hg.FindRegionHandle(regionHandle); 148 realHandle = m_hg.FindRegionHandle(regionHandle);
140 m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); 149 m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString());
141 } 150 }