diff options
Add hypergrid teleporting support to user profiles picks
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 113 |
1 files changed, 97 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index f4a4f17..8337a2f 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -48,6 +48,8 @@ using Mono.Addins; | |||
48 | using OpenSim.Services.Connectors.Hypergrid; | 48 | using OpenSim.Services.Connectors.Hypergrid; |
49 | using OpenSim.Framework.Servers.HttpServer; | 49 | using OpenSim.Framework.Servers.HttpServer; |
50 | using OpenSim.Services.UserProfilesService; | 50 | using OpenSim.Services.UserProfilesService; |
51 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
52 | using Microsoft.CSharp; | ||
51 | 53 | ||
52 | namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | 54 | namespace OpenSim.Region.CoreModules.Avatar.UserProfiles |
53 | { | 55 | { |
@@ -78,7 +80,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
78 | /// <value> | 80 | /// <value> |
79 | /// The configuration | 81 | /// The configuration |
80 | /// </value> | 82 | /// </value> |
81 | public IConfigSource Config { | 83 | public IConfigSource Config |
84 | { | ||
82 | get; | 85 | get; |
83 | set; | 86 | set; |
84 | } | 87 | } |
@@ -89,7 +92,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
89 | /// <value> | 92 | /// <value> |
90 | /// The profile server URI. | 93 | /// The profile server URI. |
91 | /// </value> | 94 | /// </value> |
92 | public string ProfileServerUri { | 95 | public string ProfileServerUri |
96 | { | ||
93 | get; | 97 | get; |
94 | set; | 98 | set; |
95 | } | 99 | } |
@@ -111,11 +115,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
111 | /// <value> | 115 | /// <value> |
112 | /// <c>true</c> if enabled; otherwise, <c>false</c>. | 116 | /// <c>true</c> if enabled; otherwise, <c>false</c>. |
113 | /// </value> | 117 | /// </value> |
114 | public bool Enabled { | 118 | public bool Enabled |
119 | { | ||
115 | get; | 120 | get; |
116 | set; | 121 | set; |
117 | } | 122 | } |
118 | 123 | ||
124 | public string MyGatekeeper | ||
125 | { | ||
126 | get; private set; | ||
127 | } | ||
128 | |||
119 | 129 | ||
120 | #region IRegionModuleBase implementation | 130 | #region IRegionModuleBase implementation |
121 | /// <summary> | 131 | /// <summary> |
@@ -152,6 +162,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
152 | m_log.Debug("[PROFILES]: Full Profiles Enabled"); | 162 | m_log.Debug("[PROFILES]: Full Profiles Enabled"); |
153 | ReplaceableInterface = null; | 163 | ReplaceableInterface = null; |
154 | Enabled = true; | 164 | Enabled = true; |
165 | |||
166 | MyGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", | ||
167 | new string[] { "Startup", "Hypergrid", "UserProfiles" }, String.Empty); | ||
155 | } | 168 | } |
156 | 169 | ||
157 | /// <summary> | 170 | /// <summary> |
@@ -599,30 +612,64 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
599 | return; | 612 | return; |
600 | 613 | ||
601 | UUID targetID; | 614 | UUID targetID; |
602 | UUID.TryParse(args[0], out targetID); | 615 | UUID.TryParse (args [0], out targetID); |
603 | string serverURI = string.Empty; | 616 | string serverURI = string.Empty; |
604 | GetUserProfileServerURI(targetID, out serverURI); | 617 | GetUserProfileServerURI (targetID, out serverURI); |
618 | |||
619 | string theirGatekeeperURI; | ||
620 | GetUserGatekeeperURI (targetID, out theirGatekeeperURI); | ||
621 | |||
605 | IClientAPI remoteClient = (IClientAPI)sender; | 622 | IClientAPI remoteClient = (IClientAPI)sender; |
606 | 623 | ||
607 | UserProfilePick pick = new UserProfilePick(); | 624 | UserProfilePick pick = new UserProfilePick (); |
608 | UUID.TryParse(args[0], out pick.CreatorId); | 625 | UUID.TryParse (args [0], out pick.CreatorId); |
609 | UUID.TryParse(args[1], out pick.PickId); | 626 | UUID.TryParse (args [1], out pick.PickId); |
610 | 627 | ||
611 | 628 | ||
612 | object Pick = (object)pick; | 629 | object Pick = (object)pick; |
613 | if(!rpc.JsonRpcRequest(ref Pick, "pickinforequest", serverURI, UUID.Random().ToString())) | 630 | if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) { |
614 | { | 631 | remoteClient.SendAgentAlertMessage ( |
615 | remoteClient.SendAgentAlertMessage( | ||
616 | "Error selecting pick", false); | 632 | "Error selecting pick", false); |
617 | return; | 633 | return; |
618 | } | 634 | } |
619 | pick = (UserProfilePick) Pick; | 635 | pick = (UserProfilePick)Pick; |
620 | 636 | ||
621 | Vector3 globalPos; | 637 | Vector3 globalPos = new Vector3(Vector3.Zero); |
622 | Vector3.TryParse(pick.GlobalPos,out globalPos); | 638 | |
639 | // Smoke and mirrors | ||
640 | if (pick.Gatekeeper == MyGatekeeper) | ||
641 | { | ||
642 | Vector3.TryParse(pick.GlobalPos,out globalPos); | ||
643 | } | ||
644 | else | ||
645 | { | ||
646 | // Setup the illusion | ||
647 | string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName); | ||
648 | GridRegion target = Scene.GridService.GetRegionByName(Scene.RegionInfo.ScopeID, region); | ||
649 | |||
650 | if(target == null) | ||
651 | { | ||
652 | // This is a dead or unreachable region | ||
653 | } | ||
654 | else | ||
655 | { | ||
656 | // Work our slight of hand | ||
657 | int x = target.RegionLocX; | ||
658 | int y = target.RegionLocY; | ||
659 | |||
660 | dynamic synthX = globalPos.X - (globalPos.X/Constants.RegionSize) * Constants.RegionSize; | ||
661 | synthX += x; | ||
662 | globalPos.X = synthX; | ||
663 | |||
664 | dynamic synthY = globalPos.Y - (globalPos.Y/Constants.RegionSize) * Constants.RegionSize; | ||
665 | synthY += y; | ||
666 | globalPos.Y = synthY; | ||
667 | } | ||
668 | } | ||
623 | 669 | ||
624 | m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); | 670 | m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); |
625 | 671 | ||
672 | // Pull the rabbit out of the hat | ||
626 | remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, | 673 | remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, |
627 | pick.Desc,pick.SnapshotId,pick.User,pick.OriginalName,pick.SimName, | 674 | pick.Desc,pick.SnapshotId,pick.User,pick.OriginalName,pick.SimName, |
628 | globalPos,pick.SortOrder,pick.Enabled); | 675 | globalPos,pick.SortOrder,pick.Enabled); |
@@ -659,7 +706,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
659 | /// Enabled. | 706 | /// Enabled. |
660 | /// </param> | 707 | /// </param> |
661 | public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) | 708 | public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) |
662 | { | 709 | { |
710 | //TODO: See how this works with NPC, May need to test | ||
663 | m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); | 711 | m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); |
664 | 712 | ||
665 | UserProfilePick pick = new UserProfilePick(); | 713 | UserProfilePick pick = new UserProfilePick(); |
@@ -699,6 +747,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
699 | avaPos.X, avaPos.Y, p.Scene.Name); | 747 | avaPos.X, avaPos.Y, p.Scene.Name); |
700 | } | 748 | } |
701 | 749 | ||
750 | |||
702 | pick.PickId = pickID; | 751 | pick.PickId = pickID; |
703 | pick.CreatorId = creatorID; | 752 | pick.CreatorId = creatorID; |
704 | pick.TopPick = topPick; | 753 | pick.TopPick = topPick; |
@@ -708,6 +757,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
708 | pick.SnapshotId = snapshotID; | 757 | pick.SnapshotId = snapshotID; |
709 | pick.User = landOwnerName; | 758 | pick.User = landOwnerName; |
710 | pick.SimName = remoteClient.Scene.RegionInfo.RegionName; | 759 | pick.SimName = remoteClient.Scene.RegionInfo.RegionName; |
760 | pick.Gatekeeper = MyGatekeeper; | ||
711 | pick.GlobalPos = posGlobal.ToString(); | 761 | pick.GlobalPos = posGlobal.ToString(); |
712 | pick.SortOrder = sortOrder; | 762 | pick.SortOrder = sortOrder; |
713 | pick.Enabled = enabled; | 763 | pick.Enabled = enabled; |
@@ -1260,6 +1310,37 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
1260 | } | 1310 | } |
1261 | 1311 | ||
1262 | /// <summary> | 1312 | /// <summary> |
1313 | /// Gets the user gatekeeper server URI. | ||
1314 | /// </summary> | ||
1315 | /// <returns> | ||
1316 | /// The user gatekeeper server URI. | ||
1317 | /// </returns> | ||
1318 | /// <param name='userID'> | ||
1319 | /// If set to <c>true</c> user URI. | ||
1320 | /// </param> | ||
1321 | /// <param name='serverURI'> | ||
1322 | /// If set to <c>true</c> server URI. | ||
1323 | /// </param> | ||
1324 | bool GetUserGatekeeperURI(UUID userID, out string serverURI) | ||
1325 | { | ||
1326 | bool local; | ||
1327 | local = UserManagementModule.IsLocalGridUser(userID); | ||
1328 | |||
1329 | if (!local) | ||
1330 | { | ||
1331 | serverURI = UserManagementModule.GetUserServerURL(userID, "GatekeeperURI"); | ||
1332 | // Is Foreign | ||
1333 | return true; | ||
1334 | } | ||
1335 | else | ||
1336 | { | ||
1337 | serverURI = MyGatekeeper; | ||
1338 | // Is local | ||
1339 | return false; | ||
1340 | } | ||
1341 | } | ||
1342 | |||
1343 | /// <summary> | ||
1263 | /// Gets the user profile server UR. | 1344 | /// Gets the user profile server UR. |
1264 | /// </summary> | 1345 | /// </summary> |
1265 | /// <returns> | 1346 | /// <returns> |