a few changes to estates and estate teleportHome (used kick)
parent
f4a51116f6
commit
d43a3bec19
|
@ -71,6 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
public event ChangeDelegate OnRegionInfoChange;
|
public event ChangeDelegate OnRegionInfoChange;
|
||||||
public event ChangeDelegate OnEstateInfoChange;
|
public event ChangeDelegate OnEstateInfoChange;
|
||||||
public event MessageDelegate OnEstateMessage;
|
public event MessageDelegate OnEstateMessage;
|
||||||
|
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
|
||||||
|
public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
|
||||||
|
|
||||||
private int m_delayCount = 0;
|
private int m_delayCount = 0;
|
||||||
|
|
||||||
|
@ -1193,13 +1195,20 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)
|
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)
|
||||||
{
|
{
|
||||||
|
EstateTeleportOneUserHomeRequest evOverride = OnEstateTeleportOneUserHomeRequest;
|
||||||
|
if(evOverride != null)
|
||||||
|
{
|
||||||
|
evOverride(remover_client, invoice, senderID, prey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
|
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (prey != UUID.Zero)
|
if (prey != UUID.Zero)
|
||||||
{
|
{
|
||||||
ScenePresence s = Scene.GetScenePresence(prey);
|
ScenePresence s = Scene.GetScenePresence(prey);
|
||||||
if (s != null)
|
if (s != null && !s.IsDeleted && !s.IsInTransit)
|
||||||
{
|
{
|
||||||
if (!Scene.TeleportClientHome(prey, s.ControllingClient))
|
if (!Scene.TeleportClientHome(prey, s.ControllingClient))
|
||||||
{
|
{
|
||||||
|
@ -1212,6 +1221,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
|
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
|
||||||
{
|
{
|
||||||
|
EstateTeleportAllUsersHomeRequest evOverride = OnEstateTeleportAllUsersHomeRequest;
|
||||||
|
if(evOverride != null)
|
||||||
|
{
|
||||||
|
evOverride(remover_client, invoice, senderID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
|
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -46,16 +46,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected XEstateModule m_EstateModule;
|
protected XEstateModule m_EstateModule;
|
||||||
|
private string token;
|
||||||
|
|
||||||
public EstateConnector(XEstateModule module)
|
public EstateConnector(XEstateModule module, string _token)
|
||||||
{
|
{
|
||||||
m_EstateModule = module;
|
m_EstateModule = module;
|
||||||
|
token = _token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID)
|
public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
sendData["METHOD"] = "teleport_home_one_user";
|
sendData["METHOD"] = "teleport_home_one_user";
|
||||||
|
sendData["TOKEN"] = token;
|
||||||
|
|
||||||
sendData["EstateID"] = EstateID.ToString();
|
sendData["EstateID"] = EstateID.ToString();
|
||||||
sendData["PreyID"] = PreyID.ToString();
|
sendData["PreyID"] = PreyID.ToString();
|
||||||
|
@ -67,6 +70,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
sendData["METHOD"] = "teleport_home_all_users";
|
sendData["METHOD"] = "teleport_home_all_users";
|
||||||
|
sendData["TOKEN"] = token;
|
||||||
|
|
||||||
sendData["EstateID"] = EstateID.ToString();
|
sendData["EstateID"] = EstateID.ToString();
|
||||||
|
|
||||||
|
@ -77,6 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
sendData["METHOD"] = "update_covenant";
|
sendData["METHOD"] = "update_covenant";
|
||||||
|
sendData["TOKEN"] = token;
|
||||||
|
|
||||||
sendData["CovenantID"] = CovenantID.ToString();
|
sendData["CovenantID"] = CovenantID.ToString();
|
||||||
sendData["EstateID"] = EstateID.ToString();
|
sendData["EstateID"] = EstateID.ToString();
|
||||||
|
@ -99,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
sendData["METHOD"] = "update_estate";
|
sendData["METHOD"] = "update_estate";
|
||||||
|
sendData["TOKEN"] = token;
|
||||||
|
|
||||||
sendData["EstateID"] = EstateID.ToString();
|
sendData["EstateID"] = EstateID.ToString();
|
||||||
|
|
||||||
|
@ -119,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
sendData["METHOD"] = "estate_message";
|
sendData["METHOD"] = "estate_message";
|
||||||
|
sendData["TOKEN"] = token;
|
||||||
|
|
||||||
sendData["EstateID"] = EstateID.ToString();
|
sendData["EstateID"] = EstateID.ToString();
|
||||||
sendData["FromID"] = FromID.ToString();
|
sendData["FromID"] = FromID.ToString();
|
||||||
|
@ -132,47 +139,43 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID);
|
List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID);
|
||||||
|
|
||||||
UUID ScopeID = UUID.Zero;
|
// Don't send to the same instance twice
|
||||||
|
List<string> done = new List<string>();
|
||||||
|
|
||||||
// Handle local regions locally
|
// Handle local regions locally
|
||||||
//
|
|
||||||
lock (m_EstateModule.Scenes)
|
lock (m_EstateModule.Scenes)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_EstateModule.Scenes)
|
foreach (Scene s in m_EstateModule.Scenes)
|
||||||
{
|
{
|
||||||
if (regions.Contains(s.RegionInfo.RegionID))
|
RegionInfo sreg = s.RegionInfo;
|
||||||
|
if (regions.Contains(sreg.RegionID))
|
||||||
{
|
{
|
||||||
// All regions in one estate are in the same scope.
|
string url = sreg.ExternalHostName + ":" + sreg.HttpPort;
|
||||||
// Use that scope.
|
regions.Remove(sreg.RegionID);
|
||||||
//
|
if(!done.Contains(url)) // we may have older regs with same url lost in dbs
|
||||||
ScopeID = s.RegionInfo.ScopeID;
|
done.Add(url);
|
||||||
regions.Remove(s.RegionInfo.RegionID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our own region should always be in the above list.
|
if(regions.Count == 0)
|
||||||
// In a standalone this would not be true. But then,
|
return;
|
||||||
// Scope ID is not relevat there. Use first scope.
|
|
||||||
//
|
|
||||||
if (ScopeID == UUID.Zero)
|
|
||||||
ScopeID = m_EstateModule.Scenes[0].RegionInfo.ScopeID;
|
|
||||||
|
|
||||||
// Don't send to the same instance twice
|
Scene baseScene = m_EstateModule.Scenes[0];
|
||||||
//
|
UUID ScopeID = baseScene.RegionInfo.ScopeID;
|
||||||
List<string> done = new List<string>();
|
IGridService gridService = baseScene.GridService;
|
||||||
|
if(gridService == null)
|
||||||
|
return;
|
||||||
|
|
||||||
// Send to remote regions
|
// Send to remote regions
|
||||||
//
|
|
||||||
foreach (UUID regionID in regions)
|
foreach (UUID regionID in regions)
|
||||||
{
|
{
|
||||||
GridRegion region = m_EstateModule.Scenes[0].GridService.GetRegionByUUID(ScopeID, regionID);
|
GridRegion region = gridService.GetRegionByUUID(ScopeID, regionID);
|
||||||
if (region != null)
|
if (region != null)
|
||||||
{
|
{
|
||||||
string url = "http://" + region.ExternalHostName + ":" + region.HttpPort;
|
string url = region.ExternalHostName + ":" + region.HttpPort;
|
||||||
if(done.Contains(url))
|
if(done.Contains(url))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Call(region, sendData);
|
Call(region, sendData);
|
||||||
done.Add(url);
|
done.Add(url);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +188,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
// m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString);
|
// m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string url = "http://" + region.ExternalHostName + ":" + region.HttpPort;
|
string url = "";
|
||||||
|
if(string.IsNullOrEmpty(region.ServerURI))
|
||||||
|
url = "http://" + region.ExternalHostName + ":" + region.HttpPort;
|
||||||
|
else
|
||||||
|
url = region.ServerURI;
|
||||||
|
|
||||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
url + "/estate",
|
url + "/estate",
|
||||||
reqString);
|
reqString);
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected List<Scene> m_Scenes = new List<Scene>();
|
||||||
protected bool m_InInfoUpdate = false;
|
protected bool m_InInfoUpdate = false;
|
||||||
|
private string token = "7db8eh2gvgg45jj";
|
||||||
|
|
||||||
public bool InInfoUpdate
|
public bool InInfoUpdate
|
||||||
{
|
{
|
||||||
|
@ -69,17 +70,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
int port = 0;
|
int port = 0;
|
||||||
|
|
||||||
IConfig estateConfig = config.Configs["Estate"];
|
IConfig estateConfig = config.Configs["Estates"];
|
||||||
if (estateConfig != null)
|
if (estateConfig != null)
|
||||||
{
|
{
|
||||||
port = estateConfig.GetInt("Port", 0);
|
port = estateConfig.GetInt("Port", 0);
|
||||||
|
// this will need to came from somewhere else
|
||||||
|
token = estateConfig.GetString("Token", token);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EstateConnector = new EstateConnector(this);
|
m_EstateConnector = new EstateConnector(this, token);
|
||||||
|
|
||||||
// Instantiate the request handler
|
// Instantiate the request handler
|
||||||
IHttpServer server = MainServer.GetHttpServer((uint)port);
|
IHttpServer server = MainServer.GetHttpServer((uint)port);
|
||||||
server.AddStreamHandler(new EstateRequestHandler(this));
|
server.AddStreamHandler(new EstateRequestHandler(this, token));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -94,8 +97,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
lock (m_Scenes)
|
lock (m_Scenes)
|
||||||
m_Scenes.Add(scene);
|
m_Scenes.Add(scene);
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
|
@ -105,12 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
em.OnRegionInfoChange += OnRegionInfoChange;
|
em.OnRegionInfoChange += OnRegionInfoChange;
|
||||||
em.OnEstateInfoChange += OnEstateInfoChange;
|
em.OnEstateInfoChange += OnEstateInfoChange;
|
||||||
em.OnEstateMessage += OnEstateMessage;
|
em.OnEstateMessage += OnEstateMessage;
|
||||||
|
em.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest;
|
||||||
|
em.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
scene.EventManager.OnNewClient -= OnNewClient;
|
|
||||||
|
|
||||||
lock (m_Scenes)
|
lock (m_Scenes)
|
||||||
m_Scenes.Remove(scene);
|
m_Scenes.Remove(scene);
|
||||||
}
|
}
|
||||||
|
@ -181,13 +182,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message);
|
m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnNewClient(IClientAPI client)
|
|
||||||
{
|
|
||||||
client.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest;
|
|
||||||
client.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey)
|
private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey)
|
||||||
{
|
{
|
||||||
if (prey == UUID.Zero)
|
if (prey == UUID.Zero)
|
||||||
|
@ -205,17 +199,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
foreach (Scene s in Scenes)
|
foreach (Scene s in Scenes)
|
||||||
{
|
{
|
||||||
if (s == scene)
|
|
||||||
continue; // Already handles by estate module
|
|
||||||
if (s.RegionInfo.EstateSettings.EstateID != estateID)
|
if (s.RegionInfo.EstateSettings.EstateID != estateID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ScenePresence p = scene.GetScenePresence(prey);
|
ScenePresence p = scene.GetScenePresence(prey);
|
||||||
if (p != null && !p.IsChildAgent )
|
if (p != null && !p.IsChildAgent )
|
||||||
|
{
|
||||||
|
if(!p.IsDeleted && !p.IsInTransit)
|
||||||
{
|
{
|
||||||
p.ControllingClient.SendTeleportStart(16);
|
p.ControllingClient.SendTeleportStart(16);
|
||||||
scene.TeleportClientHome(prey, p.ControllingClient);
|
scene.TeleportClientHome(prey, p.ControllingClient);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EstateConnector.SendTeleportHomeOneUser(estateID, prey);
|
m_EstateConnector.SendTeleportHomeOneUser(estateID, prey);
|
||||||
|
@ -235,8 +231,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
foreach (Scene s in Scenes)
|
foreach (Scene s in Scenes)
|
||||||
{
|
{
|
||||||
if (s == scene)
|
|
||||||
continue; // Already handles by estate module
|
|
||||||
if (s.RegionInfo.EstateSettings.EstateID != estateID)
|
if (s.RegionInfo.EstateSettings.EstateID != estateID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
protected XEstateModule m_EstateModule;
|
protected XEstateModule m_EstateModule;
|
||||||
protected Object m_RequestLock = new Object();
|
protected Object m_RequestLock = new Object();
|
||||||
|
private string token;
|
||||||
|
|
||||||
public EstateRequestHandler(XEstateModule fmodule)
|
public EstateRequestHandler(XEstateModule fmodule, string _token)
|
||||||
: base("POST", "/estate")
|
: base("POST", "/estate")
|
||||||
{
|
{
|
||||||
m_EstateModule = fmodule;
|
m_EstateModule = fmodule;
|
||||||
|
token = _token;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||||
|
@ -75,6 +77,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
if (!request.ContainsKey("METHOD"))
|
if (!request.ContainsKey("METHOD"))
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
|
if (!request.ContainsKey("TOKEN"))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
string reqToken = request["TOKEN"].ToString();
|
||||||
|
request.Remove("TOKEN");
|
||||||
|
|
||||||
|
if(token != reqToken)
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
string method = request["METHOD"].ToString();
|
string method = request["METHOD"].ToString();
|
||||||
request.Remove("METHOD");
|
request.Remove("METHOD");
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
event ChangeDelegate OnRegionInfoChange;
|
event ChangeDelegate OnRegionInfoChange;
|
||||||
event ChangeDelegate OnEstateInfoChange;
|
event ChangeDelegate OnEstateInfoChange;
|
||||||
event MessageDelegate OnEstateMessage;
|
event MessageDelegate OnEstateMessage;
|
||||||
|
event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
|
||||||
|
event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
|
||||||
|
|
||||||
uint GetRegionFlags();
|
uint GetRegionFlags();
|
||||||
bool IsManager(UUID avatarID);
|
bool IsManager(UUID avatarID);
|
||||||
|
|
Loading…
Reference in New Issue