Merge branch 'master' of git://opensimulator.org/git/opensim
commit
ae4964050b
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1035,11 +1035,6 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
// Minimap function, not used.
|
||||
}
|
||||
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
public void SetChildAgentThrottle(byte[] throttle)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
|
@ -1711,5 +1706,9 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId)
|
||||
{
|
||||
}
|
||||
|
||||
public void StopFlying(ISceneEntity presence)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -593,11 +593,6 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
|||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetChildAgentThrottle(byte[] throttle)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
@ -1199,6 +1194,10 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
|||
{
|
||||
}
|
||||
|
||||
public void StopFlying(ISceneEntity presence)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -599,11 +599,6 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
|||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetChildAgentThrottle(byte[] throttle)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
@ -1214,5 +1209,9 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
|||
public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId)
|
||||
{
|
||||
}
|
||||
|
||||
public void StopFlying(ISceneEntity presence)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ using Nini.Config;
|
|||
using log4net;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Server.Base;
|
||||
|
@ -73,9 +74,18 @@ namespace OpenSim.ConsoleClient
|
|||
|
||||
Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply);
|
||||
|
||||
int res = m_Server.Run();
|
||||
string pidFile = serverConfig.GetString("PIDFile", String.Empty);
|
||||
|
||||
Environment.Exit(res);
|
||||
while (m_Server.Running)
|
||||
{
|
||||
System.Threading.Thread.Sleep(500);
|
||||
// MainConsole.Instance.Prompt();
|
||||
}
|
||||
|
||||
if (pidFile != String.Empty)
|
||||
File.Delete(pidFile);
|
||||
|
||||
Environment.Exit(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -83,13 +93,14 @@ namespace OpenSim.ConsoleClient
|
|||
private static void SendCommand(string module, string[] cmd)
|
||||
{
|
||||
string sendCmd = "";
|
||||
string[] cmdlist = new string[cmd.Length - 1];
|
||||
|
||||
sendCmd = cmd[0];
|
||||
|
||||
if (cmd.Length > 1)
|
||||
{
|
||||
sendCmd = cmd[0];
|
||||
|
||||
Array.Copy(cmd, 1, cmd, 0, cmd.Length-1);
|
||||
Array.Resize(ref cmd, cmd.Length-1);
|
||||
sendCmd += "\"" + String.Join("\" \"", cmd) + "\"";
|
||||
Array.Copy(cmd, 1, cmdlist, 0, cmd.Length - 1);
|
||||
sendCmd += " \"" + String.Join("\" \"", cmdlist) + "\"";
|
||||
}
|
||||
|
||||
Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply);
|
||||
|
@ -183,16 +194,27 @@ namespace OpenSim.ConsoleClient
|
|||
while (lines.Count > 100)
|
||||
lines.RemoveAt(0);
|
||||
|
||||
string prompt = String.Empty;
|
||||
|
||||
foreach (string l in lines)
|
||||
{
|
||||
string[] parts = l.Split(new char[] {':'}, 3);
|
||||
if (parts.Length != 3)
|
||||
continue;
|
||||
|
||||
MainConsole.Instance.Output(parts[2].Trim(), parts[1]);
|
||||
if (parts[2].StartsWith("+++") || parts[2].StartsWith("-++"))
|
||||
prompt = parts[2];
|
||||
else
|
||||
MainConsole.Instance.Output(parts[2].Trim(), parts[1]);
|
||||
}
|
||||
|
||||
|
||||
Requester.MakeRequest(requestUrl, requestData, ReadResponses);
|
||||
|
||||
if (prompt.StartsWith("+++"))
|
||||
MainConsole.Instance.ReadLine(prompt.Substring(3), true, true);
|
||||
else if (prompt.StartsWith("-++"))
|
||||
SendCommand(String.Empty, new string[] { MainConsole.Instance.ReadLine(prompt.Substring(3), false, true) });
|
||||
}
|
||||
|
||||
public static void CommandReply(string requestUrl, string requestData, string replyData)
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Data
|
|||
public int inventoryNextPermissions;
|
||||
public int inventoryCurrentPermissions;
|
||||
public int invType;
|
||||
public UUID creatorID;
|
||||
public string creatorID;
|
||||
public int inventoryBasePermissions;
|
||||
public int inventoryEveryOnePermissions;
|
||||
public int salePrice;
|
||||
|
|
|
@ -67,7 +67,6 @@ namespace OpenSim.Data
|
|||
/// really want is the assembly of your database class.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
public class Migration
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -173,8 +172,6 @@ namespace OpenSim.Data
|
|||
ExecuteScript(_conn, script);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
InitMigrationsTable();
|
||||
|
@ -186,8 +183,8 @@ namespace OpenSim.Data
|
|||
return;
|
||||
|
||||
// to prevent people from killing long migrations.
|
||||
m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]);
|
||||
m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!");
|
||||
m_log.InfoFormat("[MIGRATIONS]: Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]);
|
||||
m_log.Info("[MIGRATIONS]: NOTE - this may take a while, don't interrupt this process!");
|
||||
|
||||
foreach (KeyValuePair<int, string[]> kvp in migrations)
|
||||
{
|
||||
|
@ -206,7 +203,7 @@ namespace OpenSim.Data
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", e.Message.Replace("\n", " "));
|
||||
m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " "));
|
||||
m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.");
|
||||
ExecuteScript("ROLLBACK;");
|
||||
}
|
||||
|
|
|
@ -64,14 +64,22 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
if (folder.folderName.Length > 64)
|
||||
folder.folderName = folder.folderName.Substring(0, 64);
|
||||
|
||||
return m_Folders.Store(folder);
|
||||
}
|
||||
|
||||
public bool StoreItem(XInventoryItem item)
|
||||
{
|
||||
if (item.inventoryName.Length > 64)
|
||||
item.inventoryName = item.inventoryName.Substring(0, 64);
|
||||
if (item.inventoryDescription.Length > 128)
|
||||
item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
|
||||
|
||||
return m_Items.Store(item);
|
||||
}
|
||||
|
||||
|
||||
public bool DeleteFolders(string field, string val)
|
||||
{
|
||||
return m_Folders.Delete(field, val);
|
||||
|
|
|
@ -73,5 +73,5 @@ ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
|
|||
|
||||
:VERSION 8
|
||||
|
||||
ALTER TABLE assets ADD COLUMN CreatorID varchar(36) NOT NULL DEFAULT '';
|
||||
ALTER TABLE assets ADD COLUMN CreatorID varchar(128) NOT NULL DEFAULT '';
|
||||
|
||||
|
|
|
@ -91,3 +91,11 @@ update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' whe
|
|||
alter table inventoryitems modify column creatorID varchar(36) not NULL default '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 5 # ------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
alter table inventoryitems modify column creatorID varchar(128) not NULL default '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -717,9 +717,86 @@ ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT
|
|||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 32
|
||||
|
||||
BEGIN;
|
||||
CREATE TABLE `regionwindlight` (
|
||||
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
|
||||
`water_color_r` float(9,6) unsigned NOT NULL DEFAULT '4.000000',
|
||||
`water_color_g` float(9,6) unsigned NOT NULL DEFAULT '38.000000',
|
||||
`water_color_b` float(9,6) unsigned NOT NULL DEFAULT '64.000000',
|
||||
`water_fog_density_exponent` float(3,1) unsigned NOT NULL DEFAULT '4.0',
|
||||
`underwater_fog_modifier` float(3,2) unsigned NOT NULL DEFAULT '0.25',
|
||||
`reflection_wavelet_scale_1` float(3,1) unsigned NOT NULL DEFAULT '2.0',
|
||||
`reflection_wavelet_scale_2` float(3,1) unsigned NOT NULL DEFAULT '2.0',
|
||||
`reflection_wavelet_scale_3` float(3,1) unsigned NOT NULL DEFAULT '2.0',
|
||||
`fresnel_scale` float(3,2) unsigned NOT NULL DEFAULT '0.40',
|
||||
`fresnel_offset` float(3,2) unsigned NOT NULL DEFAULT '0.50',
|
||||
`refract_scale_above` float(3,2) unsigned NOT NULL DEFAULT '0.03',
|
||||
`refract_scale_below` float(3,2) unsigned NOT NULL DEFAULT '0.20',
|
||||
`blur_multiplier` float(4,3) unsigned NOT NULL DEFAULT '0.040',
|
||||
`big_wave_direction_x` float(3,2) NOT NULL DEFAULT '1.05',
|
||||
`big_wave_direction_y` float(3,2) NOT NULL DEFAULT '-0.42',
|
||||
`little_wave_direction_x` float(3,2) NOT NULL DEFAULT '1.11',
|
||||
`little_wave_direction_y` float(3,2) NOT NULL DEFAULT '-1.16',
|
||||
`normal_map_texture` varchar(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
|
||||
`horizon_r` float(3,2) unsigned NOT NULL DEFAULT '0.25',
|
||||
`horizon_g` float(3,2) unsigned NOT NULL DEFAULT '0.25',
|
||||
`horizon_b` float(3,2) unsigned NOT NULL DEFAULT '0.32',
|
||||
`horizon_i` float(3,2) unsigned NOT NULL DEFAULT '0.32',
|
||||
`haze_horizon` float(3,2) unsigned NOT NULL DEFAULT '0.19',
|
||||
`blue_density_r` float(3,2) unsigned NOT NULL DEFAULT '0.12',
|
||||
`blue_density_g` float(3,2) unsigned NOT NULL DEFAULT '0.22',
|
||||
`blue_density_b` float(3,2) unsigned NOT NULL DEFAULT '0.38',
|
||||
`blue_density_i` float(3,2) unsigned NOT NULL DEFAULT '0.38',
|
||||
`haze_density` float(3,2) unsigned NOT NULL DEFAULT '0.70',
|
||||
`density_multiplier` float(3,2) unsigned NOT NULL DEFAULT '0.18',
|
||||
`distance_multiplier` float(4,1) unsigned NOT NULL DEFAULT '0.8',
|
||||
`max_altitude` int(4) unsigned NOT NULL DEFAULT '1605',
|
||||
`sun_moon_color_r` float(3,2) unsigned NOT NULL DEFAULT '0.24',
|
||||
`sun_moon_color_g` float(3,2) unsigned NOT NULL DEFAULT '0.26',
|
||||
`sun_moon_color_b` float(3,2) unsigned NOT NULL DEFAULT '0.30',
|
||||
`sun_moon_color_i` float(3,2) unsigned NOT NULL DEFAULT '0.30',
|
||||
`sun_moon_position` float(4,3) unsigned NOT NULL DEFAULT '0.317',
|
||||
`ambient_r` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`ambient_g` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`ambient_b` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`ambient_i` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`east_angle` float(3,2) unsigned NOT NULL DEFAULT '0.00',
|
||||
`sun_glow_focus` float(3,2) unsigned NOT NULL DEFAULT '0.10',
|
||||
`sun_glow_size` float(3,2) unsigned NOT NULL DEFAULT '1.75',
|
||||
`scene_gamma` float(4,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`star_brightness` float(3,2) unsigned NOT NULL DEFAULT '0.00',
|
||||
`cloud_color_r` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_color_g` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_color_b` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_color_i` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_x` float(3,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`cloud_y` float(3,2) unsigned NOT NULL DEFAULT '0.53',
|
||||
`cloud_density` float(3,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`cloud_coverage` float(3,2) unsigned NOT NULL DEFAULT '0.27',
|
||||
`cloud_scale` float(3,2) unsigned NOT NULL DEFAULT '0.42',
|
||||
`cloud_detail_x` float(3,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`cloud_detail_y` float(3,2) unsigned NOT NULL DEFAULT '0.53',
|
||||
`cloud_detail_density` float(3,2) unsigned NOT NULL DEFAULT '0.12',
|
||||
`cloud_scroll_x` float(3,2) unsigned NOT NULL DEFAULT '0.20',
|
||||
`cloud_scroll_x_lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`cloud_scroll_y` float(3,2) unsigned NOT NULL DEFAULT '0.01',
|
||||
`cloud_scroll_y_lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`draw_classic_clouds` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`region_id`)
|
||||
);
|
||||
|
||||
|
||||
:VERSION 33 #---------------------
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
COMMIT;
|
||||
|
||||
:VERSION 34 #---------------------
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `regionwindlight` CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` FLOAT(4,2) NOT NULL DEFAULT '0.20' AFTER `cloud_detail_density`, CHANGE COLUMN `cloud_scroll_y` `cloud_scroll_y` FLOAT(4,2) NOT NULL DEFAULT '0.01' AFTER `cloud_scroll_x_lock`;
|
||||
COMMIT;
|
||||
|
||||
|
|
|
@ -76,6 +76,5 @@ namespace OpenSim.Data.Null
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Data.Null
|
|||
|
||||
m_DataByUUID[data.PrincipalID] = data;
|
||||
m_DataByName[data.FirstName + " " + data.LastName] = data;
|
||||
if (data.Data.ContainsKey("Email") && data.Data["Email"] != string.Empty)
|
||||
if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty)
|
||||
m_DataByEmail[data.Data["Email"]] = data;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE inventoryfolders(
|
||||
folderName varchar(255),
|
||||
type integer,
|
||||
version integer,
|
||||
folderID varchar(255) primary key,
|
||||
agentID varchar(255) not null default '00000000-0000-0000-0000-000000000000',
|
||||
parentFolderID varchar(255) not null default '00000000-0000-0000-0000-000000000000');
|
||||
|
||||
CREATE TABLE inventoryitems(
|
||||
assetID varchar(255),
|
||||
assetType integer,
|
||||
inventoryName varchar(255),
|
||||
inventoryDescription varchar(255),
|
||||
inventoryNextPermissions integer,
|
||||
inventoryCurrentPermissions integer,
|
||||
invType integer,
|
||||
creatorID varchar(255),
|
||||
inventoryBasePermissions integer,
|
||||
inventoryEveryOnePermissions integer,
|
||||
salePrice integer default 99,
|
||||
saleType integer default 0,
|
||||
creationDate integer default 2000,
|
||||
groupID varchar(255) default '00000000-0000-0000-0000-000000000000',
|
||||
groupOwned integer default 0,
|
||||
flags integer default 0,
|
||||
inventoryID varchar(255) primary key,
|
||||
parentFolderID varchar(255) not null default '00000000-0000-0000-0000-000000000000',
|
||||
avatarID varchar(255) not null default '00000000-0000-0000-0000-000000000000',
|
||||
inventoryGroupPermissions integer not null default 0);
|
||||
|
||||
create index inventoryfolders_agentid on inventoryfolders(agentID);
|
||||
create index inventoryfolders_parentid on inventoryfolders(parentFolderID);
|
||||
create index inventoryitems_parentfolderid on inventoryitems(parentFolderID);
|
||||
create index inventoryitems_avatarid on inventoryitems(avatarID);
|
||||
|
||||
COMMIT;
|
|
@ -1,8 +0,0 @@
|
|||
ATTACH 'inventoryStore.db' AS old;
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders;
|
||||
INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems;
|
||||
|
||||
COMMIT;
|
|
@ -1,5 +0,0 @@
|
|||
BEGIN;
|
||||
|
||||
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT;
|
|
@ -55,7 +55,7 @@ CREATE TABLE assets(
|
|||
Local,
|
||||
Temporary,
|
||||
asset_flags INTEGER NOT NULL DEFAULT 0,
|
||||
CreatorID varchar(36) default '',
|
||||
CreatorID varchar(128) default '',
|
||||
Data);
|
||||
|
||||
INSERT INTO assets(UUID,Name,Description,Type,Local,Temporary,Data)
|
||||
|
@ -64,3 +64,4 @@ DROP TABLE assets_backup;
|
|||
|
||||
COMMIT;
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
:VERSION 1
|
||||
:VERSION 1
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
|
@ -219,59 +219,6 @@ COMMIT;
|
|||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE estate_groups (
|
||||
EstateID int(10) NOT NULL,
|
||||
uuid char(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estate_managers (
|
||||
EstateID int(10) NOT NULL,
|
||||
uuid char(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estate_map (
|
||||
RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
|
||||
EstateID int(11) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estate_settings (
|
||||
EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
EstateName varchar(64) default NULL,
|
||||
AbuseEmailToEstateOwner tinyint(4) NOT NULL,
|
||||
DenyAnonymous tinyint(4) NOT NULL,
|
||||
ResetHomeOnTeleport tinyint(4) NOT NULL,
|
||||
FixedSun tinyint(4) NOT NULL,
|
||||
DenyTransacted tinyint(4) NOT NULL,
|
||||
BlockDwell tinyint(4) NOT NULL,
|
||||
DenyIdentified tinyint(4) NOT NULL,
|
||||
AllowVoice tinyint(4) NOT NULL,
|
||||
UseGlobalTime tinyint(4) NOT NULL,
|
||||
PricePerMeter int(11) NOT NULL,
|
||||
TaxFree tinyint(4) NOT NULL,
|
||||
AllowDirectTeleport tinyint(4) NOT NULL,
|
||||
RedirectGridX int(11) NOT NULL,
|
||||
RedirectGridY int(11) NOT NULL,
|
||||
ParentEstateID int(10) NOT NULL,
|
||||
SunPosition double NOT NULL,
|
||||
EstateSkipScripts tinyint(4) NOT NULL,
|
||||
BillableFactor float NOT NULL,
|
||||
PublicAccess tinyint(4) NOT NULL
|
||||
);
|
||||
insert into estate_settings (EstateID,EstateName,AbuseEmailToEstateOwner,DenyAnonymous,ResetHomeOnTeleport,FixedSun,DenyTransacted,BlockDwell,DenyIdentified,AllowVoice,UseGlobalTime,PricePerMeter,TaxFree,AllowDirectTeleport,RedirectGridX,RedirectGridY,ParentEstateID,SunPosition,PublicAccess,EstateSkipScripts,BillableFactor) values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
||||
delete from estate_settings;
|
||||
CREATE TABLE estate_users (
|
||||
EstateID int(10) NOT NULL,
|
||||
uuid char(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estateban (
|
||||
EstateID int(10) NOT NULL,
|
||||
bannedUUID varchar(36) NOT NULL,
|
||||
bannedIp varchar(16) NOT NULL,
|
||||
bannedIpHostMask varchar(16) NOT NULL,
|
||||
bannedNameMask varchar(64) default NULL
|
||||
);
|
||||
|
||||
drop table regionsettings;
|
||||
CREATE TABLE regionsettings (
|
||||
regionUUID char(36) NOT NULL,
|
||||
|
@ -307,7 +254,7 @@ CREATE TABLE regionsettings (
|
|||
fixed_sun int(11) NOT NULL,
|
||||
sun_position float NOT NULL,
|
||||
covenant char(36) default NULL,
|
||||
Sandbox tinyint(4) NOT NULL,
|
||||
sandbox tinyint(4) NOT NULL,
|
||||
PRIMARY KEY (regionUUID)
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
:VERSION 1
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE inventoryfolders(
|
||||
folderName varchar(64),
|
||||
type integer,
|
||||
version integer,
|
||||
folderID varchar(36) primary key,
|
||||
agentID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
|
||||
parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000');
|
||||
|
||||
CREATE TABLE inventoryitems(
|
||||
assetID varchar(36),
|
||||
assetType integer,
|
||||
inventoryName varchar(64),
|
||||
inventoryDescription varchar(128),
|
||||
inventoryNextPermissions integer,
|
||||
inventoryCurrentPermissions integer,
|
||||
invType integer,
|
||||
creatorID varchar(128),
|
||||
inventoryBasePermissions integer,
|
||||
inventoryEveryOnePermissions integer,
|
||||
salePrice integer default 99,
|
||||
saleType integer default 0,
|
||||
creationDate integer default 2000,
|
||||
groupID varchar(36) default '00000000-0000-0000-0000-000000000000',
|
||||
groupOwned integer default 0,
|
||||
flags integer default 0,
|
||||
inventoryID varchar(36) primary key,
|
||||
parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
|
||||
avatarID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
|
||||
inventoryGroupPermissions integer not null default 0);
|
||||
|
||||
create index inventoryfolders_agentid on inventoryfolders(agentID);
|
||||
create index inventoryfolders_parentid on inventoryfolders(parentFolderID);
|
||||
create index inventoryitems_parentfolderid on inventoryitems(parentFolderID);
|
||||
create index inventoryitems_avatarid on inventoryitems(avatarID);
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 2
|
||||
|
||||
ATTACH 'inventoryStore.db' AS old;
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders;
|
||||
INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems;
|
||||
|
||||
COMMIT;
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
ds = new DataSet("Region");
|
||||
|
||||
m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
|
||||
m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString);
|
||||
m_conn = new SqliteConnection(m_connectionString);
|
||||
m_conn.Open();
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on prims table");
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table");
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -165,16 +165,25 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on primshapes table");
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
itemsDa.Fill(ds.Tables["primitems"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
terrainDa.Fill(ds.Tables["terrain"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on terrain table");
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table");
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -183,7 +192,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on land table");
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on land table");
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -192,7 +201,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table");
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -201,7 +210,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table");
|
||||
}
|
||||
|
||||
// We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
|
||||
|
@ -434,7 +443,7 @@ namespace OpenSim.Data.SQLite
|
|||
lock (ds)
|
||||
{
|
||||
DataRow[] primsForRegion = prims.Select(byRegion);
|
||||
m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
|
||||
// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
|
||||
|
||||
// First, create all groups
|
||||
foreach (DataRow primRow in primsForRegion)
|
||||
|
@ -456,8 +465,8 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.Info(
|
||||
"[REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
m_log.Warn(
|
||||
"[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
prim.Shape = PrimitiveBaseShape.Default;
|
||||
}
|
||||
|
||||
|
@ -469,11 +478,11 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows");
|
||||
m_log.Info("[REGION DB]: " + e.ToString());
|
||||
m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
|
||||
m_log.Error("[SQLITE REGION DB]: ", e);
|
||||
foreach (DataColumn col in prims.Columns)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +507,7 @@ namespace OpenSim.Data.SQLite
|
|||
else
|
||||
{
|
||||
m_log.Warn(
|
||||
"[REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
"[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
prim.Shape = PrimitiveBaseShape.Default;
|
||||
}
|
||||
|
||||
|
@ -508,11 +517,11 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows");
|
||||
m_log.Info("[REGION DB]: " + e.ToString());
|
||||
m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
|
||||
m_log.Error("[SQLITE REGION DB]: ", e);
|
||||
foreach (DataColumn col in prims.Columns)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -525,20 +534,23 @@ namespace OpenSim.Data.SQLite
|
|||
/// </summary>
|
||||
/// <param name="prim">the prim</param>
|
||||
private void LoadItems(SceneObjectPart prim)
|
||||
{
|
||||
//m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
|
||||
|
||||
{
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
|
||||
|
||||
DataTable dbItems = ds.Tables["primitems"];
|
||||
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
|
||||
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
|
||||
DataRow[] dbItemRows = dbItems.Select(sql);
|
||||
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
|
||||
|
||||
foreach (DataRow row in dbItemRows)
|
||||
{
|
||||
TaskInventoryItem item = buildItem(row);
|
||||
inventory.Add(item);
|
||||
|
||||
//m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID);
|
||||
}
|
||||
|
||||
prim.Inventory.RestoreInventoryItems(inventory);
|
||||
|
@ -574,7 +586,7 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
// the following is an work around for .NET. The perf
|
||||
// issues associated with it aren't as bad as you think.
|
||||
m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString());
|
||||
m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString());
|
||||
String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
|
||||
" values(:RegionUUID, :Revision, :Heightfield)";
|
||||
|
||||
|
@ -630,11 +642,11 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[REGION DB]: No terrain found for region");
|
||||
m_log.Warn("[SQLITE REGION DB]: No terrain found for region");
|
||||
return null;
|
||||
}
|
||||
|
||||
m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
|
||||
m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
|
||||
}
|
||||
}
|
||||
return terret;
|
||||
|
@ -1417,7 +1429,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
|
||||
m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
|
||||
newData.UserLocation = Vector3.Zero;
|
||||
newData.UserLookAt = Vector3.Zero;
|
||||
}
|
||||
|
@ -1926,7 +1938,7 @@ namespace OpenSim.Data.SQLite
|
|||
/// <param name="items"></param>
|
||||
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||
{
|
||||
//m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
|
||||
|
||||
DataTable dbItems = ds.Tables["primitems"];
|
||||
|
||||
|
|
|
@ -66,11 +66,19 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
if (folder.folderName.Length > 64)
|
||||
folder.folderName = folder.folderName.Substring(0, 64);
|
||||
|
||||
return m_Folders.Store(folder);
|
||||
}
|
||||
|
||||
public bool StoreItem(XInventoryItem item)
|
||||
{
|
||||
if (item.inventoryName.Length > 64)
|
||||
item.inventoryName = item.inventoryName.Substring(0, 64);
|
||||
if (item.inventoryDescription.Length > 128)
|
||||
item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
|
||||
|
||||
return m_Items.Store(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -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))");
|
||||
}
|
||||
|
|
|
@ -21,4 +21,4 @@
|
|||
[TestConnections]
|
||||
MySqlConnection="Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;"
|
||||
SqlConnection="Server=.\SQL2008;Database=opensim-nunit;Trusted_Connection=True;"
|
||||
SqliteConnection=""
|
||||
SqliteConnection="URI=file:opensim-nunit.db,version=3"
|
|
@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(client))
|
||||
if (!mm.UploadCovered(client, mm.UploadCharge))
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
|
|
|
@ -265,6 +265,46 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public class ControllerData
|
||||
{
|
||||
public UUID ItemID;
|
||||
public uint IgnoreControls;
|
||||
public uint EventControls;
|
||||
|
||||
public ControllerData(UUID item, uint ignore, uint ev)
|
||||
{
|
||||
ItemID = item;
|
||||
IgnoreControls = ignore;
|
||||
EventControls = ev;
|
||||
}
|
||||
|
||||
public ControllerData(OSDMap args)
|
||||
{
|
||||
UnpackUpdateMessage(args);
|
||||
}
|
||||
|
||||
public OSDMap PackUpdateMessage()
|
||||
{
|
||||
OSDMap controldata = new OSDMap();
|
||||
controldata["item"] = OSD.FromUUID(ItemID);
|
||||
controldata["ignore"] = OSD.FromInteger(IgnoreControls);
|
||||
controldata["event"] = OSD.FromInteger(EventControls);
|
||||
|
||||
return controldata;
|
||||
}
|
||||
|
||||
|
||||
public void UnpackUpdateMessage(OSDMap args)
|
||||
{
|
||||
if (args["item"] != null)
|
||||
ItemID = args["item"].AsUUID();
|
||||
if (args["ignore"] != null)
|
||||
IgnoreControls = (uint)args["ignore"].AsInteger();
|
||||
if (args["event"] != null)
|
||||
EventControls = (uint)args["event"].AsInteger();
|
||||
}
|
||||
}
|
||||
|
||||
public class AgentData : IAgentData
|
||||
{
|
||||
private UUID m_id;
|
||||
|
@ -313,6 +353,9 @@ namespace OpenSim.Framework
|
|||
public UUID[] Wearables;
|
||||
public AttachmentData[] Attachments;
|
||||
|
||||
// Scripted
|
||||
public ControllerData[] Controllers;
|
||||
|
||||
public string CallbackURI;
|
||||
|
||||
public virtual OSDMap Pack()
|
||||
|
@ -403,6 +446,14 @@ namespace OpenSim.Framework
|
|||
args["attachments"] = attachs;
|
||||
}
|
||||
|
||||
if ((Controllers != null) && (Controllers.Length > 0))
|
||||
{
|
||||
OSDArray controls = new OSDArray(Controllers.Length);
|
||||
foreach (ControllerData ctl in Controllers)
|
||||
controls.Add(ctl.PackUpdateMessage());
|
||||
args["controllers"] = controls;
|
||||
}
|
||||
|
||||
|
||||
if ((CallbackURI != null) && (!CallbackURI.Equals("")))
|
||||
args["callback_uri"] = OSD.FromString(CallbackURI);
|
||||
|
@ -559,6 +610,20 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
|
||||
{
|
||||
OSDArray controls = (OSDArray)(args["controllers"]);
|
||||
Controllers = new ControllerData[controls.Count];
|
||||
int i = 0;
|
||||
foreach (OSD o in controls)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
{
|
||||
Controllers[i++] = new ControllerData((OSDMap)o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args["callback_uri"] != null)
|
||||
CallbackURI = args["callback_uri"].AsString();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace OpenSim.Framework.Console
|
|||
{
|
||||
public int last;
|
||||
public long lastLineSeen;
|
||||
public bool newConnection = true;
|
||||
}
|
||||
|
||||
// A console that uses REST interfaces
|
||||
|
@ -106,8 +107,15 @@ namespace OpenSim.Framework.Console
|
|||
|
||||
public override string ReadLine(string p, bool isCommand, bool e)
|
||||
{
|
||||
if (isCommand)
|
||||
Output("+++"+p);
|
||||
else
|
||||
Output("-++"+p);
|
||||
|
||||
m_DataEvent.WaitOne();
|
||||
|
||||
string cmdinput;
|
||||
|
||||
lock (m_InputData)
|
||||
{
|
||||
if (m_InputData.Count == 0)
|
||||
|
@ -116,29 +124,30 @@ namespace OpenSim.Framework.Console
|
|||
return "";
|
||||
}
|
||||
|
||||
string cmdinput = m_InputData[0];
|
||||
cmdinput = m_InputData[0];
|
||||
m_InputData.RemoveAt(0);
|
||||
if (m_InputData.Count == 0)
|
||||
m_DataEvent.Reset();
|
||||
|
||||
if (isCommand)
|
||||
{
|
||||
string[] cmd = Commands.Resolve(Parser.Parse(cmdinput));
|
||||
|
||||
if (cmd.Length != 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0 ; i < cmd.Length ; i++)
|
||||
{
|
||||
if (cmd[i].Contains(" "))
|
||||
cmd[i] = "\"" + cmd[i] + "\"";
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
return cmdinput;
|
||||
}
|
||||
|
||||
if (isCommand)
|
||||
{
|
||||
string[] cmd = Commands.Resolve(Parser.Parse(cmdinput));
|
||||
|
||||
if (cmd.Length != 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0 ; i < cmd.Length ; i++)
|
||||
{
|
||||
if (cmd[i].Contains(" "))
|
||||
cmd[i] = "\"" + cmd[i] + "\"";
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
return cmdinput;
|
||||
}
|
||||
|
||||
private void DoExpire()
|
||||
|
@ -308,7 +317,7 @@ namespace OpenSim.Framework.Console
|
|||
return reply;
|
||||
}
|
||||
|
||||
if (post["COMMAND"] == null || post["COMMAND"].ToString() == String.Empty)
|
||||
if (post["COMMAND"] == null)
|
||||
return reply;
|
||||
|
||||
lock (m_InputData)
|
||||
|
@ -416,6 +425,12 @@ namespace OpenSim.Framework.Console
|
|||
XmlElement rootElement = xmldoc.CreateElement("", "ConsoleSession",
|
||||
"");
|
||||
|
||||
if (c.newConnection)
|
||||
{
|
||||
c.newConnection = false;
|
||||
Output("+++" + DefaultPrompt);
|
||||
}
|
||||
|
||||
lock (m_Scrollback)
|
||||
{
|
||||
long startLine = m_LineNumber - m_Scrollback.Count;
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Framework
|
|||
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
|
||||
|
||||
public delegate void ObjectAttach(
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent);
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
|
||||
|
||||
public delegate void ModifyTerrain(UUID user,
|
||||
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
|
||||
|
@ -1017,7 +1017,6 @@ namespace OpenSim.Framework
|
|||
|
||||
void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
|
||||
|
||||
void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID);
|
||||
void SetChildAgentThrottle(byte[] throttle);
|
||||
|
||||
void SendAvatarDataImmediate(ISceneEntity avatar);
|
||||
|
@ -1308,5 +1307,7 @@ namespace OpenSim.Framework
|
|||
|
||||
void SendChangeUserRights(UUID agentID, UUID friendID, int rights);
|
||||
void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId);
|
||||
|
||||
void StopFlying(ISceneEntity presence);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,35 +35,15 @@ namespace OpenSim.Framework
|
|||
bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
|
||||
int amount);
|
||||
|
||||
int GetBalance(IClientAPI client);
|
||||
void ApplyUploadCharge(UUID agentID);
|
||||
bool UploadCovered(IClientAPI client);
|
||||
void ApplyGroupCreationCharge(UUID agentID);
|
||||
bool GroupCreationCovered(IClientAPI client);
|
||||
int GetBalance(UUID agentID);
|
||||
bool UploadCovered(IClientAPI client, int amount);
|
||||
bool AmountCovered(IClientAPI client, int amount);
|
||||
void ApplyCharge(UUID agentID, int amount, string text);
|
||||
void ApplyUploadCharge(UUID agentID, int amount, string text);
|
||||
|
||||
EconomyData GetEconomyData();
|
||||
int UploadCharge { get; }
|
||||
int GroupCreationCharge { get; }
|
||||
|
||||
event ObjectPaid OnObjectPaid;
|
||||
}
|
||||
|
||||
public struct EconomyData
|
||||
{
|
||||
public int ObjectCapacity;
|
||||
public int ObjectCount;
|
||||
public int PriceEnergyUnit;
|
||||
public int PriceGroupCreate;
|
||||
public int PriceObjectClaim;
|
||||
public float PriceObjectRent;
|
||||
public float PriceObjectScaleFactor;
|
||||
public int PriceParcelClaim;
|
||||
public float PriceParcelClaimFactor;
|
||||
public int PriceParcelRent;
|
||||
public int PricePublicObjectDecay;
|
||||
public int PricePublicObjectDelete;
|
||||
public int PriceRentLight;
|
||||
public int PriceUpload;
|
||||
public int TeleportMinPrice;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,14 +29,15 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class RegionLightShareData : ICloneable
|
||||
|
@ -96,10 +97,9 @@ namespace OpenSim.Framework
|
|||
|
||||
[Serializable]
|
||||
public class SimpleRegionInfo
|
||||
{
|
||||
// private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
|
||||
/// </summary>
|
||||
|
@ -327,8 +327,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public class RegionInfo
|
||||
{
|
||||
// private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public bool commFailTF = false;
|
||||
public ConfigurationMember configMember;
|
||||
|
@ -772,9 +771,16 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if (externalName == "SYSTEMIP")
|
||||
{
|
||||
m_externalHostName = Util.GetLocalHost().ToString();
|
||||
m_log.InfoFormat(
|
||||
"[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
|
||||
m_externalHostName, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_externalHostName = externalName;
|
||||
}
|
||||
|
||||
m_regionType = config.GetString("RegionType", String.Empty);
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(string.Format("[BASE HTTP SERVER]: OnRequest() failed with "), e);
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
@ -106,4 +117,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
m_request.Enqueue(pPollServiceHttpRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace OpenSim
|
|||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7";
|
||||
private const string VERSION_NUMBER = "0.7.1";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
|
||||
public enum Flavour
|
||||
|
@ -71,4 +71,4 @@ namespace OpenSim
|
|||
/// </value>
|
||||
public readonly static int MajorInterfaceVersion = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("GET from URL " + url + " failed: " + ex.Message);
|
||||
m_log.Warn(httpVerb + " on URL " + url + " failed: " + ex.Message);
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,9 +192,7 @@ namespace OpenSim
|
|||
// Hook up to the watchdog timer
|
||||
Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
|
||||
|
||||
PrintFileToConsole("startuplogo.txt");
|
||||
|
||||
m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString());
|
||||
PrintFileToConsole("startuplogo.txt");
|
||||
|
||||
// For now, start at the 'root' level by default
|
||||
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
|
||||
|
|
|
@ -367,13 +367,13 @@ namespace OpenSim
|
|||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
// We need to do this after we've initialized the
|
||||
// scripting engines.
|
||||
scene.CreateScriptInstances();
|
||||
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
m_sceneManager.Add(scene);
|
||||
|
||||
if (m_autoCreateClientStack)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,6 +331,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// </value>
|
||||
protected HashSet<uint> m_killRecord;
|
||||
|
||||
// protected HashSet<uint> m_attachmentsSent;
|
||||
|
||||
private int m_moneyBalance;
|
||||
private int m_animationSequenceNumber = 1;
|
||||
private bool m_SendLogoutPacketWhenClosing = true;
|
||||
|
@ -355,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;
|
||||
|
@ -427,9 +428,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
|
||||
m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
|
||||
m_killRecord = new HashSet<uint>();
|
||||
// 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());
|
||||
|
@ -3411,6 +3412,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
|
||||
|
||||
OutPacket(objupdate, ThrottleOutPacketType.Task);
|
||||
|
||||
// We need to record the avatar local id since the root prim of an attachment points to this.
|
||||
// m_attachmentsSent.Add(avatar.LocalId);
|
||||
}
|
||||
|
||||
public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
|
||||
|
@ -3420,7 +3424,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
|
||||
loc.Header.Reliable = false;
|
||||
|
||||
// Each packet can only hold around 62 avatar positions and the client clears the mini-map each time
|
||||
// Each packet can only hold around 60 avatar positions and the client clears the mini-map each time
|
||||
// a CoarseLocationUpdate packet is received. Oh well.
|
||||
int total = Math.Min(CoarseLocations.Count, 60);
|
||||
|
||||
|
@ -3466,7 +3470,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
|
||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
|
||||
}
|
||||
|
||||
private void ProcessEntityUpdates(int maxUpdates)
|
||||
|
@ -3542,9 +3546,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (!canUseImproved && !canUseCompressed)
|
||||
{
|
||||
if (update.Entity is ScenePresence)
|
||||
{
|
||||
objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
|
||||
}
|
||||
else
|
||||
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
|
||||
{
|
||||
// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
|
||||
// {
|
||||
// SceneObjectPart sop = (SceneObjectPart)update.Entity;
|
||||
// string text = sop.Text;
|
||||
// if (text.IndexOf("\n") >= 0)
|
||||
// text = text.Remove(text.IndexOf("\n"));
|
||||
//
|
||||
// if (m_attachmentsSent.Contains(sop.ParentID))
|
||||
// {
|
||||
//// m_log.DebugFormat(
|
||||
//// "[CLIENT]: Sending full info about attached prim {0} text {1}",
|
||||
//// sop.LocalId, text);
|
||||
//
|
||||
// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
|
||||
//
|
||||
// m_attachmentsSent.Add(sop.LocalId);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
|
||||
// sop.LocalId, text, sop.ParentID);
|
||||
//
|
||||
// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
|
||||
// }
|
||||
}
|
||||
}
|
||||
else if (!canUseImproved)
|
||||
{
|
||||
|
@ -3641,30 +3678,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
#endregion Primitive Packet/Data Sending Methods
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="attachPoint"></param>
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD
|
||||
return;
|
||||
|
||||
ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
attach.AgentData.AgentID = AgentId;
|
||||
attach.AgentData.SessionID = m_sessionId;
|
||||
attach.AgentData.AttachmentPoint = attachPoint;
|
||||
attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
|
||||
attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
|
||||
attach.ObjectData[0].ObjectLocalID = localID;
|
||||
attach.ObjectData[0].Rotation = rotation;
|
||||
attach.Header.Zerocoded = true;
|
||||
OutPacket(attach, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
||||
{
|
||||
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
|
||||
|
@ -5694,7 +5707,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
if (att.ObjectData.Length > 0)
|
||||
{
|
||||
handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false);
|
||||
handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6264,8 +6277,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (handlerObjectDuplicate != null)
|
||||
{
|
||||
handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
|
||||
dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
|
||||
AgentandGroupData.GroupID);
|
||||
dupe.SharedData.DuplicateFlags, AgentId,
|
||||
m_activeGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6855,7 +6868,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (handlerObjectDuplicateOnRay != null)
|
||||
{
|
||||
handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
|
||||
dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
|
||||
AgentId, m_activeGroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
|
||||
dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
|
||||
dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
|
||||
}
|
||||
|
@ -7157,59 +7170,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;
|
||||
}
|
||||
|
||||
|
@ -11420,15 +11396,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);
|
||||
|
@ -11444,49 +11411,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;
|
||||
|
@ -11804,5 +11747,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
dialog.Buttons = buttons;
|
||||
OutPacket(dialog, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void StopFlying(ISceneEntity p)
|
||||
{
|
||||
if (p is ScenePresence)
|
||||
{
|
||||
ScenePresence presence = p as ScenePresence;
|
||||
// It turns out to get the agent to stop flying, you have to feed it stop flying velocities
|
||||
// There's no explicit message to send the client to tell it to stop flying.. it relies on the
|
||||
// velocity, collision plane and avatar height
|
||||
|
||||
// Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
|
||||
// when the avatar stands up
|
||||
|
||||
Vector3 pos = presence.AbsolutePosition;
|
||||
|
||||
if (presence.Appearance.AvatarHeight != 127.0f)
|
||||
pos += new Vector3(0f, 0f, (presence.Appearance.AvatarHeight/6f));
|
||||
else
|
||||
pos += new Vector3(0f, 0f, (1.56f/6f));
|
||||
|
||||
presence.AbsolutePosition = pos;
|
||||
|
||||
// attach a suitable collision plane regardless of the actual situation to force the LLClient to land.
|
||||
// Collision plane below the avatar's position a 6th of the avatar's height is suitable.
|
||||
// Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a
|
||||
// certain amount.. because the LLClient wouldn't land in that situation anyway.
|
||||
|
||||
// why are we still testing for this really old height value default???
|
||||
if (presence.Appearance.AvatarHeight != 127.0f)
|
||||
presence.CollisionPlane = new Vector4(0, 0, 0, pos.Z - presence.Appearance.AvatarHeight/6f);
|
||||
else
|
||||
presence.CollisionPlane = new Vector4(0, 0, 0, pos.Z - (1.56f/6f));
|
||||
|
||||
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock block =
|
||||
CreateImprovedTerseBlock(p, false);
|
||||
|
||||
const float TIME_DILATION = 1.0f;
|
||||
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
|
||||
|
||||
|
||||
ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
|
||||
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||
packet.RegionData.TimeDilation = timeDilation;
|
||||
packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
|
||||
packet.ObjectData[0] = block;
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||
}
|
||||
|
||||
//ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
|
||||
// AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient)));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(remoteClient))
|
||||
if (!mm.UploadCovered(remoteClient, mm.UploadCharge))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -131,6 +131,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
{
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
httpResponse.Send();
|
||||
return null;
|
||||
}
|
||||
SendTexture(httpRequest, httpResponse, texture);
|
||||
}
|
||||
else
|
||||
|
@ -147,6 +153,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
{
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
httpResponse.Send();
|
||||
return null;
|
||||
}
|
||||
SendTexture(httpRequest, httpResponse, texture);
|
||||
}
|
||||
else
|
||||
|
@ -178,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;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
|
@ -68,102 +69,117 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
|
||||
// Called by client
|
||||
//
|
||||
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
|
||||
{
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
|
||||
|
||||
// If we can't take it, we can't attach it!
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||
try
|
||||
{
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
// Save avatar attachment information
|
||||
ScenePresence presence;
|
||||
if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
// If we can't take it, we can't attach it!
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false))
|
||||
{
|
||||
m_log.Info(
|
||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
// Save avatar attachment information
|
||||
ScenePresence presence;
|
||||
if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
{
|
||||
m_log.Info(
|
||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
public bool AttachObject(
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
|
||||
public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
|
||||
{
|
||||
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
|
||||
if (group != null)
|
||||
Vector3 attachPos = group.AbsolutePosition;
|
||||
|
||||
if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
|
||||
{
|
||||
if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
|
||||
// If the attachment point isn't the same as the one previously used
|
||||
// set it's offset position = 0 so that it appears on the attachment point
|
||||
// and not in a weird location somewhere unknown.
|
||||
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
|
||||
{
|
||||
// If the attachment point isn't the same as the one previously used
|
||||
// set it's offset position = 0 so that it appears on the attachment point
|
||||
// and not in a weird location somewhere unknown.
|
||||
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Check object for stored attachment point
|
||||
AttachmentPt = (uint)group.GetAttachmentPoint();
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Stick it on left hand with Zero Offset from the attachment point.
|
||||
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// Remove any previous attachments
|
||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||
UUID itemID = UUID.Zero;
|
||||
if (sp != null)
|
||||
{
|
||||
foreach(SceneObjectGroup grp in sp.Attachments)
|
||||
{
|
||||
attachPos = Vector3.Zero;
|
||||
if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
|
||||
{
|
||||
itemID = grp.GetFromItemID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (itemID != UUID.Zero)
|
||||
DetachSingleAttachmentToInv(itemID, remoteClient);
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Check object for stored attachment point
|
||||
AttachmentPt = (uint)group.GetAttachmentPoint();
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Stick it on left hand with Zero Offset from the attachment point.
|
||||
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// Saves and gets itemID
|
||||
UUID itemId;
|
||||
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemId = group.GetFromItemID();
|
||||
}
|
||||
|
||||
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group);
|
||||
|
||||
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
|
||||
|
||||
// In case it is later dropped again, don't let
|
||||
// it get cleaned up
|
||||
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
group.HasGroupChanged = false;
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"You don't have sufficient permissions to attach this object", false);
|
||||
|
||||
return false;
|
||||
itemID = group.GetFromItemID();
|
||||
}
|
||||
|
||||
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
|
||||
|
||||
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
|
||||
|
||||
// In case it is later dropped again, don't let
|
||||
// it get cleaned up
|
||||
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
group.HasGroupChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: AttachObject found no such scene object {0}", objectLocalID);
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"You don't have sufficient permissions to attach this object", false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -229,8 +245,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
||||
tainted = true;
|
||||
|
||||
AttachObject(
|
||||
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
|
||||
AttachObject(remoteClient, objatt, AttachmentPt, false);
|
||||
//objatt.ScheduleGroupForFullUpdate();
|
||||
|
||||
if (tainted)
|
||||
|
@ -344,7 +359,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
// Save avatar attachment information
|
||||
if (m_scene.AvatarFactory != null)
|
||||
{
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID);
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Dettaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
|
||||
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
public void UpdateDatabase(UUID user, AvatarAppearance appearance)
|
||||
{
|
||||
//m_log.DebugFormat("[APPEARANCE]: UpdateDatabase");
|
||||
m_log.DebugFormat("[APPEARANCE]: UpdateDatabase");
|
||||
AvatarData adata = new AvatarData(appearance);
|
||||
m_scene.AvatarService.SetAvatar(user, adata);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
{
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (!presence.IsChildAgent)
|
||||
presence.ControllingClient.SendAlertMessage(message);
|
||||
presence.ControllingClient.SendAlertMessage(message);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -119,7 +118,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 +127,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 +148,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);
|
||||
}
|
||||
|
||||
|
@ -205,4 +204,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,10 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
|
||||
protected IGridService GridService
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Scenes[0].GridService;
|
||||
}
|
||||
get { return m_Scenes[0].GridService; }
|
||||
}
|
||||
|
||||
public IUserAccountService UserAccountService
|
||||
{
|
||||
get { return m_Scenes[0].UserAccountService; }
|
||||
}
|
||||
|
||||
public IScene Scene
|
||||
|
@ -218,41 +220,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
|
||||
client.OnGrantUserRights += OnGrantUserRights;
|
||||
|
||||
client.OnLogout += OnLogout;
|
||||
|
||||
if (m_Friends.ContainsKey(client.AgentId))
|
||||
lock (m_Friends)
|
||||
{
|
||||
m_Friends[client.AgentId].Refcount++;
|
||||
return;
|
||||
if (m_Friends.ContainsKey(client.AgentId))
|
||||
{
|
||||
m_Friends[client.AgentId].Refcount++;
|
||||
return;
|
||||
}
|
||||
|
||||
UserFriendData newFriends = new UserFriendData();
|
||||
|
||||
newFriends.PrincipalID = client.AgentId;
|
||||
newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
|
||||
newFriends.Refcount = 1;
|
||||
newFriends.RegionID = UUID.Zero;
|
||||
|
||||
m_Friends.Add(client.AgentId, newFriends);
|
||||
}
|
||||
|
||||
UserFriendData newFriends = new UserFriendData();
|
||||
|
||||
newFriends.PrincipalID = client.AgentId;
|
||||
newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
|
||||
newFriends.Refcount = 1;
|
||||
newFriends.RegionID = UUID.Zero;
|
||||
|
||||
m_Friends.Add(client.AgentId, newFriends);
|
||||
|
||||
//StatusChange(client.AgentId, true);
|
||||
}
|
||||
|
||||
private void OnClientClosed(UUID agentID, Scene scene)
|
||||
{
|
||||
if (m_Friends.ContainsKey(agentID))
|
||||
{
|
||||
if (m_Friends[agentID].Refcount == 1)
|
||||
m_Friends.Remove(agentID);
|
||||
else
|
||||
m_Friends[agentID].Refcount--;
|
||||
}
|
||||
}
|
||||
ScenePresence sp = scene.GetScenePresence(agentID);
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
// do this for root agents closing out
|
||||
StatusChange(agentID, false);
|
||||
|
||||
private void OnLogout(IClientAPI client)
|
||||
{
|
||||
StatusChange(client.AgentId, false);
|
||||
m_Friends.Remove(client.AgentId);
|
||||
lock (m_Friends)
|
||||
if (m_Friends.ContainsKey(agentID))
|
||||
{
|
||||
if (m_Friends[agentID].Refcount == 1)
|
||||
m_Friends.Remove(agentID);
|
||||
else
|
||||
m_Friends[agentID].Refcount--;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMakeRootAgent(ScenePresence sp)
|
||||
|
@ -261,11 +263,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
|
||||
if (m_Friends.ContainsKey(agentID))
|
||||
{
|
||||
if (m_Friends[agentID].RegionID == UUID.Zero && m_Friends[agentID].Friends == null)
|
||||
{
|
||||
m_Friends[agentID].Friends =
|
||||
// This is probably an overkill, but just
|
||||
// to make sure we have the latest and greatest
|
||||
// friends list -- always pull OnMakeRoot
|
||||
m_Friends[agentID].Friends =
|
||||
m_FriendsService.GetFriends(agentID);
|
||||
}
|
||||
|
||||
m_Friends[agentID].RegionID =
|
||||
sp.ControllingClient.Scene.RegionInfo.RegionID;
|
||||
}
|
||||
|
@ -431,20 +434,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
/// <param name="online"></param>
|
||||
private void StatusChange(UUID agentID, bool online)
|
||||
{
|
||||
//m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online);
|
||||
if (m_Friends.ContainsKey(agentID))
|
||||
{
|
||||
//m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
|
||||
List<FriendInfo> friendList = new List<FriendInfo>();
|
||||
foreach (FriendInfo fi in m_Friends[agentID].Friends)
|
||||
{
|
||||
if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
|
||||
friendList.Add(fi);
|
||||
}
|
||||
foreach (FriendInfo fi in friendList)
|
||||
|
||||
Util.FireAndForget(delegate
|
||||
{
|
||||
// Notify about this user status
|
||||
StatusNotify(fi, agentID, online);
|
||||
}
|
||||
foreach (FriendInfo fi in friendList)
|
||||
{
|
||||
//m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
|
||||
// Notify about this user status
|
||||
StatusNotify(fi, agentID, online);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID);
|
||||
}
|
||||
|
||||
private void StatusNotify(FriendInfo friend, UUID userID, bool online)
|
||||
|
@ -456,21 +468,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
// Try local
|
||||
if (LocalStatusNotification(userID, friendID, online))
|
||||
return;
|
||||
|
||||
|
||||
// The friend is not here [as root]. Let's forward.
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||
if (friendSessions != null && friendSessions.Length > 0)
|
||||
{
|
||||
PresenceInfo friendSession = friendSessions[0];
|
||||
PresenceInfo friendSession = null;
|
||||
foreach (PresenceInfo pinfo in friendSessions)
|
||||
if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
|
||||
{
|
||||
friendSession = pinfo;
|
||||
break;
|
||||
}
|
||||
|
||||
if (friendSession != null)
|
||||
{
|
||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
|
||||
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
|
||||
}
|
||||
}
|
||||
|
||||
// Friend is not online. Ignore.
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
|
||||
}
|
||||
|
||||
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||
|
@ -481,7 +503,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
UUID principalID = new UUID(im.fromAgentID);
|
||||
UUID friendID = new UUID(im.toAgentID);
|
||||
|
||||
m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID);
|
||||
m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2}", principalID, im.fromAgentName, friendID);
|
||||
|
||||
// This user wants to be friends with the other user.
|
||||
// Let's add the relation backwards, in case the other is not online
|
||||
|
@ -499,6 +521,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
im.imSessionID = im.fromAgentID;
|
||||
|
||||
// Try the local sim
|
||||
UserAccount account = UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, agentID);
|
||||
im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
|
||||
|
||||
if (LocalFriendshipOffered(friendID, im))
|
||||
return;
|
||||
|
||||
|
@ -518,12 +543,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
|
||||
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
|
||||
{
|
||||
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
|
||||
|
||||
FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
|
||||
FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
|
||||
// update the local cache
|
||||
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
|
||||
|
||||
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
|
||||
|
||||
//
|
||||
// Notify the friend
|
||||
|
@ -572,7 +598,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
if (friendSession != null)
|
||||
{
|
||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
|
||||
if (region != null)
|
||||
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
|
||||
else
|
||||
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -739,8 +768,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
|
||||
if (canEditObjectsChanged)
|
||||
friendClient.SendChangeUserRights(userID, friendID, rights);
|
||||
|
||||
}
|
||||
|
||||
// update local cache
|
||||
//m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
|
||||
foreach (FriendInfo finfo in m_Friends[friendID].Friends)
|
||||
if (finfo.Friend == userID.ToString())
|
||||
finfo.TheirFlags = rights;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -753,7 +789,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
IClientAPI friendClient = LocateClientObject(friendID);
|
||||
if (friendClient != null)
|
||||
{
|
||||
//m_log.DebugFormat("[FRIENDS]: Notify {0} that user {1} is {2}", friend.Friend, userID, online);
|
||||
//m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
|
||||
// the friend in this sim as root agent
|
||||
if (online)
|
||||
friendClient.SendAgentOnline(new UUID[] { userID });
|
||||
|
|
|
@ -35,6 +35,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
|
@ -61,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
sr.Close();
|
||||
body = body.Trim();
|
||||
|
||||
m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -115,9 +116,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
if (!UUID.TryParse(request["ToID"].ToString(), out toID))
|
||||
return FailureResult();
|
||||
|
||||
GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, "", toID,
|
||||
UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID);
|
||||
string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
|
||||
|
||||
GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID,
|
||||
(byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero);
|
||||
|
||||
|
||||
// !! HACK
|
||||
im.imSessionID = im.fromAgentID;
|
||||
|
||||
if (m_FriendsModule.LocalFriendshipOffered(toID, im))
|
||||
return SuccessResult();
|
||||
|
||||
|
|
|
@ -268,6 +268,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
|
||||
fromAgentName = (string)requestData["from_agent_name"];
|
||||
message = (string)requestData["message"];
|
||||
if (message == null)
|
||||
message = string.Empty;
|
||||
|
||||
// Bytes don't transfer well over XMLRPC, so, we Base64 Encode them.
|
||||
string requestData1 = (string)requestData["dialog"];
|
||||
|
|
|
@ -93,36 +93,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// </returns>
|
||||
public List<InventoryNodeBase> Execute()
|
||||
{
|
||||
string filePath = "ERROR";
|
||||
int successfulAssetRestores = 0;
|
||||
int failedAssetRestores = 0;
|
||||
int successfulItemRestores = 0;
|
||||
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
||||
|
||||
//InventoryFolderImpl rootDestinationFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
||||
InventoryFolderBase rootDestinationFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(
|
||||
m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
|
||||
|
||||
if (null == rootDestinationFolder)
|
||||
{
|
||||
// Possibly provide an option later on to automatically create this folder if it does not exist
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
|
||||
|
||||
return nodesLoaded;
|
||||
}
|
||||
|
||||
archive = new TarArchiveReader(m_loadStream);
|
||||
|
||||
// In order to load identically named folders, we need to keep track of the folders that we have already
|
||||
// created
|
||||
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||
|
||||
byte[] data;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
|
||||
try
|
||||
{
|
||||
string filePath = "ERROR";
|
||||
int successfulAssetRestores = 0;
|
||||
int failedAssetRestores = 0;
|
||||
int successfulItemRestores = 0;
|
||||
|
||||
List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
|
||||
|
||||
List<InventoryFolderBase> folderCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(
|
||||
m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
|
||||
|
||||
if (folderCandidates.Count == 0)
|
||||
{
|
||||
// Possibly provide an option later on to automatically create this folder if it does not exist
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
|
||||
|
||||
return loadedNodes;
|
||||
}
|
||||
|
||||
InventoryFolderBase rootDestinationFolder = folderCandidates[0];
|
||||
archive = new TarArchiveReader(m_loadStream);
|
||||
|
||||
// In order to load identically named folders, we need to keep track of the folders that we have already
|
||||
// resolved
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
|
||||
|
||||
byte[] data;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
|
||||
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
|
||||
{
|
||||
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||
|
@ -139,10 +140,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
}
|
||||
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
|
||||
{
|
||||
filePath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
|
||||
|
||||
// Trim off the file portion if we aren't already dealing with a directory path
|
||||
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
|
||||
filePath = filePath.Remove(filePath.LastIndexOf("/") + 1);
|
||||
|
||||
InventoryFolderBase foundFolder
|
||||
= ReplicateArchivePathToUserInventory(
|
||||
filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
|
||||
rootDestinationFolder, foldersCreated, nodesLoaded);
|
||||
filePath, rootDestinationFolder, resolvedFolders, loadedNodes);
|
||||
|
||||
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
|
||||
{
|
||||
|
@ -155,23 +161,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
// If we're loading an item directly into the given destination folder then we need to record
|
||||
// it separately from any loaded root folders
|
||||
if (rootDestinationFolder == foundFolder)
|
||||
nodesLoaded.Add(item);
|
||||
loadedNodes.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
archive.Close();
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
|
||||
successfulAssetRestores, failedAssetRestores);
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
|
||||
|
||||
return loadedNodes;
|
||||
}
|
||||
finally
|
||||
{
|
||||
archive.Close();
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
|
||||
successfulAssetRestores, failedAssetRestores);
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
|
||||
|
||||
return nodesLoaded;
|
||||
m_loadStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -183,81 +191,139 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <summary>
|
||||
/// Replicate the inventory paths in the archive to the user's inventory as necessary.
|
||||
/// </summary>
|
||||
/// <param name="archivePath">The item archive path to replicate</param>
|
||||
/// <param name="isDir">Is the path we're dealing with a directory?</param>
|
||||
/// <param name="iarPath">The item archive path to replicate</param>
|
||||
/// <param name="rootDestinationFolder">The root folder for the inventory load</param>
|
||||
/// <param name="foldersCreated">
|
||||
/// The folders created so far. This method will add more folders if necessary
|
||||
/// <param name="resolvedFolders">
|
||||
/// The folders that we have resolved so far for a given archive path.
|
||||
/// This method will add more folders if necessary
|
||||
/// </param>
|
||||
/// <param name="nodesLoaded">
|
||||
/// Track the inventory nodes created. This is distinct from the folders created since for a particular folder
|
||||
/// chain, only the root node needs to be recorded
|
||||
/// <param name="loadedNodes">
|
||||
/// Track the inventory nodes created.
|
||||
/// </param>
|
||||
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
||||
public InventoryFolderBase ReplicateArchivePathToUserInventory(
|
||||
string archivePath,
|
||||
bool isDir,
|
||||
string iarPath,
|
||||
InventoryFolderBase rootDestFolder,
|
||||
Dictionary <string, InventoryFolderBase> foldersCreated,
|
||||
List<InventoryNodeBase> nodesLoaded)
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders,
|
||||
List<InventoryNodeBase> loadedNodes)
|
||||
{
|
||||
archivePath = archivePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
|
||||
|
||||
// Remove the file portion if we aren't already dealing with a directory path
|
||||
if (!isDir)
|
||||
archivePath = archivePath.Remove(archivePath.LastIndexOf("/") + 1);
|
||||
|
||||
string originalArchivePath = archivePath;
|
||||
string iarPathExisting = iarPath;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
|
||||
|
||||
InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
|
||||
|
||||
// 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);
|
||||
|
||||
return destFolder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolve a destination folder
|
||||
/// </summary>
|
||||
///
|
||||
/// We require here a root destination folder (usually the root of the user's inventory) and the archive
|
||||
/// path. We also pass in a list of previously resolved folders in case we've found this one previously.
|
||||
///
|
||||
/// <param name="archivePath">
|
||||
/// The item archive path to resolve. The portion of the path passed back is that
|
||||
/// which corresponds to the resolved desintation folder.
|
||||
/// <param name="rootDestinationFolder">
|
||||
/// The root folder for the inventory load
|
||||
/// </param>
|
||||
/// <param name="resolvedFolders">
|
||||
/// The folders that we have resolved so far for a given archive path.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The folder in the user's inventory that matches best the archive path given. If no such folder was found
|
||||
/// then the passed in root destination folder is returned.
|
||||
/// </returns>
|
||||
protected InventoryFolderBase ResolveDestinationFolder(
|
||||
InventoryFolderBase rootDestFolder,
|
||||
ref string archivePath,
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders)
|
||||
{
|
||||
// string originalArchivePath = archivePath;
|
||||
|
||||
InventoryFolderBase destFolder = null;
|
||||
|
||||
// XXX: Nasty way of dealing with a path that has no directory component
|
||||
if (archivePath.Length > 0)
|
||||
{
|
||||
while (null == destFolder && archivePath.Length > 0)
|
||||
{
|
||||
if (foldersCreated.ContainsKey(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);
|
||||
destFolder = foldersCreated[archivePath];
|
||||
destFolder = resolvedFolders[archivePath];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't include the last slash
|
||||
// Don't include the last slash so find the penultimate one
|
||||
int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
|
||||
|
||||
if (penultimateSlashIndex >= 0)
|
||||
{
|
||||
// Remove the last section of path so that we can see if we've already resolved the parent
|
||||
archivePath = archivePath.Remove(penultimateSlashIndex + 1);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (null == destFolder)
|
||||
destFolder = rootDestFolder;
|
||||
}
|
||||
|
||||
string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length);
|
||||
string[] rawDirsToCreate
|
||||
= archivePathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
return destFolder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a set of folders for the given path.
|
||||
/// </summary>
|
||||
/// <param name="destFolder">
|
||||
/// The root folder from which the creation will take place.
|
||||
/// </param>
|
||||
/// <param name="iarPathExisting">
|
||||
/// the part of the iar path that already exists
|
||||
/// </param>
|
||||
/// <param name="iarPathToReplicate">
|
||||
/// The path to replicate in the user's inventory from iar
|
||||
/// </param>
|
||||
/// <param name="resolvedFolders">
|
||||
/// The folders that we have resolved so far for a given archive path.
|
||||
/// </param>
|
||||
/// <param name="loadedNodes">
|
||||
/// Track the inventory nodes created.
|
||||
/// </param>
|
||||
protected void CreateFoldersForPath(
|
||||
InventoryFolderBase destFolder,
|
||||
string iarPathExisting,
|
||||
string iarPathToReplicate,
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders,
|
||||
List<InventoryNodeBase> loadedNodes)
|
||||
{
|
||||
string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
int i = 0;
|
||||
|
||||
while (i < rawDirsToCreate.Length)
|
||||
{
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading archived folder {0}", rawDirsToCreate[i]);
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0} from IAR", rawDirsToCreate[i]);
|
||||
|
||||
int identicalNameIdentifierIndex
|
||||
= rawDirsToCreate[i].LastIndexOf(
|
||||
|
@ -282,66 +348,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
newFolderId, newFolderName, m_userInfo.PrincipalID,
|
||||
(short)AssetType.Unknown, destFolder.ID, 1);
|
||||
m_scene.InventoryService.AddFolder(destFolder);
|
||||
|
||||
// UUID newFolderId = UUID.Random();
|
||||
// m_scene.InventoryService.AddFolder(
|
||||
// m_userInfo.CreateFolder(
|
||||
// folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
|
||||
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Retrieving newly created folder {0}", folderName);
|
||||
// foundFolder = foundFolder.GetChildFolder(newFolderId);
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Retrieved newly created folder {0} with ID {1}",
|
||||
// foundFolder.Name, foundFolder.ID);
|
||||
|
||||
// Record that we have now created this folder
|
||||
archivePath += rawDirsToCreate[i] + "/";
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loaded archive path {0}", archivePath);
|
||||
foldersCreated[archivePath] = destFolder;
|
||||
iarPathExisting += rawDirsToCreate[i] + "/";
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Created folder {0} from IAR", iarPathExisting);
|
||||
resolvedFolders[iarPathExisting] = destFolder;
|
||||
|
||||
if (0 == i)
|
||||
nodesLoaded.Add(destFolder);
|
||||
loadedNodes.Add(destFolder);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return destFolder;
|
||||
|
||||
/*
|
||||
string[] rawFolders = filePath.Split(new char[] { '/' });
|
||||
|
||||
// Find the folders that do exist along the path given
|
||||
int i = 0;
|
||||
bool noFolder = false;
|
||||
InventoryFolderImpl foundFolder = rootDestinationFolder;
|
||||
while (!noFolder && i < rawFolders.Length)
|
||||
{
|
||||
InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]);
|
||||
if (null != folder)
|
||||
{
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name);
|
||||
foundFolder = folder;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
noFolder = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Create any folders that did not previously exist
|
||||
while (i < rawFolders.Length)
|
||||
{
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]);
|
||||
|
||||
UUID newFolderId = UUID.Random();
|
||||
m_userInfo.CreateFolder(
|
||||
rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
|
||||
foundFolder = foundFolder.GetChildFolder(newFolderId);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Load an item from the archive
|
||||
/// </summary>
|
||||
|
@ -432,4 +451,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,8 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
///
|
||||
/// This method does not handle paths that contain multiple delimitors
|
||||
///
|
||||
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
||||
/// XPath like expression
|
||||
/// FIXME: We have no way of distinguishing folders with the same path
|
||||
///
|
||||
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||
///
|
||||
|
@ -70,14 +69,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// The path to the required folder.
|
||||
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||
/// </param>
|
||||
/// <returns>null if the folder is not found</returns>
|
||||
public static InventoryFolderBase FindFolderByPath(
|
||||
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
|
||||
public static List<InventoryFolderBase> FindFolderByPath(
|
||||
IInventoryService inventoryService, UUID userId, string path)
|
||||
{
|
||||
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
|
||||
|
||||
if (null == rootFolder)
|
||||
return null;
|
||||
return new List<InventoryFolderBase>();
|
||||
|
||||
return FindFolderByPath(inventoryService, rootFolder, path);
|
||||
}
|
||||
|
@ -88,8 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
///
|
||||
/// This method does not handle paths that contain multiple delimitors
|
||||
///
|
||||
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
||||
/// XPath like expression
|
||||
/// FIXME: We have no way of distinguishing folders with the same path.
|
||||
///
|
||||
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||
///
|
||||
|
@ -103,17 +101,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// The path to the required folder.
|
||||
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||
/// </param>
|
||||
/// <returns>null if the folder is not found</returns>
|
||||
public static InventoryFolderBase FindFolderByPath(
|
||||
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
|
||||
public static List<InventoryFolderBase> FindFolderByPath(
|
||||
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
|
||||
{
|
||||
List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>();
|
||||
|
||||
if (path == string.Empty)
|
||||
return startFolder;
|
||||
{
|
||||
foundFolders.Add(startFolder);
|
||||
return foundFolders;
|
||||
}
|
||||
|
||||
path = path.Trim();
|
||||
|
||||
if (path == PATH_DELIMITER.ToString())
|
||||
return startFolder;
|
||||
{
|
||||
foundFolders.Add(startFolder);
|
||||
return foundFolders;
|
||||
}
|
||||
|
||||
string[] components = SplitEscapedPath(path);
|
||||
components[0] = UnescapePath(components[0]);
|
||||
|
@ -127,14 +133,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (folder.Name == components[0])
|
||||
{
|
||||
if (components.Length > 1)
|
||||
return FindFolderByPath(inventoryService, folder, components[1]);
|
||||
foundFolders.AddRange(FindFolderByPath(inventoryService, folder, components[1]));
|
||||
else
|
||||
return folder;
|
||||
foundFolders.Add(folder);
|
||||
}
|
||||
}
|
||||
|
||||
// We didn't find a folder with the right name
|
||||
return null;
|
||||
return foundFolders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -201,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;
|
||||
}
|
||||
|
|
|
@ -119,22 +119,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
|
||||
{
|
||||
Exception reportedException = null;
|
||||
bool succeeded = true;
|
||||
|
||||
bool succeeded = true;
|
||||
|
||||
try
|
||||
{
|
||||
// We're almost done. Just need to write out the control file now
|
||||
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
|
||||
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
|
||||
|
||||
m_archiveWriter.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_saveStream.Close();
|
||||
reportedException = e;
|
||||
succeeded = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_saveStream.Close();
|
||||
}
|
||||
|
||||
m_module.TriggerInventoryArchiveSaved(
|
||||
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
|
||||
|
@ -213,69 +215,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// </summary>
|
||||
public void Execute()
|
||||
{
|
||||
InventoryFolderBase inventoryFolder = null;
|
||||
InventoryItemBase inventoryItem = null;
|
||||
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
|
||||
|
||||
bool foundStar = false;
|
||||
|
||||
// Eliminate double slashes and any leading / on the path.
|
||||
string[] components
|
||||
= m_invPath.Split(
|
||||
new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
int maxComponentIndex = components.Length - 1;
|
||||
|
||||
// If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
|
||||
// folder itself. This may get more sophisicated later on
|
||||
if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
|
||||
{
|
||||
foundStar = true;
|
||||
maxComponentIndex--;
|
||||
}
|
||||
|
||||
m_invPath = String.Empty;
|
||||
for (int i = 0; i <= maxComponentIndex; i++)
|
||||
{
|
||||
m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
|
||||
}
|
||||
|
||||
// Annoyingly Split actually returns the original string if the input string consists only of delimiters
|
||||
// Therefore if we still start with a / after the split, then we need the root folder
|
||||
if (m_invPath.Length == 0)
|
||||
{
|
||||
inventoryFolder = rootFolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
||||
inventoryFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
//inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
||||
}
|
||||
|
||||
// The path may point to an item instead
|
||||
if (inventoryFolder == null)
|
||||
{
|
||||
inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
//inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
|
||||
}
|
||||
|
||||
if (null == inventoryFolder && null == inventoryItem)
|
||||
{
|
||||
// We couldn't find the path indicated
|
||||
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage);
|
||||
m_module.TriggerInventoryArchiveSaved(
|
||||
m_id, false, m_userInfo, m_invPath, m_saveStream,
|
||||
new Exception(errorMessage));
|
||||
return;
|
||||
}
|
||||
|
||||
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||
|
||||
try
|
||||
{
|
||||
InventoryFolderBase inventoryFolder = null;
|
||||
InventoryItemBase inventoryItem = null;
|
||||
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
|
||||
|
||||
bool foundStar = false;
|
||||
|
||||
// Eliminate double slashes and any leading / on the path.
|
||||
string[] components
|
||||
= m_invPath.Split(
|
||||
new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
int maxComponentIndex = components.Length - 1;
|
||||
|
||||
// If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
|
||||
// folder itself. This may get more sophisicated later on
|
||||
if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
|
||||
{
|
||||
foundStar = true;
|
||||
maxComponentIndex--;
|
||||
}
|
||||
|
||||
m_invPath = String.Empty;
|
||||
for (int i = 0; i <= maxComponentIndex; i++)
|
||||
{
|
||||
m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
|
||||
}
|
||||
|
||||
// Annoyingly Split actually returns the original string if the input string consists only of delimiters
|
||||
// Therefore if we still start with a / after the split, then we need the root folder
|
||||
if (m_invPath.Length == 0)
|
||||
{
|
||||
inventoryFolder = rootFolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
||||
List<InventoryFolderBase> candidateFolders
|
||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
if (candidateFolders.Count > 0)
|
||||
inventoryFolder = candidateFolders[0];
|
||||
}
|
||||
|
||||
// The path may point to an item instead
|
||||
if (inventoryFolder == null)
|
||||
{
|
||||
inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
//inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
|
||||
}
|
||||
|
||||
if (null == inventoryFolder && null == inventoryItem)
|
||||
{
|
||||
// We couldn't find the path indicated
|
||||
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
|
||||
Exception e = new InventoryArchiverException(errorMessage);
|
||||
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||
|
||||
if (inventoryFolder != null)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
|
@ -296,16 +297,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
// Don't put all this profile information into the archive right now.
|
||||
//SaveUsers();
|
||||
|
||||
new AssetsRequest(
|
||||
new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_archiveWriter.Close();
|
||||
m_saveStream.Close();
|
||||
throw;
|
||||
}
|
||||
|
||||
new AssetsRequest(
|
||||
new AssetsArchiver(m_archiveWriter), m_assetUuids,
|
||||
m_scene.AssetService, ReceivedAllAssets).Execute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -24,14 +24,17 @@
|
|||
* (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
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
public interface IHyperAssetService
|
||||
{
|
||||
string GetUserAssetServer(UUID userID);
|
||||
string GetSimAssetServer();
|
||||
/// <summary>
|
||||
/// Signals an inventory archiving problem
|
||||
/// </summary>
|
||||
public class InventoryArchiverException : Exception
|
||||
{
|
||||
public InventoryArchiverException(string message) : base(message) {}
|
||||
public InventoryArchiverException(string message, Exception e) : base(message, e) {}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,11 +30,11 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using NDesk.Options;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
@ -91,9 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
scene.AddCommand(
|
||||
this, "load iar",
|
||||
"load iar <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
"load iar <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
//"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
"Load user inventory archive (IAR).",
|
||||
"<first> is user's first name." + Environment.NewLine
|
||||
//"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
|
||||
//+ "<first> is user's first name." + Environment.NewLine
|
||||
"<first> is user's first name." + Environment.NewLine
|
||||
+ "<last> is user's last name." + Environment.NewLine
|
||||
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
|
||||
+ "<password> is the user's password." + Environment.NewLine
|
||||
|
@ -133,8 +136,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (handlerInventoryArchiveSaved != null)
|
||||
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
|
||||
{
|
||||
return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -172,7 +183,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, string savePath)
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -209,8 +222,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
|
||||
{
|
||||
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -252,7 +272,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath)
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, string loadPath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -300,29 +322,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="cmdparams"></param>
|
||||
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
|
||||
{
|
||||
if (cmdparams.Length < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
string firstName = cmdparams[2];
|
||||
string lastName = cmdparams[3];
|
||||
string invPath = cmdparams[4];
|
||||
string pass = cmdparams[5];
|
||||
string loadPath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
||||
loadPath, invPath, firstName, lastName);
|
||||
|
||||
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath))
|
||||
try
|
||||
{
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
|
||||
|
||||
List<string> mainParams = optionSet.Parse(cmdparams);
|
||||
|
||||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
string firstName = mainParams[2];
|
||||
string lastName = mainParams[3];
|
||||
string invPath = mainParams[4];
|
||||
string pass = mainParams[5];
|
||||
string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
||||
loadPath, firstName, lastName);
|
||||
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
||||
loadPath, invPath, firstName, lastName);
|
||||
|
||||
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
||||
loadPath, firstName, lastName);
|
||||
}
|
||||
catch (InventoryArchiverException e)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -331,30 +365,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="cmdparams"></param>
|
||||
protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
|
||||
{
|
||||
if (cmdparams.Length < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
string firstName = cmdparams[2];
|
||||
string lastName = cmdparams[3];
|
||||
string invPath = cmdparams[4];
|
||||
string pass = cmdparams[5];
|
||||
string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
|
||||
savePath, invPath, firstName, lastName);
|
||||
|
||||
Guid id = Guid.NewGuid();
|
||||
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (cmdparams.Length < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
string firstName = cmdparams[2];
|
||||
string lastName = cmdparams[3];
|
||||
string invPath = cmdparams[4];
|
||||
string pass = cmdparams[5];
|
||||
string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
|
||||
savePath, invPath, firstName, lastName);
|
||||
|
||||
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
|
||||
}
|
||||
catch (InventoryArchiverException e)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
|
||||
}
|
||||
|
||||
lock (m_pendingConsoleSaves)
|
||||
m_pendingConsoleSaves.Add(id);
|
||||
m_pendingConsoleSaves.Add(id);
|
||||
}
|
||||
|
||||
private void SaveInvConsoleCommandCompleted(
|
||||
|
@ -390,7 +432,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <returns></returns>
|
||||
protected UserAccount GetUserInfo(string firstName, string lastName, string pass)
|
||||
{
|
||||
UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName);
|
||||
UserAccount account
|
||||
= m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName);
|
||||
|
||||
if (null == account)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
|
|
|
@ -55,14 +55,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
{
|
||||
protected ManualResetEvent mre = new ManualResetEvent(false);
|
||||
|
||||
private void InventoryReceived(UUID userId)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
Monitor.PulseAll(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveCompleted(
|
||||
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
|
||||
Exception reportedException)
|
||||
|
@ -71,16 +63,14 @@ 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()
|
||||
[Test]
|
||||
public void TestSavePathToIarV0_1()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
log4net.Config.XmlConfigurator.Configure();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
|
||||
|
@ -125,7 +115,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
|
||||
|
@ -189,195 +179,298 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
// 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");
|
||||
|
||||
// TODO: Test presence of more files and contents of files.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
/// an account exists with the creator name.
|
||||
/// </summary>
|
||||
///
|
||||
/// This test also does some deeper probing of loading into nested inventory structures
|
||||
/// REFACTORING PROBLEM. This needs to be rewritten.
|
||||
// [Test]
|
||||
// public void TestLoadIarV0_1ExistingUsers()
|
||||
// {
|
||||
// TestHelper.InMethod();
|
||||
[Test]
|
||||
public void TestLoadIarV0_1ExistingUsers()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// //log4net.Config.XmlConfigurator.Configure();
|
||||
string userFirstName = "Mr";
|
||||
string userLastName = "Tiddles";
|
||||
UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
|
||||
string userItemCreatorFirstName = "Lord";
|
||||
string userItemCreatorLastName = "Lucan";
|
||||
UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
||||
|
||||
// string userFirstName = "Mr";
|
||||
// string userLastName = "Tiddles";
|
||||
// UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
|
||||
// string userItemCreatorFirstName = "Lord";
|
||||
// string userItemCreatorLastName = "Lucan";
|
||||
// UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
||||
|
||||
// string item1Name = "b.lsl";
|
||||
// string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
|
||||
string item1Name = "b.lsl";
|
||||
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
|
||||
|
||||
// MemoryStream archiveWriteStream = new MemoryStream();
|
||||
// TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||
|
||||
// InventoryItemBase item1 = new InventoryItemBase();
|
||||
// item1.Name = item1Name;
|
||||
// item1.AssetID = UUID.Random();
|
||||
// item1.GroupID = UUID.Random();
|
||||
// item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
|
||||
// //item1.CreatorId = userUuid.ToString();
|
||||
// //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
|
||||
// item1.Owner = UUID.Zero;
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = item1Name;
|
||||
item1.AssetID = UUID.Random();
|
||||
item1.GroupID = UUID.Random();
|
||||
item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
|
||||
//item1.CreatorId = userUuid.ToString();
|
||||
//item1.CreatorId = "00000000-0000-0000-0000-000000000444";
|
||||
item1.Owner = UUID.Zero;
|
||||
|
||||
// string item1FileName
|
||||
// = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
||||
// tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
|
||||
// tar.Close();
|
||||
string item1FileName
|
||||
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
||||
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
|
||||
tar.Close();
|
||||
|
||||
// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
// SerialiserModule serialiserModule = new SerialiserModule();
|
||||
// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
|
||||
// // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||
// Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
// IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
|
||||
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
|
||||
// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
// userAdminService.AddUser(
|
||||
// userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
|
||||
// userAdminService.AddUser(
|
||||
// userItemCreatorFirstName, userItemCreatorLastName, "hampshire",
|
||||
// String.Empty, 1000, 1000, userItemCreatorUuid);
|
||||
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
|
||||
UserProfileTestUtils.CreateUserWithInventory(
|
||||
scene, userFirstName, userLastName, userUuid, "meowfood");
|
||||
UserProfileTestUtils.CreateUserWithInventory(
|
||||
scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire");
|
||||
|
||||
// archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
|
||||
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
|
||||
|
||||
// CachedUserInfo userInfo
|
||||
// = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
|
||||
|
||||
// InventoryItemBase foundItem1
|
||||
// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name);
|
||||
InventoryItemBase foundItem1
|
||||
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name);
|
||||
|
||||
// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
|
||||
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
|
||||
|
||||
//// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
|
||||
//// UUID, not the OSPA itself.
|
||||
//// Assert.That(
|
||||
//// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
|
||||
//// "Loaded item non-uuid creator doesn't match original");
|
||||
// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
|
||||
// UUID, not the OSPA itself.
|
||||
// Assert.That(
|
||||
// foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()),
|
||||
// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
|
||||
// "Loaded item non-uuid creator doesn't match original");
|
||||
Assert.That(
|
||||
foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()),
|
||||
"Loaded item non-uuid creator doesn't match original");
|
||||
|
||||
Assert.That(
|
||||
foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
|
||||
"Loaded item uuid creator doesn't match original");
|
||||
Assert.That(foundItem1.Owner, Is.EqualTo(userUuid),
|
||||
"Loaded item owner doesn't match inventory reciever");
|
||||
|
||||
// Now try loading to a root child folder
|
||||
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA");
|
||||
archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
|
||||
archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream);
|
||||
|
||||
InventoryItemBase foundItem2
|
||||
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name);
|
||||
Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
|
||||
|
||||
// Now try loading to a more deeply nested folder
|
||||
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xB/xC");
|
||||
archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
|
||||
archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream);
|
||||
|
||||
InventoryItemBase foundItem3
|
||||
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name);
|
||||
Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIarV0_1WithEscapedChars()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
string itemName = "You & you are a mean/man/";
|
||||
string humanEscapedItemName = @"You & you are a mean\/man\/";
|
||||
string userPassword = "meowfood";
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
string userFirstName = "Jock";
|
||||
string userLastName = "Stirrup";
|
||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1;
|
||||
SceneObjectPart part1;
|
||||
{
|
||||
string partName = "part name";
|
||||
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");
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = itemName;
|
||||
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", userPassword, archiveWriteStream);
|
||||
mre.WaitOne(60000, false);
|
||||
|
||||
// LOAD ITEM
|
||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
|
||||
archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
|
||||
|
||||
InventoryItemBase foundItem1
|
||||
= InventoryArchiveUtils.FindItemByPath(
|
||||
scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
|
||||
|
||||
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
|
||||
// Assert.That(
|
||||
// foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
|
||||
// "Loaded item uuid creator doesn't match original");
|
||||
// Assert.That(foundItem1.Owner, Is.EqualTo(userUuid),
|
||||
// "Loaded item owner doesn't match inventory reciever");
|
||||
|
||||
// // Now try loading to a root child folder
|
||||
// UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA");
|
||||
// archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
|
||||
// archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream);
|
||||
|
||||
// InventoryItemBase foundItem2
|
||||
// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + item1Name);
|
||||
// Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
|
||||
|
||||
// // Now try loading to a more deeply nested folder
|
||||
// UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC");
|
||||
// archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
|
||||
// archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream);
|
||||
|
||||
// InventoryItemBase foundItem3
|
||||
// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + item1Name);
|
||||
// Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
|
||||
//}
|
||||
|
||||
// REFACTORING PROBLEM. Needs rewrite.
|
||||
// [Test]
|
||||
// public void TestIarV0_1WithEscapedChars()
|
||||
// {
|
||||
// TestHelper.InMethod();
|
||||
//// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// string itemName = "You & you are a mean/man/";
|
||||
// string humanEscapedItemName = @"You & you are a mean\/man\/";
|
||||
// string userPassword = "meowfood";
|
||||
|
||||
// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
|
||||
// Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
// SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
// CommunicationsManager cm = scene.CommsManager;
|
||||
|
||||
// // Create user
|
||||
// string userFirstName = "Jock";
|
||||
// string userLastName = "Stirrup";
|
||||
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||
|
||||
// lock (this)
|
||||
// {
|
||||
// UserProfileTestUtils.CreateUserWithInventory(
|
||||
// cm, userFirstName, userLastName, userPassword, userId, InventoryReceived);
|
||||
// Monitor.Wait(this, 60000);
|
||||
// }
|
||||
|
||||
// // Create asset
|
||||
// SceneObjectGroup object1;
|
||||
// SceneObjectPart part1;
|
||||
// {
|
||||
// string partName = "part name";
|
||||
// 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");
|
||||
// InventoryItemBase item1 = new InventoryItemBase();
|
||||
// item1.Name = itemName;
|
||||
// item1.AssetID = asset1.FullID;
|
||||
// item1.ID = item1Id;
|
||||
// InventoryFolderBase objsFolder
|
||||
// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
||||
// item1.Folder = objsFolder.ID;
|
||||
// scene.AddInventoryItem(userId, item1);
|
||||
|
||||
// MemoryStream archiveWriteStream = new MemoryStream();
|
||||
// archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||
|
||||
// mre.Reset();
|
||||
// archiverModule.ArchiveInventory(
|
||||
// Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
|
||||
// mre.WaitOne(60000, false);
|
||||
|
||||
// // LOAD ITEM
|
||||
// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
|
||||
// archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
|
||||
|
||||
// InventoryItemBase foundItem1
|
||||
// = InventoryArchiveUtils.FindItemByPath(
|
||||
// scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
|
||||
|
||||
// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
|
||||
//// Assert.That(
|
||||
//// foundItem1.CreatorId, Is.EqualTo(userUuid),
|
||||
//// "Loaded item non-uuid creator doesn't match that of the loading user");
|
||||
// Assert.That(
|
||||
// foundItem1.Name, Is.EqualTo(itemName),
|
||||
// "Loaded item name doesn't match saved name");
|
||||
// }
|
||||
// foundItem1.CreatorId, Is.EqualTo(userUuid),
|
||||
// "Loaded item non-uuid creator doesn't match that of the loading user");
|
||||
Assert.That(
|
||||
foundItem1.Name, Is.EqualTo(itemName),
|
||||
"Loaded item name doesn't match saved name");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
|
@ -386,76 +479,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
///
|
||||
/// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature
|
||||
/// (as tested in the a later commented out test)
|
||||
/// REFACTORING PROBLEM. Needs rewrite.
|
||||
// [Test]
|
||||
// public void TestLoadIarV0_1AbsentUsers()
|
||||
// {
|
||||
// TestHelper.InMethod();
|
||||
/// This test is currently disabled
|
||||
[Test]
|
||||
public void TestLoadIarV0_1AbsentUsers()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// //log4net.Config.XmlConfigurator.Configure();
|
||||
string userFirstName = "Charlie";
|
||||
string userLastName = "Chan";
|
||||
UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
|
||||
string userItemCreatorFirstName = "Bat";
|
||||
string userItemCreatorLastName = "Man";
|
||||
//UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
|
||||
|
||||
// string userFirstName = "Charlie";
|
||||
// string userLastName = "Chan";
|
||||
// UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
|
||||
// string userItemCreatorFirstName = "Bat";
|
||||
// string userItemCreatorLastName = "Man";
|
||||
// //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
|
||||
|
||||
// string itemName = "b.lsl";
|
||||
// string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
||||
string itemName = "b.lsl";
|
||||
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
||||
|
||||
// MemoryStream archiveWriteStream = new MemoryStream();
|
||||
// TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||
|
||||
// InventoryItemBase item1 = new InventoryItemBase();
|
||||
// item1.Name = itemName;
|
||||
// item1.AssetID = UUID.Random();
|
||||
// item1.GroupID = UUID.Random();
|
||||
// item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
|
||||
// //item1.CreatorId = userUuid.ToString();
|
||||
// //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
|
||||
// item1.Owner = UUID.Zero;
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = itemName;
|
||||
item1.AssetID = UUID.Random();
|
||||
item1.GroupID = UUID.Random();
|
||||
item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
|
||||
//item1.CreatorId = userUuid.ToString();
|
||||
//item1.CreatorId = "00000000-0000-0000-0000-000000000444";
|
||||
item1.Owner = UUID.Zero;
|
||||
|
||||
// string item1FileName
|
||||
// = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
||||
// tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
|
||||
// tar.Close();
|
||||
string item1FileName
|
||||
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
||||
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
|
||||
tar.Close();
|
||||
|
||||
// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
// SerialiserModule serialiserModule = new SerialiserModule();
|
||||
// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
|
||||
// // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||
// Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
// IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
|
||||
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
|
||||
// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
// userAdminService.AddUser(
|
||||
// userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
|
||||
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
|
||||
|
||||
// archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
|
||||
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
|
||||
|
||||
// CachedUserInfo userInfo
|
||||
// = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
|
||||
|
||||
// InventoryItemBase foundItem1
|
||||
// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName);
|
||||
InventoryItemBase foundItem1
|
||||
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName);
|
||||
|
||||
// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
|
||||
//// Assert.That(
|
||||
//// foundItem1.CreatorId, Is.EqualTo(userUuid),
|
||||
//// "Loaded item non-uuid creator doesn't match that of the loading user");
|
||||
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
|
||||
// Assert.That(
|
||||
// foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
|
||||
// "Loaded item uuid creator doesn't match that of the loading user");
|
||||
// }
|
||||
// foundItem1.CreatorId, Is.EqualTo(userUuid),
|
||||
// "Loaded item non-uuid creator doesn't match that of the loading user");
|
||||
Assert.That(
|
||||
foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
|
||||
"Loaded item uuid creator doesn't match that of the loading user");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
/// no account exists with the creator name
|
||||
/// </summary>
|
||||
/// Disabled since temporary profiles have not yet been implemented.
|
||||
/// REFACTORING PROBLEM. Needs rewrite.
|
||||
///
|
||||
//[Test]
|
||||
//public void TestLoadIarV0_1TempProfiles()
|
||||
|
@ -534,10 +620,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
/// Test replication of an archive path to the user's inventory.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestReplicateArchivePathToUserInventory()
|
||||
public void TestNewIarPath()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||
|
@ -545,29 +631,106 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
||||
|
||||
string folder1Name = "a";
|
||||
string folder2Name = "b";
|
||||
string itemName = "c.lsl";
|
||||
string folder1Name = "1";
|
||||
string folder2aName = "2a";
|
||||
string folder2bName = "2b";
|
||||
|
||||
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
|
||||
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
||||
string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
||||
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
|
||||
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
|
||||
|
||||
string itemArchivePath
|
||||
= string.Format(
|
||||
"{0}{1}{2}{3}",
|
||||
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
|
||||
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
|
||||
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
|
||||
|
||||
{
|
||||
// Test replication of path1
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
foldersCreated, nodesLoaded);
|
||||
|
||||
List<InventoryFolderBase> folder1Candidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
|
||||
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
|
||||
|
||||
InventoryFolderBase folder1 = folder1Candidates[0];
|
||||
List<InventoryFolderBase> folder2aCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
|
||||
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
{
|
||||
// Test replication of path2
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
foldersCreated, nodesLoaded);
|
||||
|
||||
List<InventoryFolderBase> folder1Candidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
|
||||
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
|
||||
|
||||
InventoryFolderBase folder1 = folder1Candidates[0];
|
||||
|
||||
List<InventoryFolderBase> folder2aCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
|
||||
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
|
||||
|
||||
List<InventoryFolderBase> folder2bCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
|
||||
Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test replication of a partly existing archive path to the user's inventory. This should create
|
||||
/// a duplicate path without the merge option.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestPartExistingIarPath()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
string folder2Name = "b";
|
||||
|
||||
InventoryFolderBase folder1
|
||||
= UserInventoryTestUtils.CreateInventoryFolder(
|
||||
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
|
||||
|
||||
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
|
||||
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
||||
|
||||
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
|
||||
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
foldersCreated, nodesLoaded);
|
||||
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>());
|
||||
|
||||
InventoryFolderBase folder1
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a");
|
||||
Assert.That(folder1, Is.Not.Null, "Could not find folder a");
|
||||
InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
|
||||
Assert.That(folder2, Is.Not.Null, "Could not find folder b");
|
||||
}
|
||||
List<InventoryFolderBase> folder1PostCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
|
||||
Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
|
||||
|
||||
// FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
|
||||
InventoryFolderBase folder1Post = null;
|
||||
foreach (InventoryFolderBase folder in folder1PostCandidates)
|
||||
{
|
||||
if (folder.ID != folder1.ID)
|
||||
{
|
||||
folder1Post = folder;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
|
||||
|
||||
List<InventoryFolderBase> folder2PostCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
|
||||
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -145,10 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
{
|
||||
ScenePresence presence = scene.GetScenePresence(agentId);
|
||||
if (presence != null)
|
||||
{
|
||||
if (!presence.IsChildAgent)
|
||||
return scene;
|
||||
}
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -156,19 +153,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||
{
|
||||
m_log.InfoFormat("OnInstantMessage {0}", im.dialog);
|
||||
m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog);
|
||||
|
||||
Scene scene = FindClientScene(client.AgentId);
|
||||
|
||||
if (scene == null) // Something seriously wrong here.
|
||||
return;
|
||||
|
||||
|
||||
|
||||
if (im.dialog == (byte) InstantMessageDialog.InventoryOffered)
|
||||
{
|
||||
//m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0]));
|
||||
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||
|
||||
if (im.binaryBucket.Length < 17) // Invalid
|
||||
return;
|
||||
|
||||
UUID receipientID = new UUID(im.toAgentID);
|
||||
ScenePresence user = scene.GetScenePresence(receipientID);
|
||||
UUID copyID;
|
||||
|
||||
// First byte is the asset type
|
||||
|
@ -183,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
folderID, new UUID(im.toAgentID));
|
||||
|
||||
InventoryFolderBase folderCopy
|
||||
= scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero);
|
||||
= scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero);
|
||||
|
||||
if (folderCopy == null)
|
||||
{
|
||||
|
@ -199,20 +200,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
im.binaryBucket[0] = (byte)AssetType.Folder;
|
||||
Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length);
|
||||
|
||||
if (user != null && !user.IsChildAgent)
|
||||
if (user != null)
|
||||
{
|
||||
user.ControllingClient.SendBulkUpdateInventory(folderCopy);
|
||||
}
|
||||
|
||||
// HACK!!
|
||||
im.imSessionID = folderID.Guid;
|
||||
}
|
||||
else
|
||||
{
|
||||
// First byte of the array is probably the item type
|
||||
// Next 16 bytes are the UUID
|
||||
m_log.Info("OnInstantMessage - giving item");
|
||||
|
||||
UUID itemID = new UUID(im.binaryBucket, 1);
|
||||
|
||||
m_log.DebugFormat("[AGENT INVENTORY]: Inserting item {0} "+
|
||||
m_log.DebugFormat("[AGENT INVENTORY]: (giving) Inserting item {0} "+
|
||||
"into agent {1}'s inventory",
|
||||
itemID, new UUID(im.toAgentID));
|
||||
|
||||
|
@ -229,29 +232,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
copyID = itemCopy.ID;
|
||||
Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16);
|
||||
|
||||
if (user != null && !user.IsChildAgent)
|
||||
if (user != null)
|
||||
{
|
||||
user.ControllingClient.SendBulkUpdateInventory(itemCopy);
|
||||
}
|
||||
|
||||
// HACK!!
|
||||
im.imSessionID = itemID.Guid;
|
||||
}
|
||||
|
||||
// Send the IM to the recipient. The item is already
|
||||
// in their inventory, so it will not be lost if
|
||||
// they are offline.
|
||||
//
|
||||
if (user != null && !user.IsChildAgent)
|
||||
if (user != null)
|
||||
{
|
||||
// And notify. Transaction ID is the item ID. We get that
|
||||
// same ID back on the reply so we know what to act on
|
||||
//
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_TransferModule != null)
|
||||
m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
|
||||
m_TransferModule.SendInstantMessage(im, delegate(bool success)
|
||||
{
|
||||
if (!success)
|
||||
client.SendAlertMessage("User not online. Inventory has been saved");
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
|
||||
|
@ -282,10 +288,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
InventoryFolderBase trashFolder =
|
||||
invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
|
||||
|
||||
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase(inventoryEntityID, client.AgentId);
|
||||
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId);
|
||||
item = invService.GetItem(item);
|
||||
InventoryFolderBase folder = null;
|
||||
|
||||
|
@ -301,7 +307,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
}
|
||||
else
|
||||
{
|
||||
folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
|
||||
folder = new InventoryFolderBase(inventoryID, client.AgentId);
|
||||
folder = invService.GetFolder(folder);
|
||||
|
||||
if (folder != null & trashFolder != null)
|
||||
|
@ -417,90 +423,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
{
|
||||
// Check if this is ours to handle
|
||||
//
|
||||
m_log.Info("OnFridInstantMessage");
|
||||
if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered)
|
||||
return;
|
||||
|
||||
if (msg.binaryBucket.Length < 17) // Invalid
|
||||
return;
|
||||
|
||||
Scene scene = FindClientScene(new UUID(msg.toAgentID));
|
||||
|
||||
if (scene == null)
|
||||
return;
|
||||
|
||||
// Find agent to deliver to
|
||||
//
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID));
|
||||
|
||||
if (user == null) // Shouldn't happen
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find recipient");
|
||||
return;
|
||||
}
|
||||
// Just forward to local handling
|
||||
OnInstantMessage(user.ControllingClient, msg);
|
||||
|
||||
//CachedUserInfo userInfo =
|
||||
// scene.CommsManager.UserProfileCacheService.
|
||||
// GetUserDetails(user.ControllingClient.AgentId);
|
||||
|
||||
//if (userInfo == null)
|
||||
//{
|
||||
// m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
|
||||
// return;
|
||||
//}
|
||||
|
||||
AssetType assetType = (AssetType)msg.binaryBucket[0];
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
|
||||
if (AssetType.Folder == assetType)
|
||||
{
|
||||
UUID folderID = new UUID(msg.binaryBucket, 1);
|
||||
InventoryFolderBase folder = new InventoryFolderBase();
|
||||
|
||||
folder.ID = folderID;
|
||||
folder.Owner = user.ControllingClient.AgentId;
|
||||
|
||||
// Fetch from service
|
||||
//
|
||||
folder = invService.GetFolder(folder);
|
||||
if (folder == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
|
||||
return;
|
||||
}
|
||||
|
||||
user.ControllingClient.SendBulkUpdateInventory(folder);
|
||||
|
||||
//// This unelegant, slow kludge is to reload the folders and
|
||||
//// items. Since a folder give can transfer subfolders and
|
||||
//// items, this is the easiest way to pull that stuff in
|
||||
////
|
||||
//userInfo.DropInventory();
|
||||
//userInfo.FetchInventory();
|
||||
|
||||
// Deliver message
|
||||
//
|
||||
user.ControllingClient.SendInstantMessage(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID itemID = new UUID(msg.binaryBucket, 1);
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, user.ControllingClient.AgentId);
|
||||
|
||||
// Fetch from service
|
||||
//
|
||||
item = invService.GetItem(item);
|
||||
if (item == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
|
||||
return;
|
||||
}
|
||||
|
||||
// Update item to viewer (makes it appear in proper folder)
|
||||
//
|
||||
user.ControllingClient.SendBulkUpdateInventory(item);
|
||||
|
||||
// Deliver message
|
||||
//
|
||||
user.ControllingClient.SendInstantMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,6 +180,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.Teleport(position);
|
||||
|
||||
foreach (SceneObjectGroup grp in sp.Attachments)
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
|
||||
}
|
||||
else // Another region possibly in another simulator
|
||||
{
|
||||
|
@ -393,7 +396,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.Position = position;
|
||||
SetCallbackURL(agent, sp.Scene.RegionInfo);
|
||||
|
||||
UpdateAgent(reg, finalDestination, agent);
|
||||
if (!UpdateAgent(reg, finalDestination, agent))
|
||||
{
|
||||
// Region doesn't take it
|
||||
Fail(sp, finalDestination);
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID);
|
||||
|
@ -410,23 +418,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
teleportFlags, capsPath);
|
||||
}
|
||||
|
||||
// Let's set this to true tentatively. This does not trigger OnChildAgent
|
||||
sp.IsChildAgent = true;
|
||||
|
||||
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
|
||||
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
|
||||
// that the client contacted the destination before we send the attachments and close things here.
|
||||
if (!WaitForCallback(sp.UUID))
|
||||
{
|
||||
// Client never contacted destination. Let's restore everything back
|
||||
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
|
||||
|
||||
ResetFromTransit(sp.UUID);
|
||||
|
||||
// Yikes! We should just have a ref to scene here.
|
||||
//sp.Scene.InformClientOfNeighbours(sp);
|
||||
EnableChildAgents(sp);
|
||||
|
||||
// Finally, kill the agent we just created at the destination.
|
||||
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
|
||||
|
||||
Fail(sp, finalDestination);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
KillEntity(sp.Scene, sp.LocalId);
|
||||
|
||||
// Now let's make it officially a child agent
|
||||
sp.MakeChildAgent();
|
||||
|
||||
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
|
||||
|
||||
if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
|
||||
|
@ -464,6 +466,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
}
|
||||
|
||||
private void Fail(ScenePresence sp, GridRegion finalDestination)
|
||||
{
|
||||
// Client never contacted destination. Let's restore everything back
|
||||
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
|
||||
|
||||
// Fail. Reset it back
|
||||
sp.IsChildAgent = false;
|
||||
|
||||
ResetFromTransit(sp.UUID);
|
||||
|
||||
EnableChildAgents(sp);
|
||||
|
||||
// Finally, kill the agent we just created at the destination.
|
||||
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
|
||||
|
||||
}
|
||||
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
{
|
||||
|
@ -538,6 +556,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
client.SendTeleportFailed("Your home region could not be found.");
|
||||
return;
|
||||
}
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
|
||||
regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize);
|
||||
|
||||
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
|
||||
((Scene)(client.Scene)).RequestTeleportLocation(
|
||||
client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
|
||||
|
@ -799,7 +820,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort +
|
||||
"/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
|
||||
|
||||
m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent);
|
||||
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
|
||||
{
|
||||
// region doesn't take it
|
||||
ResetFromTransit(agent.UUID);
|
||||
return agent;
|
||||
}
|
||||
|
||||
// Next, let's close the child agent connections that are too far away.
|
||||
agent.CloseChildAgents(neighbourx, neighboury);
|
||||
|
@ -854,9 +880,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
|
||||
|
||||
// m_scene.SendKillObject(m_localId);
|
||||
|
||||
agent.Scene.NotifyMyCoarseLocationChange();
|
||||
// the user may change their profile information in other region,
|
||||
// so the userinfo in UserProfileCache is not reliable any more, delete it
|
||||
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
|
||||
|
@ -899,12 +922,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
/// </summary>
|
||||
public void EnableChildAgent(ScenePresence sp, GridRegion region)
|
||||
{
|
||||
m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName);
|
||||
|
||||
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||
AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
|
||||
agent.BaseFolder = UUID.Zero;
|
||||
agent.InventoryFolder = UUID.Zero;
|
||||
agent.startpos = new Vector3(128, 128, 70);
|
||||
agent.child = true;
|
||||
agent.Appearance = sp.Appearance;
|
||||
agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||
|
||||
agent.ChildrenCapSeeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID));
|
||||
m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count);
|
||||
|
||||
if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle))
|
||||
agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath);
|
||||
m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count);
|
||||
|
||||
sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath);
|
||||
foreach (ulong h in agent.ChildrenCapSeeds.Keys)
|
||||
m_log.DebugFormat("[XXX] --> {0}", h);
|
||||
m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle);
|
||||
agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath);
|
||||
|
||||
if (sp.Scene.CapsModule != null)
|
||||
{
|
||||
sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, agent.ChildrenCapSeeds);
|
||||
}
|
||||
|
||||
if (currentAgentCircuit != null)
|
||||
{
|
||||
agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
|
||||
agent.Viewer = currentAgentCircuit.Viewer;
|
||||
}
|
||||
|
||||
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
|
||||
d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true,
|
||||
|
@ -1112,7 +1163,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
string reason = String.Empty;
|
||||
|
||||
|
||||
bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, 0, out reason); // m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason);
|
||||
bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
|
||||
|
||||
if (regionAccepted && newAgent)
|
||||
{
|
||||
|
|
|
@ -95,6 +95,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
try
|
||||
{
|
||||
asset1.ID = url + "/" + asset.ID;
|
||||
UUID temp = UUID.Zero;
|
||||
// TODO: if the creator is local, stick this grid's URL in front
|
||||
//if (UUID.TryParse(asset.Metadata.CreatorID, out temp))
|
||||
// asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -153,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,6 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return ret;
|
||||
}
|
||||
|
||||
// DO NOT OVERRIDE THE BASE METHOD
|
||||
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
||||
SceneObjectGroup objectGroup, IClientAPI remoteClient)
|
||||
{
|
||||
|
@ -138,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");
|
||||
|
@ -191,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;
|
||||
|
@ -216,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,23 +286,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
// Deleting someone else's item
|
||||
//
|
||||
|
||||
|
||||
if (remoteClient == null ||
|
||||
objectGroup.OwnerID != remoteClient.AgentId)
|
||||
{
|
||||
// Folder skeleton may not be loaded and we
|
||||
// have to wait for the inventory to find
|
||||
// the destination folder
|
||||
//
|
||||
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume inventory skeleton was loaded during login
|
||||
// and all folders can be found
|
||||
//
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
}
|
||||
}
|
||||
else if (action == DeRezAction.Return)
|
||||
|
@ -330,9 +322,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
}
|
||||
|
||||
// Override and put into where it came from, if it came
|
||||
// from anywhere in inventory
|
||||
//
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||
{
|
||||
if (objectGroup.RootPart.FromFolderID != UUID.Zero)
|
||||
{
|
||||
InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID);
|
||||
folder = m_Scene.InventoryService.GetFolder(f);
|
||||
}
|
||||
}
|
||||
|
||||
if (folder == null) // None of the above
|
||||
{
|
||||
//folder = userInfo.RootFolder.FindFolder(folderID);
|
||||
folder = new InventoryFolderBase(folderID);
|
||||
|
||||
if (folder == null) // Nowhere to put it
|
||||
|
@ -378,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
|
||||
// Make sure all bits but the ones we want are clear
|
||||
// on take.
|
||||
// This will be applied to the current perms, so
|
||||
// it will do what we want.
|
||||
objectGroup.RootPart.NextOwnerMask &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify);
|
||||
objectGroup.RootPart.NextOwnerMask |=
|
||||
(uint)PermissionMask.Move;
|
||||
|
||||
item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = item.BasePermissions;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
|
||||
item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
|
||||
// Magic number badness. Maybe this deserves an enum.
|
||||
// bit 4 (16) is the "Slam" bit, it means treat as passed
|
||||
// and apply next owner perms on rez
|
||||
item.CurrentPermissions |= 16; // Slam!
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -393,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
item.GroupPermissions = objectGroup.RootPart.GroupMask;
|
||||
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.CurrentPermissions &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify |
|
||||
(uint)PermissionMask.Move |
|
||||
7); // Preserve folded permissions
|
||||
}
|
||||
|
||||
// TODO: add the new fields (Flags, Sale info, etc)
|
||||
|
@ -494,6 +517,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
SceneObjectGroup group
|
||||
= SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
|
||||
|
||||
group.RootPart.FromFolderID = item.Folder;
|
||||
|
||||
// If it's rezzed in world, select it. Much easier to
|
||||
// find small items.
|
||||
//
|
||||
if (!attachment)
|
||||
group.RootPart.CreateSelected = true;
|
||||
|
||||
if (!m_Scene.Permissions.CanRezObject(
|
||||
group.Children.Count, remoteClient.AgentId, pos)
|
||||
&& !attachment)
|
||||
|
@ -566,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
||||
|
||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||
if (rootPart.OwnerID != item.Owner)
|
||||
if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
//Need to kill the for sale here
|
||||
rootPart.ObjectSaleType = 0;
|
||||
|
@ -574,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
if (m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
if ((item.CurrentPermissions & 8) != 0)
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
|
||||
group.ApplyNextOwnerPermissions();
|
||||
|
@ -590,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if (part.OwnerID != item.Owner)
|
||||
if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.Owner;
|
||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||
}
|
||||
else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
|
@ -648,6 +672,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
|
||||
|
@ -670,6 +745,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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ using OpenSim.Region.Framework.Scenes;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||
{
|
||||
public class EmailModule : IEmailModule
|
||||
public class EmailModule : IRegionModule, IEmailModule
|
||||
{
|
||||
//
|
||||
// Log
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
|
|||
|
||||
Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" };
|
||||
|
||||
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:HGInventoryServiceInConnector", args);
|
||||
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:XInventoryInConnector", args);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,17 +123,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
|
|||
|
||||
public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
||||
{
|
||||
m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
|
||||
thisRegion.RegionName, regionHandle, m_Scenes.Count);
|
||||
foreach (Scene s in m_Scenes)
|
||||
{
|
||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
m_log.Debug("[NEIGHBOUR IN CONNECTOR]: Found region to SendHelloNeighbour");
|
||||
//m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0} to {1}", thisRegion.RegionName, s.RegionInfo.RegionName);
|
||||
return s.IncomingHelloNeighbour(thisRegion);
|
||||
}
|
||||
}
|
||||
m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -181,22 +181,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
|
||||
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
|
||||
{
|
||||
if (m_LocalCache.ContainsKey(regionID))
|
||||
{
|
||||
List<GridRegion> neighbours = m_LocalCache[regionID].GetNeighbours();
|
||||
if (neighbours.Count == 0)
|
||||
// try the DB
|
||||
neighbours = m_GridService.GetNeighbours(scopeID, regionID);
|
||||
return neighbours;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[LOCAL GRID CONNECTOR]: GetNeighbours: Requested region {0} is not on this sim", regionID);
|
||||
return new List<GridRegion>();
|
||||
}
|
||||
|
||||
// Don't go to the DB
|
||||
//return m_GridService.GetNeighbours(scopeID, regionID);
|
||||
return m_GridService.GetNeighbours(scopeID, regionID);
|
||||
}
|
||||
|
||||
public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
|
||||
|
|
|
@ -153,12 +153,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
return false;
|
||||
}
|
||||
|
||||
// Let's override GetNeighbours completely -- never go to the grid server
|
||||
// Neighbours are/should be cached locally
|
||||
// For retrieval from the DB, caller should call GetRegionByPosition
|
||||
public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
|
||||
{
|
||||
return m_LocalGridService.GetNeighbours(scopeID, regionID);
|
||||
return base.GetNeighbours(scopeID, regionID);
|
||||
}
|
||||
|
||||
public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
|
||||
|
|
|
@ -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);
|
||||
|
||||
return m_InventoryURLs[userID];
|
||||
if (m_InventoryURLs.ContainsKey(userID))
|
||||
return m_InventoryURLs[userID];
|
||||
|
||||
return null; //it means that the methods should forward to local grid's inventory
|
||||
|
||||
}
|
||||
#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);
|
||||
|
||||
|
|
|
@ -121,17 +121,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
|||
|
||||
public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
||||
{
|
||||
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
|
||||
thisRegion.RegionName, regionHandle, m_Scenes.Count);
|
||||
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}.",
|
||||
thisRegion.RegionName, regionHandle);
|
||||
foreach (Scene s in m_Scenes)
|
||||
{
|
||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
|
||||
//m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
|
||||
return s.IncomingHelloNeighbour(thisRegion);
|
||||
}
|
||||
}
|
||||
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
|
||||
//m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||
{
|
||||
//m_regionClient.SendUserInformation(regInfo, aCircuit);
|
||||
return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
|||
|
||||
public UserAccountCache()
|
||||
{
|
||||
// Warning: the size values are a bit fuzzy. What matters
|
||||
// most for this cache is the count value (128 entries).
|
||||
m_UUIDCache = new ExpiringCache<UUID, UserAccount>();
|
||||
m_NameCache = new ExpiringCache<string, UUID>(); // this one is unbound
|
||||
m_NameCache = new ExpiringCache<string, UUID>();
|
||||
}
|
||||
|
||||
public void Cache(UUID userID, UserAccount account)
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
m_scene = SceneSetupHelpers.SetupScene("useraccounts");
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
else
|
||||
{
|
||||
// Normal Calculations
|
||||
return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.objectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||
return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||
}
|
||||
}
|
||||
public int GetSimulatorMaxPrimCount(ILandObject thisObject)
|
||||
|
@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
else
|
||||
{
|
||||
//Normal Calculations
|
||||
return m_scene.objectCapacity;
|
||||
return m_scene.RegionInfo.ObjectCapacity;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -70,10 +70,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
#region IMapImageGenerator Members
|
||||
|
||||
public byte[] WriteJpeg2000Image(string gradientmap)
|
||||
public Bitmap CreateMapTile(string gradientmap)
|
||||
{
|
||||
byte[] imageData = null;
|
||||
|
||||
bool drawPrimVolume = true;
|
||||
bool textureTerrain = false;
|
||||
|
||||
|
@ -98,32 +96,36 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
}
|
||||
terrainRenderer.Initialise(m_scene, m_config);
|
||||
|
||||
using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize))
|
||||
Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
||||
//long t = System.Environment.TickCount;
|
||||
//for (int i = 0; i < 10; ++i) {
|
||||
terrainRenderer.TerrainToBitmap(mapbmp);
|
||||
//}
|
||||
//t = System.Environment.TickCount - t;
|
||||
//m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
|
||||
|
||||
|
||||
if (drawPrimVolume)
|
||||
{
|
||||
//long t = System.Environment.TickCount;
|
||||
//for (int i = 0; i < 10; ++i) {
|
||||
terrainRenderer.TerrainToBitmap(mapbmp);
|
||||
//}
|
||||
//t = System.Environment.TickCount - t;
|
||||
//m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
|
||||
|
||||
|
||||
if (drawPrimVolume)
|
||||
{
|
||||
DrawObjectVolume(m_scene, mapbmp);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
imageData = OpenJPEG.EncodeFromImage(mapbmp, true);
|
||||
}
|
||||
catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
|
||||
{
|
||||
m_log.Error("Failed generating terrain map: " + e);
|
||||
}
|
||||
DrawObjectVolume(m_scene, mapbmp);
|
||||
}
|
||||
|
||||
return imageData;
|
||||
return mapbmp;
|
||||
}
|
||||
|
||||
public byte[] WriteJpeg2000Image(string gradientmap)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Bitmap mapbmp = CreateMapTile(gradientmap))
|
||||
return OpenJPEG.EncodeFromImage(mapbmp, true);
|
||||
}
|
||||
catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
|
||||
{
|
||||
m_log.Error("Failed generating terrain map: " + e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
{
|
||||
public class ShadedMapTileRenderer : IMapTileTerrainRenderer
|
||||
{
|
||||
private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
|
||||
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
@ -221,8 +223,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
try
|
||||
{
|
||||
Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255);
|
||||
mapbmp.SetPixel(x, yr, water);
|
||||
mapbmp.SetPixel(x, yr, WATER_COLOR);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
|
|
|
@ -136,6 +136,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
|
||||
private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
|
||||
|
||||
private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
@ -406,8 +408,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0
|
||||
|
||||
Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255);
|
||||
mapbmp.SetPixel(x, yr, water);
|
||||
mapbmp.SetPixel(x, yr, WATER_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
@ -1002,41 +1002,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
public void RegenerateMaptile(byte[] data)
|
||||
{
|
||||
// Overwrites the local Asset cache with new maptile data
|
||||
// Assets are single write, this causes the asset server to ignore this update,
|
||||
// but the local asset cache does not
|
||||
|
||||
// this is on purpose! The net result of this is the region always has the most up to date
|
||||
// map tile while protecting the (grid) asset database from bloat caused by a new asset each
|
||||
// time a mapimage is generated!
|
||||
|
||||
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
|
||||
|
||||
int lastMapRefresh = 0;
|
||||
int twoDays = 172800;
|
||||
// int RefreshSeconds = twoDays;
|
||||
|
||||
try
|
||||
{
|
||||
lastMapRefresh = Convert.ToInt32(m_scene.RegionInfo.lastMapRefresh);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
}
|
||||
|
||||
m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE");
|
||||
|
||||
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
|
||||
|
||||
AssetBase asset = new AssetBase(
|
||||
m_scene.RegionInfo.RegionSettings.TerrainImageID,
|
||||
"terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(),
|
||||
"terrainImage_" + m_scene.RegionInfo.RegionID.ToString(),
|
||||
(sbyte)AssetType.Texture,
|
||||
m_scene.RegionInfo.RegionID.ToString());
|
||||
asset.Data = data;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
|||
client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos,
|
||||
IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; };
|
||||
client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt,
|
||||
Quaternion rot, bool silent) { this.Stale = true; };
|
||||
bool silent) { this.Stale = true; };
|
||||
client.OnObjectDuplicate += delegate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID,
|
||||
UUID GroupID) { this.Stale = true; };
|
||||
client.OnObjectDuplicateOnRay += delegate(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
|
||||
|
|
|
@ -258,21 +258,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)
|
||||
|
|
|
@ -536,10 +536,6 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
{
|
||||
}
|
||||
|
||||
public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
|
||||
{
|
||||
}
|
||||
|
@ -1155,5 +1151,9 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId)
|
||||
{
|
||||
}
|
||||
|
||||
public void StopFlying(ISceneEntity presence)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="rot"></param>
|
||||
/// <param name="silent"></param>
|
||||
void AttachObject(
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent);
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
|
||||
|
||||
/// <summary>
|
||||
/// Attach an object to an avatar.
|
||||
|
@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="silent"></param>
|
||||
/// <returns>true if the object was successfully attached, false otherwise</returns>
|
||||
bool AttachObject(
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent);
|
||||
IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent);
|
||||
|
||||
/// <summary>
|
||||
/// Rez an attachment from user inventory and change inventory status to match.
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
public int numLeft;
|
||||
}
|
||||
|
||||
public interface IEmailModule : IRegionModule
|
||||
public interface IEmailModule
|
||||
{
|
||||
void SendEmail(UUID objectID, string address, string subject, string body);
|
||||
Email GetNextEmail(UUID objectID, string sender, string subject);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
|
@ -59,6 +60,20 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
|
||||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
|
||||
|
||||
/// <summary>
|
||||
/// Dearchive a user's inventory folder from the given stream
|
||||
/// </summary>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
|
||||
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
|
||||
/// <param name="options">Dearchiving options. At the moment, the only option is ("merge", true). This merges
|
||||
/// the loaded IAR with existing folders where possible.</param>
|
||||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
Dictionary<string, object> options);
|
||||
|
||||
/// <summary>
|
||||
/// Archive a user's inventory folder to the given stream
|
||||
|
@ -70,5 +85,19 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
||||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
|
||||
|
||||
/// <summary>
|
||||
/// Archive a user's inventory folder to the given stream
|
||||
/// </summary>
|
||||
/// <param name="id">ID representing this request. This will later be returned in the save event</param>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="invPath">The inventory path from which the inventory should be saved.</param>
|
||||
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
||||
/// <param name="options">Archiving options. Currently, there are none.</param>
|
||||
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||
bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Dictionary<string, object> options);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
|
||||
public interface IMapImageGenerator
|
||||
{
|
||||
System.Drawing.Bitmap CreateMapTile(string gradientmap);
|
||||
byte[] WriteJpeg2000Image(string gradientmap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event ScriptChangedEvent OnScriptChangedEvent;
|
||||
public delegate void ScriptChangedEvent(uint localID, uint change);
|
||||
|
||||
public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed);
|
||||
public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
|
||||
public event ScriptControlEvent OnScriptControlEvent;
|
||||
|
||||
public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
|
||||
|
@ -1595,7 +1595,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
|
||||
internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed)
|
||||
{
|
||||
ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent;
|
||||
if (handlerScriptControlEvent != null)
|
||||
|
@ -1604,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
try
|
||||
{
|
||||
d(p, scriptUUID, avatarID, held, _changed);
|
||||
d(scriptUUID, avatarID, held, _changed);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
|
@ -32,6 +32,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public class Prioritizer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
|
||||
/// viewer before child prim updates.
|
||||
/// The adjustment is added to child prims and subtracted from root prims, so the gap ends up
|
||||
/// being double. We do it both ways so that there is a still a priority delta even if the priority is already
|
||||
/// double.MinValue or double.MaxValue.
|
||||
/// </summary>
|
||||
private double m_childPrimAdjustmentFactor = 0.05;
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
|
@ -42,21 +51,53 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
|
||||
{
|
||||
double priority = 0;
|
||||
|
||||
if (entity == null)
|
||||
return 100000;
|
||||
|
||||
switch (m_scene.UpdatePrioritizationScheme)
|
||||
{
|
||||
case UpdatePrioritizationSchemes.Time:
|
||||
return GetPriorityByTime();
|
||||
priority = GetPriorityByTime();
|
||||
break;
|
||||
case UpdatePrioritizationSchemes.Distance:
|
||||
return GetPriorityByDistance(client, entity);
|
||||
priority = GetPriorityByDistance(client, entity);
|
||||
break;
|
||||
case UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||
return GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
|
||||
priority = GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
|
||||
break;
|
||||
case UpdatePrioritizationSchemes.FrontBack:
|
||||
return GetPriorityByFrontBack(client, entity);
|
||||
priority = GetPriorityByFrontBack(client, entity);
|
||||
break;
|
||||
case UpdatePrioritizationSchemes.BestAvatarResponsiveness:
|
||||
return GetPriorityByBestAvatarResponsiveness(client, entity);
|
||||
priority = GetPriorityByBestAvatarResponsiveness(client, entity);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
||||
break;
|
||||
}
|
||||
|
||||
// Adjust priority so that root prims are sent to the viewer first. This is especially important for
|
||||
// attachments acting as huds, since current viewers fail to display hud child prims if their updates
|
||||
// arrive before the root one.
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart sop = ((SceneObjectPart)entity);
|
||||
|
||||
if (sop.IsRoot)
|
||||
{
|
||||
if (priority >= double.MinValue + m_childPrimAdjustmentFactor)
|
||||
priority -= m_childPrimAdjustmentFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priority <= double.MaxValue - m_childPrimAdjustmentFactor)
|
||||
priority += m_childPrimAdjustmentFactor;
|
||||
}
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
private double GetPriorityByTime()
|
||||
|
@ -172,7 +213,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
|
||||
if (physActor == null || !physActor.IsPhysical)
|
||||
priority+=100;
|
||||
priority += 100;
|
||||
|
||||
if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
|
||||
priority = 1.0;
|
||||
}
|
||||
return priority;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
IMoneyModule money=RequestModuleInterface<IMoneyModule>();
|
||||
if (money != null)
|
||||
{
|
||||
money.ApplyUploadCharge(agentID);
|
||||
money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
|
||||
}
|
||||
|
||||
AddInventoryItem(agentID, item);
|
||||
|
@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Update item with new asset
|
||||
item.AssetID = asset.FullID;
|
||||
if (group.UpdateInventoryItem(item))
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||
|
||||
part.GetProperties(remoteClient);
|
||||
|
||||
|
@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
|
||||
UUID itemID, InventoryItemBase itemUpd)
|
||||
{
|
||||
// This one will let people set next perms on items in agent
|
||||
// inventory. Rut-Roh. Whatever. Make this secure. Yeah.
|
||||
//
|
||||
// Passing something to another avatar or a an object will already
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = InventoryService.GetItem(item);
|
||||
|
||||
|
@ -274,11 +278,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
item.Name = itemUpd.Name;
|
||||
item.Description = itemUpd.Description;
|
||||
item.NextPermissions = itemUpd.NextPermissions;
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.EveryOnePermissions = itemUpd.EveryOnePermissions;
|
||||
item.GroupPermissions = itemUpd.GroupPermissions;
|
||||
|
||||
item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
|
||||
item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
|
||||
item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
|
||||
item.GroupID = itemUpd.GroupID;
|
||||
item.GroupOwned = itemUpd.GroupOwned;
|
||||
item.CreationDate = itemUpd.CreationDate;
|
||||
|
@ -384,28 +386,103 @@ 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;
|
||||
// By default, current equals base
|
||||
itemCopy.CurrentPermissions = itemCopy.BasePermissions;
|
||||
// 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;
|
||||
// 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
|
||||
|
@ -897,14 +974,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
||||
{
|
||||
agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions;
|
||||
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
if (taskItem.InvType == (int)InventoryType.Object)
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13);
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions ;
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move));
|
||||
else
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
||||
|
||||
agentItem.CurrentPermissions |= 8;
|
||||
agentItem.CurrentPermissions |= 16; // Slam
|
||||
agentItem.NextPermissions = taskItem.NextPermissions;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
|
||||
}
|
||||
else
|
||||
|
@ -1086,14 +1164,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (Permissions.PropagatePermissions())
|
||||
{
|
||||
destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
|
||||
srcTaskItem.NextPermissions;
|
||||
(srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
|
||||
srcTaskItem.NextPermissions;
|
||||
(srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
|
||||
srcTaskItem.NextPermissions;
|
||||
(srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
|
||||
srcTaskItem.NextPermissions;
|
||||
destTaskItem.CurrentPermissions |= 8; // Slam!
|
||||
(srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
destTaskItem.CurrentPermissions |= 16; // Slam!
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1265,7 +1343,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
if (part.Inventory.UpdateInventoryItem(itemInfo))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
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);
|
||||
|
||||
part.GetProperties(remoteClient);
|
||||
}
|
||||
}
|
||||
|
@ -1477,7 +1561,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
srcTaskItem.NextPermissions;
|
||||
destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
|
||||
srcTaskItem.NextPermissions;
|
||||
destTaskItem.CurrentPermissions |= 8; // Slam!
|
||||
destTaskItem.CurrentPermissions |= 16; // Slam!
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1573,18 +1657,30 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// for when deleting the object from it
|
||||
ForceSceneObjectBackup(grp);
|
||||
|
||||
if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
|
||||
permissionToTakeCopy = false;
|
||||
if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
|
||||
permissionToTake = false;
|
||||
if (remoteClient == null)
|
||||
{
|
||||
// Autoreturn has a null client. Nothing else does. So
|
||||
// allow only returns
|
||||
if (action != DeRezAction.Return)
|
||||
return;
|
||||
|
||||
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
|
||||
permissionToDelete = false;
|
||||
permissionToTakeCopy = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
|
||||
permissionToTakeCopy = false;
|
||||
if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
|
||||
permissionToTake = false;
|
||||
|
||||
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
|
||||
permissionToDelete = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Handle god perms
|
||||
if (Permissions.IsGod(remoteClient.AgentId))
|
||||
if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId))
|
||||
{
|
||||
permissionToTake = true;
|
||||
permissionToTakeCopy = true;
|
||||
|
@ -1595,7 +1691,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
|
||||
|
@ -1606,6 +1702,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!permissionToTakeCopy)
|
||||
return;
|
||||
|
||||
permissionToTake = true;
|
||||
// Don't delete
|
||||
permissionToDelete = false;
|
||||
}
|
||||
|
@ -1736,7 +1833,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
|
||||
item.Folder = UUID.Zero; // Objects folder!
|
||||
InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object);
|
||||
if (folder != null)
|
||||
item.Folder = folder.ID;
|
||||
else // oopsies
|
||||
item.Folder = UUID.Zero;
|
||||
|
||||
if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions())
|
||||
{
|
||||
|
@ -1846,17 +1947,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
group.SetGroup(sourcePart.GroupID, null);
|
||||
|
||||
if (rootPart.OwnerID != item.OwnerID)
|
||||
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
if (Permissions.PropagatePermissions())
|
||||
{
|
||||
if ((item.CurrentPermissions & 8) != 0)
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
group.ApplyNextOwnerPermissions();
|
||||
}
|
||||
|
@ -1864,17 +1962,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if (part.OwnerID != item.OwnerID)
|
||||
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.OwnerID;
|
||||
part.Inventory.ChangeInventoryOwner(item.OwnerID);
|
||||
}
|
||||
else if ((item.CurrentPermissions & 8) != 0) // Slam!
|
||||
{
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
|
|
|
@ -348,6 +348,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private int m_update_backup = 200;
|
||||
private int m_update_terrain = 50;
|
||||
private int m_update_land = 1;
|
||||
private int m_update_coarse_locations = 50;
|
||||
|
||||
private int frameMS;
|
||||
private int physicsMS2;
|
||||
|
@ -477,8 +478,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
set { m_sceneGraph.RestorePresences = value; }
|
||||
}
|
||||
|
||||
public int objectCapacity = 45000;
|
||||
|
||||
#endregion
|
||||
|
||||
#region BinaryStats
|
||||
|
@ -686,7 +685,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||
|
||||
StatsReporter.SetObjectCapacity(objectCapacity);
|
||||
StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity);
|
||||
|
||||
// Old
|
||||
/*
|
||||
|
@ -947,12 +946,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Let the grid service module know, so this can be cached
|
||||
m_eventManager.TriggerOnRegionUp(otherRegion);
|
||||
|
||||
RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName);
|
||||
regInfo.RegionID = otherRegion.RegionID;
|
||||
regInfo.RegionName = otherRegion.RegionName;
|
||||
regInfo.ScopeID = otherRegion.ScopeID;
|
||||
regInfo.ExternalHostName = otherRegion.ExternalHostName;
|
||||
GridRegion r = new GridRegion(regInfo);
|
||||
try
|
||||
{
|
||||
ForEachScenePresence(delegate(ScenePresence agent)
|
||||
|
@ -967,7 +960,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
old.Add(otherRegion.RegionHandle);
|
||||
agent.DropOldNeighbours(old);
|
||||
if (m_teleportModule != null)
|
||||
m_teleportModule.EnableChildAgent(agent, r);
|
||||
m_teleportModule.EnableChildAgent(agent, otherRegion);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -1339,6 +1332,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
|
||||
m_regInfo.EstateSettings.Save();
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid,\n you must create the estate owner account first.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1417,6 +1412,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_frame % m_update_presences == 0)
|
||||
m_sceneGraph.UpdatePresences();
|
||||
|
||||
if (m_frame % m_update_coarse_locations == 0)
|
||||
{
|
||||
List<Vector3> coarseLocations;
|
||||
List<UUID> avatarUUIDs;
|
||||
SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
|
||||
// Send coarse locations to clients
|
||||
ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
|
||||
});
|
||||
}
|
||||
|
||||
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
|
||||
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
||||
m_sceneGraph.UpdatePreparePhysics();
|
||||
|
@ -1505,6 +1512,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
||||
LoginsDisabled = false;
|
||||
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1789,6 +1797,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
RegisterCommsEvents();
|
||||
|
||||
m_sceneGridService.SetScene(this);
|
||||
|
||||
// These two 'commands' *must be* next to each other or sim rebooting fails.
|
||||
//m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
|
||||
|
||||
|
@ -1799,24 +1809,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
throw new Exception(error);
|
||||
}
|
||||
|
||||
m_sceneGridService.SetScene(this);
|
||||
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
|
||||
|
||||
//Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
|
||||
|
||||
//if (dGridSettings.ContainsKey("allow_forceful_banlines"))
|
||||
//{
|
||||
// if (dGridSettings["allow_forceful_banlines"] != "TRUE")
|
||||
// {
|
||||
// m_log.Info("[GRID]: Grid is disabling forceful parcel banlists");
|
||||
// EventManager.TriggerSetAllowForcefulBan(false);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.Info("[GRID]: Grid is allowing forceful parcel banlists");
|
||||
// EventManager.TriggerSetAllowForcefulBan(true);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2066,8 +2058,34 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sceneObject.ScheduleGroupForFullUpdate();
|
||||
|
||||
return sceneObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an object into the scene that has come from storage
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <param name="attachToBackup">
|
||||
/// If true, changes to the object will be reflected in its persisted data
|
||||
/// If false, the persisted data will not be changed even if the object in the scene is changed
|
||||
/// </param>
|
||||
/// <param name="alreadyPersisted">
|
||||
/// If true, we won't persist this object until it changes
|
||||
/// If false, we'll persist this object immediately
|
||||
/// </param>
|
||||
/// <param name="sendClientUpdates">
|
||||
/// If true, we send updates to the client to tell it about this object
|
||||
/// If false, we leave it up to the caller to do this
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// true if the object was added, false if an object with the same uuid was already in the scene
|
||||
/// </returns>
|
||||
public bool AddRestoredSceneObject(
|
||||
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
|
||||
{
|
||||
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add an object into the scene that has come from storage
|
||||
/// </summary>
|
||||
|
@ -2087,7 +2105,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public bool AddRestoredSceneObject(
|
||||
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
|
||||
{
|
||||
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted);
|
||||
return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2441,7 +2459,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Called when objects or attachments cross the border between regions.
|
||||
/// Called when objects or attachments cross the border, or teleport, between regions.
|
||||
/// </summary>
|
||||
/// <param name="sog"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -2467,8 +2485,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
|
||||
|
||||
newObject.ResumeScripts();
|
||||
|
||||
// Do this as late as possible so that listeners have full access to the incoming object
|
||||
EventManager.TriggerOnIncomingSceneObject(newObject);
|
||||
|
||||
TriggerChangedTeleport(newObject);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2525,7 +2547,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
|
||||
sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
|
||||
|
||||
AddRestoredSceneObject(sceneObject, false, false);
|
||||
|
||||
// Don't sent a full update here because this will cause full updates to be sent twice for
|
||||
// attachments on region crossings, resulting in viewer glitches.
|
||||
AddRestoredSceneObject(sceneObject, false, false, false);
|
||||
|
||||
// Handle attachment special case
|
||||
SceneObjectPart RootPrim = sceneObject.RootPart;
|
||||
|
@ -2533,31 +2558,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Fix up attachment Parent Local ID
|
||||
ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
|
||||
|
||||
//uint parentLocalID = 0;
|
||||
if (sp != null)
|
||||
{
|
||||
//parentLocalID = sp.LocalId;
|
||||
|
||||
//sceneObject.RootPart.IsAttachment = true;
|
||||
//sceneObject.RootPart.SetParentLocalId(parentLocalID);
|
||||
|
||||
SceneObjectGroup grp = sceneObject;
|
||||
|
||||
//RootPrim.SetParentLocalId(parentLocalID);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
|
||||
|
||||
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
||||
|
||||
if (AttachmentsModule != null)
|
||||
AttachmentsModule.AttachObject(
|
||||
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
|
||||
|
||||
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
grp.SendGroupFullUpdate();
|
||||
|
||||
if (AttachmentsModule != null)
|
||||
AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2585,6 +2600,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void TriggerChangedTeleport(SceneObjectGroup sog)
|
||||
{
|
||||
ScenePresence sp = GetScenePresence(sog.OwnerID);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(sp.UUID);
|
||||
|
||||
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
||||
{
|
||||
// This will get your attention
|
||||
//m_log.Error("[XXX] Triggering ");
|
||||
|
||||
// Trigger CHANGED_TELEPORT
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Add/Remove Avatar Methods
|
||||
|
@ -3269,9 +3305,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
catch (NullReferenceException) { }
|
||||
});
|
||||
|
||||
ForEachScenePresence(
|
||||
delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
|
||||
|
||||
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
|
||||
if (agentTransactions != null)
|
||||
{
|
||||
|
@ -3323,14 +3356,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
|
||||
/// </summary>
|
||||
public void NotifyMyCoarseLocationChange()
|
||||
{
|
||||
ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Entities
|
||||
|
@ -3403,6 +3428,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
|
||||
{
|
||||
TeleportFlags tp = (TeleportFlags)teleportFlags;
|
||||
reason = String.Empty;
|
||||
|
||||
//Teleport flags:
|
||||
//
|
||||
// TeleportFlags.ViaGodlikeLure - Border Crossing
|
||||
|
@ -3410,36 +3437,34 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user
|
||||
// TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
|
||||
|
||||
|
||||
if (LoginsDisabled)
|
||||
{
|
||||
reason = "Logins Disabled";
|
||||
return false;
|
||||
}
|
||||
// Don't disable this log message - it's too helpful
|
||||
m_log.InfoFormat(
|
||||
"[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})",
|
||||
RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
|
||||
agent.AgentID, agent.circuitcode, teleportFlags);
|
||||
|
||||
reason = String.Empty;
|
||||
if (!VerifyUserPresence(agent, out reason))
|
||||
if (LoginsDisabled)
|
||||
{
|
||||
reason = "Logins Disabled";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AuthorizeUser(agent, out reason))
|
||||
return false;
|
||||
ScenePresence sp = GetScenePresence(agent.AgentID);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})",
|
||||
RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
|
||||
agent.AgentID, agent.circuitcode);
|
||||
|
||||
CapsModule.NewUserConnection(agent);
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
{
|
||||
// We have a zombie from a crashed session.
|
||||
// Or the same user is trying to be root twice here, won't work.
|
||||
// Kill it.
|
||||
m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName);
|
||||
sp.ControllingClient.Close();
|
||||
sp = null;
|
||||
}
|
||||
|
||||
ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
|
||||
|
||||
//On login or border crossing test land permisions
|
||||
if (tp != TeleportFlags.Default)
|
||||
//On login test land permisions
|
||||
if (tp == TeleportFlags.ViaLogin)
|
||||
{
|
||||
if (land != null && !TestLandRestrictions(agent, land, out reason))
|
||||
{
|
||||
|
@ -3447,8 +3472,40 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
ScenePresence sp = GetScenePresence(agent.AgentID);
|
||||
if (sp != null)
|
||||
if (sp == null) // We don't have an [child] agent here already
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (!VerifyUserPresence(agent, out reason))
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (!AuthorizeUser(agent, out reason))
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})",
|
||||
RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
|
||||
agent.AgentID, agent.circuitcode);
|
||||
|
||||
CapsModule.NewUserConnection(agent);
|
||||
CapsModule.AddCapsHandler(agent.AgentID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sp.IsChildAgent)
|
||||
{
|
||||
|
@ -3457,22 +3514,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
agent.AgentID, RegionInfo.RegionName);
|
||||
|
||||
sp.AdjustKnownSeeds();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have a zombie from a crashed session. Kill it.
|
||||
m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName);
|
||||
sp.ControllingClient.Close();
|
||||
CapsModule.NewUserConnection(agent);
|
||||
}
|
||||
}
|
||||
|
||||
CapsModule.AddCapsHandler(agent.AgentID);
|
||||
|
||||
if (!agent.child)
|
||||
// In all cases, add or update the circuit data with the new agent circuit data and teleport flags
|
||||
agent.teleportFlags = teleportFlags;
|
||||
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
|
||||
|
||||
if (tp == TeleportFlags.ViaLogin)
|
||||
{
|
||||
if (TestBorderCross(agent.startpos,Cardinals.E))
|
||||
if (TestBorderCross(agent.startpos, Cardinals.E))
|
||||
{
|
||||
Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E);
|
||||
agent.startpos.X = crossedBorder.BorderLine.Z - 1;
|
||||
|
@ -3537,9 +3590,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
agent.teleportFlags = teleportFlags;
|
||||
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3631,14 +3681,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
|
||||
if (m_regInfo.EstateSettings != null)
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
reason = String.Format("Denied access to region {0}: You have been banned from that region.",
|
||||
RegionInfo.RegionName);
|
||||
return false;
|
||||
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
reason = String.Format("Denied access to region {0}: You have been banned from that region.",
|
||||
RegionInfo.RegionName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!");
|
||||
|
||||
IGroupsModule groupsModule =
|
||||
RequestModuleInterface<IGroupsModule>();
|
||||
|
@ -3650,21 +3705,31 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
GroupMembershipData[] GroupMembership =
|
||||
groupsModule.GetMembershipData(agent.AgentID);
|
||||
|
||||
for (int i = 0; i < GroupMembership.Length; i++)
|
||||
agentGroups.Add(GroupMembership[i].GroupID);
|
||||
if (GroupMembership != null)
|
||||
{
|
||||
for (int i = 0; i < GroupMembership.Length; i++)
|
||||
agentGroups.Add(GroupMembership[i].GroupID);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!");
|
||||
}
|
||||
|
||||
bool groupAccess = false;
|
||||
UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups;
|
||||
|
||||
foreach (UUID group in estateGroups)
|
||||
if (estateGroups != null)
|
||||
{
|
||||
if (agentGroups.Contains(group))
|
||||
foreach (UUID group in estateGroups)
|
||||
{
|
||||
groupAccess = true;
|
||||
break;
|
||||
if (agentGroups.Contains(group))
|
||||
{
|
||||
groupAccess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
|
||||
|
||||
if (!m_regInfo.EstateSettings.PublicAccess &&
|
||||
!m_regInfo.EstateSettings.HasAccess(agent.AgentID) &&
|
||||
|
@ -3816,6 +3881,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.DebugFormat(
|
||||
"[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
|
||||
|
||||
// XPTO: if this agent is not allowed here as root, always return false
|
||||
|
||||
// We have to wait until the viewer contacts this region after receiving EAC.
|
||||
// That calls AddNewClient, which finally creates the ScenePresence
|
||||
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
|
||||
|
@ -3990,7 +4057,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// bordercross if position is outside of region
|
||||
|
||||
if (!result)
|
||||
{
|
||||
regionHandle = m_regInfo.RegionHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
// not in this region, undo the shift!
|
||||
|
@ -4047,20 +4116,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#region Other Methods
|
||||
|
||||
public void SetObjectCapacity(int objects)
|
||||
{
|
||||
// Region specific config overrides global
|
||||
//
|
||||
if (RegionInfo.ObjectCapacity != 0)
|
||||
objects = RegionInfo.ObjectCapacity;
|
||||
|
||||
if (StatsReporter != null)
|
||||
{
|
||||
StatsReporter.SetObjectCapacity(objects);
|
||||
}
|
||||
objectCapacity = objects;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
|
||||
|
@ -4659,7 +4714,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
part.NextOwnerMask;
|
||||
item.GroupPermissions = part.GroupMask &
|
||||
part.NextOwnerMask;
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.CurrentPermissions |= 16; // Slam!
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (InventoryService.AddItem(item))
|
||||
|
|
|
@ -267,7 +267,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e.ToString());
|
||||
m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="mod"></param>
|
||||
public void RegisterModuleInterface<M>(M mod)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
|
||||
// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
|
||||
|
||||
List<Object> l = null;
|
||||
if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
|
||||
|
|
|
@ -182,24 +182,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
|
||||
|
||||
for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
|
||||
List<GridRegion> neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);
|
||||
m_log.DebugFormat("[INTERGRID]: Informing {0} neighbours that this region is up", neighbours.Count);
|
||||
foreach (GridRegion n in neighbours)
|
||||
{
|
||||
for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
|
||||
{
|
||||
if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
|
||||
{
|
||||
ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
|
||||
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||
|
||||
d.BeginInvoke(neighbourService, region, handle,
|
||||
InformNeighborsThatRegionisUpCompleted,
|
||||
d);
|
||||
}
|
||||
}
|
||||
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||
d.BeginInvoke(neighbourService, region, n.RegionHandle,
|
||||
InformNeighborsThatRegionisUpCompleted,
|
||||
d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -206,6 +206,43 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
});
|
||||
}
|
||||
|
||||
public void GetCoarseLocations(out List<Vector3> coarseLocations, out List<UUID> avatarUUIDs, uint maxLocations)
|
||||
{
|
||||
coarseLocations = new List<Vector3>();
|
||||
avatarUUIDs = new List<UUID>();
|
||||
|
||||
List<ScenePresence> presences = GetScenePresences();
|
||||
for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i)
|
||||
{
|
||||
ScenePresence sp = presences[i];
|
||||
// If this presence is a child agent, we don't want its coarse locations
|
||||
if (sp.IsChildAgent)
|
||||
return;
|
||||
|
||||
if (sp.ParentID != 0)
|
||||
{
|
||||
// sitting avatar
|
||||
SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
|
||||
if (sop != null)
|
||||
{
|
||||
coarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
|
||||
avatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can't find the parent.. ! arg!
|
||||
coarseLocations.Add(sp.AbsolutePosition);
|
||||
avatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
coarseLocations.Add(sp.AbsolutePosition);
|
||||
avatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Entity Methods
|
||||
|
@ -222,11 +259,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// If true, we won't persist this object until it changes
|
||||
/// If false, we'll persist this object immediately
|
||||
/// </param>
|
||||
/// <param name="sendClientUpdates">
|
||||
/// If true, we send updates to the client to tell it about this object
|
||||
/// If false, we leave it up to the caller to do this
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// true if the object was added, false if an object with the same uuid was already in the scene
|
||||
/// </returns>
|
||||
protected internal bool AddRestoredSceneObject(
|
||||
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
|
||||
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
|
||||
{
|
||||
if (!alreadyPersisted)
|
||||
{
|
||||
|
@ -234,9 +275,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sceneObject.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
return AddSceneObject(sceneObject, attachToBackup, true);
|
||||
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a newly created object to the scene. This will both update the scene, and send information about the
|
||||
/// new object to all clients interested in the scene.
|
||||
|
@ -558,7 +599,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!Entities.Remove(agentID))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
|
||||
"[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
|
||||
agentID);
|
||||
}
|
||||
|
||||
|
@ -566,12 +607,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
|
||||
List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray);
|
||||
|
||||
// Remember the old presene reference from the dictionary
|
||||
ScenePresence oldref = newmap[agentID];
|
||||
|
||||
// Remove the presence reference from the dictionary
|
||||
if (newmap.Remove(agentID))
|
||||
if (newmap.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence oldref = newmap[agentID];
|
||||
newmap.Remove(agentID);
|
||||
|
||||
// Find the index in the list where the old ref was stored and remove the reference
|
||||
newlist.RemoveAt(newlist.IndexOf(oldref));
|
||||
// Swap out the dictionary and list with new references
|
||||
|
@ -580,7 +622,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
||||
m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1705,9 +1747,31 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition))
|
||||
{
|
||||
SceneObjectGroup copy = original.Copy(AgentID, GroupID, true);
|
||||
SceneObjectGroup copy = original.Copy(true);
|
||||
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
||||
|
||||
if (original.OwnerID != AgentID)
|
||||
{
|
||||
copy.SetOwnerId(AgentID);
|
||||
copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
|
||||
|
||||
List<SceneObjectPart> partList =
|
||||
new List<SceneObjectPart>(copy.Children.Values);
|
||||
|
||||
if (m_parentScene.Permissions.PropagatePermissions())
|
||||
{
|
||||
foreach (SceneObjectPart child in partList)
|
||||
{
|
||||
child.Inventory.ChangeInventoryOwner(AgentID);
|
||||
child.TriggerScriptChangedEvent(Changed.OWNER);
|
||||
child.ApplyNextOwnerPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
copy.RootPart.ObjectSaleType = 0;
|
||||
copy.RootPart.SalePrice = 10;
|
||||
}
|
||||
|
||||
Entities.Add(copy);
|
||||
|
||||
// Since we copy from a source group that is in selected
|
||||
|
|
|
@ -172,13 +172,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
taskItem.GroupPermissions = item.GroupPermissions &
|
||||
item.NextPermissions;
|
||||
taskItem.NextPermissions = item.NextPermissions;
|
||||
taskItem.CurrentPermissions |= 8;
|
||||
// We're adding this to a prim we don't own. Force
|
||||
// owner change
|
||||
taskItem.CurrentPermissions |= 16; // Slam
|
||||
}
|
||||
else
|
||||
{
|
||||
taskItem.BasePermissions = item.BasePermissions;
|
||||
taskItem.CurrentPermissions = item.CurrentPermissions;
|
||||
taskItem.CurrentPermissions |= 8;
|
||||
taskItem.EveryonePermissions = item.EveryOnePermissions;
|
||||
taskItem.GroupPermissions = item.GroupPermissions;
|
||||
taskItem.NextPermissions = item.NextPermissions;
|
||||
|
@ -281,7 +282,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 +296,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;
|
||||
}
|
||||
|
|
|
@ -1052,6 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
|
||||
detachedpos = avatar.AbsolutePosition;
|
||||
RootPart.FromItemID = UUID.Zero;
|
||||
|
||||
AbsolutePosition = detachedpos;
|
||||
m_rootPart.AttachedAvatar = UUID.Zero;
|
||||
|
@ -1471,7 +1472,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
"[SCENE]: Storing {0}, {1} in {2}",
|
||||
Name, UUID, m_scene.RegionInfo.RegionName);
|
||||
|
||||
SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false);
|
||||
SceneObjectGroup backup_group = Copy(false);
|
||||
backup_group.RootPart.Velocity = RootPart.Velocity;
|
||||
backup_group.RootPart.Acceleration = RootPart.Acceleration;
|
||||
backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
|
||||
|
@ -1527,7 +1528,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// Duplicates this object, including operations such as physics set up and attaching to the backup event.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SceneObjectGroup Copy(UUID cAgentID, UUID cGroupID, bool userExposed)
|
||||
public SceneObjectGroup Copy(bool userExposed)
|
||||
{
|
||||
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
|
||||
dupe.m_isBackedUp = false;
|
||||
|
@ -1550,7 +1551,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
|
||||
|
||||
if (!userExposed)
|
||||
{
|
||||
dupe.RootPart.IsAttachment = previousAttachmentStatus;
|
||||
}
|
||||
|
||||
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
|
||||
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
|
||||
|
@ -1575,16 +1578,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
|
||||
}
|
||||
|
||||
// Now we've made a copy that replaces this one, we need to
|
||||
// switch the owner to the person who did the copying
|
||||
// Second Life copies an object and duplicates the first one in it's place
|
||||
// So, we have to make a copy of this one, set it in it's place then set the owner on this one
|
||||
if (userExposed)
|
||||
{
|
||||
SetRootPartOwner(m_rootPart, cAgentID, cGroupID);
|
||||
m_rootPart.ScheduleFullUpdate();
|
||||
}
|
||||
|
||||
List<SceneObjectPart> partList;
|
||||
|
||||
lock (m_parts)
|
||||
|
@ -1605,12 +1598,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
|
||||
|
||||
newPart.LinkNum = part.LinkNum;
|
||||
|
||||
if (userExposed)
|
||||
{
|
||||
SetPartOwner(newPart, cAgentID, cGroupID);
|
||||
newPart.ScheduleFullUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2012,7 +1999,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void ScheduleGroupForFullUpdate()
|
||||
{
|
||||
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID);
|
||||
if (IsAttachment)
|
||||
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
|
||||
|
||||
checkAtTargets();
|
||||
RootPart.ScheduleFullUpdate();
|
||||
|
@ -3593,7 +3581,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public virtual ISceneObject CloneForNewScene()
|
||||
{
|
||||
SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false);
|
||||
SceneObjectGroup sog = Copy(false);
|
||||
sog.m_isDeleted = false;
|
||||
return sog;
|
||||
}
|
||||
|
|
|
@ -179,6 +179,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
[XmlIgnore]
|
||||
public UUID FromItemID;
|
||||
|
||||
[XmlIgnore]
|
||||
public UUID FromFolderID;
|
||||
|
||||
[XmlIgnore]
|
||||
public int STATUS_ROTATE_X;
|
||||
|
||||
|
@ -1487,6 +1490,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[SPEW]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4133,6 +4140,10 @@ 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;
|
||||
break;
|
||||
}
|
||||
SendFullUpdateToAllClients();
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.IO;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
|
@ -555,7 +556,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
m_items.Add(item.ItemID, item);
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -950,7 +951,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
||||
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
||||
item.CurrentPermissions |= 8;
|
||||
}
|
||||
item.CurrentPermissions &= item.NextPermissions;
|
||||
item.BasePermissions &= item.NextPermissions;
|
||||
|
|
|
@ -60,12 +60,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
struct ScriptControllers
|
||||
{
|
||||
public UUID itemID;
|
||||
public uint objID;
|
||||
public ScriptControlled ignoreControls;
|
||||
public ScriptControlled eventControls;
|
||||
}
|
||||
|
||||
public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence);
|
||||
public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
|
||||
|
||||
public class ScenePresence : EntityBase, ISceneEntity
|
||||
{
|
||||
|
@ -173,8 +172,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public string JID = String.Empty;
|
||||
|
||||
// Agent moves with a PID controller causing a force to be exerted.
|
||||
private bool m_newCoarseLocations = true;
|
||||
private float m_health = 100f;
|
||||
|
||||
// Default AV Height
|
||||
|
@ -1017,25 +1014,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void StopFlying()
|
||||
{
|
||||
// It turns out to get the agent to stop flying, you have to feed it stop flying velocities
|
||||
// There's no explicit message to send the client to tell it to stop flying.. it relies on the
|
||||
// velocity, collision plane and avatar height
|
||||
|
||||
// Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
|
||||
// when the avatar stands up
|
||||
|
||||
if (m_avHeight != 127.0f)
|
||||
{
|
||||
AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (m_avHeight / 6f));
|
||||
}
|
||||
else
|
||||
{
|
||||
AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f));
|
||||
}
|
||||
|
||||
ControllingClient.SendPrimUpdate(this, PrimUpdateFlags.Position);
|
||||
//ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
|
||||
// AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient)));
|
||||
ControllingClient.StopFlying(this);
|
||||
}
|
||||
|
||||
public void AddNeighbourRegion(ulong regionHandle, string cap)
|
||||
|
@ -2296,12 +2275,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
SendPrimUpdates();
|
||||
|
||||
if (m_newCoarseLocations)
|
||||
{
|
||||
SendCoarseLocations();
|
||||
m_newCoarseLocations = false;
|
||||
}
|
||||
|
||||
if (m_isChildAgent == false)
|
||||
{
|
||||
// PhysicsActor actor = m_physicsActor;
|
||||
|
@ -2375,12 +2348,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void SendCoarseLocations()
|
||||
public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
||||
{
|
||||
SendCourseLocationsMethod d = m_sendCourseLocationsMethod;
|
||||
if (d != null)
|
||||
{
|
||||
d.Invoke(m_scene.RegionInfo.originRegionID, this);
|
||||
d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2390,50 +2363,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_sendCourseLocationsMethod = d;
|
||||
}
|
||||
|
||||
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
|
||||
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
List<Vector3> CoarseLocations = new List<Vector3>();
|
||||
List<UUID> AvatarUUIDs = new List<UUID>();
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
if (sp.IsChildAgent)
|
||||
return;
|
||||
|
||||
if (sp.ParentID != 0)
|
||||
{
|
||||
// sitting avatar
|
||||
SceneObjectPart sop = m_scene.GetSceneObjectPart(sp.ParentID);
|
||||
if (sop != null)
|
||||
{
|
||||
CoarseLocations.Add(sop.AbsolutePosition + sp.m_pos);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can't find the parent.. ! arg!
|
||||
CoarseLocations.Add(sp.m_pos);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CoarseLocations.Add(sp.m_pos);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
});
|
||||
|
||||
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
|
||||
|
||||
m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void CoarseLocationChange()
|
||||
{
|
||||
m_newCoarseLocations = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar)
|
||||
/// </summary>
|
||||
|
@ -2668,7 +2604,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
posLastSignificantMove = AbsolutePosition;
|
||||
m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
|
||||
m_scene.NotifyMyCoarseLocationChange();
|
||||
}
|
||||
|
||||
// Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
|
||||
|
@ -3121,6 +3056,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
cAgent.Attachments = attachs;
|
||||
}
|
||||
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
|
||||
int i = 0;
|
||||
|
||||
foreach (ScriptControllers c in scriptedcontrols.Values)
|
||||
{
|
||||
controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
|
||||
}
|
||||
cAgent.Controllers = controls;
|
||||
}
|
||||
|
||||
// Animations
|
||||
try
|
||||
{
|
||||
|
@ -3192,6 +3139,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (cAgent.Attachments != null)
|
||||
{
|
||||
m_appearance.ClearAttachments();
|
||||
foreach (AttachmentData att in cAgent.Attachments)
|
||||
{
|
||||
m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
|
||||
|
@ -3200,6 +3148,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
if (cAgent.Controllers != null)
|
||||
{
|
||||
scriptedcontrols.Clear();
|
||||
|
||||
foreach (ControllerData c in cAgent.Controllers)
|
||||
{
|
||||
ScriptControllers sc = new ScriptControllers();
|
||||
sc.itemID = c.ItemID;
|
||||
sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
|
||||
sc.eventControls = (ScriptControlled)c.EventControls;
|
||||
|
||||
scriptedcontrols[sc.itemID] = sc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
// Animations
|
||||
try
|
||||
{
|
||||
|
@ -3531,7 +3500,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
obj.eventControls = ScriptControlled.CONTROL_ZERO;
|
||||
|
||||
obj.itemID = Script_item_UUID;
|
||||
obj.objID = Obj_localID;
|
||||
if (pass_on == 0 && accept == 0)
|
||||
{
|
||||
IgnoredControls |= (ScriptControlled)controls;
|
||||
|
@ -3674,7 +3642,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO)
|
||||
{
|
||||
// only send if still pressed or just changed
|
||||
m_scene.EventManager.TriggerControlEvent(scriptControlData.objID, scriptUUID, UUID, (uint)localHeld, (uint)localChange);
|
||||
m_scene.EventManager.TriggerControlEvent(scriptUUID, UUID, (uint)localHeld, (uint)localChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,7 +221,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
sr = new StringReader(parts[i].OuterXml);
|
||||
reader = new XmlTextReader(sr);
|
||||
SceneObjectPart part = SceneObjectPart.FromXml(reader);
|
||||
|
||||
int originalLinkNum = part.LinkNum;
|
||||
|
||||
sceneObject.AddPart(part);
|
||||
|
||||
// SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
|
||||
// We override that here
|
||||
if (originalLinkNum != 0)
|
||||
part.LinkNum = originalLinkNum;
|
||||
|
||||
part.StoreUndoState();
|
||||
reader.Close();
|
||||
sr.Close();
|
||||
|
|
|
@ -1055,11 +1055,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
}
|
||||
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendAvatarDataImmediate(ISceneEntity avatar)
|
||||
{
|
||||
|
||||
|
@ -1680,5 +1675,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId)
|
||||
{
|
||||
}
|
||||
|
||||
public void StopFlying(ISceneEntity presence)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue