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["snapshotuuid"], out pick.SnapshotId);
pick.GlobalPos = (string)reader["posglobal"];
pick.Gatekeeper = (string)reader["gatekeeper"];
bool.TryParse((string)reader["toppick"], out pick.TopPick);
bool.TryParse((string)reader["enabled"], out pick.Enabled);
pick.Name = (string)reader["name"];
@ -436,14 +437,16 @@ namespace OpenSim.Data.MySQL
query += "?SimName,";
query += "?GlobalPos,";
query += "?SortOrder,";
query += "?Enabled) ";
query += "?Enabled,";
query += "?Gatekeeper)";
query += "ON DUPLICATE KEY UPDATE ";
query += "parceluuid=?ParcelId,";
query += "name=?Name,";
query += "description=?Desc,";
query += "snapshotuuid=?SnapshotId,";
query += "pickuuid=?PickId,";
query += "posglobal=?GlobalPos";
query += "posglobal=?GlobalPos,";
query += "gatekeeper=?Gatekeeper";
try
{
@ -463,6 +466,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?Original", pick.OriginalName.ToString());
cmd.Parameters.AddWithValue("?SimName",pick.SimName.ToString());
cmd.Parameters.AddWithValue("?GlobalPos", pick.GlobalPos);
cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper);
cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.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,
PRIMARY KEY (`useruuid`)
) 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 SimName = string.Empty;
public string GlobalPos = "<0,0,0>";
public string Gatekeeper = string.Empty;
public int SortOrder = 0;
public bool Enabled = false;
}

View File

@ -48,6 +48,8 @@ using Mono.Addins;
using OpenSim.Services.Connectors.Hypergrid;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.UserProfilesService;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using Microsoft.CSharp;
namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
{
@ -78,7 +80,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// <value>
/// The configuration
/// </value>
public IConfigSource Config {
public IConfigSource Config
{
get;
set;
}
@ -89,7 +92,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// <value>
/// The profile server URI.
/// </value>
public string ProfileServerUri {
public string ProfileServerUri
{
get;
set;
}
@ -111,11 +115,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// <value>
/// <c>true</c> if enabled; otherwise, <c>false</c>.
/// </value>
public bool Enabled {
public bool Enabled
{
get;
set;
}
public string MyGatekeeper
{
get; private set;
}
#region IRegionModuleBase implementation
/// <summary>
@ -152,6 +162,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
m_log.Debug("[PROFILES]: Full Profiles Enabled");
ReplaceableInterface = null;
Enabled = true;
MyGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "UserProfiles" }, String.Empty);
}
/// <summary>
@ -599,30 +612,64 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
return;
UUID targetID;
UUID.TryParse(args[0], out targetID);
UUID.TryParse (args [0], out targetID);
string serverURI = string.Empty;
GetUserProfileServerURI(targetID, out serverURI);
GetUserProfileServerURI (targetID, out serverURI);
string theirGatekeeperURI;
GetUserGatekeeperURI (targetID, out theirGatekeeperURI);
IClientAPI remoteClient = (IClientAPI)sender;
UserProfilePick pick = new UserProfilePick();
UUID.TryParse(args[0], out pick.CreatorId);
UUID.TryParse(args[1], out pick.PickId);
UserProfilePick pick = new UserProfilePick ();
UUID.TryParse (args [0], out pick.CreatorId);
UUID.TryParse (args [1], out pick.PickId);
object Pick = (object)pick;
if(!rpc.JsonRpcRequest(ref Pick, "pickinforequest", serverURI, UUID.Random().ToString()))
{
remoteClient.SendAgentAlertMessage(
if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) {
remoteClient.SendAgentAlertMessage (
"Error selecting pick", false);
return;
}
pick = (UserProfilePick) Pick;
Vector3 globalPos;
Vector3.TryParse(pick.GlobalPos,out globalPos);
pick = (UserProfilePick)Pick;
Vector3 globalPos = new Vector3(Vector3.Zero);
// 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());
// Pull the rabbit out of the hat
remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name,
pick.Desc,pick.SnapshotId,pick.User,pick.OriginalName,pick.SimName,
globalPos,pick.SortOrder,pick.Enabled);
@ -659,7 +706,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// Enabled.
/// </param>
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());
UserProfilePick pick = new UserProfilePick();
@ -699,6 +747,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
avaPos.X, avaPos.Y, p.Scene.Name);
}
pick.PickId = pickID;
pick.CreatorId = creatorID;
pick.TopPick = topPick;
@ -708,6 +757,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
pick.SnapshotId = snapshotID;
pick.User = landOwnerName;
pick.SimName = remoteClient.Scene.RegionInfo.RegionName;
pick.Gatekeeper = MyGatekeeper;
pick.GlobalPos = posGlobal.ToString();
pick.SortOrder = sortOrder;
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>
/// Gets the user profile server UR.
/// </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]);
}
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
// [LoginService] configuration. Let's store the correct ones.
if (newUrls)

View File

@ -1232,6 +1232,40 @@
</Files>
</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">
<Configuration name="Debug">
@ -1530,6 +1564,7 @@
<Reference name="System.Xml.Linq"/>
<Reference name="System.Drawing"/>
<Reference name="System.Web"/>
<Reference name="Microsoft.CSharp" />
<Reference name="NDesk.Options" path="../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>