aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorBlueWall2014-10-27 17:27:42 -0400
committerBlueWall2014-10-27 17:27:42 -0400
commitb46387091470f3d1465c05625a656228ca54fd61 (patch)
treebf1dce79eda615246f32ec88b2df61a60a223cc4 /OpenSim
parentRefresh OpenMetaverse libraries again at 0f4b361 but with Windows builds to s... (diff)
downloadopensim-SC-b46387091470f3d1465c05625a656228ca54fd61.zip
opensim-SC-b46387091470f3d1465c05625a656228ca54fd61.tar.gz
opensim-SC-b46387091470f3d1465c05625a656228ca54fd61.tar.bz2
opensim-SC-b46387091470f3d1465c05625a656228ca54fd61.tar.xz
Add hypergrid teleporting support to user profiles picks
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs8
-rw-r--r--OpenSim/Data/MySQL/Resources/UserProfiles.migrations7
-rw-r--r--OpenSim/Framework/UserProfiles.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs113
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs7
5 files changed, 117 insertions, 19 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index c8479f0..cab0ca8 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -397,6 +397,7 @@ namespace OpenSim.Data.MySQL
397 UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); 397 UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId);
398 UUID.TryParse((string)reader["snapshotuuid"], out pick.SnapshotId); 398 UUID.TryParse((string)reader["snapshotuuid"], out pick.SnapshotId);
399 pick.GlobalPos = (string)reader["posglobal"]; 399 pick.GlobalPos = (string)reader["posglobal"];
400 pick.Gatekeeper = (string)reader["gatekeeper"];
400 bool.TryParse((string)reader["toppick"], out pick.TopPick); 401 bool.TryParse((string)reader["toppick"], out pick.TopPick);
401 bool.TryParse((string)reader["enabled"], out pick.Enabled); 402 bool.TryParse((string)reader["enabled"], out pick.Enabled);
402 pick.Name = (string)reader["name"]; 403 pick.Name = (string)reader["name"];
@@ -436,14 +437,16 @@ namespace OpenSim.Data.MySQL
436 query += "?SimName,"; 437 query += "?SimName,";
437 query += "?GlobalPos,"; 438 query += "?GlobalPos,";
438 query += "?SortOrder,"; 439 query += "?SortOrder,";
439 query += "?Enabled) "; 440 query += "?Enabled,";
441 query += "?Gatekeeper)";
440 query += "ON DUPLICATE KEY UPDATE "; 442 query += "ON DUPLICATE KEY UPDATE ";
441 query += "parceluuid=?ParcelId,"; 443 query += "parceluuid=?ParcelId,";
442 query += "name=?Name,"; 444 query += "name=?Name,";
443 query += "description=?Desc,"; 445 query += "description=?Desc,";
444 query += "snapshotuuid=?SnapshotId,"; 446 query += "snapshotuuid=?SnapshotId,";
445 query += "pickuuid=?PickId,"; 447 query += "pickuuid=?PickId,";
446 query += "posglobal=?GlobalPos"; 448 query += "posglobal=?GlobalPos,";
449 query += "gatekeeper=?Gatekeeper";
447 450
448 try 451 try
449 { 452 {
@@ -463,6 +466,7 @@ namespace OpenSim.Data.MySQL
463 cmd.Parameters.AddWithValue("?Original", pick.OriginalName.ToString()); 466 cmd.Parameters.AddWithValue("?Original", pick.OriginalName.ToString());
464 cmd.Parameters.AddWithValue("?SimName",pick.SimName.ToString()); 467 cmd.Parameters.AddWithValue("?SimName",pick.SimName.ToString());
465 cmd.Parameters.AddWithValue("?GlobalPos", pick.GlobalPos); 468 cmd.Parameters.AddWithValue("?GlobalPos", pick.GlobalPos);
469 cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper);
466 cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ()); 470 cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ());
467 cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString()); 471 cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString());
468 472
diff --git a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
index bd325da..87e99fa 100644
--- a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
@@ -90,4 +90,9 @@ CREATE TABLE IF NOT EXISTS `usersettings` (
90 `email` varchar(254) NOT NULL, 90 `email` varchar(254) NOT NULL,
91 PRIMARY KEY (`useruuid`) 91 PRIMARY KEY (`useruuid`)
92) ENGINE=MyISAM DEFAULT CHARSET=latin1; 92) ENGINE=MyISAM DEFAULT CHARSET=latin1;
93commit; \ No newline at end of file 93commit;
94
95:VERSION 4 # -------------------------------
96begin;
97ALTER TABLE userpicks ADD COLUMN gatekeeper varchar(255);
98commit;
diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs
index 492f6b9..bfc2f6b 100644
--- a/OpenSim/Framework/UserProfiles.cs
+++ b/OpenSim/Framework/UserProfiles.cs
@@ -80,6 +80,7 @@ namespace OpenSim.Framework
80 public string User = string.Empty; 80 public string User = string.Empty;
81 public string SimName = string.Empty; 81 public string SimName = string.Empty;
82 public string GlobalPos = "<0,0,0>"; 82 public string GlobalPos = "<0,0,0>";
83 public string Gatekeeper = string.Empty;
83 public int SortOrder = 0; 84 public int SortOrder = 0;
84 public bool Enabled = false; 85 public bool Enabled = false;
85 } 86 }
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;
48using OpenSim.Services.Connectors.Hypergrid; 48using OpenSim.Services.Connectors.Hypergrid;
49using OpenSim.Framework.Servers.HttpServer; 49using OpenSim.Framework.Servers.HttpServer;
50using OpenSim.Services.UserProfilesService; 50using OpenSim.Services.UserProfilesService;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52using Microsoft.CSharp;
51 53
52namespace OpenSim.Region.CoreModules.Avatar.UserProfiles 54namespace 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>
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 8059652..b1aabe6 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -945,6 +945,13 @@ namespace OpenSim.Services.LLLoginService
945 m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); 945 m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
946 } 946 }
947 947
948 if (!account.ServiceURLs.ContainsKey("GatekeeperURI") && !string.IsNullOrEmpty(m_GatekeeperURL))
949 {
950 m_log.DebugFormat("[LLLOGIN SERVICE]: adding gatekeeper uri {0}", m_GatekeeperURL);
951 account.ServiceURLs["GatekeeperURI"] = m_GatekeeperURL;
952 newUrls = true;
953 }
954
948 // The grid operator decided to override the defaults in the 955 // The grid operator decided to override the defaults in the
949 // [LoginService] configuration. Let's store the correct ones. 956 // [LoginService] configuration. Let's store the correct ones.
950 if (newUrls) 957 if (newUrls)