Compare commits
165 Commits
master
...
0.7.0.2-re
Author | SHA1 | Date |
---|---|---|
Justin Clark-Casey (justincc) | 913bf95c1c | |
Justin Clark-Casey (justincc) | 381c3e3738 | |
Melanie Thielker | 37f354fea6 | |
Melanie Thielker | 775ee242b7 | |
Melanie Thielker | f2cbd8c5f5 | |
Melanie Thielker | afd2bf5769 | |
Diva Canto | fd28b59768 | |
Diva Canto | ac55c118f2 | |
Diva Canto | 711747dd2c | |
Diva Canto | e41958ead9 | |
Diva Canto | 735124bece | |
Diva Canto | 97807d77a1 | |
Marck | be07063102 | |
Justin Clark-Casey (justincc) | 4f63edaa72 | |
Justin Clark-Casey (justincc) | 7c4e0c1368 | |
Justin Clark-Casey (justincc) | 269c9a11b7 | |
Justin Clark-Casey (justincc) | 7e0a0656a4 | |
Melanie Thielker | b2074dd1d6 | |
Melanie Thielker | d86f70bd5b | |
Diva Canto | c9b685dc15 | |
Ai Austin | b85db02f97 | |
Justin Clark-Casey (justincc) | 25ad11b8a5 | |
Ai Austin | 88aa9d39c2 | |
Melanie | a3eeac45a7 | |
Diva Canto | dad6ba2448 | |
Melanie Thielker | 37bd48c5a7 | |
Diva Canto | 1e389438e2 | |
Diva Canto | 05373de9df | |
Justin Clark-Casey (justincc) | 59ce2c3227 | |
Justin Clark-Casey (justincc) | f64358dadf | |
Diva Canto | 8c7b8f7a39 | |
Justin Clark-Casey (justincc) | 852e282dbd | |
Diva Canto | cf842dd79d | |
Diva Canto | 679707d9e2 | |
Diva Canto | cd4a19cbb6 | |
Diva Canto | 7421708ba1 | |
Marck | c1a20c8567 | |
Diva Canto | 50a88ed2e4 | |
Marck | 21bc238029 | |
Melanie | 6acfa136a4 | |
Marck | e1fb6ba437 | |
Justin Clark-Casey (justincc) | 7e06f97a87 | |
unknown | de0445c8ea | |
Melanie Thielker | 8b7e006ed0 | |
Melanie | 2892ae6b06 | |
Justin Clark-Casey (justincc) | 5d53789a49 | |
Diva Canto | d74b03a3db | |
Justin Clark-Casey (justincc) | 3d01c4ccba | |
Diva Canto | b280b8218e | |
Melanie | b0c86fea4c | |
Justin Clark-Casey (justincc) | f30cd8391e | |
Diva Canto | d44b7d9637 | |
Diva Canto | a0fa6dc967 | |
Diva Canto | db629af6d3 | |
Diva Canto | dc08e1cbf9 | |
Diva Canto | 73678947da | |
Diva Canto | 2f52a3a153 | |
Melanie | 8b6f39b206 | |
Melanie Thielker | b9dc4ab4a1 | |
Diva Canto | d97c741e67 | |
Diva Canto | a34add9534 | |
Diva Canto | ed3073eae1 | |
Diva Canto | eafe6b294e | |
Diva Canto | fb23093087 | |
Diva Canto | a46538485b | |
Diva Canto | 62ffc566c3 | |
Diva Canto | df976c9eb4 | |
Diva Canto | 63dd24a651 | |
Marck | 692e684ced | |
Melanie | 875a623654 | |
Diva Canto | 81751a1753 | |
Diva Canto | 44332d145a | |
Diva Canto | 4a7588b0f0 | |
Melanie | 72060741e1 | |
Melanie | 4fcf76eb0b | |
Justin Clark-Casey (justincc) | 0e3daf703f | |
Justin Clark-Casey (justincc) | 02aa938ce1 | |
Justin Clark-Casey (justincc) | 18117d8c9a | |
Diva Canto | 536699cf43 | |
Diva Canto | 192781e83b | |
Melanie | 46001809a6 | |
Melanie | adba22c29b | |
Melanie | 4e537a5a86 | |
Justin Clark-Casey (justincc) | 5182b9fcd2 | |
Melanie Thielker | 8c631cfaa3 | |
Diva Canto | 8641eb65b1 | |
Melanie | 9c4380feb2 | |
Melanie Thielker | 3d82e79d1c | |
Melanie Thielker | 2eadd984ab | |
Melanie Thielker | df55e5295f | |
Justin Clark-Casey (justincc) | 79d33418f0 | |
Diva Canto | d93a442483 | |
Diva Canto | 257a46dfb9 | |
Diva Canto | 699d3b0965 | |
Diva Canto | 5a8ddfe211 | |
Melanie | 128da70d15 | |
Melanie | 251740815f | |
Justin Clark-Casey (justincc) | 20c68cc531 | |
Justin Clark-Casey (justincc) | 4a898fdf8d | |
Justin Clark-Casey (justincc) | 2f562639b9 | |
Diva Canto | 02019abf22 | |
Diva Canto | d843682c18 | |
Diva Canto | 3ca3522ad1 | |
Justin Clark-Casey (justincc) | f13f35755c | |
Melanie Thielker | 67417f6478 | |
Justin Clark-Casey (justincc) | 2167f99bde | |
Diva Canto | 18f6ac7b86 | |
Diva Canto | b5f87fd455 | |
Justin Clark-Casey (justincc) | ecd46c881e | |
Justin Clark-Casey (justincc) | d55d6949fe | |
Diva Canto | 28b29aff45 | |
Melanie | 94d6d9775f | |
Diva Canto | 9316e0b867 | |
dahlia | 5f932605dc | |
dahlia | d06b75fe3b | |
Diva Canto | f5d5898964 | |
Kevin Cozens | 68f0ab9504 | |
Diva Canto | 020ed93418 | |
Diva Canto | 9e569b2a23 | |
Diva Canto | 58508fcb83 | |
Diva Canto | 40d169992a | |
Diva Canto | 60207f670f | |
Diva Canto | 80e16907bf | |
Diva Canto | 77e54747d8 | |
Diva Canto | 863462dbb8 | |
Diva Canto | ed84963ef6 | |
Diva Canto | 1fcd0272c1 | |
dahlia | 04e2390e0d | |
Melanie Thielker | 8864e3f058 | |
Melanie | 0abedae3e4 | |
Melanie Thielker | 0de8291ceb | |
Diva Canto | 5f49e5d320 | |
Diva Canto | aa8002de05 | |
Justin Clark-Casey (justincc) | 7451b8c8ab | |
Diva Canto | bd68591371 | |
Melanie | b3ce5ffc11 | |
Melanie | 21bcca4c6b | |
Justin Clark-Casey (justincc) | 150ccac747 | |
Diva Canto | bfff39c4c0 | |
Justin Clark-Casey (justincc) | f4b90b52db | |
Justin Clark-Casey (justincc) | 6f1b351cf4 | |
Diva Canto | dcb9da8495 | |
Diva Canto | 1cd9118c7a | |
Justin Clark-Casey (justincc) | 5ce119174e | |
Justin Clark-Casey (justincc) | 0f3d9e17c6 | |
Justin Clark-Casey (justincc) | 77fc48f2f9 | |
Justin Clark-Casey (justincc) | 24785e82a5 | |
John Hurliman | 31b7279095 | |
John Hurliman | 4f59a865af | |
Diva Canto | 77d892690a | |
Justin Clark-Casey (justincc) | ad5d1d0458 | |
Justin Clark-Casey (justincc) | 672108c29d | |
Justin Clark-Casey (justincc) | ab95239047 | |
Justin Clark-Casey (justincc) | 4d828eb3c3 | |
Justin Clark-Casey (justincc) | fee3b32f2f | |
Justin Clark-Casey | 5af0d94929 | |
Justin Clark-Casey | c213643ab8 | |
Melanie | 1032e1142a | |
Justin Clark-Casey (justincc) | 165429ff4d | |
Justin Clark-Casey (justincc) | 701cc35c9f | |
Justin Clark-Casey (justincc) | e98109765c | |
Diva Canto | c980326425 | |
Diva Canto | 4baf59d2dd | |
John Hurliman | 212a538557 | |
Diva Canto | cf5427e810 |
|
@ -20,6 +20,7 @@
|
|||
<delete dir="${distbindir}/.nant"/>
|
||||
<delete>
|
||||
<fileset basedir="${distbindir}">
|
||||
<include name="compile.bat"/>
|
||||
<include name="BUILDING.txt"/>
|
||||
<include name="Makefile"/>
|
||||
<include name="nant-color"/>
|
||||
|
@ -29,7 +30,7 @@
|
|||
<include name="TESTING.txt"/>
|
||||
<include name="TestResult.xml"/>
|
||||
<include name="bin/OpenSim.Server.ini"/>
|
||||
<include name="bin/Regions/*"/>
|
||||
<include name="bin/Regions/Regions.ini"/>
|
||||
<include name="bin/*.db"/>
|
||||
<include name="**/.git/**"/>
|
||||
<include name=".gitignore"/>
|
||||
|
|
|
@ -95,6 +95,7 @@ what it is today.
|
|||
* Mic Bowman
|
||||
* Michelle Argus
|
||||
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
|
||||
* Micheil Merlin
|
||||
* Mike Osias (IBM)
|
||||
* Mike Pitman (IBM)
|
||||
* mikkopa/_someone - RealXtend
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace OpenSim.Data
|
|||
|
||||
List<RegionData> GetDefaultRegions(UUID scopeID);
|
||||
List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
|
||||
List<RegionData> GetHyperlinks(UUID scopeID);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
|
|
@ -310,23 +310,23 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
public List<RegionData> GetDefaultRegions(UUID scopeID)
|
||||
{
|
||||
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 1) <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " AND ScopeID = @scopeID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
conn.Open();
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
|
||||
return Get((int)RegionFlags.DefaultRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||
{
|
||||
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 2) <> 0";
|
||||
// TODO: distance-sort results
|
||||
return Get((int)RegionFlags.FallbackRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.Hyperlink, scopeID);
|
||||
}
|
||||
|
||||
private List<RegionData> Get(int regionFlags, UUID scopeID)
|
||||
{
|
||||
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " AND ScopeID = @scopeID";
|
||||
|
||||
|
@ -335,7 +335,6 @@ namespace OpenSim.Data.MSSQL
|
|||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
conn.Open();
|
||||
// TODO: distance-sort results
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,6 +210,9 @@ namespace OpenSim.Data.MySQL
|
|||
if (data.Data.ContainsKey("locY"))
|
||||
data.Data.Remove("locY");
|
||||
|
||||
if (data.RegionName.Length > 32)
|
||||
data.RegionName = data.RegionName.Substring(0, 32);
|
||||
|
||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
|
@ -281,22 +284,26 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<RegionData> GetDefaultRegions(UUID scopeID)
|
||||
{
|
||||
string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command);
|
||||
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
return RunCommand(cmd);
|
||||
return Get((int)RegionFlags.DefaultRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||
{
|
||||
string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0";
|
||||
// TODO: distance-sort results
|
||||
return Get((int)RegionFlags.FallbackRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.Hyperlink, scopeID);
|
||||
}
|
||||
|
||||
private List<RegionData> Get(int regionFlags, UUID scopeID)
|
||||
{
|
||||
string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
|
@ -304,7 +311,6 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
// TODO: distance-sort results
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,30 +164,29 @@ namespace OpenSim.Data.Null
|
|||
|
||||
public List<RegionData> GetDefaultRegions(UUID scopeID)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.GetDefaultRegions(scopeID);
|
||||
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & 1) != 0)
|
||||
ret.Add(r);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return Get((int)RegionFlags.DefaultRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||
{
|
||||
return Get((int)RegionFlags.FallbackRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.Hyperlink, scopeID);
|
||||
}
|
||||
|
||||
private List<RegionData> Get(int regionFlags, UUID scopeID)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.GetFallbackRegions(scopeID, x, y);
|
||||
return Instance.Get(regionFlags, scopeID);
|
||||
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & 2) != 0)
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
|
||||
ret.Add(r);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,19 +3,10 @@
|
|||
<Import assembly="OpenSim.Data.dll" />
|
||||
<Import assembly="OpenSim.Framework.dll" />
|
||||
</Runtime>
|
||||
<ExtensionPoint path = "/OpenSim/GridData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/LogData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/AssetData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/InventoryData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/UserData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
</Addin>
|
||||
|
|
|
@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
public EstateSettings LoadEstateSettings(int estateID)
|
||||
{
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID";
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
List<int> result = new List<int>();
|
||||
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName";
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
if (words.Length == 1)
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||
m_Realm, scopeID.ToString(), words[0]);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLiteLegacy
|
|||
|
||||
public EstateSettings LoadEstateSettings(int estateID)
|
||||
{
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID";
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLiteLegacy
|
|||
{
|
||||
List<int> result = new List<int>();
|
||||
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName";
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
|
|
@ -781,7 +781,7 @@ namespace OpenSim.Data.Tests
|
|||
// Ownership changes when you drop an object into an object
|
||||
// owned by someone else
|
||||
Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))");
|
||||
Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
|
||||
// Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 16), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
|
||||
Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))");
|
||||
Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))");
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenSim.Framework.Capabilities
|
|||
string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
|
||||
byte[] data, string inventoryType, string assetType);
|
||||
|
||||
public delegate void UploadedBakedTexture(UUID assetID, byte[] data);
|
||||
|
||||
public delegate UUID UpdateItem(UUID itemID, byte[] data);
|
||||
|
||||
public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors);
|
||||
|
@ -97,6 +99,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
// private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module.
|
||||
|
||||
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
|
||||
private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
|
||||
|
||||
//private string eventQueue = "0100/";
|
||||
private IScene m_Scene;
|
||||
|
@ -142,7 +145,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
m_httpListenPort = httpPort;
|
||||
|
||||
if (httpServer.UseSSL)
|
||||
if (httpServer != null && httpServer.UseSSL)
|
||||
{
|
||||
m_httpListenPort = httpServer.SSLPort;
|
||||
httpListen = httpServer.SSLCommonName;
|
||||
|
@ -151,7 +154,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
m_agentID = agent;
|
||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL);
|
||||
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
|
||||
m_regionName = regionName;
|
||||
}
|
||||
|
||||
|
@ -185,6 +188,8 @@ namespace OpenSim.Framework.Capabilities
|
|||
m_capsHandlers["UpdateScriptTaskInventory"] =
|
||||
new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
|
||||
m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"];
|
||||
m_capsHandlers["UploadBakedTexture"] =
|
||||
new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -742,6 +747,50 @@ namespace OpenSim.Framework.Capabilities
|
|||
return null;
|
||||
}
|
||||
|
||||
public string UploadBakedTexture(string request, string path,
|
||||
string param, OSHttpRequest httpRequest,
|
||||
OSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " +
|
||||
m_regionName);
|
||||
|
||||
string capsBase = "/CAPS/" + m_capsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
BakedTextureUploader uploader =
|
||||
new BakedTextureUploader( capsBase + uploaderPath,
|
||||
m_httpListener);
|
||||
uploader.OnUpLoad += BakedTextureUploaded;
|
||||
|
||||
m_httpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler("POST", capsBase + uploaderPath,
|
||||
uploader.uploaderCaps));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_httpListener.UseSSL)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_httpListenerHostName + ":" +
|
||||
m_httpListenPort.ToString() + capsBase + uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse =
|
||||
new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CAPS]: " + e.ToString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by the notecard update handler. Provides a URL to which the client can upload a new asset.
|
||||
/// </summary>
|
||||
|
@ -925,6 +974,17 @@ namespace OpenSim.Framework.Capabilities
|
|||
}
|
||||
}
|
||||
|
||||
public void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||
{
|
||||
m_log.DebugFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
|
||||
AssetBase asset;
|
||||
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
|
||||
asset.Data = data;
|
||||
asset.Temporary = true;
|
||||
asset.Local = true;
|
||||
m_assetCache.Store(asset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when new asset data for an agent inventory item update has been uploaded.
|
||||
/// </summary>
|
||||
|
@ -1243,5 +1303,50 @@ namespace OpenSim.Framework.Capabilities
|
|||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class BakedTextureUploader
|
||||
{
|
||||
public event UploadedBakedTexture OnUpLoad;
|
||||
private UploadedBakedTexture handlerUpLoad = null;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
private UUID newAssetID;
|
||||
private IHttpServer httpListener;
|
||||
|
||||
public BakedTextureUploader(string path, IHttpServer httpServer)
|
||||
{
|
||||
newAssetID = UUID.Random();
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
uploadComplete.new_asset = newAssetID.ToString();
|
||||
uploadComplete.new_inventory_item = UUID.Zero;
|
||||
uploadComplete.state = "complete";
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
handlerUpLoad = OnUpLoad;
|
||||
if (handlerUpLoad != null)
|
||||
{
|
||||
handlerUpLoad(newAssetID, data);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
m_httpListenerHostName = httpListenerHostname;
|
||||
m_httpListenerPort = httpListenerPort;
|
||||
m_useSSL = https;
|
||||
if (m_useSSL)
|
||||
if (httpListener != null && m_useSSL)
|
||||
{
|
||||
m_httpListenerHostName = httpListener.SSLCommonName;
|
||||
m_httpListenerPort = httpListener.SSLPort;
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace OpenSim.Framework.Console
|
|||
// (Done with no echo and suitable for passwords)
|
||||
public string PasswdPrompt(string p)
|
||||
{
|
||||
return ReadLine(p, false, false);
|
||||
return ReadLine(String.Format("{0}: ", p), false, false);
|
||||
}
|
||||
|
||||
public virtual string ReadLine(string p, bool isCommand, bool e)
|
||||
|
|
|
@ -83,7 +83,9 @@ namespace OpenSim.Framework
|
|||
/// <summary>Finished, Sim Changed</summary>
|
||||
FinishedViaNewSim = 1 << 28,
|
||||
/// <summary>Finished, Same Sim</summary>
|
||||
FinishedViaSameSim = 1 << 29
|
||||
FinishedViaSameSim = 1 << 29,
|
||||
/// <summary>Agent coming into the grid from another grid</summary>
|
||||
ViaHGLogin = 1 << 30
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Net.Sockets;
|
|||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
|
@ -244,5 +245,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
return defaultHostname;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public class RegionSettings
|
||||
{
|
||||
private ConfigurationMember configMember;
|
||||
|
||||
public delegate void SaveDelegate(RegionSettings rs);
|
||||
|
||||
public event SaveDelegate OnSave;
|
||||
|
@ -47,202 +45,6 @@ namespace OpenSim.Framework
|
|||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
||||
|
||||
public RegionSettings()
|
||||
{
|
||||
if (configMember == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", LoadConfigurationOptions, HandleIncomingConfiguration, true);
|
||||
configMember.performConfigurationRetrieve();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadConfigurationOptions()
|
||||
{
|
||||
configMember.addConfigurationOption("region_flags",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
String.Empty, "336723974", true);
|
||||
|
||||
configMember.addConfigurationOption("max_agents",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
String.Empty, "40", true);
|
||||
|
||||
configMember.addConfigurationOption("object_bonus_factor",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "1.0", true);
|
||||
|
||||
configMember.addConfigurationOption("sim_access",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
String.Empty, "21", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_base_0",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_1.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_base_1",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_2.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_base_2",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_3.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_base_3",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_4.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_start_height_0",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "10.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_start_height_1",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "10.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_start_height_2",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "10.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_start_height_3",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "10.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_height_range_0",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "60.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_height_range_1",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "60.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_height_range_2",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "60.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_height_range_3",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "60.0", true);
|
||||
|
||||
configMember.addConfigurationOption("region_water_height",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "20.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_raise_limit",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "100.0", true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_lower_limit",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "-100.0", true);
|
||||
|
||||
configMember.addConfigurationOption("sun_hour",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
String.Empty, "0.0", true);
|
||||
}
|
||||
|
||||
public bool HandleIncomingConfiguration(string key, object value)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case "region_flags":
|
||||
RegionFlags flags = (RegionFlags)(uint)value;
|
||||
|
||||
m_BlockTerraform =
|
||||
(flags & RegionFlags.BlockTerraform) != 0;
|
||||
m_BlockFly =
|
||||
(flags & RegionFlags.NoFly) != 0;
|
||||
m_AllowDamage =
|
||||
(flags & RegionFlags.AllowDamage) != 0;
|
||||
m_RestrictPushing =
|
||||
(flags & RegionFlags.RestrictPushObject) != 0;
|
||||
m_AllowLandResell =
|
||||
(flags & RegionFlags.BlockLandResell) == 0;
|
||||
m_AllowLandJoinDivide =
|
||||
(flags & RegionFlags.AllowParcelChanges) != 0;
|
||||
m_BlockShowInSearch =
|
||||
((uint)flags & (1 << 29)) != 0;
|
||||
m_DisableScripts =
|
||||
(flags & RegionFlags.SkipScripts) != 0;
|
||||
m_DisableCollisions =
|
||||
(flags & RegionFlags.SkipCollisions) != 0;
|
||||
m_DisablePhysics =
|
||||
(flags & RegionFlags.SkipPhysics) != 0;
|
||||
m_FixedSun =
|
||||
(flags & RegionFlags.SunFixed) != 0;
|
||||
m_Sandbox =
|
||||
(flags & RegionFlags.Sandbox) != 0;
|
||||
break;
|
||||
case "max_agents":
|
||||
m_AgentLimit = (int)value;
|
||||
break;
|
||||
case "object_bonus_factor":
|
||||
m_ObjectBonus = (double)value;
|
||||
break;
|
||||
case "sim_access":
|
||||
int access = (int)value;
|
||||
if (access <= 13)
|
||||
m_Maturity = 0;
|
||||
else
|
||||
m_Maturity = 1;
|
||||
break;
|
||||
case "terrain_base_0":
|
||||
m_TerrainTexture1 = (UUID)value;
|
||||
break;
|
||||
case "terrain_base_1":
|
||||
m_TerrainTexture2 = (UUID)value;
|
||||
break;
|
||||
case "terrain_base_2":
|
||||
m_TerrainTexture3 = (UUID)value;
|
||||
break;
|
||||
case "terrain_base_3":
|
||||
m_TerrainTexture4 = (UUID)value;
|
||||
break;
|
||||
case "terrain_start_height_0":
|
||||
m_Elevation1SW = (double)value;
|
||||
break;
|
||||
case "terrain_start_height_1":
|
||||
m_Elevation1NW = (double)value;
|
||||
break;
|
||||
case "terrain_start_height_2":
|
||||
m_Elevation1SE = (double)value;
|
||||
break;
|
||||
case "terrain_start_height_3":
|
||||
m_Elevation1NE = (double)value;
|
||||
break;
|
||||
case "terrain_height_range_0":
|
||||
m_Elevation2SW = (double)value;
|
||||
break;
|
||||
case "terrain_height_range_1":
|
||||
m_Elevation2NW = (double)value;
|
||||
break;
|
||||
case "terrain_height_range_2":
|
||||
m_Elevation2SE = (double)value;
|
||||
break;
|
||||
case "terrain_height_range_3":
|
||||
m_Elevation2NE = (double)value;
|
||||
break;
|
||||
case "region_water_height":
|
||||
m_WaterHeight = (double)value;
|
||||
break;
|
||||
case "terrain_raise_limit":
|
||||
m_TerrainRaiseLimit = (double)value;
|
||||
break;
|
||||
case "terrain_lower_limit":
|
||||
m_TerrainLowerLimit = (double)value;
|
||||
break;
|
||||
case "sun_hour":
|
||||
m_SunPosition = (double)value;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if (OnSave != null)
|
||||
|
|
|
@ -319,6 +319,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
OSHttpRequest req = new OSHttpRequest(context, request);
|
||||
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
||||
HandleRequest(req, resp);
|
||||
|
||||
// !!!HACK ALERT!!!
|
||||
// There seems to be a bug in the underlying http code that makes subsequent requests
|
||||
// come up with trash in Accept headers. Until that gets fixed, we're cleaning them up here.
|
||||
if (request.AcceptTypes != null)
|
||||
for (int i = 0; i < request.AcceptTypes.Length; i++)
|
||||
request.AcceptTypes[i] = string.Empty;
|
||||
}
|
||||
|
||||
// public void ConvertIHttpClientContextToOSHttp(object stateinfo)
|
||||
|
|
|
@ -73,7 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
||||
{
|
||||
StreamReader str = new StreamReader(req.Request.Body);
|
||||
StreamReader str;
|
||||
try
|
||||
{
|
||||
str = new StreamReader(req.Request.Body);
|
||||
}
|
||||
catch (System.ArgumentException)
|
||||
{
|
||||
// Stream was not readable means a child agent
|
||||
// was closed due to logout, leaving the
|
||||
// Event Queue request orphaned.
|
||||
continue;
|
||||
}
|
||||
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
m_server.DoHTTPGruntWork(responsedata,
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace OpenSim
|
|||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.1";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
private const string VERSION_NUMBER = "0.7.0.2";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Release;
|
||||
|
||||
public enum Flavour
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ namespace OpenSim
|
|||
|
||||
public static string GetVersionString(string versionNumber, Flavour flavour)
|
||||
{
|
||||
string versionString = "OpenSim " + versionNumber + " (" + flavour + ")";
|
||||
string versionString = "OpenSim " + versionNumber + " " + flavour;
|
||||
return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,17 @@ namespace OpenSim
|
|||
else
|
||||
{
|
||||
string basepath = Path.GetFullPath(Util.configDir());
|
||||
string path = Path.Combine(basepath, file);
|
||||
// Resolve relative paths with wildcards
|
||||
string chunkWithoutWildcards = file;
|
||||
string chunkWithWildcards = string.Empty;
|
||||
int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' });
|
||||
if (wildcardIndex != -1)
|
||||
{
|
||||
chunkWithoutWildcards = file.Substring(0, wildcardIndex);
|
||||
chunkWithWildcards = file.Substring(wildcardIndex);
|
||||
}
|
||||
string path = Path.Combine(basepath, chunkWithoutWildcards);
|
||||
path = Path.GetFullPath(path) + chunkWithWildcards;
|
||||
string[] paths = Util.Glob(path);
|
||||
foreach (string p in paths)
|
||||
{
|
||||
|
@ -307,21 +317,6 @@ namespace OpenSim
|
|||
config.Set("EventQueue", true);
|
||||
}
|
||||
|
||||
{
|
||||
IConfig config = defaultConfig.Configs["StandAlone"];
|
||||
|
||||
if (null == config)
|
||||
config = defaultConfig.AddConfig("StandAlone");
|
||||
|
||||
config.Set("accounts_authenticate", true);
|
||||
config.Set("welcome_message", "Welcome to OpenSimulator");
|
||||
config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
|
||||
config.Set("inventory_source", "");
|
||||
config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
|
||||
config.Set("user_source", "");
|
||||
config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar));
|
||||
}
|
||||
|
||||
{
|
||||
IConfig config = defaultConfig.Configs["Network"];
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ namespace OpenSim
|
|||
{
|
||||
MainConsole.Instance.Output(
|
||||
String.Format(
|
||||
"Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}",
|
||||
"Kicking user: {0,-16} {1,-16} {2,-37} in region: {3,-16}",
|
||||
presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName));
|
||||
|
||||
// kick client...
|
||||
|
@ -861,7 +861,7 @@ namespace OpenSim
|
|||
MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count));
|
||||
|
||||
MainConsole.Instance.Output(
|
||||
String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", "Firstname", "Lastname",
|
||||
String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname",
|
||||
"Agent ID", "Root/Child", "Region", "Position"));
|
||||
|
||||
foreach (ScenePresence presence in agents)
|
||||
|
@ -880,7 +880,7 @@ namespace OpenSim
|
|||
|
||||
MainConsole.Instance.Output(
|
||||
String.Format(
|
||||
"{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}",
|
||||
"{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}",
|
||||
presence.Firstname,
|
||||
presence.Lastname,
|
||||
presence.UUID,
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public IJ2KDecoder J2KDecoder;
|
||||
public IAssetService AssetService;
|
||||
public UUID AgentID;
|
||||
public IHyperAssetService HyperAssets;
|
||||
public IInventoryAccessModule InventoryAccessModule;
|
||||
public OpenJPEG.J2KLayerInfo[] Layers;
|
||||
public bool IsDecoded;
|
||||
public bool HasAsset;
|
||||
|
@ -375,14 +375,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
UUID assetID = UUID.Zero;
|
||||
if (asset != null)
|
||||
assetID = asset.FullID;
|
||||
else if ((HyperAssets != null) && (sender != HyperAssets))
|
||||
else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
|
||||
{
|
||||
// Try the user's inventory, but only if it's different from the regions'
|
||||
string userAssets = HyperAssets.GetUserAssetServer(AgentID);
|
||||
if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer()))
|
||||
// Unfortunately we need this here, there's no other way.
|
||||
// This is due to the fact that textures opened directly from the agent's inventory
|
||||
// don't have any distinguishing feature. As such, in order to serve those when the
|
||||
// foreign user is visiting, we need to try again after the first fail to the local
|
||||
// asset service.
|
||||
string assetServerURL = string.Empty;
|
||||
if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
|
||||
{
|
||||
m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
|
||||
AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived);
|
||||
AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,7 +357,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
protected uint m_agentFOVCounter;
|
||||
|
||||
protected IAssetService m_assetService;
|
||||
private IHyperAssetService m_hyperAssets;
|
||||
private const bool m_checkPackets = true;
|
||||
|
||||
private Timer m_propertiesPacketTimer;
|
||||
|
@ -432,7 +431,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// m_attachmentsSent = new HashSet<uint>();
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
|
||||
m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
|
||||
m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
|
||||
m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion());
|
||||
|
@ -2699,32 +2697,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
|
||||
packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
|
||||
|
||||
packet.QueryReplies =
|
||||
new DirPlacesReplyPacket.QueryRepliesBlock[data.Length];
|
||||
|
||||
packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[
|
||||
data.Length];
|
||||
|
||||
packet.AgentData.AgentID = AgentId;
|
||||
|
||||
packet.QueryData[0].QueryID = queryID;
|
||||
|
||||
int i = 0;
|
||||
DirPlacesReplyPacket.QueryRepliesBlock[] replies =
|
||||
new DirPlacesReplyPacket.QueryRepliesBlock[0];
|
||||
DirPlacesReplyPacket.StatusDataBlock[] status =
|
||||
new DirPlacesReplyPacket.StatusDataBlock[0];
|
||||
|
||||
foreach (DirPlacesReplyData d in data)
|
||||
{
|
||||
packet.QueryReplies[i] =
|
||||
new DirPlacesReplyPacket.QueryRepliesBlock();
|
||||
packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock();
|
||||
packet.QueryReplies[i].ParcelID = d.parcelID;
|
||||
packet.QueryReplies[i].Name = Utils.StringToBytes(d.name);
|
||||
packet.QueryReplies[i].ForSale = d.forSale;
|
||||
packet.QueryReplies[i].Auction = d.auction;
|
||||
packet.QueryReplies[i].Dwell = d.dwell;
|
||||
packet.StatusData[i].Status = d.Status;
|
||||
i++;
|
||||
int idx = replies.Length;
|
||||
Array.Resize(ref replies, idx + 1);
|
||||
Array.Resize(ref status, idx + 1);
|
||||
|
||||
replies[idx] = new DirPlacesReplyPacket.QueryRepliesBlock();
|
||||
status[idx] = new DirPlacesReplyPacket.StatusDataBlock();
|
||||
replies[idx].ParcelID = d.parcelID;
|
||||
replies[idx].Name = Utils.StringToBytes(d.name);
|
||||
replies[idx].ForSale = d.forSale;
|
||||
replies[idx].Auction = d.auction;
|
||||
replies[idx].Dwell = d.dwell;
|
||||
status[idx].Status = d.Status;
|
||||
|
||||
packet.QueryReplies = replies;
|
||||
packet.StatusData = status;
|
||||
|
||||
if (packet.Length >= 1000)
|
||||
{
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
|
||||
packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply);
|
||||
|
||||
packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock();
|
||||
|
||||
packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
|
||||
packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
|
||||
|
||||
packet.AgentData.AgentID = AgentId;
|
||||
|
||||
packet.QueryData[0].QueryID = queryID;
|
||||
|
||||
replies = new DirPlacesReplyPacket.QueryRepliesBlock[0];
|
||||
status = new DirPlacesReplyPacket.StatusDataBlock[0];
|
||||
}
|
||||
}
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
if (replies.Length > 0)
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
|
||||
|
@ -3361,6 +3382,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
avp.Sender.IsTrial = false;
|
||||
avp.Sender.ID = agentID;
|
||||
m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
|
||||
OutPacket(avp, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
|
@ -4737,7 +4759,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
|
||||
AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
|
||||
AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate);
|
||||
AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage);
|
||||
|
||||
// Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once,
|
||||
// some clients will send out a separate ObjectImage packet for each face
|
||||
AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false);
|
||||
|
||||
AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false);
|
||||
AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false);
|
||||
AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab);
|
||||
|
@ -7196,59 +7222,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else // Agent
|
||||
{
|
||||
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
|
||||
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
|
||||
assetRequestItem = invService.GetItem(assetRequestItem);
|
||||
if (assetRequestItem == null)
|
||||
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
if (invAccess != null)
|
||||
{
|
||||
ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>();
|
||||
if (lib != null)
|
||||
assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
|
||||
if (assetRequestItem == null)
|
||||
return true;
|
||||
}
|
||||
if (!invAccess.GetAgentInventoryItem(this, itemID, requestID))
|
||||
return false;
|
||||
|
||||
// At this point, we need to apply perms
|
||||
// only to notecards and scripts. All
|
||||
// other asset types are always available
|
||||
//
|
||||
if (assetRequestItem.AssetType == (int)AssetType.LSLText)
|
||||
{
|
||||
if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
|
||||
{
|
||||
SendAgentAlertMessage("Insufficient permissions to view script", false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
|
||||
{
|
||||
if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
|
||||
{
|
||||
SendAgentAlertMessage("Insufficient permissions to view notecard", false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
if (assetRequestItem.AssetID != requestID)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
|
||||
Name, requestID, itemID, assetRequestItem.AssetID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//m_assetCache.AddAssetRequest(this, transfer);
|
||||
|
||||
MakeAssetRequest(transfer, taskID);
|
||||
|
||||
/* RequestAsset = OnRequestAsset;
|
||||
if (RequestAsset != null)
|
||||
{
|
||||
RequestAsset(this, transfer);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11459,15 +11448,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
{
|
||||
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
|
||||
//m_log.Debug("[XXX] inventory asset request " + requestID);
|
||||
//if (taskID == UUID.Zero) // Agent
|
||||
// if (m_scene is HGScene)
|
||||
// {
|
||||
// m_log.Debug("[XXX] hg asset request " + requestID);
|
||||
// // We may need to fetch the asset from the user's asset server into the local asset server
|
||||
// HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
|
||||
// mapper.Get(requestID, AgentId);
|
||||
// }
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
|
||||
|
@ -11483,49 +11463,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="asset"></param>
|
||||
protected void AssetReceived(string id, Object sender, AssetBase asset)
|
||||
{
|
||||
if (asset == null)
|
||||
return;
|
||||
|
||||
TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
|
||||
|
||||
UUID requestID = UUID.Zero;
|
||||
byte source = (byte)SourceType.Asset;
|
||||
|
||||
if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|
||||
|| (transferRequest.TransferInfo.SourceType == 2222))
|
||||
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|
||||
{
|
||||
requestID = new UUID(transferRequest.TransferInfo.Params, 0);
|
||||
}
|
||||
else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
|| (transferRequest.TransferInfo.SourceType == 3333))
|
||||
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
{
|
||||
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
|
||||
source = (byte)SourceType.SimInventoryItem;
|
||||
//m_log.Debug("asset request " + requestID);
|
||||
}
|
||||
|
||||
if (null == asset)
|
||||
{
|
||||
if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000))
|
||||
{
|
||||
// Try the user's inventory, but only if it's different from the regions'
|
||||
string userAssets = m_hyperAssets.GetUserAssetServer(AgentId);
|
||||
if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
|
||||
{
|
||||
m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
|
||||
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|
||||
transferRequest.TransferInfo.SourceType = 2222; // marker
|
||||
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
transferRequest.TransferInfo.SourceType = 3333; // marker
|
||||
|
||||
m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
|
||||
|
||||
// FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
|
||||
return;
|
||||
}
|
||||
|
||||
// Scripts cannot be retrieved by direct request
|
||||
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10)
|
||||
return;
|
||||
|
|
|
@ -58,8 +58,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
|
||||
private object m_syncRoot = new object();
|
||||
|
||||
private IHyperAssetService m_hyperAssets;
|
||||
|
||||
public LLClientView Client { get { return m_client; } }
|
||||
public AssetBase MissingImage { get { return m_missingImage; } }
|
||||
|
||||
|
@ -75,7 +73,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
|
||||
|
||||
m_j2kDecodeModule = pJ2kDecodeModule;
|
||||
m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -149,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
imgrequest.J2KDecoder = m_j2kDecodeModule;
|
||||
imgrequest.AssetService = m_assetCache;
|
||||
imgrequest.AgentID = m_client.AgentId;
|
||||
imgrequest.HyperAssets = m_hyperAssets;
|
||||
imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
imgrequest.DiscardLevel = newRequest.DiscardLevel;
|
||||
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
|
||||
imgrequest.Priority = newRequest.Priority;
|
||||
|
|
|
@ -182,7 +182,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
|
||||
if (part.Inventory.UpdateInventoryItem(item))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
if ((InventoryType)item.InvType == InventoryType.Notecard)
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
else if ((InventoryType)item.InvType == InventoryType.LSL)
|
||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||
else
|
||||
remoteClient.SendAgentAlertMessage("Item saved", false);
|
||||
|
||||
part.GetProperties(remoteClient);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
Caps caps
|
||||
= new Caps(m_scene,
|
||||
m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
|
||||
MainServer.Instance.Port,
|
||||
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
|
||||
capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);
|
||||
|
||||
caps.RegisterHandlers();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
end = Utils.Clamp(end, 1, texture.Data.Length);
|
||||
start = Utils.Clamp(start, 0, end - 1);
|
||||
|
||||
m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
|
||||
if (end - start < texture.Data.Length)
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
|
|
|
@ -81,14 +81,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
}
|
||||
|
||||
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
|
||||
{
|
||||
ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
|
||||
if (presence != null && !presence.IsChildAgent)
|
||||
if (presence != null)
|
||||
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
}
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarID);
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels);
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarID);
|
||||
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarid);
|
||||
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid);
|
||||
}
|
||||
|
||||
|
|
|
@ -132,20 +132,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
{
|
||||
UUID toAgentID = new UUID(im.toAgentID);
|
||||
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString());
|
||||
|
||||
// Try root avatar only first
|
||||
foreach (Scene scene in m_Scenes)
|
||||
{
|
||||
if (scene.Entities.ContainsKey(toAgentID) &&
|
||||
scene.Entities[toAgentID] is ScenePresence)
|
||||
{
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName);
|
||||
// Local message
|
||||
// m_log.DebugFormat(
|
||||
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
|
||||
// toAgentID.ToString(), scene.RegionInfo.RegionName);
|
||||
|
||||
ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
|
||||
if (!user.IsChildAgent)
|
||||
{
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
|
||||
// Local message
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
// Message sent
|
||||
|
@ -167,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
// Local message
|
||||
ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
|
||||
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
// Message sent
|
||||
|
@ -176,6 +177,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
|
||||
SendGridInstantMessageViaXMLRPC(im, result);
|
||||
|
||||
return;
|
||||
|
|
|
@ -212,9 +212,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
|
||||
iarPath, iarPathExisting);
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
|
||||
// iarPath, iarPathExisting);
|
||||
|
||||
string iarPathToCreate = iarPath.Substring(iarPathExisting.Length);
|
||||
CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes);
|
||||
|
@ -255,12 +255,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
{
|
||||
while (null == destFolder && archivePath.Length > 0)
|
||||
{
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
|
||||
|
||||
if (resolvedFolders.ContainsKey(archivePath))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
|
||||
destFolder = resolvedFolders[archivePath];
|
||||
}
|
||||
else
|
||||
|
@ -275,9 +275,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
|
||||
originalArchivePath);
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
|
||||
// originalArchivePath);
|
||||
archivePath = string.Empty;
|
||||
destFolder = rootDestFolder;
|
||||
}
|
||||
|
|
|
@ -206,11 +206,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
if (components.Length == 1)
|
||||
{
|
||||
// m_log.DebugFormat("FOUND SINGLE COMPONENT [{0}]", components[0]);
|
||||
// m_log.DebugFormat(
|
||||
// "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}",
|
||||
// components[0], startFolder.Name, startFolder.ID);
|
||||
|
||||
List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
|
||||
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count);
|
||||
|
||||
foreach (InventoryItemBase item in items)
|
||||
{
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID);
|
||||
|
||||
if (item.Name == components[0])
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -63,13 +63,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
|
||||
/// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
|
||||
/// (subject to change since there is no fixed format yet).
|
||||
/// </summary>
|
||||
// Commenting for now! The mock inventory service needs more beef, at least for
|
||||
// GetFolderForType
|
||||
// REFACTORING PROBLEM. This needs to be rewritten.
|
||||
[Test]
|
||||
public void TestSaveIarV0_1()
|
||||
public void TestSavePathToIarV0_1()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -174,6 +172,123 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
}
|
||||
}
|
||||
|
||||
// Assert.That(gotControlFile, Is.True, "No control file in archive");
|
||||
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
|
||||
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
||||
|
||||
// TODO: Test presence of more files and contents of files.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
|
||||
/// (subject to change since there is no fixed format yet).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSaveItemToIarV0_1()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
string userFirstName = "Jock";
|
||||
string userLastName = "Stirrup";
|
||||
string userPassword = "troll";
|
||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1;
|
||||
SceneObjectPart part1;
|
||||
{
|
||||
string partName = "My Little Dog Object";
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
||||
Vector3 groupPosition = new Vector3(10, 20, 30);
|
||||
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
||||
Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||
|
||||
part1
|
||||
= new SceneObjectPart(
|
||||
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
|
||||
part1.Name = partName;
|
||||
|
||||
object1 = new SceneObjectGroup(part1);
|
||||
scene.AddNewSceneObject(object1, false);
|
||||
}
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
scene.AssetService.Store(asset1);
|
||||
|
||||
// Create item
|
||||
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||
string item1Name = "My Little Dog";
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = item1Name;
|
||||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||
|
||||
mre.Reset();
|
||||
archiverModule.ArchiveInventory(
|
||||
Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
|
||||
mre.WaitOne(60000, false);
|
||||
|
||||
byte[] archive = archiveWriteStream.ToArray();
|
||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||
|
||||
//bool gotControlFile = false;
|
||||
bool gotObject1File = false;
|
||||
//bool gotObject2File = false;
|
||||
string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
|
||||
string expectedObject1FilePath = string.Format(
|
||||
"{0}{1}",
|
||||
ArchiveConstants.INVENTORY_PATH,
|
||||
expectedObject1FileName);
|
||||
|
||||
string filePath;
|
||||
TarArchiveReader.TarEntryType tarEntryType;
|
||||
|
||||
// Console.WriteLine("Reading archive");
|
||||
|
||||
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
||||
{
|
||||
Console.WriteLine("Got {0}", filePath);
|
||||
|
||||
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
||||
// {
|
||||
// gotControlFile = true;
|
||||
// }
|
||||
|
||||
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
|
||||
{
|
||||
// string fileName = filePath.Remove(0, "Objects/".Length);
|
||||
//
|
||||
// if (fileName.StartsWith(part1.Name))
|
||||
// {
|
||||
Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
|
||||
gotObject1File = true;
|
||||
// }
|
||||
// else if (fileName.StartsWith(part2.Name))
|
||||
// {
|
||||
// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
|
||||
// gotObject2File = true;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Assert.That(gotControlFile, Is.True, "No control file in archive");
|
||||
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
|
||||
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
||||
|
|
|
@ -32,7 +32,6 @@ using log4net;
|
|||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
@ -91,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
|
||||
if (m_TransferModule == null)
|
||||
{
|
||||
m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
|
||||
m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only");
|
||||
m_Enabled = false;
|
||||
|
||||
m_Scenelist.Clear();
|
||||
|
@ -153,7 +152,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||
{
|
||||
m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog);
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY TRANSFER]: {0} IM type received from {1}",
|
||||
(InstantMessageDialog)im.dialog, client.Name);
|
||||
|
||||
Scene scene = FindClientScene(client.AgentId);
|
||||
|
||||
|
@ -179,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
{
|
||||
UUID folderID = new UUID(im.binaryBucket, 1);
|
||||
|
||||
m_log.DebugFormat("[AGENT INVENTORY]: Inserting original folder {0} "+
|
||||
m_log.DebugFormat("[INVENTORY TRANSFER]: Inserting original folder {0} "+
|
||||
"into agent {1}'s inventory",
|
||||
folderID, new UUID(im.toAgentID));
|
||||
|
||||
|
@ -215,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
UUID itemID = new UUID(im.binaryBucket, 1);
|
||||
|
||||
m_log.DebugFormat("[AGENT INVENTORY]: (giving) Inserting item {0} "+
|
||||
m_log.DebugFormat("[INVENTORY TRANSFER]: (giving) Inserting item {0} "+
|
||||
"into agent {1}'s inventory",
|
||||
itemID, new UUID(im.toAgentID));
|
||||
|
||||
|
@ -280,10 +281,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
// inventory is loaded. Courtesy of the above bulk update,
|
||||
// It will have been pushed to the client, too
|
||||
//
|
||||
|
||||
//CachedUserInfo userInfo =
|
||||
// scene.CommsManager.UserProfileCacheService.
|
||||
// GetUserDetails(client.AgentId);
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
|
||||
InventoryFolderBase trashFolder =
|
||||
|
|
|
@ -202,6 +202,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
|
||||
finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
|
||||
|
||||
// Check that these are not the same coordinates
|
||||
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
|
||||
finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
|
||||
{
|
||||
// Can't do. Viewer crashes
|
||||
sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// This is it
|
||||
//
|
||||
|
@ -307,7 +316,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
string reason = String.Empty;
|
||||
|
||||
// Let's create an agent there if one doesn't exist yet.
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason))
|
||||
bool logout = false;
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
|
||||
reason));
|
||||
|
@ -434,8 +444,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
|
||||
|
||||
// Well, this is it. The agent is over there.
|
||||
|
||||
KillEntity(sp.Scene, sp.LocalId);
|
||||
|
||||
// May need to logout or other cleanup
|
||||
AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
|
||||
|
||||
// Now let's make it officially a child agent
|
||||
sp.MakeChildAgent();
|
||||
|
||||
|
@ -483,8 +498,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
}
|
||||
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
{
|
||||
logout = false;
|
||||
return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
||||
}
|
||||
|
||||
|
@ -500,6 +516,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
}
|
||||
|
||||
protected virtual void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
{
|
||||
}
|
||||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
{
|
||||
scene.SendKillObject(localID);
|
||||
|
|
|
@ -140,9 +140,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return false;
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected override void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
{
|
||||
if (logout)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
{
|
||||
reason = string.Empty;
|
||||
logout = false;
|
||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||
{
|
||||
|
@ -152,9 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver);
|
||||
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
|
||||
if (success)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID);
|
||||
logout = success; // flag for later logout from this grid; this is an HG TP
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
if (ids.ContainsKey(assetID))
|
||||
ids.Remove(assetID);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
FetchAsset(userAssetURL, uuid);
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return ret;
|
||||
}
|
||||
|
||||
// DO NOT OVERRIDE THIS METHOD
|
||||
// DO NOT OVERRIDE THE BASE METHOD
|
||||
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
||||
SceneObjectGroup objectGroup, IClientAPI remoteClient)
|
||||
{
|
||||
|
@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
if (!assetID.Equals(UUID.Zero))
|
||||
{
|
||||
UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
|
||||
if (remoteClient != null)
|
||||
UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
|
||||
}
|
||||
else
|
||||
m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
|
||||
|
@ -192,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
m_assMapper.Post(item.AssetID, receiver, userAssetServer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||
public override bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||
{
|
||||
assetServerURL = string.Empty;
|
||||
UserAccount account = null;
|
||||
|
@ -217,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
||||
{
|
||||
InventoryItemBase item = base.GetItem(agentID, itemID);
|
||||
|
||||
string userAssetServer = string.Empty;
|
||||
if (IsForeignUser(agentID, out userAssetServer))
|
||||
m_assMapper.Get(item.AssetID, agentID, userAssetServer);
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -639,6 +639,57 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
}
|
||||
|
||||
public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
|
||||
{
|
||||
InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
|
||||
if (assetRequestItem == null)
|
||||
{
|
||||
ILibraryService lib = m_Scene.RequestModuleInterface<ILibraryService>();
|
||||
if (lib != null)
|
||||
assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
|
||||
if (assetRequestItem == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
// At this point, we need to apply perms
|
||||
// only to notecards and scripts. All
|
||||
// other asset types are always available
|
||||
//
|
||||
if (assetRequestItem.AssetType == (int)AssetType.LSLText)
|
||||
{
|
||||
if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
|
||||
{
|
||||
if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (assetRequestItem.AssetID != requestID)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
|
||||
Name, requestID, itemID, assetRequestItem.AssetID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public virtual bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||
{
|
||||
assetServerURL = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
|
@ -661,6 +712,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return asset;
|
||||
}
|
||||
|
||||
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
||||
{
|
||||
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
|
||||
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
|
||||
assetRequestItem = invService.GetItem(assetRequestItem);
|
||||
return assetRequestItem;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ using OpenMetaverse;
|
|||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
{
|
||||
public class HGAssetBroker :
|
||||
ISharedRegionModule, IAssetService, IHyperAssetService
|
||||
ISharedRegionModule, IAssetService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
m_aScene = scene;
|
||||
|
||||
scene.RegisterModuleInterface<IAssetService>(this);
|
||||
scene.RegisterModuleInterface<IHyperAssetService>(this);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
|
|
@ -233,6 +233,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
return m_GridService.GetFallbackRegions(scopeID, x, y);
|
||||
}
|
||||
|
||||
public List<GridRegion> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return m_GridService.GetHyperlinks(scopeID);
|
||||
}
|
||||
|
||||
public int GetRegionFlags(UUID scopeID, UUID regionID)
|
||||
{
|
||||
return m_GridService.GetRegionFlags(scopeID, regionID);
|
||||
|
|
|
@ -136,6 +136,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize);
|
||||
Assert.IsNotNull(results, "Retrieved GetRegionRange list is null");
|
||||
Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected");
|
||||
|
||||
results = m_LocalConnector.GetHyperlinks(UUID.Zero);
|
||||
Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
|
||||
Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,15 +27,12 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using OpenMetaverse;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||
{
|
||||
public abstract class BaseInventoryConnector : IInventoryService
|
||||
|
|
|
@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// else put a null; it means that the methods should forward to local grid's inventory
|
||||
m_InventoryURLs.Add(userID, null);
|
||||
}
|
||||
|
||||
private void DropInventoryServiceURL(UUID userID)
|
||||
|
@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (m_InventoryURLs.ContainsKey(userID))
|
||||
return m_InventoryURLs[userID];
|
||||
|
||||
else
|
||||
CacheInventoryServiceURL(userID);
|
||||
CacheInventoryServiceURL(userID);
|
||||
|
||||
if (m_InventoryURLs.ContainsKey(userID))
|
||||
return m_InventoryURLs[userID];
|
||||
|
||||
return null; //it means that the methods should forward to local grid's inventory
|
||||
|
||||
return m_InventoryURLs[userID];
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
|
||||
//m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
|
||||
//m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||
{
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||
{
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folderIDs.Count == 0)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(ownerID);
|
||||
|
||||
|
@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -384,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -401,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (item == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(item.Owner);
|
||||
|
||||
|
@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (item == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(item.Owner);
|
||||
|
||||
|
@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (items.Count == 0)
|
||||
return true;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(ownerID);
|
||||
|
||||
|
@ -451,15 +451,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
|
||||
//m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
|
||||
|
||||
if (itemIDs == null)
|
||||
return false;
|
||||
if (itemIDs.Count == 0)
|
||||
return true;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(ownerID);
|
||||
|
||||
if (invURL == null) // not there, forward to local inventory connector to resolve
|
||||
|
@ -474,7 +472,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(item.Owner);
|
||||
|
||||
|
@ -491,7 +489,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return null;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -515,7 +513,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
|
|
@ -161,6 +161,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
/// <returns></returns>
|
||||
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||
{
|
||||
m_log.DebugFormat("[INVENTORY CACHE]: Getting folder for asset type {0} for user {1}", type, userID);
|
||||
|
||||
Dictionary<AssetType, InventoryFolderBase> folders = null;
|
||||
|
||||
lock (m_InventoryCache)
|
||||
|
@ -177,9 +179,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
if ((folders != null) && folders.ContainsKey(type))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY CACHE]: Returning folder {0} as type {1} for {2}", folders[type], type, userID);
|
||||
|
||||
return folders[type];
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -216,13 +216,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_InventoryService.PurgeFolder(folder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new item to the user's inventory
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns>true if the item was successfully added</returns>
|
||||
public bool AddItem(InventoryItemBase item)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
|
||||
item.Name, item.Owner, item.Folder);
|
||||
|
||||
if (UUID.Zero == item.Folder)
|
||||
{
|
||||
InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
||||
if (f != null)
|
||||
{
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = m_InventoryService.GetRootFolder(item.Owner);
|
||||
if (f != null)
|
||||
item.Folder = f.ID;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return m_InventoryService.AddItem(item);
|
||||
}
|
||||
|
||||
|
@ -236,7 +252,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_InventoryService.UpdateItem(item);
|
||||
}
|
||||
|
||||
|
||||
public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
|
||||
{
|
||||
return m_InventoryService.MoveItems(ownerID, items);
|
||||
|
|
|
@ -76,7 +76,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
base.Init(source);
|
||||
}
|
||||
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
|
|
|
@ -230,6 +230,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (item == null)
|
||||
return false;
|
||||
|
||||
if (UUID.Zero == item.Folder)
|
||||
{
|
||||
InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
||||
if (f != null)
|
||||
{
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = m_RemoteConnector.GetRootFolder(item.Owner);
|
||||
if (f != null)
|
||||
item.Folder = f.ID;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return m_RemoteConnector.AddItem(item);
|
||||
}
|
||||
|
||||
|
@ -295,9 +312,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_RemoteConnector.GetAssetPermissions(userID, assetID);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -103,6 +103,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_Enabled)
|
||||
m_GridService = scene.GridService;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -805,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
imgstream = new MemoryStream();
|
||||
|
||||
// non-async because we know we have the asset immediately.
|
||||
AssetBase mapasset = m_scene.AssetService.Get(m_scene.RegionInfo.lastMapUUID.ToString());
|
||||
AssetBase mapasset = m_scene.AssetService.Get(m_scene.RegionInfo.RegionSettings.TerrainImageID.ToString());
|
||||
|
||||
// Decode image to System.Drawing.Image
|
||||
if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image))
|
||||
|
|
|
@ -142,9 +142,18 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
|||
node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
|
||||
node.InnerText = land.LandData.GlobalID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
if (land != null && land.LandData != null)
|
||||
{
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
|
||||
node.InnerText = land.LandData.GlobalID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something is wrong with this object. Let's not list it.
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName);
|
||||
continue;
|
||||
}
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
|
||||
Vector3 loc = obj.AbsolutePosition;
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenSim.Region.DataSnapshot.Interfaces;
|
||||
|
@ -98,13 +99,21 @@ namespace OpenSim.Region.DataSnapshot
|
|||
{
|
||||
String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
|
||||
|
||||
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
||||
try
|
||||
{
|
||||
snapXWriter.Formatting = Formatting.Indented;
|
||||
snapXWriter.WriteStartDocument();
|
||||
data.WriteTo(snapXWriter);
|
||||
snapXWriter.WriteEndDocument();
|
||||
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
||||
{
|
||||
snapXWriter.Formatting = Formatting.Indented;
|
||||
snapXWriter.WriteStartDocument();
|
||||
data.WriteTo(snapXWriter);
|
||||
snapXWriter.WriteEndDocument();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//mark provider as not stale, parent scene as stale
|
||||
|
@ -185,12 +194,19 @@ namespace OpenSim.Region.DataSnapshot
|
|||
//save snapshot
|
||||
String path = DataFileNameScene(scene);
|
||||
|
||||
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
||||
try
|
||||
{
|
||||
snapXWriter.Formatting = Formatting.Indented;
|
||||
snapXWriter.WriteStartDocument();
|
||||
regionElement.WriteTo(snapXWriter);
|
||||
snapXWriter.WriteEndDocument();
|
||||
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
||||
{
|
||||
snapXWriter.Formatting = Formatting.Indented;
|
||||
snapXWriter.WriteStartDocument();
|
||||
regionElement.WriteTo(snapXWriter);
|
||||
snapXWriter.WriteEndDocument();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
|
||||
}
|
||||
|
||||
m_scenes[scene] = false;
|
||||
|
@ -206,15 +222,23 @@ namespace OpenSim.Region.DataSnapshot
|
|||
#region Helpers
|
||||
private string DataFileNameFragment(Scene scene, String fragmentName)
|
||||
{
|
||||
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml"));
|
||||
return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName + "_" + fragmentName), "xml"));
|
||||
}
|
||||
|
||||
private string DataFileNameScene(Scene scene)
|
||||
{
|
||||
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml"));
|
||||
return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName), "xml"));
|
||||
//return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
|
||||
}
|
||||
|
||||
private static string Sanitize(string name)
|
||||
{
|
||||
string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
|
||||
string invalidReStr = string.Format(@"[{0}]", invalidChars);
|
||||
string newname = Regex.Replace(name, invalidReStr, "_");
|
||||
return newname.Replace('.', '_');
|
||||
}
|
||||
|
||||
private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
|
||||
{
|
||||
XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");
|
||||
|
@ -258,21 +282,16 @@ namespace OpenSim.Region.DataSnapshot
|
|||
|
||||
private String GetRegionCategory(Scene scene)
|
||||
{
|
||||
//Boolean choice between:
|
||||
// "PG" - Mormontown
|
||||
// "Mature" - Sodom and Gomorrah
|
||||
if (scene.RegionInfo.RegionSettings.Maturity == 1)
|
||||
{
|
||||
return "Mature";
|
||||
}
|
||||
else if (scene.RegionInfo.RegionSettings.Maturity == 0)
|
||||
{
|
||||
if (scene.RegionInfo.RegionSettings.Maturity == 0)
|
||||
return "PG";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
if (scene.RegionInfo.RegionSettings.Maturity == 1)
|
||||
return "Mature";
|
||||
|
||||
if (scene.RegionInfo.RegionSettings.Maturity == 2)
|
||||
return "Adult";
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
private XmlNode GetGridSnapshotData(XmlDocument factory)
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IHyperAssetService
|
||||
{
|
||||
string GetUserAssetServer(UUID userID);
|
||||
string GetSimAssetServer();
|
||||
}
|
||||
}
|
|
@ -43,5 +43,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
||||
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
|
||||
void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver);
|
||||
bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID);
|
||||
|
||||
// Must be here because of textures in user's inventory
|
||||
bool IsForeignUser(UUID userID, out string assetServerURL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -384,29 +384,105 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (Permissions.PropagatePermissions() && recipient != senderId)
|
||||
{
|
||||
// First, make sore base is limited to the next perms
|
||||
itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move);
|
||||
// By default, current equals base
|
||||
itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions;
|
||||
// Trying to do this right this time. This is evil. If
|
||||
// you believe in Good, go elsewhere. Vampires and other
|
||||
// evil creatores only beyond this point. You have been
|
||||
// warned.
|
||||
|
||||
// If this is an object, replace current perms
|
||||
// with folded perms
|
||||
// We're going to mask a lot of things by the next perms
|
||||
// Tweak the next perms to be nicer to our data
|
||||
//
|
||||
// In this mask, all the bits we do NOT want to mess
|
||||
// with are set. These are:
|
||||
//
|
||||
// Transfer
|
||||
// Copy
|
||||
// Modufy
|
||||
uint permsMask = ~ ((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify);
|
||||
|
||||
// Now, reduce the next perms to the mask bits
|
||||
// relevant to the operation
|
||||
uint nextPerms = permsMask | (item.NextPermissions &
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify));
|
||||
|
||||
// nextPerms now has all bits set, except for the actual
|
||||
// next permission bits.
|
||||
|
||||
// This checks for no mod, no copy, no trans.
|
||||
// This indicates an error or messed up item. Do it like
|
||||
// SL and assume trans
|
||||
if (nextPerms == permsMask)
|
||||
nextPerms |= (uint)PermissionMask.Transfer;
|
||||
|
||||
// Inventory owner perms are the logical AND of the
|
||||
// folded perms and the root prim perms, however, if
|
||||
// the root prim is mod, the inventory perms will be
|
||||
// mod. This happens on "take" and is of little concern
|
||||
// here, save for preventing escalation
|
||||
|
||||
// This hack ensures that items previously permalocked
|
||||
// get unlocked when they're passed or rezzed
|
||||
uint basePerms = item.BasePermissions |
|
||||
(uint)PermissionMask.Move;
|
||||
uint ownerPerms = item.CurrentPermissions;
|
||||
|
||||
// If this is an object, root prim perms may be more
|
||||
// permissive than folded perms. Use folded perms as
|
||||
// a mask
|
||||
if (item.InvType == (int)InventoryType.Object)
|
||||
{
|
||||
itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13;
|
||||
// Create a safe mask for the current perms
|
||||
uint foldedPerms = (item.CurrentPermissions & 7) << 13;
|
||||
foldedPerms |= permsMask;
|
||||
|
||||
bool isRootMod = (item.CurrentPermissions &
|
||||
(uint)PermissionMask.Modify) != 0 ?
|
||||
true : false;
|
||||
|
||||
// Mask the owner perms to the folded perms
|
||||
ownerPerms &= foldedPerms;
|
||||
basePerms &= foldedPerms;
|
||||
|
||||
// If the root was mod, let the mask reflect that
|
||||
// We also need to adjust the base here, because
|
||||
// we should be able to edit in-inventory perms
|
||||
// for the root prim, if it's mod.
|
||||
if (isRootMod)
|
||||
{
|
||||
ownerPerms |= (uint)PermissionMask.Modify;
|
||||
basePerms |= (uint)PermissionMask.Modify;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure there is no escalation
|
||||
itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move);
|
||||
// These will be applied to the root prim at next rez.
|
||||
// The slam bit (bit 3) and folded permission (bits 0-2)
|
||||
// are preserved due to the above mangling
|
||||
ownerPerms &= nextPerms;
|
||||
|
||||
// Need slam bit on xfer
|
||||
itemCopy.CurrentPermissions |= 8;
|
||||
// Mask the base permissions. This is a conservative
|
||||
// approach altering only the three main perms
|
||||
basePerms &= nextPerms;
|
||||
|
||||
// Assign to the actual item. Make sure the slam bit is
|
||||
// set, if it wasn't set before.
|
||||
itemCopy.BasePermissions = basePerms;
|
||||
itemCopy.CurrentPermissions = ownerPerms | 16; // Slam
|
||||
|
||||
itemCopy.NextPermissions = item.NextPermissions;
|
||||
|
||||
itemCopy.EveryOnePermissions = 0;
|
||||
// This preserves "everyone can move"
|
||||
itemCopy.EveryOnePermissions = item.EveryOnePermissions &
|
||||
nextPerms;
|
||||
|
||||
// Intentionally killing "share with group" here, as
|
||||
// the recipient will not have the group this is
|
||||
// set to
|
||||
itemCopy.GroupPermissions = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -839,6 +915,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup group = part.ParentGroup;
|
||||
if (group != null)
|
||||
{
|
||||
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
|
||||
if (item == null)
|
||||
return;
|
||||
|
@ -864,7 +943,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
|
||||
{
|
||||
Console.WriteLine("CreateAgentInventoryItemFromTask");
|
||||
TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
|
||||
|
||||
if (null == taskItem)
|
||||
|
@ -935,7 +1013,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="itemID"></param>
|
||||
public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId)
|
||||
{
|
||||
m_log.Info("Adding task inventory");
|
||||
m_log.DebugFormat(
|
||||
"[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}",
|
||||
itemId, part.Name, folderId, remoteClient.Name);
|
||||
|
||||
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId);
|
||||
|
||||
if (agentItem == null)
|
||||
|
@ -978,9 +1059,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
// Only owner can copy
|
||||
if (remoteClient.AgentId != taskItem.OwnerID)
|
||||
return;
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId);
|
||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
{
|
||||
// If the item to be moved is no copy, we need to be able to
|
||||
// edit the prim.
|
||||
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the item is copiable, then we just need to have perms
|
||||
// on it. The delete check is a pure rights check
|
||||
if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
}
|
||||
|
||||
MoveTaskInventoryItem(remoteClient, folderId, part, itemId);
|
||||
}
|
||||
|
@ -989,7 +1082,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <see>MoveTaskInventoryItem</see>
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="folderID">
|
||||
/// The user inventory folder to move (or copy) the item to. If null, then the most
|
||||
/// suitable system folder is used (e.g. the Objects folder for objects). If there is no suitable folder, then
|
||||
/// the item is placed in the user's root inventory folder
|
||||
/// </param>
|
||||
/// <param name="part"></param>
|
||||
/// <param name="itemID"></param>
|
||||
public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId)
|
||||
|
@ -1263,10 +1360,48 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
agentTransactions.HandleTaskItemUpdateFromTransaction(
|
||||
remoteClient, part, transactionID, currentItem);
|
||||
|
||||
if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
|
||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||
else
|
||||
remoteClient.SendAgentAlertMessage("Item saved", false);
|
||||
}
|
||||
|
||||
// Base ALWAYS has move
|
||||
currentItem.BasePermissions |= (uint)PermissionMask.Move;
|
||||
|
||||
// Check if we're allowed to mess with permissions
|
||||
if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
|
||||
{
|
||||
if (remoteClient.AgentId != part.OwnerID) // Not owner
|
||||
{
|
||||
// Friends and group members can't change any perms
|
||||
itemInfo.BasePermissions = currentItem.BasePermissions;
|
||||
itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
|
||||
itemInfo.GroupPermissions = currentItem.GroupPermissions;
|
||||
itemInfo.NextPermissions = currentItem.NextPermissions;
|
||||
itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Owner can't change base, and can change other
|
||||
// only up to base
|
||||
itemInfo.BasePermissions = currentItem.BasePermissions;
|
||||
itemInfo.EveryonePermissions &= currentItem.BasePermissions;
|
||||
itemInfo.GroupPermissions &= currentItem.BasePermissions;
|
||||
itemInfo.CurrentPermissions &= currentItem.BasePermissions;
|
||||
itemInfo.NextPermissions &= currentItem.BasePermissions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Next ALWAYS has move
|
||||
itemInfo.NextPermissions |= (uint)PermissionMask.Move;
|
||||
|
||||
if (part.Inventory.UpdateInventoryItem(itemInfo))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
part.GetProperties(remoteClient);
|
||||
}
|
||||
}
|
||||
|
@ -1597,7 +1732,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
// Handle god perms
|
||||
if (Permissions.IsGod(remoteClient.AgentId))
|
||||
if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId))
|
||||
{
|
||||
permissionToTake = true;
|
||||
permissionToTakeCopy = true;
|
||||
|
@ -1608,7 +1743,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (action == DeRezAction.SaveToExistingUserInventoryItem)
|
||||
permissionToDelete = false;
|
||||
|
||||
// if we want to take a copy,, we also don't want to delete
|
||||
// if we want to take a copy, we also don't want to delete
|
||||
// Note: after this point, the permissionToTakeCopy flag
|
||||
// becomes irrelevant. It already includes the permissionToTake
|
||||
// permission and after excluding no copy items here, we can
|
||||
|
@ -1619,6 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!permissionToTakeCopy)
|
||||
return;
|
||||
|
||||
permissionToTake = true;
|
||||
// Don't delete
|
||||
permissionToDelete = false;
|
||||
}
|
||||
|
@ -2039,7 +2175,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (root == null)
|
||||
{
|
||||
m_log.DebugFormat("[LINK]: Can't find linkset root prim {0{", parentPrimId);
|
||||
m_log.DebugFormat("[LINK]: Can't find linkset root prim {0}", parentPrimId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
protected SceneCommunicationService m_sceneGridService;
|
||||
public bool LoginsDisabled = true;
|
||||
public bool LoadingPrims = false;
|
||||
|
||||
public new float TimeDilation
|
||||
{
|
||||
|
@ -1879,6 +1880,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public virtual void LoadPrimsFromStorage(UUID regionID)
|
||||
{
|
||||
LoadingPrims = true;
|
||||
m_log.Info("[SCENE]: Loading objects from datastore");
|
||||
|
||||
List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID);
|
||||
|
@ -1902,6 +1904,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
|
||||
LoadingPrims = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2634,18 +2637,25 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="client"></param>
|
||||
public override void AddNewClient(IClientAPI client)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
|
||||
bool vialogin = false;
|
||||
|
||||
m_clientManager.Add(client);
|
||||
if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
|
||||
return;
|
||||
|
||||
vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
|
||||
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
||||
|
||||
CheckHeartbeat();
|
||||
SubscribeToClientEvents(client);
|
||||
ScenePresence presence;
|
||||
|
||||
if (m_restorePresences.ContainsKey(client.AgentId))
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
|
||||
|
||||
m_clientManager.Add(client);
|
||||
SubscribeToClientEvents(client);
|
||||
|
||||
presence = m_restorePresences[client.AgentId];
|
||||
m_restorePresences.Remove(client.AgentId);
|
||||
|
||||
|
@ -2668,49 +2678,35 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
|
||||
|
||||
// Do the verification here
|
||||
System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP();
|
||||
if (aCircuit != null)
|
||||
if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
|
||||
{
|
||||
if (!VerifyClient(aCircuit, ep, out vialogin))
|
||||
m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
||||
|
||||
m_clientManager.Add(client);
|
||||
SubscribeToClientEvents(client);
|
||||
|
||||
ScenePresence sp = CreateAndAddScenePresence(client);
|
||||
if (aCircuit != null)
|
||||
sp.Appearance = aCircuit.Appearance;
|
||||
|
||||
// HERE!!! Do the initial attachments right here
|
||||
// first agent upon login is a root agent by design.
|
||||
// All other AddNewClient calls find aCircuit.child to be true
|
||||
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
|
||||
{
|
||||
// uh-oh, this is fishy
|
||||
m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
|
||||
client.AgentId, client.SessionId, ep.ToString());
|
||||
try
|
||||
{
|
||||
client.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace);
|
||||
}
|
||||
return;
|
||||
sp.IsChildAgent = false;
|
||||
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
||||
}
|
||||
}
|
||||
|
||||
m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
||||
|
||||
ScenePresence sp = CreateAndAddScenePresence(client);
|
||||
if (aCircuit != null)
|
||||
sp.Appearance = aCircuit.Appearance;
|
||||
|
||||
// HERE!!! Do the initial attachments right here
|
||||
// first agent upon login is a root agent by design.
|
||||
// All other AddNewClient calls find aCircuit.child to be true
|
||||
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
|
||||
{
|
||||
sp.IsChildAgent = false;
|
||||
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
||||
}
|
||||
}
|
||||
|
||||
m_LastLogin = Util.EnvironmentTickCount();
|
||||
EventManager.TriggerOnNewClient(client);
|
||||
if (vialogin)
|
||||
EventManager.TriggerOnClientLogin(client);
|
||||
if (GetScenePresence(client.AgentId) != null)
|
||||
{
|
||||
m_LastLogin = Util.EnvironmentTickCount();
|
||||
EventManager.TriggerOnNewClient(client);
|
||||
if (vialogin)
|
||||
EventManager.TriggerOnClientLogin(client);
|
||||
}
|
||||
}
|
||||
|
||||
private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin)
|
||||
|
@ -2718,9 +2714,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
vialogin = false;
|
||||
|
||||
// Do the verification here
|
||||
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
|
||||
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
|
||||
{
|
||||
m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
|
||||
m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via HG login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
|
||||
vialogin = true;
|
||||
IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
|
||||
if (userVerification != null && ep != null)
|
||||
|
@ -2736,6 +2732,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.",
|
||||
aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
|
||||
vialogin = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3430,7 +3433,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// also return a reason.</returns>
|
||||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
|
||||
{
|
||||
TeleportFlags tp = (TeleportFlags)teleportFlags;
|
||||
bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
|
||||
(teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
|
||||
reason = String.Empty;
|
||||
|
||||
//Teleport flags:
|
||||
|
@ -3467,7 +3471,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
|
||||
|
||||
//On login test land permisions
|
||||
if (tp == TeleportFlags.ViaLogin)
|
||||
if (vialogin)
|
||||
{
|
||||
if (land != null && !TestLandRestrictions(agent, land, out reason))
|
||||
{
|
||||
|
@ -3526,7 +3530,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
agent.teleportFlags = teleportFlags;
|
||||
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
|
||||
|
||||
if (tp == TeleportFlags.ViaLogin)
|
||||
if (vialogin)
|
||||
{
|
||||
if (TestBorderCross(agent.startpos, Cardinals.E))
|
||||
{
|
||||
|
@ -3644,7 +3648,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
IPresenceService presence = RequestModuleInterface<IPresenceService>();
|
||||
if (presence == null)
|
||||
{
|
||||
reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
reason = String.Format("Failed to verify user presence in the grid for {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3652,7 +3656,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (pinfo == null)
|
||||
{
|
||||
reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
reason = String.Format("Failed to verify user presence in the grid for {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
PermissionMask.Move |
|
||||
PermissionMask.Transfer) | 7;
|
||||
|
||||
uint ownerMask = 0x7ffffff;
|
||||
uint ownerMask = 0x7fffffff;
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
{
|
||||
ownerMask &= part.OwnerMask;
|
||||
|
@ -295,12 +295,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
|
||||
if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~((uint)PermissionMask.Modify >> 13);
|
||||
if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~((uint)PermissionMask.Copy >> 13);
|
||||
if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~((uint)PermissionMask.Transfer >> 13);
|
||||
// If root prim permissions are applied here, this would screw
|
||||
// with in-inventory manipulation of the next owner perms
|
||||
// in a major way. So, let's move this to the give itself.
|
||||
// Yes. I know. Evil.
|
||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
// perms &= ~((uint)PermissionMask.Modify >> 13);
|
||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
// perms &= ~((uint)PermissionMask.Copy >> 13);
|
||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
|
||||
// perms &= ~((uint)PermissionMask.Transfer >> 13);
|
||||
|
||||
return perms;
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|
||||
|| m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
|
||||
&& !IsAttachmentCheckFull())
|
||||
&& !IsAttachmentCheckFull() && (!m_scene.LoadingPrims))
|
||||
{
|
||||
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
|
||||
}
|
||||
|
@ -1999,8 +1999,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void ScheduleGroupForFullUpdate()
|
||||
{
|
||||
if (IsAttachment)
|
||||
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
|
||||
// if (IsAttachment)
|
||||
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
|
||||
|
||||
checkAtTargets();
|
||||
RootPart.ScheduleFullUpdate();
|
||||
|
|
|
@ -862,7 +862,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
set
|
||||
{
|
||||
m_color = value;
|
||||
TriggerScriptChangedEvent(Changed.COLOR);
|
||||
|
||||
/* ScheduleFullUpdate() need not be called b/c after
|
||||
* setting the color, the text will be set, so then
|
||||
|
@ -4137,6 +4136,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
case 16:
|
||||
_nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) &
|
||||
baseMask;
|
||||
// Prevent the client from creating no mod, no copy
|
||||
// objects
|
||||
if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
_nextOwnerMask |= (uint)PermissionMask.Transfer;
|
||||
|
||||
_nextOwnerMask |= (uint)PermissionMask.Move;
|
||||
|
||||
break;
|
||||
}
|
||||
SendFullUpdateToAllClients();
|
||||
|
|
|
@ -118,20 +118,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="linkNum">Link number for the part</param>
|
||||
public void ResetInventoryIDs()
|
||||
{
|
||||
lock (Items)
|
||||
lock (m_items)
|
||||
{
|
||||
if (0 == Items.Count)
|
||||
if (0 == m_items.Count)
|
||||
return;
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
|
||||
Items.Clear();
|
||||
IList<TaskInventoryItem> items = GetInventoryItems();
|
||||
m_items.Clear();
|
||||
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
item.ResetIDs(m_part.UUID);
|
||||
Items.Add(item.ItemID, item);
|
||||
m_items.Add(item.ItemID, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,17 +148,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
|
||||
foreach (TaskInventoryItem item in items)
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
List<TaskInventoryItem> items = GetInventoryItems();
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
if (ownerId != item.OwnerID)
|
||||
{
|
||||
if (ownerId != item.OwnerID)
|
||||
{
|
||||
item.LastOwnerID = item.OwnerID;
|
||||
item.OwnerID = ownerId;
|
||||
}
|
||||
item.LastOwnerID = item.OwnerID;
|
||||
item.OwnerID = ownerId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,17 +175,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
if (groupID != item.GroupID)
|
||||
{
|
||||
item.GroupID = groupID;
|
||||
}
|
||||
}
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
List<TaskInventoryItem> items = GetInventoryItems();
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
if (groupID != item.GroupID)
|
||||
item.GroupID = groupID;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,17 +192,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
||||
{
|
||||
lock (m_items)
|
||||
{
|
||||
foreach (TaskInventoryItem item in Items.Values)
|
||||
{
|
||||
if ((int)InventoryType.LSL == item.InvType)
|
||||
{
|
||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||
Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
|
||||
}
|
||||
}
|
||||
}
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||
}
|
||||
|
||||
public ArrayList GetScriptErrors(UUID itemID)
|
||||
|
@ -237,16 +227,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </param>
|
||||
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
|
||||
{
|
||||
lock (Items)
|
||||
{
|
||||
foreach (TaskInventoryItem item in Items.Values)
|
||||
{
|
||||
if ((int)InventoryType.LSL == item.InvType)
|
||||
{
|
||||
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -259,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// m_log.InfoFormat(
|
||||
// "[PRIM INVENTORY]: " +
|
||||
// "Starting script {0}, {1} in prim {2}, {3}",
|
||||
// item.Name, item.ItemID, m_part.Name, m_part.UUID);
|
||||
// item.Name, item.ItemID, Name, UUID);
|
||||
|
||||
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
|
||||
return;
|
||||
|
@ -295,20 +278,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_part.ParentGroup.m_savedScriptState != null)
|
||||
RestoreSavedScriptState(item.OldItemID, item.ItemID);
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
if (m_part.ParentGroup.m_savedScriptState != null)
|
||||
RestoreSavedScriptState(item.OldItemID, item.ItemID);
|
||||
|
||||
m_items[item.ItemID].PermsMask = 0;
|
||||
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
||||
|
||||
string script = Utils.BytesToString(asset.Data);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
||||
m_part.ParentGroup.AddActiveScriptCount(1);
|
||||
m_part.ScheduleFullUpdate();
|
||||
}
|
||||
|
||||
string script = Utils.BytesToString(asset.Data);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
||||
m_part.ParentGroup.AddActiveScriptCount(1);
|
||||
m_part.ScheduleFullUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,26 +339,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml;
|
||||
}
|
||||
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
// Stop an exception in setting saved state from propogating since this is not fatal.
|
||||
try
|
||||
{
|
||||
if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[oldID]))
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[PRIM INVENTORY]: Could not set script state for old key {0}, new key {1} in prim {2} {3}. Exception {4}{5}",
|
||||
oldID, newID, m_part.Name, m_part.UUID, ex.Message, ex.StackTrace);
|
||||
}
|
||||
if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[oldID]))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_part.ParentGroup.m_savedScriptState.Remove(oldID);
|
||||
}
|
||||
}
|
||||
|
@ -388,21 +359,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </param>
|
||||
public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
|
||||
{
|
||||
lock (m_items)
|
||||
{
|
||||
if (m_items.ContainsKey(itemId))
|
||||
{
|
||||
CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
|
||||
itemId, m_part.Name, m_part.UUID,
|
||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
TaskInventoryItem item = GetInventoryItem(itemId);
|
||||
if (item != null)
|
||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
|
||||
itemId, m_part.Name, m_part.UUID,
|
||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -443,16 +408,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
/// <summary>
|
||||
/// Check if the inventory holds an item with a given name.
|
||||
/// This method assumes that the task inventory is already locked.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
private bool InventoryContainsName(string name)
|
||||
{
|
||||
foreach (TaskInventoryItem item in Items.Values)
|
||||
lock (m_items)
|
||||
{
|
||||
if (item.Name == name)
|
||||
return true;
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.Name == name)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -495,12 +462,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="item"></param>
|
||||
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
|
||||
{
|
||||
List<TaskInventoryItem> il;
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
il = new List<TaskInventoryItem>(m_items.Values);
|
||||
}
|
||||
List<TaskInventoryItem> il = GetInventoryItems();
|
||||
|
||||
foreach (TaskInventoryItem i in il)
|
||||
{
|
||||
|
@ -540,14 +502,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.GroupID = m_part.GroupID;
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
m_items.Add(item.ItemID, item);
|
||||
|
||||
if (allowedDrop)
|
||||
m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
|
||||
else
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
}
|
||||
if (allowedDrop)
|
||||
m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
|
||||
else
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
|
||||
m_inventorySerial++;
|
||||
//m_inventorySerial += 2;
|
||||
|
@ -571,9 +531,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_items.Add(item.ItemID, item);
|
||||
// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
}
|
||||
m_inventorySerial++;
|
||||
}
|
||||
|
||||
m_inventorySerial++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -628,45 +587,44 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
|
||||
{
|
||||
lock(m_items)
|
||||
TaskInventoryItem it = GetInventoryItem(item.ItemID);
|
||||
if (it != null)
|
||||
{
|
||||
if (m_items.ContainsKey(item.ItemID))
|
||||
item.ParentID = m_part.UUID;
|
||||
item.ParentPartID = m_part.UUID;
|
||||
item.Flags = m_items[item.ItemID].Flags;
|
||||
|
||||
// If group permissions have been set on, check that the groupID is up to date in case it has
|
||||
// changed since permissions were last set.
|
||||
if (item.GroupPermissions != (uint)PermissionMask.None)
|
||||
item.GroupID = m_part.GroupID;
|
||||
|
||||
if (item.AssetID == UUID.Zero)
|
||||
item.AssetID = it.AssetID;
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
if (m_items.ContainsKey(item.ItemID))
|
||||
{
|
||||
item.ParentID = m_part.UUID;
|
||||
item.ParentPartID = m_part.UUID;
|
||||
item.Flags = m_items[item.ItemID].Flags;
|
||||
|
||||
// If group permissions have been set on, check that the groupID is up to date in case it has
|
||||
// changed since permissions were last set.
|
||||
if (item.GroupPermissions != (uint)PermissionMask.None)
|
||||
item.GroupID = m_part.GroupID;
|
||||
|
||||
if (item.AssetID == UUID.Zero)
|
||||
{
|
||||
item.AssetID = m_items[item.ItemID].AssetID;
|
||||
}
|
||||
m_items[item.ItemID] = item;
|
||||
m_inventorySerial++;
|
||||
if (fireScriptEvents)
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
||||
item.ItemID, m_part.Name, m_part.UUID,
|
||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
m_items[item.ItemID] = item;
|
||||
m_inventorySerial++;
|
||||
}
|
||||
return false;
|
||||
|
||||
if (fireScriptEvents)
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
||||
item.ItemID, m_part.Name, m_part.UUID,
|
||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -677,52 +635,37 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// in this prim's inventory.</returns>
|
||||
public int RemoveInventoryItem(UUID itemID)
|
||||
{
|
||||
lock (m_items)
|
||||
TaskInventoryItem item = GetInventoryItem(itemID);
|
||||
if (item != null)
|
||||
{
|
||||
if (m_items.ContainsKey(itemID))
|
||||
int type = m_items[itemID].InvType;
|
||||
if (type == 10) // Script
|
||||
{
|
||||
int type = m_items[itemID].InvType;
|
||||
if (type == 10) // Script
|
||||
{
|
||||
m_part.RemoveScriptEvents(itemID);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
|
||||
}
|
||||
m_items.Remove(itemID);
|
||||
m_inventorySerial++;
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
|
||||
int scriptcount = 0;
|
||||
lock (m_items)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.Type == 10)
|
||||
{
|
||||
scriptcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scriptcount <= 0)
|
||||
{
|
||||
m_part.RemFlag(PrimFlags.Scripted);
|
||||
}
|
||||
|
||||
m_part.ScheduleFullUpdate();
|
||||
|
||||
return type;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
||||
itemID, m_part.Name, m_part.UUID,
|
||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
m_part.RemoveScriptEvents(itemID);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
|
||||
}
|
||||
m_items.Remove(itemID);
|
||||
m_inventorySerial++;
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
|
||||
if (!ContainsScripts())
|
||||
m_part.RemFlag(PrimFlags.Scripted);
|
||||
|
||||
m_part.ScheduleFullUpdate();
|
||||
|
||||
return type;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
||||
itemID, m_part.Name, m_part.UUID,
|
||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -776,52 +719,50 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// isn't available (such as drag from prim inventory to agent inventory)
|
||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
||||
|
||||
lock (m_items)
|
||||
List<TaskInventoryItem> items = GetInventoryItems();
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
UUID ownerID = item.OwnerID;
|
||||
uint everyoneMask = 0;
|
||||
uint baseMask = item.BasePermissions;
|
||||
uint ownerMask = item.CurrentPermissions;
|
||||
uint groupMask = item.GroupPermissions;
|
||||
UUID ownerID = item.OwnerID;
|
||||
uint everyoneMask = 0;
|
||||
uint baseMask = item.BasePermissions;
|
||||
uint ownerMask = item.CurrentPermissions;
|
||||
uint groupMask = item.GroupPermissions;
|
||||
|
||||
invString.AddItemStart();
|
||||
invString.AddNameValueLine("item_id", item.ItemID.ToString());
|
||||
invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
|
||||
invString.AddItemStart();
|
||||
invString.AddNameValueLine("item_id", item.ItemID.ToString());
|
||||
invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
|
||||
|
||||
invString.AddPermissionsStart();
|
||||
invString.AddPermissionsStart();
|
||||
|
||||
invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
|
||||
invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
|
||||
invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
|
||||
invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
|
||||
invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
|
||||
invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
|
||||
invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
|
||||
invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
|
||||
invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
|
||||
invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
|
||||
|
||||
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
|
||||
invString.AddNameValueLine("owner_id", ownerID.ToString());
|
||||
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
|
||||
invString.AddNameValueLine("owner_id", ownerID.ToString());
|
||||
|
||||
invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
|
||||
invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
|
||||
|
||||
invString.AddNameValueLine("group_id", item.GroupID.ToString());
|
||||
invString.AddSectionEnd();
|
||||
invString.AddNameValueLine("group_id", item.GroupID.ToString());
|
||||
invString.AddSectionEnd();
|
||||
|
||||
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
|
||||
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
|
||||
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
|
||||
invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
|
||||
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
|
||||
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
|
||||
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
|
||||
invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
|
||||
|
||||
invString.AddSaleStart();
|
||||
invString.AddNameValueLine("sale_type", "not");
|
||||
invString.AddNameValueLine("sale_price", "0");
|
||||
invString.AddSectionEnd();
|
||||
invString.AddSaleStart();
|
||||
invString.AddNameValueLine("sale_type", "not");
|
||||
invString.AddNameValueLine("sale_price", "0");
|
||||
invString.AddSectionEnd();
|
||||
|
||||
invString.AddNameValueLine("name", item.Name + "|");
|
||||
invString.AddNameValueLine("desc", item.Description + "|");
|
||||
invString.AddNameValueLine("name", item.Name + "|");
|
||||
invString.AddNameValueLine("desc", item.Description + "|");
|
||||
|
||||
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
|
||||
invString.AddSectionEnd();
|
||||
}
|
||||
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
|
||||
invString.AddSectionEnd();
|
||||
}
|
||||
|
||||
fileData = Utils.StringToBytes(invString.BuildString);
|
||||
|
@ -843,12 +784,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (HasInventoryChanged)
|
||||
{
|
||||
lock (Items)
|
||||
{
|
||||
datastore.StorePrimInventory(m_part.UUID, Items.Values);
|
||||
}
|
||||
|
||||
HasInventoryChanged = false;
|
||||
List<TaskInventoryItem> items = GetInventoryItems();
|
||||
datastore.StorePrimInventory(m_part.UUID, items);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1015,6 +954,30 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return ret;
|
||||
}
|
||||
|
||||
public List<TaskInventoryItem> GetInventoryItems()
|
||||
{
|
||||
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||
|
||||
lock (m_items)
|
||||
ret = new List<TaskInventoryItem>(m_items.Values);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TaskInventoryItem> GetInventoryScripts()
|
||||
{
|
||||
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
ret.Add(item);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Dictionary<UUID, string> GetScriptStates()
|
||||
{
|
||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
|
@ -1023,35 +986,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (engines == null) // No engine at all
|
||||
return ret;
|
||||
|
||||
lock (m_items)
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
if (e != null)
|
||||
{
|
||||
foreach (IScriptModule e in engines)
|
||||
string n = e.GetXMLState(item.ItemID);
|
||||
if (n != String.Empty)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
// Stop any exception from the script engine from propogating since setting state
|
||||
// isn't essential.
|
||||
try
|
||||
{
|
||||
string n = e.GetXMLState(item.ItemID);
|
||||
if (n != String.Empty)
|
||||
{
|
||||
if (!ret.ContainsKey(item.ItemID))
|
||||
ret[item.ItemID] = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[PRIM INVENTORY]: Could not retrieve script state for item {0} {1} in prim {2} {3}. Exception {4}{5}",
|
||||
item.Name, item.ItemID, m_part.Name, m_part.UUID, ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
if (!ret.ContainsKey(item.ItemID))
|
||||
ret[item.ItemID] = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1066,25 +1014,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (engines == null)
|
||||
return;
|
||||
|
||||
lock (m_items)
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
foreach (IScriptModule engine in engines)
|
||||
{
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
if (engine != null)
|
||||
{
|
||||
foreach (IScriptModule engine in engines)
|
||||
{
|
||||
if (engine != null)
|
||||
{
|
||||
if (item.OwnerChanged)
|
||||
engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
|
||||
item.OwnerChanged = false;
|
||||
engine.ResumeScript(item.ItemID);
|
||||
}
|
||||
}
|
||||
if (item.OwnerChanged)
|
||||
engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
|
||||
item.OwnerChanged = false;
|
||||
engine.ResumeScript(item.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -930,7 +930,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void MakeChildAgent()
|
||||
{
|
||||
Animator.ResetAnimations();
|
||||
// It looks like m_animator is set to null somewhere, and MakeChild
|
||||
// is called after that. Probably in aborted teleports.
|
||||
if (m_animator == null)
|
||||
m_animator = new ScenePresenceAnimator(this);
|
||||
else
|
||||
Animator.ResetAnimations();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
|
||||
|
@ -2460,7 +2465,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_controllingClient.SendAvatarDataImmediate(this);
|
||||
|
||||
SendInitialFullUpdateToAllClients();
|
||||
SendAppearanceToAllOtherAgents();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -104,8 +104,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
agent.AgentID = agent1;
|
||||
agent.firstname = firstName;
|
||||
agent.lastname = "testlastname";
|
||||
agent.SessionID = UUID.Zero;
|
||||
agent.SecureSessionID = UUID.Zero;
|
||||
agent.SessionID = UUID.Random();
|
||||
agent.SecureSessionID = UUID.Random();
|
||||
agent.circuitcode = 123;
|
||||
agent.BaseFolder = UUID.Zero;
|
||||
agent.InventoryFolder = UUID.Zero;
|
||||
|
@ -114,6 +114,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
|
||||
agent.child = true;
|
||||
|
||||
if (scene.PresenceService == null)
|
||||
Console.WriteLine("Presence Service is null");
|
||||
|
||||
scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
|
||||
|
||||
string reason;
|
||||
scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
|
||||
testclient = new TestClient(agent, scene);
|
||||
|
|
|
@ -451,12 +451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public LSL_Vector llVecNorm(LSL_Vector v)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
double mag = LSL_Vector.Mag(v);
|
||||
LSL_Vector nor = new LSL_Vector();
|
||||
nor.x = v.x / mag;
|
||||
nor.y = v.y / mag;
|
||||
nor.z = v.z / mag;
|
||||
return nor;
|
||||
return LSL_Vector.Norm(v);
|
||||
}
|
||||
|
||||
public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)
|
||||
|
@ -470,22 +465,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
//Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
|
||||
|
||||
// Utility function for llRot2Euler
|
||||
|
||||
// normalize an angle between -PI and PI (-180 to +180 degrees)
|
||||
protected double NormalizeAngle(double angle)
|
||||
{
|
||||
if (angle > -Math.PI && angle < Math.PI)
|
||||
return angle;
|
||||
|
||||
int numPis = (int)(Math.PI / angle);
|
||||
double remainder = angle - Math.PI * numPis;
|
||||
if (numPis % 2 == 1)
|
||||
return Math.PI - angle;
|
||||
return remainder;
|
||||
}
|
||||
|
||||
// Old implementation of llRot2Euler, now normalized
|
||||
// Old implementation of llRot2Euler. Normalization not required as Atan2 function will
|
||||
// only return values >= -PI (-180 degrees) and <= PI (180 degrees).
|
||||
|
||||
public LSL_Vector llRot2Euler(LSL_Rotation r)
|
||||
{
|
||||
|
@ -497,13 +478,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
double n = 2 * (r.y * r.s + r.x * r.z);
|
||||
double p = m * m - n * n;
|
||||
if (p > 0)
|
||||
return new LSL_Vector(NormalizeAngle(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s))),
|
||||
NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
|
||||
NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))));
|
||||
return new LSL_Vector(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s)),
|
||||
Math.Atan2(n, Math.Sqrt(p)),
|
||||
Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)));
|
||||
else if (n > 0)
|
||||
return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
||||
return new LSL_Vector(0.0, Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
|
||||
else
|
||||
return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
||||
return new LSL_Vector(0.0, -Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
|
||||
}
|
||||
|
||||
/* From wiki:
|
||||
|
@ -1938,14 +1919,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
|
||||
{
|
||||
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
|
||||
LSL_Vector currentPos = llGetLocalPos();
|
||||
LSL_Vector currentPos = GetPartLocalPos(part);
|
||||
|
||||
float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
|
||||
bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
|
||||
|
||||
if (part.ParentGroup.RootPart == part)
|
||||
{
|
||||
if ((targetPos.z < ground) && disable_underground_movement)
|
||||
if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0)
|
||||
targetPos.z = ground;
|
||||
SceneObjectGroup parent = part.ParentGroup;
|
||||
LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
|
||||
|
@ -1953,13 +1934,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
else
|
||||
{
|
||||
if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f)
|
||||
{
|
||||
part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
|
||||
SceneObjectGroup parent = part.ParentGroup;
|
||||
parent.HasGroupChanged = true;
|
||||
parent.ScheduleGroupForTerseUpdate();
|
||||
}
|
||||
LSL_Vector rel_vec = SetPosAdjust(currentPos, targetPos);
|
||||
part.OffsetPosition = new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z);
|
||||
SceneObjectGroup parent = part.ParentGroup;
|
||||
parent.HasGroupChanged = true;
|
||||
parent.ScheduleGroupForTerseUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1973,17 +1952,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public LSL_Vector llGetLocalPos()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (m_host.ParentID != 0)
|
||||
return GetPartLocalPos(m_host);
|
||||
}
|
||||
|
||||
protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (part.ParentID == 0)
|
||||
{
|
||||
return new LSL_Vector(m_host.OffsetPosition.X,
|
||||
m_host.OffsetPosition.Y,
|
||||
m_host.OffsetPosition.Z);
|
||||
return new LSL_Vector(part.AbsolutePosition.X,
|
||||
part.AbsolutePosition.Y,
|
||||
part.AbsolutePosition.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new LSL_Vector(m_host.AbsolutePosition.X,
|
||||
m_host.AbsolutePosition.Y,
|
||||
m_host.AbsolutePosition.Z);
|
||||
if (m_host.IsRoot)
|
||||
{
|
||||
return new LSL_Vector(m_host.AttachedPos.X,
|
||||
m_host.AttachedPos.Y,
|
||||
m_host.AttachedPos.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new LSL_Vector(part.OffsetPosition.X,
|
||||
part.OffsetPosition.Y,
|
||||
part.OffsetPosition.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3852,18 +3846,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (World.GetScenePresence(destId) != null)
|
||||
{
|
||||
// destination is an avatar
|
||||
InventoryItemBase agentItem =
|
||||
World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
|
||||
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
|
||||
|
||||
if (agentItem == null)
|
||||
return;
|
||||
|
||||
byte[] bucket = new byte[17];
|
||||
bucket[0] = (byte)assetType;
|
||||
byte[] objBytes = objId.GetBytes();
|
||||
byte[] objBytes = agentItem.ID.GetBytes();
|
||||
Array.Copy(objBytes, 0, bucket, 1, 16);
|
||||
|
||||
Console.WriteLine("Giving inventory");
|
||||
GridInstantMessage msg = new GridInstantMessage(World,
|
||||
m_host.UUID, m_host.Name+", an object owned by "+
|
||||
resolveName(m_host.OwnerID)+",", destId,
|
||||
|
@ -4950,7 +4942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
case ',':
|
||||
if (parens == 0)
|
||||
{
|
||||
result.Add(src.Substring(start,length).Trim());
|
||||
result.Add(new LSL_String(src.Substring(start,length).Trim()));
|
||||
start += length+1;
|
||||
length = 0;
|
||||
}
|
||||
|
@ -5879,6 +5871,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
PSYS_PART_MAX_AGE = 7,
|
||||
PSYS_SRC_ACCEL = 8,
|
||||
PSYS_SRC_PATTERN = 9,
|
||||
PSYS_SRC_INNERANGLE = 10,
|
||||
PSYS_SRC_OUTERANGLE = 11,
|
||||
PSYS_SRC_TEXTURE = 12,
|
||||
PSYS_SRC_BURST_RATE = 13,
|
||||
PSYS_SRC_BURST_PART_COUNT = 15,
|
||||
|
@ -6011,6 +6005,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
|
||||
break;
|
||||
|
||||
// PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The
|
||||
// PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The
|
||||
// client tells the difference between the two by looking at the 0x02 bit in
|
||||
// the PartFlags variable.
|
||||
case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
|
||||
tempf = (float)rules.GetLSLFloatItem(i + 1);
|
||||
prules.InnerAngle = (float)tempf;
|
||||
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
|
||||
tempf = (float)rules.GetLSLFloatItem(i + 1);
|
||||
prules.OuterAngle = (float)tempf;
|
||||
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
|
||||
prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
|
||||
break;
|
||||
|
@ -6067,11 +6077,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
|
||||
tempf = (float)rules.GetLSLFloatItem(i + 1);
|
||||
prules.InnerAngle = (float)tempf;
|
||||
prules.PartFlags |= 0x02; // Set new angle format.
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
|
||||
tempf = (float)rules.GetLSLFloatItem(i + 1);
|
||||
prules.OuterAngle = (float)tempf;
|
||||
prules.PartFlags |= 0x02; // Set new angle format.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -8442,7 +8454,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
string reply = String.Empty;
|
||||
|
||||
GridRegion info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
|
||||
GridRegion info;
|
||||
|
||||
if (m_ScriptEngine.World.RegionInfo.RegionName == simulator)
|
||||
info = new GridRegion(m_ScriptEngine.World.RegionInfo);
|
||||
else
|
||||
info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
|
||||
|
||||
switch (data)
|
||||
{
|
||||
|
|
|
@ -262,7 +262,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
public static Vector3 Norm(Vector3 vector)
|
||||
{
|
||||
double mag = Mag(vector);
|
||||
return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag);
|
||||
if (mag > 0.0)
|
||||
{
|
||||
double invMag = 1.0 / mag;
|
||||
return vector * invMag;
|
||||
}
|
||||
return new Vector3(0, 0, 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -663,13 +668,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
Object[] ret;
|
||||
|
||||
if (start < 0)
|
||||
start=m_data.Length-start;
|
||||
start=m_data.Length+start;
|
||||
|
||||
if (start < 0)
|
||||
start=0;
|
||||
|
||||
if (end < 0)
|
||||
end=m_data.Length-end;
|
||||
end=m_data.Length+end;
|
||||
if (end < 0)
|
||||
end=0;
|
||||
|
||||
|
|
|
@ -488,6 +488,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
|
||||
if (stateSource == (int)StateSource.ScriptedRez)
|
||||
{
|
||||
lock (m_CompileDict)
|
||||
{
|
||||
m_CompileDict[itemID] = 0;
|
||||
}
|
||||
|
||||
DoOnRezScript(parms);
|
||||
}
|
||||
else
|
||||
|
@ -696,9 +701,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
}
|
||||
}
|
||||
|
||||
ScriptInstance instance = null;
|
||||
lock (m_Scripts)
|
||||
{
|
||||
ScriptInstance instance = null;
|
||||
// Create the object record
|
||||
|
||||
if ((!m_Scripts.ContainsKey(itemID)) ||
|
||||
|
@ -765,8 +770,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
item.Name, startParam, postOnRez,
|
||||
stateSource, m_MaxScriptQueue);
|
||||
|
||||
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
|
||||
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString());
|
||||
m_log.DebugFormat(
|
||||
"[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
|
||||
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
|
||||
part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
|
||||
if (presence != null)
|
||||
{
|
||||
|
@ -779,28 +786,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
|
||||
m_Scripts[itemID] = instance;
|
||||
}
|
||||
|
||||
lock (m_PrimObjects)
|
||||
{
|
||||
if (!m_PrimObjects.ContainsKey(localID))
|
||||
m_PrimObjects[localID] = new List<UUID>();
|
||||
|
||||
if (!m_PrimObjects[localID].Contains(itemID))
|
||||
m_PrimObjects[localID].Add(itemID);
|
||||
|
||||
}
|
||||
|
||||
if (!m_Assemblies.ContainsKey(assetID))
|
||||
m_Assemblies[assetID] = assembly;
|
||||
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
m_AddingAssemblies[assembly]--;
|
||||
}
|
||||
|
||||
if (instance!=null)
|
||||
instance.Init();
|
||||
}
|
||||
|
||||
lock (m_PrimObjects)
|
||||
{
|
||||
if (!m_PrimObjects.ContainsKey(localID))
|
||||
m_PrimObjects[localID] = new List<UUID>();
|
||||
|
||||
if (!m_PrimObjects[localID].Contains(itemID))
|
||||
m_PrimObjects[localID].Add(itemID);
|
||||
|
||||
}
|
||||
|
||||
if (!m_Assemblies.ContainsKey(assetID))
|
||||
m_Assemblies[assetID] = assembly;
|
||||
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
m_AddingAssemblies[assembly]--;
|
||||
}
|
||||
|
||||
if (instance != null)
|
||||
instance.Init();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -813,60 +821,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
m_CompileDict.Remove(itemID);
|
||||
}
|
||||
|
||||
IScriptInstance instance = null;
|
||||
|
||||
lock (m_Scripts)
|
||||
{
|
||||
// Do we even have it?
|
||||
if (!m_Scripts.ContainsKey(itemID))
|
||||
return;
|
||||
|
||||
IScriptInstance instance=m_Scripts[itemID];
|
||||
instance=m_Scripts[itemID];
|
||||
m_Scripts.Remove(itemID);
|
||||
}
|
||||
|
||||
instance.ClearQueue();
|
||||
instance.Stop(0);
|
||||
|
||||
instance.ClearQueue();
|
||||
instance.Stop(0);
|
||||
// bool objectRemoved = false;
|
||||
|
||||
lock (m_PrimObjects)
|
||||
lock (m_PrimObjects)
|
||||
{
|
||||
// Remove the script from it's prim
|
||||
if (m_PrimObjects.ContainsKey(localID))
|
||||
{
|
||||
// Remove the script from it's prim
|
||||
if (m_PrimObjects.ContainsKey(localID))
|
||||
{
|
||||
// Remove inventory item record
|
||||
if (m_PrimObjects[localID].Contains(itemID))
|
||||
m_PrimObjects[localID].Remove(itemID);
|
||||
// Remove inventory item record
|
||||
if (m_PrimObjects[localID].Contains(itemID))
|
||||
m_PrimObjects[localID].Remove(itemID);
|
||||
|
||||
// If there are no more scripts, remove prim
|
||||
if (m_PrimObjects[localID].Count == 0)
|
||||
{
|
||||
m_PrimObjects.Remove(localID);
|
||||
// If there are no more scripts, remove prim
|
||||
if (m_PrimObjects[localID].Count == 0)
|
||||
{
|
||||
m_PrimObjects.Remove(localID);
|
||||
// objectRemoved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
instance.RemoveState();
|
||||
instance.DestroyScriptInstance();
|
||||
|
||||
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
|
||||
if (m_DomainScripts[instance.AppDomain].Count == 0)
|
||||
{
|
||||
m_DomainScripts.Remove(instance.AppDomain);
|
||||
UnloadAppDomain(instance.AppDomain);
|
||||
}
|
||||
|
||||
instance = null;
|
||||
|
||||
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
||||
if (handlerObjectRemoved != null)
|
||||
{
|
||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
||||
handlerObjectRemoved(part.UUID);
|
||||
}
|
||||
|
||||
CleanAssemblies();
|
||||
}
|
||||
|
||||
instance.RemoveState();
|
||||
instance.DestroyScriptInstance();
|
||||
|
||||
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
|
||||
if (m_DomainScripts[instance.AppDomain].Count == 0)
|
||||
{
|
||||
m_DomainScripts.Remove(instance.AppDomain);
|
||||
UnloadAppDomain(instance.AppDomain);
|
||||
}
|
||||
|
||||
instance = null;
|
||||
|
||||
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
||||
if (handlerObjectRemoved != null)
|
||||
{
|
||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
||||
handlerObjectRemoved(part.UUID);
|
||||
}
|
||||
|
||||
|
||||
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
|
||||
if (handlerScriptRemoved != null)
|
||||
handlerScriptRemoved(itemID);
|
||||
|
@ -1000,26 +1008,33 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
public bool PostObjectEvent(uint localID, EventParams p)
|
||||
{
|
||||
bool result = false;
|
||||
List<UUID> uuids = null;
|
||||
|
||||
lock (m_PrimObjects)
|
||||
{
|
||||
if (!m_PrimObjects.ContainsKey(localID))
|
||||
return false;
|
||||
|
||||
uuids = m_PrimObjects[localID];
|
||||
}
|
||||
|
||||
foreach (UUID itemID in m_PrimObjects[localID])
|
||||
foreach (UUID itemID in uuids)
|
||||
{
|
||||
IScriptInstance instance = null;
|
||||
try
|
||||
{
|
||||
if (m_Scripts.ContainsKey(itemID))
|
||||
{
|
||||
IScriptInstance instance = m_Scripts[itemID];
|
||||
if (instance != null)
|
||||
{
|
||||
instance.PostEvent(p);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
instance = m_Scripts[itemID];
|
||||
}
|
||||
catch { /* ignore race conditions */ }
|
||||
|
||||
if (instance != null)
|
||||
{
|
||||
instance.PostEvent(p);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1274,9 +1289,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
string xml = instance.GetXMLState();
|
||||
|
||||
XmlDocument sdoc = new XmlDocument();
|
||||
sdoc.LoadXml(xml);
|
||||
XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
|
||||
XmlNode rootNode = rootL[0];
|
||||
bool loadedState = true;
|
||||
try
|
||||
{
|
||||
sdoc.LoadXml(xml);
|
||||
}
|
||||
catch (System.Xml.XmlException)
|
||||
{
|
||||
loadedState = false;
|
||||
}
|
||||
|
||||
XmlNodeList rootL = null;
|
||||
XmlNode rootNode = null;
|
||||
if (loadedState)
|
||||
{
|
||||
rootL = sdoc.GetElementsByTagName("ScriptState");
|
||||
rootNode = rootL[0];
|
||||
}
|
||||
|
||||
// Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
@ -1292,8 +1321,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
stateData.Attributes.Append(engineName);
|
||||
doc.AppendChild(stateData);
|
||||
|
||||
XmlNode xmlstate = null;
|
||||
|
||||
// Add <ScriptState>...</ScriptState>
|
||||
XmlNode xmlstate = doc.ImportNode(rootNode, true);
|
||||
if (loadedState)
|
||||
{
|
||||
xmlstate = doc.ImportNode(rootNode, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlstate = doc.CreateElement("", "ScriptState", "");
|
||||
}
|
||||
|
||||
stateData.AppendChild(xmlstate);
|
||||
|
||||
string assemName = instance.GetAssemblyName();
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
|
||||
private void IssueWarning()
|
||||
{
|
||||
_log.Warn("[GRID INFO SERVICE]: found no [GridInfo] section in your OpenSim.ini");
|
||||
_log.Warn("[GRID INFO SERVICE]: found no [GridInfo] section in your configuration files");
|
||||
_log.Warn("[GRID INFO SERVICE]: trying to guess sensible defaults, you might want to provide better ones:");
|
||||
|
||||
foreach (string k in _info.Keys)
|
||||
|
|
|
@ -109,6 +109,9 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
case "get_fallback_regions":
|
||||
return GetFallbackRegions(request);
|
||||
|
||||
case "get_hyperlinks":
|
||||
return GetHyperlinks(request);
|
||||
|
||||
case "get_region_flags":
|
||||
return GetRegionFlags(request);
|
||||
}
|
||||
|
@ -483,6 +486,36 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
return encoding.GetBytes(xmlString);
|
||||
}
|
||||
|
||||
byte[] GetHyperlinks(Dictionary<string, object> request)
|
||||
{
|
||||
//m_log.DebugFormat("[GRID HANDLER]: GetHyperlinks");
|
||||
UUID scopeID = UUID.Zero;
|
||||
if (request.ContainsKey("SCOPEID"))
|
||||
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
|
||||
else
|
||||
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get linked regions");
|
||||
|
||||
List<GridRegion> rinfos = m_GridService.GetHyperlinks(scopeID);
|
||||
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
|
||||
result["result"] = "null";
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
foreach (GridRegion rinfo in rinfos)
|
||||
{
|
||||
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
|
||||
result["region" + i] = rinfoDict;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
|
||||
UTF8Encoding encoding = new UTF8Encoding();
|
||||
return encoding.GetBytes(xmlString);
|
||||
}
|
||||
|
||||
byte[] GetRegionFlags(Dictionary<string, object> request)
|
||||
{
|
||||
UUID scopeID = UUID.Zero;
|
||||
|
|
|
@ -178,6 +178,8 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
|
||||
resp["reason"] = OSD.FromString(reason);
|
||||
resp["success"] = OSD.FromBoolean(result);
|
||||
// Let's also send out the IP address of the caller back to the caller (HG 1.5)
|
||||
resp["your_ip"] = OSD.FromString(GetCallerIP(request));
|
||||
|
||||
// TODO: add reason if not String.Empty?
|
||||
responsedata["int_response_code"] = HttpStatusCode.OK;
|
||||
|
@ -283,6 +285,10 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
if (m_SimulationService == null)
|
||||
{
|
||||
m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
|
||||
responsedata["content_type"] = "application/json";
|
||||
responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
|
||||
responsedata["str_response_string"] = string.Empty;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -348,6 +354,24 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
{
|
||||
m_SimulationService.ReleaseAgent(regionID, id, "");
|
||||
}
|
||||
|
||||
private string GetCallerIP(Hashtable req)
|
||||
{
|
||||
if (req.ContainsKey("headers"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Hashtable headers = (Hashtable)req["headers"];
|
||||
if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
|
||||
return headers["remote_addr"].ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -156,8 +156,6 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
sendData["METHOD"] = "storefriend";
|
||||
|
||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||
|
||||
string reply = string.Empty;
|
||||
try
|
||||
{
|
||||
|
@ -199,8 +197,6 @@ namespace OpenSim.Services.Connectors
|
|||
sendData["FRIEND"] = Friend;
|
||||
sendData["METHOD"] = "deletefriend";
|
||||
|
||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||
|
||||
string reply = string.Empty;
|
||||
try
|
||||
{
|
||||
|
@ -232,10 +228,8 @@ namespace OpenSim.Services.Connectors
|
|||
m_log.DebugFormat("[FRIENDS CONNECTOR]: DeleteFriend received null reply");
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -556,6 +556,56 @@ namespace OpenSim.Services.Connectors
|
|||
return rinfos;
|
||||
}
|
||||
|
||||
public List<GridRegion> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
|
||||
sendData["SCOPEID"] = scopeID.ToString();
|
||||
|
||||
sendData["METHOD"] = "get_hyperlinks";
|
||||
|
||||
List<GridRegion> rinfos = new List<GridRegion>();
|
||||
string reply = string.Empty;
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/grid",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
|
||||
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
|
||||
return rinfos;
|
||||
}
|
||||
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
||||
if (replyData != null)
|
||||
{
|
||||
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
|
||||
foreach (object r in rinfosList)
|
||||
{
|
||||
if (r is Dictionary<string, object>)
|
||||
{
|
||||
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
|
||||
rinfos.Add(rinfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks {0} received null response",
|
||||
scopeID);
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks received null reply");
|
||||
|
||||
return rinfos;
|
||||
}
|
||||
|
||||
public virtual int GetRegionFlags(UUID scopeID, UUID regionID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
|
|
|
@ -31,13 +31,12 @@ using System.Collections.Generic;
|
|||
using System.Drawing;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using Nwc.XmlRpc;
|
||||
using log4net;
|
||||
|
||||
|
@ -49,7 +48,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
|
||||
// private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
|
||||
|
||||
private IAssetService m_AssetService;
|
||||
|
||||
|
@ -268,5 +267,48 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
return null;
|
||||
}
|
||||
|
||||
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
|
||||
{
|
||||
HttpWebRequest AgentCreateRequest = null;
|
||||
myipaddress = String.Empty;
|
||||
reason = String.Empty;
|
||||
|
||||
if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
|
||||
{
|
||||
string response = GetResponse(AgentCreateRequest, out reason);
|
||||
bool success = true;
|
||||
UnpackResponse(response, out success, out reason, out myipaddress);
|
||||
return success;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void UnpackResponse(string response, out bool result, out string reason, out string ipaddress)
|
||||
{
|
||||
result = true;
|
||||
reason = string.Empty;
|
||||
ipaddress = string.Empty;
|
||||
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
{
|
||||
try
|
||||
{
|
||||
// we assume we got an OSDMap back
|
||||
OSDMap r = Util.GetOSDMap(response);
|
||||
result = r["success"].AsBoolean();
|
||||
reason = r["reason"].AsString();
|
||||
ipaddress = r["your_ip"].AsString();
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.InfoFormat("[GATEKEEPER SERVICE CONNECTOR]: exception on UnpackResponse of DoCreateChildAgentCall {0}", e.Message);
|
||||
reason = "Internal error";
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,12 +32,10 @@ using System.IO;
|
|||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.Connectors.Simulation;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using log4net;
|
||||
|
@ -53,15 +51,33 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
string m_ServerURL;
|
||||
Uri m_Uri;
|
||||
public UserAgentServiceConnector(string url)
|
||||
{
|
||||
m_ServerURL = url;
|
||||
try
|
||||
{
|
||||
m_Uri = new Uri(m_ServerURL);
|
||||
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
|
||||
m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public UserAgentServiceConnector(IConfigSource config)
|
||||
{
|
||||
}
|
||||
|
||||
public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason)
|
||||
{
|
||||
// not available over remote calls
|
||||
reason = "Method not available over remote calls";
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
|
||||
{
|
||||
reason = String.Empty;
|
||||
|
@ -225,7 +241,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
{
|
||||
response = request.Send(m_ServerURL, 10000);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -290,13 +306,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName)
|
||||
|
@ -358,7 +373,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
|
||||
private bool GetBoolResponse(XmlRpcRequest request, out string reason)
|
||||
{
|
||||
//m_log.Debug("[HGrid]: Linking to " + uri);
|
||||
//m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL);
|
||||
XmlRpcResponse response = null;
|
||||
try
|
||||
{
|
||||
|
@ -366,14 +381,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug("[USER AGENT CONNECTOR]: Unable to contact remote server ");
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
|
||||
reason = "Exception: " + e.Message;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (response.IsFault)
|
||||
{
|
||||
m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
|
||||
reason = "XMLRPC Fault";
|
||||
return false;
|
||||
}
|
||||
|
@ -383,15 +398,29 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||
try
|
||||
{
|
||||
if (hash == null)
|
||||
{
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
|
||||
reason = "Internal error 1";
|
||||
return false;
|
||||
}
|
||||
bool success = false;
|
||||
reason = string.Empty;
|
||||
Boolean.TryParse((string)hash["result"], out success);
|
||||
if (hash.ContainsKey("result"))
|
||||
Boolean.TryParse((string)hash["result"], out success);
|
||||
else
|
||||
{
|
||||
reason = "Internal error 2";
|
||||
m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURL);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[HGrid]: Got exception while parsing GetEndPoint response " + e.StackTrace);
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetBoolResponse response.");
|
||||
if (hash.ContainsKey("result") && hash["result"] != null)
|
||||
m_log.ErrorFormat("Reply was ", (string)hash["result"]);
|
||||
reason = "Exception: " + e.Message;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -53,7 +53,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static string ZeroID = UUID.Zero.ToString();
|
||||
// private static string ZeroID = UUID.Zero.ToString();
|
||||
|
||||
private string m_serverUrl = String.Empty;
|
||||
|
||||
|
|
|
@ -357,6 +357,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return new List<GridRegion>(0);
|
||||
}
|
||||
|
||||
public List<GridRegion> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
// Hypergrid/linked regions are not supported
|
||||
return new List<GridRegion>();
|
||||
}
|
||||
|
||||
public int GetRegionFlags(UUID scopeID, UUID regionID)
|
||||
{
|
||||
const int REGION_ONLINE = 4;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
private string m_serverUrl = String.Empty;
|
||||
private string m_userServerUrl = String.Empty;
|
||||
private object m_gestureSyncRoot = new object();
|
||||
// private object m_gestureSyncRoot = new object();
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
|
@ -687,12 +687,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
for (int i = 0; i < items.Count; i++)
|
||||
itemIDs[i] = items[i].AsUUID().ToString();
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
{ "RequestMethod", "GetInventoryNodes" },
|
||||
{ "OwnerID", userID.ToString() },
|
||||
{ "Items", String.Join(",", itemIDs) }
|
||||
};
|
||||
// NameValueCollection requestArgs = new NameValueCollection
|
||||
// {
|
||||
// { "RequestMethod", "GetInventoryNodes" },
|
||||
// { "OwnerID", userID.ToString() },
|
||||
// { "Items", String.Join(",", itemIDs) }
|
||||
// };
|
||||
|
||||
// FIXME: Implement this in SimianGrid
|
||||
return new List<InventoryItemBase>(0);
|
||||
|
@ -708,12 +708,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
/// the user's inventory</returns>
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
{ "RequestMethod", "GetInventoryNodes" },
|
||||
{ "OwnerID", userID.ToString() },
|
||||
{ "AssetID", assetID.ToString() }
|
||||
};
|
||||
// NameValueCollection requestArgs = new NameValueCollection
|
||||
// {
|
||||
// { "RequestMethod", "GetInventoryNodes" },
|
||||
// { "OwnerID", userID.ToString() },
|
||||
// { "AssetID", assetID.ToString() }
|
||||
// };
|
||||
|
||||
// FIXME: Implement this in SimianGrid
|
||||
return (int)PermissionMask.All;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -349,24 +349,24 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return null;
|
||||
}
|
||||
|
||||
private OSDMap GetSessionData(UUID sessionID)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
{ "RequestMethod", "GetSession" },
|
||||
{ "SessionID", sessionID.ToString() }
|
||||
};
|
||||
|
||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
||||
if (response["Success"].AsBoolean())
|
||||
return response;
|
||||
else
|
||||
m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
|
||||
|
||||
return null;
|
||||
}
|
||||
// private OSDMap GetSessionData(UUID sessionID)
|
||||
// {
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
|
||||
//
|
||||
// NameValueCollection requestArgs = new NameValueCollection
|
||||
// {
|
||||
// { "RequestMethod", "GetSession" },
|
||||
// { "SessionID", sessionID.ToString() }
|
||||
// };
|
||||
//
|
||||
// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
||||
// if (response["Success"].AsBoolean())
|
||||
// return response;
|
||||
// else
|
||||
// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
|
||||
private List<PresenceInfo> GetSessions(UUID userID)
|
||||
{
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name))
|
||||
if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector"))
|
||||
{
|
||||
IConfig gridConfig = source.Configs["UserAccountService"];
|
||||
if (gridConfig == null)
|
||||
|
@ -108,6 +108,23 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
serviceUrl = serviceUrl + '/';
|
||||
|
||||
m_serverUrl = serviceUrl;
|
||||
IConfig profilesConfig = source.Configs["Profiles"];
|
||||
if (profilesConfig == null)
|
||||
{
|
||||
// Do not run this module by default.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if profiles aren't enabled, we're not needed.
|
||||
// if we're not specified as the connector to use, then we're not wanted
|
||||
if (profilesConfig.GetString("Module", String.Empty) != Name)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,6 +152,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
// Profiles
|
||||
client.OnRequestAvatarProperties += RequestAvatarPropertiesHandler;
|
||||
|
||||
client.OnUpdateAvatarProperties += UpdateAvatarPropertiesHandler;
|
||||
client.OnAvatarInterestUpdate += AvatarInterestUpdateHandler;
|
||||
client.OnUserInfoRequest += UserInfoRequestHandler;
|
||||
|
@ -302,12 +320,25 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
System.Globalization.CultureInfo.InvariantCulture), charterMember, about["FLAbout"].AsString(), (uint)flags,
|
||||
about["FLImage"].AsUUID(), about["Image"].AsUUID(), about["URL"].AsString(), user["Partner"].AsUUID());
|
||||
|
||||
OSDMap interests = null;
|
||||
if (user.ContainsKey("LLInterests"))
|
||||
{
|
||||
try
|
||||
{
|
||||
interests = OSDParser.DeserializeJson(user["LLInterests"].AsString()) as OSDMap;
|
||||
client.SendAvatarInterestsReply(avatarID, interests["WantMask"].AsUInteger(), interests["WantText"].AsString(), interests["SkillsMask"].AsUInteger(), interests["SkillsText"].AsString(), interests["languages"].AsString());
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
if (about == null)
|
||||
about = new OSDMap(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[SIMIAN PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values");
|
||||
client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes,
|
||||
String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero);
|
||||
String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,26 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
|
||||
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
|
||||
{
|
||||
HttpWebRequest AgentCreateRequest = null;
|
||||
reason = String.Empty;
|
||||
|
||||
if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
|
||||
{
|
||||
string response = GetResponse(AgentCreateRequest, out reason);
|
||||
bool success = true;
|
||||
UnpackResponse(response, out success, out reason);
|
||||
return success;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected bool SendRequest(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason, out HttpWebRequest AgentCreateRequest)
|
||||
{
|
||||
reason = String.Empty;
|
||||
AgentCreateRequest = null;
|
||||
|
||||
if (destination == null)
|
||||
{
|
||||
reason = "Destination is null";
|
||||
|
@ -101,7 +119,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
|
||||
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
|
||||
|
||||
HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||
AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||
AgentCreateRequest.Method = "POST";
|
||||
AgentCreateRequest.ContentType = "application/json";
|
||||
AgentCreateRequest.Timeout = 10000;
|
||||
|
@ -150,11 +168,18 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
os.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected string GetResponse(HttpWebRequest AgentCreateRequest, out string reason)
|
||||
{
|
||||
// Let's wait for the response
|
||||
//m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
|
||||
reason = string.Empty;
|
||||
|
||||
WebResponse webResponse = null;
|
||||
StreamReader sr = null;
|
||||
string response = string.Empty;
|
||||
try
|
||||
{
|
||||
webResponse = AgentCreateRequest.GetResponse();
|
||||
|
@ -166,37 +191,15 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
{
|
||||
|
||||
sr = new StreamReader(webResponse.GetResponseStream());
|
||||
string response = sr.ReadToEnd().Trim();
|
||||
response = sr.ReadToEnd().Trim();
|
||||
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response);
|
||||
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
{
|
||||
try
|
||||
{
|
||||
// we assume we got an OSDMap back
|
||||
OSDMap r = Util.GetOSDMap(response);
|
||||
bool success = r["success"].AsBoolean();
|
||||
reason = r["reason"].AsString();
|
||||
return success;
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
|
||||
|
||||
// check for old style response
|
||||
if (response.ToLower().StartsWith("true"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
|
||||
reason = "Destination did not reply";
|
||||
return false;
|
||||
return string.Empty;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -204,7 +207,33 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
sr.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
return response;
|
||||
}
|
||||
|
||||
protected void UnpackResponse(string response, out bool result, out string reason)
|
||||
{
|
||||
result = true;
|
||||
reason = string.Empty;
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
{
|
||||
try
|
||||
{
|
||||
// we assume we got an OSDMap back
|
||||
OSDMap r = Util.GetOSDMap(response);
|
||||
result = r["success"].AsBoolean();
|
||||
reason = r["reason"].AsString();
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
|
||||
|
||||
// check for old style response
|
||||
if (response.ToLower().StartsWith("true"))
|
||||
result = true;
|
||||
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion destination, uint flags)
|
||||
|
@ -257,7 +286,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||
ChildUpdateRequest.Method = "PUT";
|
||||
ChildUpdateRequest.ContentType = "application/json";
|
||||
ChildUpdateRequest.Timeout = 10000;
|
||||
ChildUpdateRequest.Timeout = 30000;
|
||||
//ChildUpdateRequest.KeepAlive = false;
|
||||
|
||||
// Fill it in
|
||||
|
@ -334,7 +363,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ChilAgentUpdate {0}", ex.Message);
|
||||
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ChilAgentUpdate from {0}: {1}", uri, ex.Message);
|
||||
// ignore, really
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Services.GridService
|
|||
private bool m_DeleteOnUnregister = true;
|
||||
private static GridService m_RootInstance = null;
|
||||
protected IConfigSource m_config;
|
||||
protected HypergridLinker m_HypergridLinker;
|
||||
protected static HypergridLinker m_HypergridLinker;
|
||||
|
||||
protected IAuthenticationService m_AuthenticationService = null;
|
||||
protected bool m_AllowDuplicateNames = false;
|
||||
|
@ -124,7 +124,7 @@ namespace OpenSim.Services.GridService
|
|||
{
|
||||
// Regions reserved for the null key cannot be taken.
|
||||
if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
|
||||
return "Region location us reserved";
|
||||
return "Region location is reserved";
|
||||
|
||||
// Treat it as an auth request
|
||||
//
|
||||
|
@ -210,6 +210,7 @@ namespace OpenSim.Services.GridService
|
|||
{
|
||||
int newFlags = 0;
|
||||
string regionName = rdata.RegionName.Trim().Replace(' ', '_');
|
||||
newFlags = ParseFlags(newFlags, gridConfig.GetString("DefaultRegionFlags", String.Empty));
|
||||
newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + regionName, String.Empty));
|
||||
newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty));
|
||||
rdata.Data["flags"] = newFlags.ToString();
|
||||
|
@ -278,7 +279,11 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
foreach (RegionData rdata in rdatas)
|
||||
if (rdata.RegionID != regionID)
|
||||
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||
{
|
||||
int flags = Convert.ToInt32(rdata.Data["flags"]);
|
||||
if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
|
||||
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||
}
|
||||
|
||||
}
|
||||
m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count);
|
||||
|
@ -421,6 +426,22 @@ namespace OpenSim.Services.GridService
|
|||
return ret;
|
||||
}
|
||||
|
||||
public List<GridRegion> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
List<GridRegion> ret = new List<GridRegion>();
|
||||
|
||||
List<RegionData> regions = m_Database.GetHyperlinks(scopeID);
|
||||
|
||||
foreach (RegionData r in regions)
|
||||
{
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
|
||||
ret.Add(RegionData2RegionInfo(r));
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[GRID SERVICE]: Hyperlinks returned {0} regions", ret.Count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int GetRegionFlags(UUID scopeID, UUID regionID)
|
||||
{
|
||||
RegionData region = m_Database.Get(regionID, scopeID);
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace OpenSim.Services.GridService
|
|||
protected GatekeeperServiceConnector m_GatekeeperConnector;
|
||||
|
||||
protected UUID m_ScopeID = UUID.Zero;
|
||||
protected bool m_Check4096 = true;
|
||||
|
||||
// Hyperlink regions are hyperlinks on the map
|
||||
public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
|
||||
|
@ -116,6 +117,8 @@ namespace OpenSim.Services.GridService
|
|||
if (scope != string.Empty)
|
||||
UUID.TryParse(scope, out m_ScopeID);
|
||||
|
||||
m_Check4096 = gridConfig.GetBoolean("Check4096", true);
|
||||
|
||||
m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
|
||||
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services...");
|
||||
|
@ -244,21 +247,8 @@ namespace OpenSim.Services.GridService
|
|||
}
|
||||
|
||||
regInfo.RegionID = regionID;
|
||||
Uri uri = null;
|
||||
try
|
||||
{
|
||||
uri = new Uri(externalName);
|
||||
regInfo.ExternalHostName = uri.Host;
|
||||
regInfo.HttpPort = (uint)uri.Port;
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName);
|
||||
}
|
||||
string name = regInfo.RegionName;
|
||||
regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort;
|
||||
if (name != string.Empty)
|
||||
regInfo.RegionName += ":" + name;
|
||||
if (regInfo.RegionName == string.Empty)
|
||||
regInfo.RegionName = regInfo.ExternalHostName;
|
||||
|
||||
// Try get the map image
|
||||
//regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
|
||||
|
@ -277,7 +267,7 @@ namespace OpenSim.Services.GridService
|
|||
}
|
||||
|
||||
uint x, y;
|
||||
if (!Check4096(handle, out x, out y))
|
||||
if (m_Check4096 && !Check4096(handle, out x, out y))
|
||||
{
|
||||
RemoveHyperlinkRegion(regInfo.RegionID);
|
||||
reason = "Region is too far (" + x + ", " + y + ")";
|
||||
|
@ -332,25 +322,55 @@ namespace OpenSim.Services.GridService
|
|||
/// <returns></returns>
|
||||
public bool Check4096(ulong realHandle, out uint x, out uint y)
|
||||
{
|
||||
GridRegion defRegion = DefaultRegion;
|
||||
|
||||
uint ux = 0, uy = 0;
|
||||
Utils.LongToUInts(realHandle, out ux, out uy);
|
||||
x = ux / Constants.RegionSize;
|
||||
y = uy / Constants.RegionSize;
|
||||
|
||||
if ((Math.Abs((int)defRegion.RegionLocX - ux) >= 4096 * Constants.RegionSize) ||
|
||||
(Math.Abs((int)defRegion.RegionLocY - uy) >= 4096 * Constants.RegionSize))
|
||||
const uint limit = (4096 - 1) * Constants.RegionSize;
|
||||
uint xmin = ux - limit;
|
||||
uint xmax = ux + limit;
|
||||
uint ymin = uy - limit;
|
||||
uint ymax = uy + limit;
|
||||
// World map boundary checks
|
||||
if (xmin < 0 || xmin > ux)
|
||||
xmin = 0;
|
||||
if (xmax > int.MaxValue || xmax < ux)
|
||||
xmax = int.MaxValue;
|
||||
if (ymin < 0 || ymin > uy)
|
||||
ymin = 0;
|
||||
if (ymax > int.MaxValue || ymax < uy)
|
||||
ymax = int.MaxValue;
|
||||
|
||||
// Check for any regions that are within the possible teleport range to the linked region
|
||||
List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
|
||||
if (regions.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check for regions which are not linked regions
|
||||
List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
|
||||
// would like to use .Except, but doesn't seem to exist
|
||||
//IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
|
||||
List<GridRegion> availableRegions = regions.FindAll(delegate(GridRegion region)
|
||||
{
|
||||
// Ewww! n^2
|
||||
if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good.
|
||||
return true;
|
||||
|
||||
return false;
|
||||
});
|
||||
if (availableRegions.Count == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
|
||||
{
|
||||
//m_HyperlinkRegions[regionInfo.RegionID] = regionInfo;
|
||||
//m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
|
||||
|
||||
RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
|
||||
int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
|
||||
|
@ -362,12 +382,6 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
private void RemoveHyperlinkRegion(UUID regionID)
|
||||
{
|
||||
//// Try the hyperlink collection
|
||||
//if (m_HyperlinkRegions.ContainsKey(regionID))
|
||||
//{
|
||||
// m_HyperlinkRegions.Remove(regionID);
|
||||
// m_HyperlinkHandles.Remove(regionID);
|
||||
//}
|
||||
m_Database.Delete(regionID);
|
||||
}
|
||||
|
||||
|
@ -378,32 +392,31 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
public void HandleShow(string module, string[] cmd)
|
||||
{
|
||||
MainConsole.Instance.Output("Not Implemented Yet");
|
||||
//if (cmd.Length != 2)
|
||||
//{
|
||||
// MainConsole.Instance.Output("Syntax: show hyperlinks");
|
||||
// return;
|
||||
//}
|
||||
//List<GridRegion> regions = new List<GridRegion>(m_HypergridService.m_HyperlinkRegions.Values);
|
||||
//if (regions == null || regions.Count < 1)
|
||||
//{
|
||||
// MainConsole.Instance.Output("No hyperlinks");
|
||||
// return;
|
||||
//}
|
||||
if (cmd.Length != 2)
|
||||
{
|
||||
MainConsole.Instance.Output("Syntax: show hyperlinks");
|
||||
return;
|
||||
}
|
||||
List<RegionData> regions = m_Database.GetHyperlinks(UUID.Zero);
|
||||
if (regions == null || regions.Count < 1)
|
||||
{
|
||||
MainConsole.Instance.Output("No hyperlinks");
|
||||
return;
|
||||
}
|
||||
|
||||
//MainConsole.Instance.Output("Region Name Region UUID");
|
||||
//MainConsole.Instance.Output("Location URI");
|
||||
//MainConsole.Instance.Output("Owner ID ");
|
||||
//MainConsole.Instance.Output("-------------------------------------------------------------------------------");
|
||||
//foreach (GridRegion r in regions)
|
||||
//{
|
||||
// MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} \n\n",
|
||||
// r.RegionName, r.RegionID,
|
||||
// String.Format("{0},{1}", r.RegionLocX, r.RegionLocY), "http://" + r.ExternalHostName + ":" + r.HttpPort.ToString(),
|
||||
// r.EstateOwner.ToString()));
|
||||
//}
|
||||
//return;
|
||||
MainConsole.Instance.Output("Region Name Region UUID");
|
||||
MainConsole.Instance.Output("Location URI");
|
||||
MainConsole.Instance.Output("-------------------------------------------------------------------------------");
|
||||
foreach (RegionData r in regions)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
|
||||
r.RegionName, r.RegionID,
|
||||
String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
|
||||
"http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public void RunCommand(string module, string[] cmdparams)
|
||||
{
|
||||
List<string> args = new List<string>(cmdparams);
|
||||
|
|
|
@ -49,61 +49,64 @@ namespace OpenSim.Services.HypergridService
|
|||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
IGridService m_GridService;
|
||||
IPresenceService m_PresenceService;
|
||||
IUserAccountService m_UserAccountService;
|
||||
IUserAgentService m_UserAgentService;
|
||||
ISimulationService m_SimulationService;
|
||||
private static bool m_Initialized = false;
|
||||
|
||||
string m_AuthDll;
|
||||
private static IGridService m_GridService;
|
||||
private static IPresenceService m_PresenceService;
|
||||
private static IUserAccountService m_UserAccountService;
|
||||
private static IUserAgentService m_UserAgentService;
|
||||
private static ISimulationService m_SimulationService;
|
||||
|
||||
UUID m_ScopeID;
|
||||
bool m_AllowTeleportsToAnyRegion;
|
||||
string m_ExternalName;
|
||||
GridRegion m_DefaultGatewayRegion;
|
||||
private static UUID m_ScopeID;
|
||||
private static bool m_AllowTeleportsToAnyRegion;
|
||||
private static string m_ExternalName;
|
||||
private static GridRegion m_DefaultGatewayRegion;
|
||||
|
||||
public GatekeeperService(IConfigSource config, ISimulationService simService)
|
||||
{
|
||||
IConfig serverConfig = config.Configs["GatekeeperService"];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section GatekeeperService in config file"));
|
||||
if (!m_Initialized)
|
||||
{
|
||||
m_Initialized = true;
|
||||
|
||||
string accountService = serverConfig.GetString("UserAccountService", String.Empty);
|
||||
string homeUsersService = serverConfig.GetString("HomeUsersSecurityService", string.Empty);
|
||||
string gridService = serverConfig.GetString("GridService", String.Empty);
|
||||
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
|
||||
string simulationService = serverConfig.GetString("SimulationService", String.Empty);
|
||||
IConfig serverConfig = config.Configs["GatekeeperService"];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section GatekeeperService in config file"));
|
||||
|
||||
//m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty);
|
||||
string accountService = serverConfig.GetString("UserAccountService", String.Empty);
|
||||
string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty);
|
||||
string gridService = serverConfig.GetString("GridService", String.Empty);
|
||||
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
|
||||
string simulationService = serverConfig.GetString("SimulationService", String.Empty);
|
||||
|
||||
// These 3 are mandatory, the others aren't
|
||||
if (gridService == string.Empty || presenceService == string.Empty || m_AuthDll == string.Empty)
|
||||
throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
|
||||
// These 3 are mandatory, the others aren't
|
||||
if (gridService == string.Empty || presenceService == string.Empty)
|
||||
throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
|
||||
|
||||
string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
|
||||
UUID.TryParse(scope, out m_ScopeID);
|
||||
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
||||
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
|
||||
m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
|
||||
UUID.TryParse(scope, out m_ScopeID);
|
||||
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
||||
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
|
||||
m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
|
||||
Object[] args = new Object[] { config };
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
|
||||
|
||||
if (accountService != string.Empty)
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||
if (homeUsersService != string.Empty)
|
||||
m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
|
||||
if (accountService != string.Empty)
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||
if (homeUsersService != string.Empty)
|
||||
m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
|
||||
|
||||
if (simService != null)
|
||||
m_SimulationService = simService;
|
||||
else if (simulationService != string.Empty)
|
||||
m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
|
||||
if (simService != null)
|
||||
m_SimulationService = simService;
|
||||
else if (simulationService != string.Empty)
|
||||
m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
|
||||
|
||||
if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
|
||||
throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
|
||||
if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
|
||||
throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
|
||||
|
||||
m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
|
||||
m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
|
||||
}
|
||||
}
|
||||
|
||||
public GatekeeperService(IConfigSource config)
|
||||
|
@ -222,17 +225,23 @@ namespace OpenSim.Services.HypergridService
|
|||
|
||||
// May want to authorize
|
||||
|
||||
bool isFirstLogin = false;
|
||||
//
|
||||
// Login the presence
|
||||
// Login the presence, if it's not there yet (by the login service)
|
||||
//
|
||||
if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
|
||||
{
|
||||
reason = "Unable to login presence";
|
||||
m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.",
|
||||
aCircuit.firstname, aCircuit.lastname);
|
||||
return false;
|
||||
}
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok");
|
||||
PresenceInfo presence = m_PresenceService.GetAgent(aCircuit.SessionID);
|
||||
if (presence != null) // it has been placed there by the login service
|
||||
isFirstLogin = true;
|
||||
|
||||
else
|
||||
if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
|
||||
{
|
||||
reason = "Unable to login presence";
|
||||
m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.",
|
||||
aCircuit.firstname, aCircuit.lastname);
|
||||
return false;
|
||||
}
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok");
|
||||
|
||||
//
|
||||
// Get the region
|
||||
|
@ -256,13 +265,24 @@ namespace OpenSim.Services.HypergridService
|
|||
if (account == null && !aCircuit.lastname.StartsWith("@"))
|
||||
{
|
||||
aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
|
||||
aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString());
|
||||
aCircuit.lastname = "@" + uri.Host; // + ":" + uri.Port;
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed HomeURI (this should never happen): {0}", aCircuit.ServiceURLs["HomeURI"]);
|
||||
aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Finally launch the agent at the destination
|
||||
//
|
||||
return m_SimulationService.CreateAgent(destination, aCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
|
||||
Constants.TeleportFlags loginFlag = isFirstLogin ? Constants.TeleportFlags.ViaLogin : Constants.TeleportFlags.ViaHGLogin;
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag);
|
||||
return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason);
|
||||
}
|
||||
|
||||
protected bool Authenticate(AgentCircuitData aCircuit)
|
||||
|
@ -280,18 +300,23 @@ namespace OpenSim.Services.HypergridService
|
|||
return false;
|
||||
}
|
||||
|
||||
Object[] args = new Object[] { userURL };
|
||||
IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); //ServerUtils.LoadPlugin<IUserAgentService>(m_AuthDll, args);
|
||||
if (userAgentService != null)
|
||||
if (userURL == m_ExternalName)
|
||||
return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
|
||||
else
|
||||
{
|
||||
try
|
||||
Object[] args = new Object[] { userURL };
|
||||
IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);
|
||||
if (userAgentService != null)
|
||||
{
|
||||
return userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
|
||||
return false;
|
||||
try
|
||||
{
|
||||
return userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,11 +62,18 @@ namespace OpenSim.Services.HypergridService
|
|||
protected static IGridUserService m_GridUserService;
|
||||
protected static IGridService m_GridService;
|
||||
protected static GatekeeperServiceConnector m_GatekeeperConnector;
|
||||
protected static IGatekeeperService m_GatekeeperService;
|
||||
|
||||
protected static string m_GridName;
|
||||
|
||||
protected static bool m_BypassClientVerification;
|
||||
|
||||
public UserAgentService(IConfigSource config)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
{
|
||||
m_Initialized = true;
|
||||
|
||||
m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");
|
||||
|
||||
IConfig serverConfig = config.Configs["UserAgentService"];
|
||||
|
@ -75,16 +82,25 @@ namespace OpenSim.Services.HypergridService
|
|||
|
||||
string gridService = serverConfig.GetString("GridService", String.Empty);
|
||||
string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
|
||||
string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty);
|
||||
|
||||
if (gridService == string.Empty || gridUserService == string.Empty)
|
||||
m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);
|
||||
|
||||
if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
|
||||
throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
|
||||
m_GatekeeperConnector = new GatekeeperServiceConnector();
|
||||
m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args);
|
||||
|
||||
m_Initialized = true;
|
||||
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
if (m_GridName == string.Empty)
|
||||
{
|
||||
serverConfig = config.Configs["GatekeeperService"];
|
||||
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,10 +131,11 @@ namespace OpenSim.Services.HypergridService
|
|||
return home;
|
||||
}
|
||||
|
||||
public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason)
|
||||
public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} to grid {2}",
|
||||
agentCircuit.firstname, agentCircuit.lastname, gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
|
||||
agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()),
|
||||
gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
|
||||
|
||||
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
|
||||
GridRegion region = new GridRegion(gatekeeper);
|
||||
|
@ -131,7 +148,14 @@ namespace OpenSim.Services.HypergridService
|
|||
agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random();
|
||||
TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
|
||||
|
||||
bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
|
||||
//bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
|
||||
bool success = false;
|
||||
string myExternalIP = string.Empty;
|
||||
string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
|
||||
if (m_GridName == gridName)
|
||||
success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
|
||||
else
|
||||
success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
|
@ -145,15 +169,26 @@ namespace OpenSim.Services.HypergridService
|
|||
return false;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
|
||||
// else set the IP addresses associated with this client
|
||||
if (clientIP != null)
|
||||
m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString();
|
||||
m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetClientToken(UUID sessionID, string token)
|
||||
public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, null, out reason);
|
||||
}
|
||||
|
||||
private void SetClientIP(UUID sessionID, string ip)
|
||||
{
|
||||
if (m_TravelingAgents.ContainsKey(sessionID))
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Setting token {0} for session {1}", token, sessionID);
|
||||
m_TravelingAgents[sessionID].ClientToken = token;
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Setting IP {0} for session {1}", ip, sessionID);
|
||||
m_TravelingAgents[sessionID].ClientIPAddress = ip;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,10 +206,10 @@ namespace OpenSim.Services.HypergridService
|
|||
m_TravelingAgents[agentCircuit.SessionID] = travel;
|
||||
}
|
||||
travel.UserID = agentCircuit.AgentID;
|
||||
travel.GridExternalName = region.ExternalHostName + ":" + region.HttpPort;
|
||||
travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
|
||||
travel.ServiceToken = agentCircuit.ServiceSessionID;
|
||||
if (old != null)
|
||||
travel.ClientToken = old.ClientToken;
|
||||
travel.ClientIPAddress = old.ClientIPAddress;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
@ -207,19 +242,26 @@ namespace OpenSim.Services.HypergridService
|
|||
return false;
|
||||
|
||||
TravelingAgentInfo travel = m_TravelingAgents[sessionID];
|
||||
|
||||
return travel.GridExternalName == thisGridExternalName;
|
||||
}
|
||||
|
||||
public bool VerifyClient(UUID sessionID, string token)
|
||||
public bool VerifyClient(UUID sessionID, string reportedIP)
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with token {1}", sessionID, token);
|
||||
//return true;
|
||||
if (m_BypassClientVerification)
|
||||
return true;
|
||||
|
||||
// Commenting this for now until I understand better what part of a sender's
|
||||
// info stays unchanged throughout a session
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.",
|
||||
sessionID, reportedIP);
|
||||
|
||||
if (m_TravelingAgents.ContainsKey(sessionID))
|
||||
return m_TravelingAgents[sessionID].ClientToken == token;
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}",
|
||||
m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress);
|
||||
|
||||
return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP ||
|
||||
m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -244,7 +286,8 @@ namespace OpenSim.Services.HypergridService
|
|||
public UUID UserID;
|
||||
public string GridExternalName = string.Empty;
|
||||
public string ServiceToken = string.Empty;
|
||||
public string ClientToken = string.Empty;
|
||||
public string ClientIPAddress = string.Empty; // as seen from this user agent service
|
||||
public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,13 +48,15 @@ namespace OpenSim.Services.Interfaces
|
|||
/// </summary>
|
||||
public interface IUserAgentService
|
||||
{
|
||||
// called by login service only
|
||||
bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason);
|
||||
// called by simulators
|
||||
bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason);
|
||||
void SetClientToken(UUID sessionID, string token);
|
||||
void LogoutAgent(UUID userID, UUID sessionID);
|
||||
GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
|
||||
|
||||
bool AgentIsComingHome(UUID sessionID, string thisGridExternalName);
|
||||
bool VerifyAgent(UUID sessionID, string token);
|
||||
bool VerifyClient(UUID sessionID, string token);
|
||||
bool VerifyClient(UUID sessionID, string reportedIP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace OpenSim.Services.Interfaces
|
|||
|
||||
List<GridRegion> GetDefaultRegions(UUID scopeID);
|
||||
List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y);
|
||||
List<GridRegion> GetHyperlinks(UUID scopeID);
|
||||
|
||||
int GetRegionFlags(UUID scopeID, UUID regionID);
|
||||
}
|
||||
|
|
|
@ -141,8 +141,11 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <summary>
|
||||
/// Add a new item to the user's inventory
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns>true if the item was successfully added</returns>
|
||||
/// <param name="item">
|
||||
/// The item to be added. If item.FolderID == UUID.Zero then the item is added to the most suitable system
|
||||
/// folder. If there is no suitable folder then the item is added to the user's root inventory folder.
|
||||
/// </param>
|
||||
/// <returns>true if the item was successfully added, false if it was not</returns>
|
||||
bool AddItem(InventoryItemBase item);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace OpenSim.Services.InventoryService
|
|||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected IXInventoryData m_Database;
|
||||
protected bool m_AllowDelete = true;
|
||||
|
||||
public XInventoryService(IConfigSource config) : base(config)
|
||||
{
|
||||
|
@ -60,6 +61,7 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
dllName = authConfig.GetString("StorageProvider", dllName);
|
||||
connString = authConfig.GetString("ConnectionString", connString);
|
||||
m_AllowDelete = authConfig.GetBoolean("AllowDelete", true);
|
||||
// realm = authConfig.GetString("Realm", realm);
|
||||
}
|
||||
|
||||
|
@ -155,6 +157,8 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID)
|
||||
{
|
||||
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting system folders for {0}", principalID);
|
||||
|
||||
XInventoryFolder[] allFolders = m_Database.GetFolders(
|
||||
new string[] { "agentID" },
|
||||
new string[] { principalID.ToString() });
|
||||
|
@ -168,6 +172,9 @@ namespace OpenSim.Services.InventoryService
|
|||
return false;
|
||||
});
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[XINVENTORY SERVICE]: Found {0} system folders for {1}", sysFolders.Length, principalID);
|
||||
|
||||
return sysFolders;
|
||||
}
|
||||
|
||||
|
@ -184,7 +191,7 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
foreach (XInventoryFolder x in allFolders)
|
||||
{
|
||||
//m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName);
|
||||
//m_log.DebugFormat("[XINVENTORY SERVICE]: Adding folder {0} to skeleton", x.folderName);
|
||||
folders.Add(ConvertToOpenSim(x));
|
||||
}
|
||||
|
||||
|
@ -212,12 +219,21 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
|
||||
{
|
||||
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
|
||||
|
||||
XInventoryFolder[] folders = m_Database.GetFolders(
|
||||
new string[] { "agentID", "type"},
|
||||
new string[] { principalID.ToString(), ((int)type).ToString() });
|
||||
|
||||
if (folders.Length == 0)
|
||||
{
|
||||
// m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} for user {1}", type, principalID);
|
||||
return null;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2} for user {3}",
|
||||
// folders[0].folderName, folders[0].folderID, type, principalID);
|
||||
|
||||
return ConvertToOpenSim(folders[0]);
|
||||
}
|
||||
|
@ -228,7 +244,7 @@ namespace OpenSim.Services.InventoryService
|
|||
// connector. So we disregard the principal and look
|
||||
// by ID.
|
||||
//
|
||||
m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString());
|
||||
m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString());
|
||||
InventoryCollection inventory = new InventoryCollection();
|
||||
inventory.UserID = principalID;
|
||||
inventory.Folders = new List<InventoryFolderBase>();
|
||||
|
@ -259,13 +275,15 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
|
||||
{
|
||||
// m_log.DebugFormat("[XINVENTORY]: Fetch items for folder {0}", folderID);
|
||||
|
||||
// Since we probably don't get a valid principal here, either ...
|
||||
//
|
||||
List<InventoryItemBase> invItems = new List<InventoryItemBase>();
|
||||
|
||||
XInventoryItem[] items = m_Database.GetItems(
|
||||
new string[] { "parentFolderID"},
|
||||
new string[] { UUID.Zero.ToString() });
|
||||
new string[] { "parentFolderID" },
|
||||
new string[] { folderID.ToString() });
|
||||
|
||||
foreach (XInventoryItem i in items)
|
||||
invItems.Add(ConvertToOpenSim(i));
|
||||
|
@ -302,10 +320,15 @@ namespace OpenSim.Services.InventoryService
|
|||
//
|
||||
public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
|
||||
{
|
||||
if (!m_AllowDelete)
|
||||
return false;
|
||||
|
||||
// Ignore principal ID, it's bogus at connector level
|
||||
//
|
||||
foreach (UUID id in folderIDs)
|
||||
{
|
||||
if (!ParentIsTrash(id))
|
||||
continue;
|
||||
InventoryFolderBase f = new InventoryFolderBase();
|
||||
f.ID = id;
|
||||
PurgeFolder(f);
|
||||
|
@ -317,6 +340,12 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual bool PurgeFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (!m_AllowDelete)
|
||||
return false;
|
||||
|
||||
if (!ParentIsTrash(folder.ID))
|
||||
return false;
|
||||
|
||||
XInventoryFolder[] subFolders = m_Database.GetFolders(
|
||||
new string[] { "parentFolderID" },
|
||||
new string[] { folder.ID.ToString() });
|
||||
|
@ -334,6 +363,9 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual bool AddItem(InventoryItemBase item)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner);
|
||||
|
||||
return m_Database.StoreItem(ConvertFromOpenSim(item));
|
||||
}
|
||||
|
||||
|
@ -356,6 +388,9 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
|
||||
{
|
||||
if (!m_AllowDelete)
|
||||
return false;
|
||||
|
||||
// Just use the ID... *facepalms*
|
||||
//
|
||||
foreach (UUID id in itemIDs)
|
||||
|
@ -517,5 +552,32 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private bool ParentIsTrash(UUID folderID)
|
||||
{
|
||||
XInventoryFolder[] folder = m_Database.GetFolders(new string[] {"folderID"}, new string[] {folderID.ToString()});
|
||||
if (folder.Length < 1)
|
||||
return false;
|
||||
|
||||
if (folder[0].type == (int)AssetType.TrashFolder)
|
||||
return true;
|
||||
|
||||
UUID parentFolder = folder[0].parentFolderID;
|
||||
|
||||
while (parentFolder != UUID.Zero)
|
||||
{
|
||||
XInventoryFolder[] parent = m_Database.GetFolders(new string[] {"folderID"}, new string[] {parentFolder.ToString()});
|
||||
if (parent.Length < 1)
|
||||
return false;
|
||||
|
||||
if (parent[0].type == (int)AssetType.TrashFolder)
|
||||
return true;
|
||||
if (parent[0].type == (int)AssetType.RootFolder)
|
||||
return false;
|
||||
|
||||
parentFolder = parent[0].parentFolderID;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,6 +170,11 @@ namespace OpenSim.Services.LLLoginService
|
|||
private string firstname;
|
||||
private string lastname;
|
||||
|
||||
// Web map
|
||||
private string mapTileURL;
|
||||
|
||||
private string searchURL;
|
||||
|
||||
// Error Flags
|
||||
private string errorReason;
|
||||
private string errorMessage;
|
||||
|
@ -218,7 +223,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
|
||||
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
|
||||
string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
|
||||
GridRegion home, IPEndPoint clientIP)
|
||||
GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL)
|
||||
: this()
|
||||
{
|
||||
FillOutInventoryData(invSkel, libService);
|
||||
|
@ -234,6 +239,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
Message = message;
|
||||
BuddList = ConvertFriendListItem(friendsList);
|
||||
StartLocation = where;
|
||||
MapTileURL = mapTileURL;
|
||||
SearchURL = searchURL;
|
||||
|
||||
FillOutHomeData(pinfo, home);
|
||||
LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
|
||||
|
@ -405,6 +412,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
InitialOutfitHash["folder_name"] = "Nightclub Female";
|
||||
InitialOutfitHash["gender"] = "female";
|
||||
initialOutfit.Add(InitialOutfitHash);
|
||||
mapTileURL = String.Empty;
|
||||
searchURL = String.Empty;
|
||||
}
|
||||
|
||||
|
||||
|
@ -468,6 +477,12 @@ namespace OpenSim.Services.LLLoginService
|
|||
responseData["region_x"] = (Int32)(RegionX);
|
||||
responseData["region_y"] = (Int32)(RegionY);
|
||||
|
||||
if (searchURL != String.Empty)
|
||||
responseData["search"] = searchURL;
|
||||
|
||||
if (mapTileURL != String.Empty)
|
||||
responseData["map-server-url"] = mapTileURL;
|
||||
|
||||
if (m_buddyList != null)
|
||||
{
|
||||
responseData["buddy-list"] = m_buddyList.ToArray();
|
||||
|
@ -564,6 +579,12 @@ namespace OpenSim.Services.LLLoginService
|
|||
map["region_x"] = OSD.FromInteger(RegionX);
|
||||
map["region_y"] = OSD.FromInteger(RegionY);
|
||||
|
||||
if (mapTileURL != String.Empty)
|
||||
map["map-server-url"] = OSD.FromString(mapTileURL);
|
||||
|
||||
if (searchURL != String.Empty)
|
||||
map["search"] = OSD.FromString(searchURL);
|
||||
|
||||
if (m_buddyList != null)
|
||||
{
|
||||
map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray());
|
||||
|
@ -647,7 +668,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
Hashtable TempHash;
|
||||
foreach (InventoryFolderBase InvFolder in folders)
|
||||
{
|
||||
if (InvFolder.ParentID == UUID.Zero)
|
||||
if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == "My Inventory")
|
||||
{
|
||||
rootID = InvFolder.ID;
|
||||
}
|
||||
|
@ -915,6 +936,18 @@ namespace OpenSim.Services.LLLoginService
|
|||
set { home = value; }
|
||||
}
|
||||
|
||||
public string MapTileURL
|
||||
{
|
||||
get { return mapTileURL; }
|
||||
set { mapTileURL = value; }
|
||||
}
|
||||
|
||||
public string SearchURL
|
||||
{
|
||||
get { return searchURL; }
|
||||
set { searchURL = value; }
|
||||
}
|
||||
|
||||
public string Message
|
||||
{
|
||||
get { return welcomeMessage; }
|
||||
|
|
|
@ -73,6 +73,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
protected int m_MinLoginLevel;
|
||||
protected string m_GatekeeperURL;
|
||||
protected bool m_AllowRemoteSetLoginLevel;
|
||||
protected string m_MapTileURL;
|
||||
protected string m_SearchURL;
|
||||
|
||||
IConfig m_LoginServerConfig;
|
||||
|
||||
|
@ -100,6 +102,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
|
||||
m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
|
||||
m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
|
||||
m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
|
||||
m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
|
||||
|
||||
// These are required; the others aren't
|
||||
if (accountService == string.Empty || authService == string.Empty)
|
||||
|
@ -356,7 +360,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
// Finally, fill out the response and return it
|
||||
//
|
||||
LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
|
||||
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP);
|
||||
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL);
|
||||
|
||||
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
|
||||
return response;
|
||||
|
@ -750,14 +754,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason)
|
||||
{
|
||||
m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName);
|
||||
if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason))
|
||||
{
|
||||
// We may need to do this at some point,
|
||||
// so leaving it here in comments.
|
||||
//IPAddress addr = NetworkUtil.GetIPFor(clientIP.Address, destination.ExternalEndPoint.Address);
|
||||
m_UserAgentService.SetClientToken(aCircuit.SessionID, /*addr.Address.ToString() */ clientIP.Address.ToString());
|
||||
if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, clientIP, out reason))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
|
|||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
|
@ -63,6 +64,7 @@ namespace OpenSim.Tests.Common.Setup
|
|||
private static ISharedRegionModule m_inventoryService = null;
|
||||
private static ISharedRegionModule m_gridService = null;
|
||||
private static ISharedRegionModule m_userAccountService = null;
|
||||
private static ISharedRegionModule m_presenceService = null;
|
||||
|
||||
/// <summary>
|
||||
/// Set up a test scene
|
||||
|
@ -180,7 +182,7 @@ namespace OpenSim.Tests.Common.Setup
|
|||
else
|
||||
StartAssetService(testScene, false);
|
||||
|
||||
// For now, always started a 'real' authenication service
|
||||
// For now, always started a 'real' authentication service
|
||||
StartAuthenticationService(testScene, true);
|
||||
|
||||
if (realServices.Contains("inventory"))
|
||||
|
@ -188,10 +190,9 @@ namespace OpenSim.Tests.Common.Setup
|
|||
else
|
||||
StartInventoryService(testScene, false);
|
||||
|
||||
if (realServices.Contains("grid"))
|
||||
StartGridService(testScene, true);
|
||||
|
||||
StartGridService(testScene, true);
|
||||
StartUserAccountService(testScene);
|
||||
StartPresenceService(testScene);
|
||||
}
|
||||
// If not, make sure the shared module gets references to this new scene
|
||||
else
|
||||
|
@ -202,11 +203,15 @@ namespace OpenSim.Tests.Common.Setup
|
|||
m_inventoryService.RegionLoaded(testScene);
|
||||
m_userAccountService.AddRegion(testScene);
|
||||
m_userAccountService.RegionLoaded(testScene);
|
||||
m_presenceService.AddRegion(testScene);
|
||||
m_presenceService.RegionLoaded(testScene);
|
||||
|
||||
}
|
||||
|
||||
m_inventoryService.PostInitialise();
|
||||
m_assetService.PostInitialise();
|
||||
m_userAccountService.PostInitialise();
|
||||
m_presenceService.PostInitialise();
|
||||
testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
|
||||
testScene.SetModuleInterfaces();
|
||||
|
||||
|
@ -225,6 +230,10 @@ namespace OpenSim.Tests.Common.Setup
|
|||
m_inventoryService = null;
|
||||
m_gridService = null;
|
||||
m_userAccountService = null;
|
||||
m_presenceService = null;
|
||||
|
||||
testScene.RegionInfo.EstateSettings = new EstateSettings();
|
||||
testScene.LoginsDisabled = false;
|
||||
|
||||
return testScene;
|
||||
}
|
||||
|
@ -336,6 +345,32 @@ namespace OpenSim.Tests.Common.Setup
|
|||
testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start a presence service
|
||||
/// </summary>
|
||||
/// <param name="testScene"></param>
|
||||
private static void StartPresenceService(Scene testScene)
|
||||
{
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
config.AddConfig("PresenceService");
|
||||
config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
|
||||
config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||
config.Configs["PresenceService"].Set(
|
||||
"LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
|
||||
|
||||
if (m_presenceService == null)
|
||||
{
|
||||
ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
|
||||
presenceService.Initialise(config);
|
||||
m_presenceService = presenceService;
|
||||
}
|
||||
|
||||
m_presenceService.AddRegion(testScene);
|
||||
m_presenceService.RegionLoaded(testScene);
|
||||
testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup modules for a scene using their default settings.
|
||||
/// </summary>
|
||||
|
@ -446,9 +481,14 @@ namespace OpenSim.Tests.Common.Setup
|
|||
{
|
||||
string reason;
|
||||
|
||||
// We emulate the proper login sequence here by doing things in three stages
|
||||
// We emulate the proper login sequence here by doing things in four stages
|
||||
|
||||
// Stage 0: log the presence
|
||||
scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
|
||||
|
||||
// Stage 1: simulate login by telling the scene to expect a new user connection
|
||||
scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason);
|
||||
if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
|
||||
Console.WriteLine("NewUserConnection failed: " + reason);
|
||||
|
||||
// Stage 2: add the new client as a child agent to the scene
|
||||
TestClient client = new TestClient(agentData, scene);
|
||||
|
@ -459,7 +499,7 @@ namespace OpenSim.Tests.Common.Setup
|
|||
//scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
|
||||
|
||||
ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
|
||||
scp.MakeRootAgent(new Vector3(90,90,90), true);
|
||||
scp.MakeRootAgent(new Vector3(90, 90, 90), true);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,17 @@ namespace OpenSim.Tools.Configger
|
|||
else
|
||||
{
|
||||
string basepath = Path.GetFullPath(".");
|
||||
string path = Path.Combine(basepath, file);
|
||||
// Resolve relative paths with wildcards
|
||||
string chunkWithoutWildcards = file;
|
||||
string chunkWithWildcards = string.Empty;
|
||||
int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' });
|
||||
if (wildcardIndex != -1)
|
||||
{
|
||||
chunkWithoutWildcards = file.Substring(0, wildcardIndex);
|
||||
chunkWithWildcards = file.Substring(wildcardIndex);
|
||||
}
|
||||
string path = Path.Combine(basepath, chunkWithoutWildcards);
|
||||
path = Path.GetFullPath(path) + chunkWithWildcards;
|
||||
string[] paths = Util.Glob(path);
|
||||
foreach (string p in paths)
|
||||
{
|
||||
|
@ -241,36 +251,6 @@ namespace OpenSim.Tools.Configger
|
|||
config.Set("EventQueue", true);
|
||||
}
|
||||
|
||||
{
|
||||
IConfig config = defaultConfig.Configs["StandAlone"];
|
||||
|
||||
if (null == config)
|
||||
config = defaultConfig.AddConfig("StandAlone");
|
||||
|
||||
config.Set("accounts_authenticate", true);
|
||||
config.Set("welcome_message", "Welcome to OpenSimulator");
|
||||
config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
|
||||
config.Set("inventory_source", "");
|
||||
config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
|
||||
config.Set("user_source", "");
|
||||
config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar));
|
||||
}
|
||||
|
||||
{
|
||||
IConfig config = defaultConfig.Configs["Network"];
|
||||
|
||||
if (null == config)
|
||||
config = defaultConfig.AddConfig("Network");
|
||||
|
||||
config.Set("default_location_x", 1000);
|
||||
config.Set("default_location_y", 1000);
|
||||
config.Set("grid_send_key", "null");
|
||||
config.Set("grid_recv_key", "null");
|
||||
config.Set("user_send_key", "null");
|
||||
config.Set("user_recv_key", "null");
|
||||
config.Set("secure_inventory_server", "true");
|
||||
}
|
||||
|
||||
return defaultConfig;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<gcConcurrent enabled="true" />
|
||||
<gcServer enabled="true" />
|
||||
</runtime>
|
||||
<appSettings>
|
||||
</appSettings>
|
||||
<log4net>
|
||||
<appender name="LogForwarder" type="OpenSim.GridLaunch.log4netAppender">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="TraceWriter" type="log4net.Appender.TraceAppender">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||
<file value="OpenSim.GridLaunch.log" />
|
||||
<appendToFile value="true" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<level value="ALL" />
|
||||
<appender-ref ref="LogForwarder" />
|
||||
<appender-ref ref="LogFileAppender" />
|
||||
<appender-ref ref="TraceWriter" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,247 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.GridLaunch
|
||||
{
|
||||
internal partial class AppExecutor : IDisposable
|
||||
{
|
||||
// How long to wait for process to shut down by itself
|
||||
private static readonly int shutdownWaitSeconds = 10;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
//private StreamWriter Input { get { return process.StandardInput; } }
|
||||
//private StreamReader Output { get { return process.StandardOutput; } }
|
||||
//private StreamReader Error { get { return process.StandardError; } }
|
||||
|
||||
private StreamWriter Input { get; set; }
|
||||
private StreamReader Output { get; set; }
|
||||
private StreamReader Error { get; set; }
|
||||
|
||||
private object processLock = new object();
|
||||
|
||||
private bool isRunning = false;
|
||||
public bool IsRunning { get { return isRunning; } }
|
||||
|
||||
private string file;
|
||||
public string File { get { return file; } }
|
||||
|
||||
Process process;
|
||||
|
||||
public AppExecutor(string File)
|
||||
{
|
||||
file = File;
|
||||
}
|
||||
|
||||
#region Dispose of unmanaged resources
|
||||
~AppExecutor()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
private bool isDisposed = false;
|
||||
public void Dispose()
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
isDisposed = true;
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Start / Stop process
|
||||
public void Start()
|
||||
{
|
||||
if (isDisposed)
|
||||
throw new ApplicationException("Attempt to start process in Disposed instance of AppExecutor.");
|
||||
// Stop before starting
|
||||
Stop();
|
||||
|
||||
lock (processLock)
|
||||
{
|
||||
isRunning = true;
|
||||
|
||||
m_log.InfoFormat("Starting \"{0}\".", file);
|
||||
|
||||
// Start the process
|
||||
process = new Process();
|
||||
process.StartInfo.FileName = file;
|
||||
process.StartInfo.Arguments = "";
|
||||
process.StartInfo.CreateNoWindow = true;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.ErrorDialog = false;
|
||||
process.EnableRaisingEvents = true;
|
||||
|
||||
|
||||
// Redirect all standard input/output/errors
|
||||
process.StartInfo.RedirectStandardInput = true;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
|
||||
// Start process
|
||||
process.Start();
|
||||
|
||||
Input = process.StandardInput;
|
||||
Output = process.StandardOutput;
|
||||
Error = process.StandardError;
|
||||
|
||||
// Start data copying
|
||||
timer_Start();
|
||||
|
||||
// We will flush manually
|
||||
//Input.AutoFlush = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
// Shut down process
|
||||
// We will ignore some exceptions here, against good programming practice... :)
|
||||
|
||||
lock (processLock)
|
||||
{
|
||||
// Running?
|
||||
if (!isRunning)
|
||||
return;
|
||||
isRunning = false;
|
||||
|
||||
timer_Stop();
|
||||
|
||||
m_log.InfoFormat("Stopping \"{0}\".", file);
|
||||
|
||||
// Send exit command to console
|
||||
try
|
||||
{
|
||||
if (Input != null)
|
||||
{
|
||||
_writeLine("");
|
||||
_writeLine("exit");
|
||||
_writeLine("quit");
|
||||
// Wait for process to exit
|
||||
process.WaitForExit(1000 * shutdownWaitSeconds);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("Exeption asking \"{0}\" to shut down: {1}", file, ex.ToString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Forcefully kill it
|
||||
if (process.HasExited != true)
|
||||
process.Kill();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("Exeption killing \"{0}\": {1}", file, ex.ToString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Free resources
|
||||
process.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("Exeption freeing resources for \"{0}\": {1}", file, ex.ToString());
|
||||
}
|
||||
|
||||
// Dispose of stream and process object
|
||||
//SafeDisposeOf(Input);
|
||||
//SafeDisposeOf(Output);
|
||||
//SafeDisposeOf(Error);
|
||||
Program.SafeDisposeOf(process);
|
||||
}
|
||||
|
||||
// Done stopping process
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Write to stdInput
|
||||
public void Write(string Text)
|
||||
{
|
||||
// Lock so process won't shut down while we write, and that we won't write while proc is shutting down
|
||||
lock (processLock)
|
||||
{
|
||||
_write(Text);
|
||||
}
|
||||
}
|
||||
public void _write(string Text)
|
||||
{
|
||||
if (Input != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Input.Write(Text);
|
||||
Input.Flush();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("Exeption sending text \"{0}\" to \"{1}\": {2}", file, Text, ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void WriteLine(string Text)
|
||||
{
|
||||
// Lock so process won't shut down while we write, and that we won't write while proc is shutting down
|
||||
lock (processLock)
|
||||
{
|
||||
_writeLine(Text);
|
||||
}
|
||||
}
|
||||
public void _writeLine(string Text)
|
||||
{
|
||||
if (Input != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_log.DebugFormat("\"{0}\": Sending: \"{1}\"", file, Text);
|
||||
Input.WriteLine(Text);
|
||||
Input.Flush();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("Exeption sending text \"{0}\" to \"{1}\": {2}", file, Text, ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.GridLaunch
|
||||
{
|
||||
internal partial class AppExecutor
|
||||
{
|
||||
|
||||
|
||||
#region Start / Stop timer thread
|
||||
private void timer_Start()
|
||||
{
|
||||
asyncReadOutput();
|
||||
asyncReadError();
|
||||
}
|
||||
|
||||
private bool running = true;
|
||||
private void timer_Stop()
|
||||
{
|
||||
running = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private byte[] readBufferOutput = new byte[4096];
|
||||
private byte[] readBufferError = new byte[4096];
|
||||
|
||||
private void asyncReadOutput()
|
||||
{
|
||||
if (running)
|
||||
Output.BaseStream.BeginRead(readBufferOutput, 0, readBufferOutput.Length, asyncReadCallBackOutput, null);
|
||||
}
|
||||
private void asyncReadError()
|
||||
{
|
||||
if (running)
|
||||
Error.BaseStream.BeginRead(readBufferError, 0, readBufferError.Length, asyncReadCallBackError, null);
|
||||
}
|
||||
|
||||
private void asyncReadCallBackOutput(IAsyncResult ar)
|
||||
{
|
||||
int len = Output.BaseStream.EndRead(ar);
|
||||
Program.FireAppConsoleOutput(file,
|
||||
System.Text.Encoding.ASCII.GetString(readBufferOutput, 0, len)
|
||||
);
|
||||
|
||||
asyncReadOutput();
|
||||
}
|
||||
private void asyncReadCallBackError(IAsyncResult ar)
|
||||
{
|
||||
int len = Error.BaseStream.EndRead(ar);
|
||||
Program.FireAppConsoleError(file,
|
||||
System.Text.Encoding.ASCII.GetString(readBufferError, 0, len)
|
||||
);
|
||||
|
||||
asyncReadError();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,187 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
//using System;
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Reflection;
|
||||
//using System.Text;
|
||||
//using System.Threading;
|
||||
//using log4net;
|
||||
|
||||
//namespace OpenSim.GridLaunch
|
||||
//{
|
||||
// internal class AppExecutor2
|
||||
// {
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly int consoleReadIntervalMilliseconds = 50;
|
||||
// //private static readonly Timer readTimer = new Timer(readConsole, null, Timeout.Infinite, Timeout.Infinite);
|
||||
// private static Thread timerThread;
|
||||
// private static object timerThreadLock = new object();
|
||||
|
||||
// #region Start / Stop timer thread
|
||||
// private static void timer_Start()
|
||||
// {
|
||||
// //readTimer.Change(0, consoleReadIntervalMilliseconds);
|
||||
// lock (timerThreadLock)
|
||||
// {
|
||||
// if (timerThread == null)
|
||||
// {
|
||||
// m_log.Debug("Starting timer thread.");
|
||||
// timerThread = new Thread(timerThreadLoop);
|
||||
// timerThread.Name = "StdOutputStdErrorReadThread";
|
||||
// timerThread.IsBackground = true;
|
||||
// timerThread.Start();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private static void timer_Stop()
|
||||
// {
|
||||
// //readTimer.Change(Timeout.Infinite, Timeout.Infinite);
|
||||
// lock (timerThreadLock)
|
||||
// {
|
||||
// if (timerThread != null)
|
||||
// {
|
||||
// m_log.Debug("Stopping timer thread.");
|
||||
// try
|
||||
// {
|
||||
// if (timerThread.IsAlive)
|
||||
// timerThread.Abort();
|
||||
// timerThread.Join(2000);
|
||||
// timerThread = null;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// m_log.Error("Exception stopping timer thread: " + ex.ToString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region Timer read from consoles and fire event
|
||||
|
||||
// private static void timerThreadLoop()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// while (true)
|
||||
// {
|
||||
// readConsole();
|
||||
// Thread.Sleep(consoleReadIntervalMilliseconds);
|
||||
// }
|
||||
// }
|
||||
// catch (ThreadAbortException) { } // Expected on thread shutdown
|
||||
// }
|
||||
|
||||
// private static void readConsole()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
|
||||
// // Lock so we don't collide with any startup or shutdown
|
||||
// lock (Program.AppList)
|
||||
// {
|
||||
// foreach (AppExecutor app in new ArrayList(Program.AppList.Values))
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// string txt = app.GetStdOutput();
|
||||
// // Fire event with received text
|
||||
// if (!string.IsNullOrEmpty(txt))
|
||||
// Program.FireAppConsoleOutput(app.File, txt);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// m_log.ErrorFormat("Exception reading standard output from \"{0}\": {1}", app.File, ex.ToString());
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// string txt = app.GetStdError();
|
||||
// // Fire event with received text
|
||||
// if (!string.IsNullOrEmpty(txt))
|
||||
// Program.FireAppConsoleOutput(app.File, txt);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// m_log.ErrorFormat("Exception reading standard error from \"{0}\": {1}", app.File, ex.ToString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
|
||||
// #region Read stdOutput and stdError
|
||||
// public string GetStdOutput()
|
||||
// {
|
||||
// return GetStreamData(Output);
|
||||
// }
|
||||
// public string GetStdError()
|
||||
// {
|
||||
// return GetStreamData(Error);
|
||||
// }
|
||||
|
||||
// private static int num = 0;
|
||||
// // Gets any data from StreamReader object, non-blocking
|
||||
// private static string GetStreamData(StreamReader sr)
|
||||
// {
|
||||
// // Can't read?
|
||||
// if (!sr.BaseStream.CanRead)
|
||||
// return "";
|
||||
|
||||
// // Read a chunk
|
||||
// //sr.BaseStream.ReadTimeout = 100;
|
||||
// byte[] buffer = new byte[4096];
|
||||
// num++;
|
||||
// Trace.WriteLine("Start read " + num);
|
||||
// int len = sr.BaseStream.Read(buffer, 0, buffer.Length);
|
||||
// Trace.WriteLine("End read " + num + ": " + len);
|
||||
|
||||
// // Nothing?
|
||||
// if (len <= 0)
|
||||
// return "";
|
||||
|
||||
// // Return data
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.Append(System.Text.Encoding.ASCII.GetString(buffer, 0, len));
|
||||
|
||||
// //while (sr.Peek() >= 0)
|
||||
// //{
|
||||
// // sb.Append(Convert.ToChar(sr.Read()));
|
||||
// //}
|
||||
|
||||
// return sb.ToString();
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
|
||||
// }
|
||||
//}
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.GridLaunch
|
||||
{
|
||||
internal class CommandProcessor
|
||||
{
|
||||
public delegate void CommandLineDelegate(string application, string command, string arguments);
|
||||
public event CommandLineDelegate CommandLine;
|
||||
|
||||
public bool IsCommand(string cmd)
|
||||
{
|
||||
if (cmd.Trim().StartsWith("/"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static readonly char[] cmdSplit = new char[] { ' ' };
|
||||
public bool Process(string app, string command)
|
||||
{
|
||||
// Only process commands
|
||||
if (!IsCommand(command))
|
||||
return false;
|
||||
|
||||
// Remove first /
|
||||
command = command.Trim().Remove(0, 1);
|
||||
|
||||
// Split cmd and args
|
||||
string[] carg = command.Split(cmdSplit, 2);
|
||||
if (carg.Length == 0)
|
||||
return true;
|
||||
|
||||
string cmd = carg[0]; // Command
|
||||
string arg = "";
|
||||
if (carg.Length > 1)
|
||||
arg = carg[1]; // Arguments
|
||||
|
||||
// Do we have a command?
|
||||
if (string.IsNullOrEmpty(cmd))
|
||||
return true;
|
||||
|
||||
// All is fine
|
||||
if (CommandLine != null)
|
||||
CommandLine(app, cmd, arg);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.GridLaunch.GUI.Console
|
||||
{
|
||||
internal class Console: IGUI
|
||||
{
|
||||
private List<string> Apps = new List<string>();
|
||||
public Console ()
|
||||
{
|
||||
Program.AppCreated += Program_AppCreated;
|
||||
Program.AppRemoved += Program_AppRemoved;
|
||||
Program.AppConsoleOutput += Program_AppConsoleOutput;
|
||||
Program.Command.CommandLine += Command_CommandLine;
|
||||
}
|
||||
|
||||
private string currentApp = "";
|
||||
private bool quitTyped = false;
|
||||
void Command_CommandLine(string application, string command, string arguments)
|
||||
{
|
||||
|
||||
// If command is a number then someone might be trying to change console: /1, /2, etc.
|
||||
int currentAppNum = 0;
|
||||
if (int.TryParse(command, out currentAppNum))
|
||||
if (currentAppNum <= Apps.Count)
|
||||
{
|
||||
currentApp = Apps[currentAppNum - 1];
|
||||
System.Console.WriteLine("Changed console to app: " + currentApp);
|
||||
} else
|
||||
System.Console.WriteLine("Unable to change to app number: " + currentAppNum);
|
||||
|
||||
// Has user typed quit?
|
||||
if (command.ToLower() == "quit")
|
||||
quitTyped = true;
|
||||
|
||||
// Has user typed /list?
|
||||
if (command.ToLower() == "list")
|
||||
{
|
||||
System.Console.WriteLine("/0 Log console");
|
||||
for (int i = 1; i <= Apps.Count; i++)
|
||||
{
|
||||
System.Console.WriteLine(string.Format("/{0} {1}", i, Apps[i - 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
#region Module Start / Stop
|
||||
public void StartGUI()
|
||||
{
|
||||
// Console start
|
||||
System.Console.WriteLine("Console GUI");
|
||||
System.Console.WriteLine("Use commands /0, /1, /2, etc to switch between applications.");
|
||||
System.Console.WriteLine("Type /list for list of applications.");
|
||||
System.Console.WriteLine("Anything that doesn't start with a / will be sent to selected application");
|
||||
System.Console.WriteLine("type /quit to exit");
|
||||
|
||||
|
||||
while (quitTyped == false)
|
||||
{
|
||||
string line = System.Console.ReadLine().TrimEnd("\r\n".ToCharArray());
|
||||
Program.Write(currentApp, line);
|
||||
}
|
||||
// We are done
|
||||
System.Console.WriteLine("Console exit.");
|
||||
}
|
||||
|
||||
public void StopGUI()
|
||||
{
|
||||
// Console stop
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GridLaunch Events
|
||||
void Program_AppCreated(string App)
|
||||
{
|
||||
System.Console.WriteLine("Started: " + App);
|
||||
if (!Apps.Contains(App))
|
||||
Apps.Add(App);
|
||||
}
|
||||
|
||||
void Program_AppRemoved(string App)
|
||||
{
|
||||
System.Console.WriteLine("Stopped: " + App);
|
||||
if (Apps.Contains(App))
|
||||
Apps.Remove(App);
|
||||
}
|
||||
|
||||
void Program_AppConsoleOutput(string App, string Text)
|
||||
{
|
||||
System.Console.Write(App + ": " + Text);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.GridLaunch.GUI
|
||||
{
|
||||
public interface IGUI
|
||||
{
|
||||
void StartGUI();
|
||||
void StopGUI();
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace OpenSim.GridLaunch.GUI.Network
|
||||
{
|
||||
internal class Client
|
||||
{
|
||||
public TcpClient tcpClient;
|
||||
private byte[] readBuffer = new byte[4096];
|
||||
private byte[] writeBuffer;
|
||||
private TCPD tcp;
|
||||
private string inputData = "";
|
||||
private object inputDataLock = new object();
|
||||
public Client(TCPD _tcp, TcpClient Client)
|
||||
{
|
||||
tcp = _tcp;
|
||||
tcpClient = Client;
|
||||
asyncReadStart();
|
||||
Write("OpenSim TCP Console GUI");
|
||||
Write("Use commands /0, /1, /2, etc to switch between applications.");
|
||||
Write("Type /list for list of applications.");
|
||||
Write("Anything that doesn't start with a / will be sent to selected application");
|
||||
Write("type /quit to exit");
|
||||
|
||||
}
|
||||
|
||||
private void asyncReadStart()
|
||||
{
|
||||
tcpClient.GetStream().BeginRead(readBuffer, 0, readBuffer.Length, asyncReadCallBack, null);
|
||||
}
|
||||
|
||||
//private Regex LineExtractor = new Regex("^(.*)$")
|
||||
private void asyncReadCallBack(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read data
|
||||
int len = tcpClient.GetStream().EndRead(ar);
|
||||
|
||||
// Send it to app
|
||||
string newData = System.Text.Encoding.ASCII.GetString(readBuffer, 0, len);
|
||||
//lock (inputDataLock)
|
||||
//{
|
||||
inputData += newData;
|
||||
if (newData.Contains("\n"))
|
||||
SendInputLines();
|
||||
//}
|
||||
|
||||
// Start it again
|
||||
asyncReadStart();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// TODO: Remove client when we get exception
|
||||
// Temp patch: if exception we don't call asyncReadStart()
|
||||
}
|
||||
}
|
||||
|
||||
private void SendInputLines()
|
||||
{
|
||||
StringBuilder line = new StringBuilder();
|
||||
foreach (char c in inputData)
|
||||
{
|
||||
if (c == 13)
|
||||
continue;
|
||||
if (c == 10)
|
||||
{
|
||||
Program.WriteLine(tcp.currentApp, line.ToString());
|
||||
line = new StringBuilder();
|
||||
continue;
|
||||
}
|
||||
line.Append(c);
|
||||
}
|
||||
// We'll keep whatever is left over
|
||||
inputData = line.ToString();
|
||||
}
|
||||
|
||||
public void Write(string Text)
|
||||
{
|
||||
writeBuffer = Encoding.ASCII.GetBytes(Text);
|
||||
tcpClient.GetStream().Write(writeBuffer, 0, writeBuffer.Length);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,231 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.GridLaunch.GUI.Network
|
||||
{
|
||||
public class TCPD : IGUI, IDisposable
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private List<Client> Clients = new List<Client>();
|
||||
|
||||
private readonly int defaultPort = 7998;
|
||||
private TcpListener tcpListener;
|
||||
private Thread listenThread;
|
||||
private Thread clientThread;
|
||||
|
||||
|
||||
private List<string> Apps = new List<string>();
|
||||
internal string currentApp = "";
|
||||
private bool quitTyped = false;
|
||||
|
||||
public TCPD()
|
||||
{
|
||||
Program.AppCreated += Program_AppCreated;
|
||||
Program.AppRemoved += Program_AppRemoved;
|
||||
Program.AppConsoleOutput += Program_AppConsoleOutput;
|
||||
Program.Command.CommandLine += Command_CommandLine;
|
||||
|
||||
}
|
||||
|
||||
~TCPD()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
private bool isDisposed = false;
|
||||
///<summary>
|
||||
///Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
///</summary>
|
||||
///<filterpriority>2</filterpriority>
|
||||
public void Dispose()
|
||||
{
|
||||
if (isDisposed)
|
||||
return;
|
||||
isDisposed = true;
|
||||
tcpd_Stop();
|
||||
}
|
||||
|
||||
public void StartGUI()
|
||||
{
|
||||
// We are starting
|
||||
tcpd_Start();
|
||||
}
|
||||
|
||||
public void StopGUI()
|
||||
{
|
||||
// We are stopping
|
||||
tcpd_Stop();
|
||||
}
|
||||
|
||||
|
||||
#region GridLaunch Events
|
||||
private void Command_CommandLine(string application, string command, string arguments)
|
||||
{
|
||||
// If command is a number then someone might be trying to change console: /1, /2, etc.
|
||||
int currentAppNum = 0;
|
||||
if (int.TryParse(command, out currentAppNum))
|
||||
if (currentAppNum <= Apps.Count)
|
||||
{
|
||||
currentApp = Apps[currentAppNum - 1];
|
||||
TCPWriteToAll("Changed console to app: " + currentApp + Environment.NewLine);
|
||||
}
|
||||
else
|
||||
TCPWriteToAll("Unable to change to app number: " + currentAppNum + Environment.NewLine);
|
||||
|
||||
// Has user typed quit?
|
||||
if (command.ToLower() == "quit")
|
||||
quitTyped = true;
|
||||
|
||||
// Has user typed /list?
|
||||
if (command.ToLower() == "list")
|
||||
{
|
||||
TCPWriteToAll("/0 Log console");
|
||||
for (int i = 1; i <= Apps.Count; i++)
|
||||
{
|
||||
TCPWriteToAll(string.Format("/{0} {1}", i, Apps[i - 1]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Program_AppCreated(string App)
|
||||
{
|
||||
TCPWriteToAll("Started: " + App);
|
||||
if (!Apps.Contains(App))
|
||||
Apps.Add(App);
|
||||
}
|
||||
|
||||
void Program_AppRemoved(string App)
|
||||
{
|
||||
TCPWriteToAll("Stopped: " + App);
|
||||
if (Apps.Contains(App))
|
||||
Apps.Remove(App);
|
||||
}
|
||||
|
||||
private void Program_AppConsoleOutput(string App, string Text)
|
||||
{
|
||||
TCPWriteToAll(App, Text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void tcpd_Start()
|
||||
{
|
||||
listenThread = new Thread(new ThreadStart(ListenForClients));
|
||||
listenThread.Name = "TCPDThread";
|
||||
listenThread.IsBackground = true;
|
||||
listenThread.Start();
|
||||
|
||||
while (!quitTyped)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
//clientThread = new Thread(new ThreadStart(ProcessClients));
|
||||
//clientThread.Name = "TCPClientThread";
|
||||
//clientThread.IsBackground = true;
|
||||
////clientThread.Start();
|
||||
|
||||
}
|
||||
private void tcpd_Stop()
|
||||
{
|
||||
StopThread(listenThread);
|
||||
StopThread(clientThread);
|
||||
}
|
||||
private void ListenForClients()
|
||||
{
|
||||
int Port = 0;
|
||||
int.TryParse(Program.Settings["TCPPort"], out Port);
|
||||
if (Port < 1)
|
||||
Port = defaultPort;
|
||||
|
||||
m_log.Info("Starting TCP Server on port " + Port);
|
||||
this.tcpListener = new TcpListener(IPAddress.Any, Port);
|
||||
|
||||
this.tcpListener.Start();
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Blocks until a client has connected to the server
|
||||
TcpClient tcpClient = this.tcpListener.AcceptTcpClient();
|
||||
Client client = new Client(this, tcpClient);
|
||||
|
||||
lock (Clients)
|
||||
{
|
||||
Clients.Add(client);
|
||||
}
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
private static void StopThread(Thread t)
|
||||
{
|
||||
if (t != null)
|
||||
{
|
||||
m_log.Debug("Stopping thread " + t.Name);
|
||||
try
|
||||
{
|
||||
if (t.IsAlive)
|
||||
t.Abort();
|
||||
t.Join(2000);
|
||||
t = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("Exception stopping thread: " + ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TCPWriteToAll(string app, string text)
|
||||
{
|
||||
TCPWriteToAll(text);
|
||||
}
|
||||
private void TCPWriteToAll(string text)
|
||||
{
|
||||
foreach (Client c in new ArrayList(Clients))
|
||||
{
|
||||
try
|
||||
{
|
||||
c.Write(text);
|
||||
} catch (Exception ex)
|
||||
{
|
||||
m_log.Error("Exception writing to TCP: " + ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceProcess;
|
||||
using System.Text;
|
||||
using OpenSim.GridLaunch.GUI;
|
||||
|
||||
namespace OpenSim.GridLaunch
|
||||
{
|
||||
internal class Service: ServiceBase, IGUI
|
||||
{
|
||||
private ServiceBase[] ServicesToRun;
|
||||
public Service()
|
||||
{
|
||||
ServicesToRun = new ServiceBase[] {this};
|
||||
}
|
||||
|
||||
public void StartGUI()
|
||||
{
|
||||
ServiceBase.Run(ServicesToRun);
|
||||
}
|
||||
|
||||
public void StopGUI()
|
||||
{
|
||||
// Nothing
|
||||
}
|
||||
|
||||
protected override void OnStart(string[] args)
|
||||
{
|
||||
// Command line arguments override settings
|
||||
Program.Settings.ParseCommandArguments(args);
|
||||
}
|
||||
|
||||
protected override void OnStop()
|
||||
{
|
||||
Program.Shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue