Add hypergrid teleporting support to user profiles picks

mb-throttle-test
BlueWall 2014-10-27 17:27:42 -04:00
parent c995b07818
commit b463870914
6 changed files with 152 additions and 19 deletions

View File

@ -397,6 +397,7 @@ namespace OpenSim.Data.MySQL
UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId);
UUID.TryParse((string)reader["snapshotuuid"], out pick.SnapshotId); UUID.TryParse((string)reader["snapshotuuid"], out pick.SnapshotId);
pick.GlobalPos = (string)reader["posglobal"]; pick.GlobalPos = (string)reader["posglobal"];
pick.Gatekeeper = (string)reader["gatekeeper"];
bool.TryParse((string)reader["toppick"], out pick.TopPick); bool.TryParse((string)reader["toppick"], out pick.TopPick);
bool.TryParse((string)reader["enabled"], out pick.Enabled); bool.TryParse((string)reader["enabled"], out pick.Enabled);
pick.Name = (string)reader["name"]; pick.Name = (string)reader["name"];
@ -436,14 +437,16 @@ namespace OpenSim.Data.MySQL
query += "?SimName,"; query += "?SimName,";
query += "?GlobalPos,"; query += "?GlobalPos,";
query += "?SortOrder,"; query += "?SortOrder,";
query += "?Enabled) "; query += "?Enabled,";
query += "?Gatekeeper)";
query += "ON DUPLICATE KEY UPDATE "; query += "ON DUPLICATE KEY UPDATE ";
query += "parceluuid=?ParcelId,"; query += "parceluuid=?ParcelId,";
query += "name=?Name,"; query += "name=?Name,";
query += "description=?Desc,"; query += "description=?Desc,";
query += "snapshotuuid=?SnapshotId,"; query += "snapshotuuid=?SnapshotId,";
query += "pickuuid=?PickId,"; query += "pickuuid=?PickId,";
query += "posglobal=?GlobalPos"; query += "posglobal=?GlobalPos,";
query += "gatekeeper=?Gatekeeper";
try try
{ {
@ -463,6 +466,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?Original", pick.OriginalName.ToString()); cmd.Parameters.AddWithValue("?Original", pick.OriginalName.ToString());
cmd.Parameters.AddWithValue("?SimName",pick.SimName.ToString()); cmd.Parameters.AddWithValue("?SimName",pick.SimName.ToString());
cmd.Parameters.AddWithValue("?GlobalPos", pick.GlobalPos); cmd.Parameters.AddWithValue("?GlobalPos", pick.GlobalPos);
cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper);
cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ()); cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ());
cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString()); cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString());

View File

@ -90,4 +90,9 @@ CREATE TABLE IF NOT EXISTS `usersettings` (
`email` varchar(254) NOT NULL, `email` varchar(254) NOT NULL,
PRIMARY KEY (`useruuid`) PRIMARY KEY (`useruuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
commit; commit;
:VERSION 4 # -------------------------------
begin;
ALTER TABLE userpicks ADD COLUMN gatekeeper varchar(255);
commit;

View File

@ -80,6 +80,7 @@ namespace OpenSim.Framework
public string User = string.Empty; public string User = string.Empty;
public string SimName = string.Empty; public string SimName = string.Empty;
public string GlobalPos = "<0,0,0>"; public string GlobalPos = "<0,0,0>";
public string Gatekeeper = string.Empty;
public int SortOrder = 0; public int SortOrder = 0;
public bool Enabled = false; public bool Enabled = false;
} }

View File

@ -48,6 +48,8 @@ using Mono.Addins;
using OpenSim.Services.Connectors.Hypergrid; using OpenSim.Services.Connectors.Hypergrid;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.UserProfilesService; using OpenSim.Services.UserProfilesService;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using Microsoft.CSharp;
namespace OpenSim.Region.CoreModules.Avatar.UserProfiles namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
{ {
@ -78,7 +80,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// <value> /// <value>
/// The configuration /// The configuration
/// </value> /// </value>
public IConfigSource Config { public IConfigSource Config
{
get; get;
set; set;
} }
@ -89,7 +92,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// <value> /// <value>
/// The profile server URI. /// The profile server URI.
/// </value> /// </value>
public string ProfileServerUri { public string ProfileServerUri
{
get; get;
set; set;
} }
@ -111,11 +115,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// <value> /// <value>
/// <c>true</c> if enabled; otherwise, <c>false</c>. /// <c>true</c> if enabled; otherwise, <c>false</c>.
/// </value> /// </value>
public bool Enabled { public bool Enabled
{
get; get;
set; set;
} }
public string MyGatekeeper
{
get; private set;
}
#region IRegionModuleBase implementation #region IRegionModuleBase implementation
/// <summary> /// <summary>
@ -152,6 +162,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
m_log.Debug("[PROFILES]: Full Profiles Enabled"); m_log.Debug("[PROFILES]: Full Profiles Enabled");
ReplaceableInterface = null; ReplaceableInterface = null;
Enabled = true; Enabled = true;
MyGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "UserProfiles" }, String.Empty);
} }
/// <summary> /// <summary>
@ -599,30 +612,64 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
return; return;
UUID targetID; UUID targetID;
UUID.TryParse(args[0], out targetID); UUID.TryParse (args [0], out targetID);
string serverURI = string.Empty; string serverURI = string.Empty;
GetUserProfileServerURI(targetID, out serverURI); GetUserProfileServerURI (targetID, out serverURI);
string theirGatekeeperURI;
GetUserGatekeeperURI (targetID, out theirGatekeeperURI);
IClientAPI remoteClient = (IClientAPI)sender; IClientAPI remoteClient = (IClientAPI)sender;
UserProfilePick pick = new UserProfilePick(); UserProfilePick pick = new UserProfilePick ();
UUID.TryParse(args[0], out pick.CreatorId); UUID.TryParse (args [0], out pick.CreatorId);
UUID.TryParse(args[1], out pick.PickId); UUID.TryParse (args [1], out pick.PickId);
object Pick = (object)pick; object Pick = (object)pick;
if(!rpc.JsonRpcRequest(ref Pick, "pickinforequest", serverURI, UUID.Random().ToString())) if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) {
{ remoteClient.SendAgentAlertMessage (
remoteClient.SendAgentAlertMessage(
"Error selecting pick", false); "Error selecting pick", false);
return; return;
} }
pick = (UserProfilePick) Pick; pick = (UserProfilePick)Pick;
Vector3 globalPos; Vector3 globalPos = new Vector3(Vector3.Zero);
Vector3.TryParse(pick.GlobalPos,out globalPos);
// Smoke and mirrors
if (pick.Gatekeeper == MyGatekeeper)
{
Vector3.TryParse(pick.GlobalPos,out globalPos);
}
else
{
// Setup the illusion
string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName);
GridRegion target = Scene.GridService.GetRegionByName(Scene.RegionInfo.ScopeID, region);
if(target == null)
{
// This is a dead or unreachable region
}
else
{
// Work our slight of hand
int x = target.RegionLocX;
int y = target.RegionLocY;
dynamic synthX = globalPos.X - (globalPos.X/Constants.RegionSize) * Constants.RegionSize;
synthX += x;
globalPos.X = synthX;
dynamic synthY = globalPos.Y - (globalPos.Y/Constants.RegionSize) * Constants.RegionSize;
synthY += y;
globalPos.Y = synthY;
}
}
m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString());
// Pull the rabbit out of the hat
remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name,
pick.Desc,pick.SnapshotId,pick.User,pick.OriginalName,pick.SimName, pick.Desc,pick.SnapshotId,pick.User,pick.OriginalName,pick.SimName,
globalPos,pick.SortOrder,pick.Enabled); globalPos,pick.SortOrder,pick.Enabled);
@ -659,7 +706,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// Enabled. /// Enabled.
/// </param> /// </param>
public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled)
{ {
//TODO: See how this works with NPC, May need to test
m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
UserProfilePick pick = new UserProfilePick(); UserProfilePick pick = new UserProfilePick();
@ -699,6 +747,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
avaPos.X, avaPos.Y, p.Scene.Name); avaPos.X, avaPos.Y, p.Scene.Name);
} }
pick.PickId = pickID; pick.PickId = pickID;
pick.CreatorId = creatorID; pick.CreatorId = creatorID;
pick.TopPick = topPick; pick.TopPick = topPick;
@ -708,6 +757,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
pick.SnapshotId = snapshotID; pick.SnapshotId = snapshotID;
pick.User = landOwnerName; pick.User = landOwnerName;
pick.SimName = remoteClient.Scene.RegionInfo.RegionName; pick.SimName = remoteClient.Scene.RegionInfo.RegionName;
pick.Gatekeeper = MyGatekeeper;
pick.GlobalPos = posGlobal.ToString(); pick.GlobalPos = posGlobal.ToString();
pick.SortOrder = sortOrder; pick.SortOrder = sortOrder;
pick.Enabled = enabled; pick.Enabled = enabled;
@ -1259,6 +1309,37 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
} }
} }
/// <summary>
/// Gets the user gatekeeper server URI.
/// </summary>
/// <returns>
/// The user gatekeeper server URI.
/// </returns>
/// <param name='userID'>
/// If set to <c>true</c> user URI.
/// </param>
/// <param name='serverURI'>
/// If set to <c>true</c> server URI.
/// </param>
bool GetUserGatekeeperURI(UUID userID, out string serverURI)
{
bool local;
local = UserManagementModule.IsLocalGridUser(userID);
if (!local)
{
serverURI = UserManagementModule.GetUserServerURL(userID, "GatekeeperURI");
// Is Foreign
return true;
}
else
{
serverURI = MyGatekeeper;
// Is local
return false;
}
}
/// <summary> /// <summary>
/// Gets the user profile server UR. /// Gets the user profile server UR.
/// </summary> /// </summary>

View File

@ -945,6 +945,13 @@ namespace OpenSim.Services.LLLoginService
m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
} }
if (!account.ServiceURLs.ContainsKey("GatekeeperURI") && !string.IsNullOrEmpty(m_GatekeeperURL))
{
m_log.DebugFormat("[LLLOGIN SERVICE]: adding gatekeeper uri {0}", m_GatekeeperURL);
account.ServiceURLs["GatekeeperURI"] = m_GatekeeperURL;
newUrls = true;
}
// The grid operator decided to override the defaults in the // The grid operator decided to override the defaults in the
// [LoginService] configuration. Let's store the correct ones. // [LoginService] configuration. Let's store the correct ones.
if (newUrls) if (newUrls)

View File

@ -1232,6 +1232,40 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v4_0" name="OpenSim.Services.SearchService" path="OpenSim/Services/SearchService" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Services.UserAccountService"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_0" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library"> <Project frameworkVersion="v4_0" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
@ -1530,6 +1564,7 @@
<Reference name="System.Xml.Linq"/> <Reference name="System.Xml.Linq"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="Microsoft.CSharp" />
<Reference name="NDesk.Options" path="../../../bin/"/> <Reference name="NDesk.Options" path="../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>