Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

slimupdates
John Hurliman 2010-04-22 18:56:06 -07:00
commit 8692ac53f5
41 changed files with 458 additions and 190 deletions

View File

@ -48,6 +48,7 @@ namespace OpenSim.Data
{
UserAccountData[] Get(string[] fields, string[] values);
bool Store(UserAccountData data);
bool Delete(string field, string val);
UserAccountData[] GetUsers(UUID scopeID, string query);
}
}

View File

@ -146,6 +146,8 @@ namespace OpenSim.Data
{
m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText);
m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n 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.", e.Message);
cmd.CommandText = "ROLLBACK;";
cmd.ExecuteNonQuery();
}
if (version == 0)

View File

@ -135,5 +135,26 @@ namespace OpenSim.Data.Null
return result;
}
public bool Delete(string field, string val)
{
// Only delete by PrincipalID
if (field.Equals("PrincipalID"))
{
UUID uuid = UUID.Zero;
if (UUID.TryParse(val, out uuid) && m_DataByUUID.ContainsKey(uuid))
{
UserAccountData account = m_DataByUUID[uuid];
m_DataByUUID.Remove(uuid);
if (m_DataByName.ContainsKey(account.FirstName + " " + account.LastName))
m_DataByName.Remove(account.FirstName + " " + account.LastName);
if (account.Data.ContainsKey("Email") && account.Data["Email"] != string.Empty && m_DataByEmail.ContainsKey(account.Data["Email"]))
m_DataByEmail.Remove(account.Data["Email"]);
return true;
}
}
return false;
}
}
}

View File

@ -2,7 +2,7 @@
-- useraccounts table
CREATE TABLE UserAccounts (
PrincipalID CHAR(36) NOT NULL,
PrincipalID CHAR(36) primary key,
ScopeID CHAR(36) NOT NULL,
FirstName VARCHAR(64) NOT NULL,
LastName VARCHAR(64) NOT NULL,

View File

@ -235,7 +235,7 @@ namespace OpenSim.Data.SQLite
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now, 'localtime', '+" + lifetime.ToString() +
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");
if (ExecuteNonQuery(cmd, m_Connection) > 0)

View File

@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
if (words.Length == 1)
{
cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
m_Realm, scopeID.ToString(), words[0]);
}
else

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
{
/// <summary>
/// A console that uses cursor control and color
/// </summary>
/// </summary>
public class LocalConsole : CommandConsole
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -100,24 +100,40 @@ namespace OpenSim.Framework.Console
private int SetCursorTop(int top)
{
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
// to set a cursor row position with a currently invalid column, mono will throw an exception.
// Therefore, we need to make sure that the column position is valid first.
// to set a cursor row position with a currently invalid column, mono will throw an exception.
// Therefore, we need to make sure that the column position is valid first.
int left = System.Console.CursorLeft;
if (left < 0)
{
System.Console.CursorLeft = 0;
else if (left >= System.Console.BufferWidth)
System.Console.CursorLeft = System.Console.BufferWidth - 1;
}
else
{
int bw = System.Console.BufferWidth;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bw > 0 && left >= bw)
System.Console.CursorLeft = bw - 1;
}
if (top < 0)
{
top = 0;
if (top >= System.Console.BufferHeight)
top = System.Console.BufferHeight - 1;
}
else
{
int bh = System.Console.BufferHeight;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bh > 0 && top >= bh)
top = bh - 1;
}
System.Console.CursorTop = top;
return top;
}
}
/// <summary>
/// Set the cursor column.
@ -129,23 +145,38 @@ namespace OpenSim.Framework.Console
/// </param>
/// <returns>
/// The new cursor column.
/// </returns>
/// </returns>
private int SetCursorLeft(int left)
{
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
// to set a cursor column position with a currently invalid row, mono will throw an exception.
// Therefore, we need to make sure that the row position is valid first.
// to set a cursor column position with a currently invalid row, mono will throw an exception.
// Therefore, we need to make sure that the row position is valid first.
int top = System.Console.CursorTop;
if (top < 0)
{
System.Console.CursorTop = 0;
else if (top >= System.Console.BufferHeight)
System.Console.CursorTop = System.Console.BufferHeight - 1;
}
else
{
int bh = System.Console.BufferHeight;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bh > 0 && top >= bh)
System.Console.CursorTop = bh - 1;
}
if (left < 0)
{
left = 0;
if (left >= System.Console.BufferWidth)
left = System.Console.BufferWidth - 1;
}
else
{
int bw = System.Console.BufferWidth;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bw > 0 && left >= bw)
left = bw - 1;
}
System.Console.CursorLeft = left;
@ -183,7 +214,7 @@ namespace OpenSim.Framework.Console
System.Console.Write("{0}", prompt);
SetCursorTop(new_y);
SetCursorLeft(new_x);
SetCursorLeft(new_x);
}
}

View File

@ -1486,4 +1486,4 @@ namespace OpenSim.Framework
}
}
}
}

5
OpenSim/Region/Application/OpenSim.cs Executable file → Normal file
View File

@ -251,8 +251,9 @@ namespace OpenSim
"Save named prim to XML2", SavePrimsXml2);
m_console.Commands.AddCommand("region", false, "load oar",
"load oar [--merge] <oar name>",
"Load a region's data from OAR archive", LoadOar);
"load oar [--merge] [--skip-assets] <oar name>",
"Load a region's data from OAR archive. --merge will merge the oar with the existing scene. --skip-assets will load the oar but ignore the assets it contains",
LoadOar);
m_console.Commands.AddCommand("region", false, "save oar",
"save oar <oar name>",

View File

@ -7091,32 +7091,90 @@ namespace OpenSim.Region.ClientStack.LindenUDP
taskID = new UUID(transfer.TransferInfo.Params, 48);
UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
// m_log.DebugFormat(
// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
// requestID, itemID, taskID, Name);
if (!(((Scene)m_scene).Permissions.BypassPermissions()))
{
if (taskID != UUID.Zero) // Prim
{
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
if (part == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
Name, requestID, itemID, taskID);
return true;
}
if (part.OwnerID != AgentId)
return true;
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return true;
TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
if (ti == null)
return true;
if (ti.OwnerID != AgentId)
return true;
if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
return true;
if (ti.AssetID != requestID)
TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
if (tii == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID);
return true;
}
if (tii.Type == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
return true;
}
else if (tii.Type == (int)AssetType.Notecard)
{
if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
return true;
}
else
{
// TODO: Change this code to allow items other than notecards and scripts to be successfully
// shared with group. In fact, this whole block of permissions checking should move to an IPermissionsModule
if (part.OwnerID != AgentId)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
Name, requestID, itemID, taskID, part.OwnerID);
return true;
}
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
Name, requestID, itemID, taskID);
return true;
}
if (tii.OwnerID != AgentId)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID, tii.OwnerID);
return true;
}
if ((
tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
!= ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
Name, requestID, itemID, taskID);
return true;
}
if (tii.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
Name, requestID, itemID, taskID, tii.AssetID);
return true;
}
}
}
else // Agent
{
@ -7136,7 +7194,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// only to notecards and scripts. All
// other asset types are always available
//
if (assetRequestItem.AssetType == 10)
if (assetRequestItem.AssetType == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
{
@ -7144,7 +7202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
}
else if (assetRequestItem.AssetType == 7)
else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
{
if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
{
@ -7154,7 +7212,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
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;
}
}
}
}
@ -11389,7 +11452,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// }
}
//m_log.DebugFormat("[LLCLIENTVIEW]: {0} requesting asset {1}", Name, requestID);
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
}
@ -11757,4 +11820,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(dialog, ThrottleOutPacketType.Task);
}
}
}
}

View File

@ -181,7 +181,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
Manager.MyScene.AssetService.Store(asset);
if (part.Inventory.UpdateInventoryItem(item))
{
remoteClient.SendAgentAlertMessage("Notecard saved", false);
part.GetProperties(remoteClient);
}
}
}
}

View File

@ -30,6 +30,7 @@ using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
@ -169,6 +170,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return true;
}
public void RezMultipleAttachmentsFromInventory(
IClientAPI remoteClient,
RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
{
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
{
RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
}
}
public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
@ -227,6 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// Fire after attach, so we don't get messy perms dialogs
// 3 == AttachedRez
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
objatt.ResumeScripts();
// Do this last so that event listeners have access to all the effects of the attachment
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
@ -311,6 +324,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
}
public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
{
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
if (group != null)
{
//group.DetachToGround();
ShowDetachInUserInventory(group.GetFromItemID(), remoteClient);
}
}
public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient)
{
ScenePresence presence;
@ -329,6 +352,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
DetachSingleAttachmentToInv(itemID, remoteClient);
}
public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(itemID);
if (part == null || part.ParentGroup == null)
return;
UUID inventoryID = part.ParentGroup.GetFromItemID();
ScenePresence presence;
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
{
if (!m_scene.Permissions.CanRezObject(
part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition))
return;
presence.Appearance.DetachAttachment(itemID);
if (m_scene.AvatarFactory != null)
{
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
}
part.ParentGroup.DetachToGround();
List<UUID> uuids = new List<UUID>();
uuids.Add(inventoryID);
m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids);
remoteClient.SendRemoveInventoryItem(inventoryID);
}
m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero);
}
// What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
// To LocalId or UUID, *THAT* is the question. How now Brown UUID??
protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
@ -359,4 +414,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
}
}
}
}

View File

@ -601,6 +601,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// Fire on_rez
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 0);
rootPart.ParentGroup.ResumeScripts();
rootPart.ScheduleFullUpdate();
}

View File

@ -311,10 +311,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{
// m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID);
UUID requestedItemId = item.ID;
item = m_InventoryService.GetItem(item);
if (null == item)
m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", item.ID);
m_log.ErrorFormat(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", requestedItemId);
return item;
}

View File

@ -53,25 +53,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
private static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
private Scene m_scene;
private Stream m_loadStream;
private Guid m_requestId;
private string m_errorMessage;
protected Scene m_scene;
protected Stream m_loadStream;
protected Guid m_requestId;
protected string m_errorMessage;
/// <value>
/// Should the archive being loaded be merged with what is already on the region?
/// </value>
private bool m_merge;
protected bool m_merge;
/// <value>
/// Should we ignore any assets when reloading the archive?
/// </value>
protected bool m_skipAssets;
/// <summary>
/// Used to cache lookups for valid uuids.
/// </summary>
private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>();
public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId)
public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId)
{
m_scene = scene;
@ -89,14 +91,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_errorMessage = String.Empty;
m_merge = merge;
m_skipAssets = skipAssets;
m_requestId = requestId;
}
public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId)
public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
{
m_scene = scene;
m_loadStream = loadStream;
m_merge = merge;
m_skipAssets = skipAssets;
m_requestId = requestId;
}
@ -133,9 +137,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
{
serialisedSceneObjects.Add(m_utf8Encoding.GetString(data));
serialisedSceneObjects.Add(Encoding.UTF8.GetString(data));
}
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH) && !m_skipAssets)
{
if (LoadAsset(filePath, data))
successfulAssetRestores++;
@ -155,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
{
serialisedParcels.Add(m_utf8Encoding.GetString(data));
serialisedParcels.Add(Encoding.UTF8.GetString(data));
}
else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
{
@ -178,12 +182,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
archive.Close();
}
m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
if (failedAssetRestores > 0)
if (!m_skipAssets)
{
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
if (failedAssetRestores > 0)
{
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
}
}
if (!m_merge)
@ -277,6 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
sceneObjectsLoadedCount++;
sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0);
sceneObject.ResumeScripts();
}
}
@ -541,7 +549,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
XmlTextReader xtr
= new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context);
= new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;

View File

@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public void HandleLoadOarConsoleCommand(string module, string[] cmdparams)
{
bool mergeOar = false;
bool skipAssets = false;
OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; });
options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; });
List<string> mainParams = options.Parse(cmdparams);
// m_log.DebugFormat("MERGE OAR IS [{0}]", mergeOar);
@ -105,11 +108,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (mainParams.Count > 2)
{
DearchiveRegion(mainParams[2], mergeOar, Guid.Empty);
DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty);
}
else
{
DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, Guid.Empty);
DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, skipAssets, Guid.Empty);
}
}
@ -154,25 +157,25 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public void DearchiveRegion(string loadPath)
{
DearchiveRegion(loadPath, false, Guid.Empty);
DearchiveRegion(loadPath, false, false, Guid.Empty);
}
public void DearchiveRegion(string loadPath, bool merge, Guid requestId)
public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId)
{
m_log.InfoFormat(
"[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath);
new ArchiveReadRequest(m_scene, loadPath, merge, requestId).DearchiveRegion();
new ArchiveReadRequest(m_scene, loadPath, merge, skipAssets, requestId).DearchiveRegion();
}
public void DearchiveRegion(Stream loadStream)
{
DearchiveRegion(loadStream, false, Guid.Empty);
DearchiveRegion(loadStream, false, false, Guid.Empty);
}
public void DearchiveRegion(Stream loadStream, bool merge, Guid requestId)
public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId)
{
new ArchiveReadRequest(m_scene, loadStream, merge, requestId).DearchiveRegion();
new ArchiveReadRequest(m_scene, loadStream, merge, skipAssets, requestId).DearchiveRegion();
}
}
}

View File

@ -442,7 +442,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive);
m_archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty);
m_archiverModule.DearchiveRegion(archiveReadStream, true, false, Guid.Empty);
SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name);
Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge");

View File

@ -1079,7 +1079,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false;
} else {
}
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false;
}
@ -1095,7 +1097,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
if (!IsGroupMember(ti.GroupID, user, 0))
return false;
return false;
}
// Require full perms
@ -1593,14 +1595,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (part.OwnerID != user)
{
if (part.GroupID == UUID.Zero)
return false;
return false;
if (!IsGroupMember(part.GroupID, user, 0))
return false;
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false;
} else {
}
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false;
}
@ -1855,7 +1859,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericObjectPermission(agentID, prim, false);
}
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) {
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene)
{
//m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
switch (scriptType) {
case 0:
@ -1889,4 +1894,4 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return(false);
}
}
}
}

View File

@ -94,7 +94,7 @@ namespace OpenSim.Region.DataSnapshot
if (!m_configLoaded)
{
m_configLoaded = true;
m_log.Info("[DATASNAPSHOT]: Loading configuration");
//m_log.Debug("[DATASNAPSHOT]: Loading configuration");
//Read from the config for options
lock (m_syncInit)
{
@ -123,7 +123,7 @@ namespace OpenSim.Region.DataSnapshot
}
catch (Exception)
{
m_log.Info("[DATASNAPSHOT]: Could not load configuration. DataSnapshot will be disabled.");
m_log.Warn("[DATASNAPSHOT]: Could not load configuration. DataSnapshot will be disabled.");
m_enabled = false;
return;
}
@ -179,7 +179,7 @@ namespace OpenSim.Region.DataSnapshot
}
else
{
m_log.Warn("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else).");
//m_log.Debug("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else).");
}
}

View File

@ -27,6 +27,7 @@
using System;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
@ -81,6 +82,34 @@ namespace OpenSim.Region.Framework.Interfaces
UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
/// <summary>
/// Rez multiple attachments from a user's inventory
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="header"></param>
/// <param name="objects"></param>
void RezMultipleAttachmentsFromInventory(
IClientAPI remoteClient,
RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
/// <summary>
/// Detach an object from the avatar.
/// </summary>
///
/// This method is called in response to a client's detach request, so we only update the information in
/// inventory
/// <param name="objectLocalID"></param>
/// <param name="remoteClient"></param>
void DetachObject(uint objectLocalID, IClientAPI remoteClient);
/// <summary>
/// Detach the given item to the ground.
/// </summary>
/// <param name="itemID"></param>
/// <param name="remoteClient"></param>
void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient);
/// <summary>
/// Update the user inventory to the attachment of an item
/// </summary>

View File

@ -74,6 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
ArrayList GetScriptErrors(UUID itemID);
void ResumeScripts();
/// <summary>
/// Stop all the scripts in this entity.

View File

@ -90,8 +90,12 @@ namespace OpenSim.Region.Framework.Interfaces
/// If true, the loaded region merges with the existing one rather than replacing it. Any terrain or region
/// settings in the archive will be ignored.
/// </param>
/// <param name="skipAssets">
/// If true, the archive is loaded without loading any assets contained within it. This is useful if the
/// assets are already known to be present in the grid's asset service.
/// </param>
/// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
void DearchiveRegion(string loadPath, bool merge, Guid requestId);
void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId);
/// <summary>
/// Dearchive a region from a stream. This replaces the existing scene.
@ -113,7 +117,11 @@ namespace OpenSim.Region.Framework.Interfaces
/// If true, the loaded region merges with the existing one rather than replacing it. Any terrain or region
/// settings in the archive will be ignored.
/// </param>
/// <param name="skipAssets">
/// If true, the archive is loaded without loading any assets contained within it. This is useful if the
/// assets are already known to be present in the grid's asset service.
/// </param
/// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
void DearchiveRegion(Stream loadStream, bool merge, Guid requestId);
void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId);
}
}

View File

@ -41,6 +41,14 @@ namespace OpenSim.Region.Framework.Interfaces
bool PostScriptEvent(UUID itemID, string name, Object[] args);
bool PostObjectEvent(UUID itemID, string name, Object[] args);
// Suspend ALL scripts in a given scene object. The item ID
// is the UUID of a SOG, and the method acts on all contained
// scripts. This is different from the suspend/resume that
// can be issued by a client.
//
void SuspendScript(UUID itemID);
void ResumeScript(UUID itemID);
ArrayList GetScriptErrors(UUID itemID);
}
}

View File

@ -35,7 +35,6 @@ using OpenMetaverse;
using OpenMetaverse.Packets;
using log4net;
using OpenSim.Framework;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes.Serialization;
@ -64,6 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
if (group is SceneObjectGroup)
{
((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
((SceneObjectGroup) group).ResumeScripts();
}
}
}
@ -202,7 +202,9 @@ namespace OpenSim.Region.Framework.Scenes
// Update item with new asset
item.AssetID = asset.FullID;
group.UpdateInventoryItem(item);
if (group.UpdateInventoryItem(item))
remoteClient.SendAgentAlertMessage("Notecard saved", false);
part.GetProperties(remoteClient);
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
@ -219,6 +221,7 @@ namespace OpenSim.Region.Framework.Scenes
{
remoteClient.SendAgentAlertMessage("Script saved", false);
}
part.ParentGroup.ResumeScripts();
return errors;
}
@ -472,7 +475,6 @@ namespace OpenSim.Region.Framework.Scenes
return null;
}
if (recipientParentFolderId == UUID.Zero)
{
InventoryFolderBase recipientRootFolder = InventoryService.GetRootFolder(recipientId);
@ -1226,7 +1228,10 @@ namespace OpenSim.Region.Framework.Scenes
remoteClient, part, transactionID, currentItem);
}
if (part.Inventory.UpdateInventoryItem(itemInfo))
{
remoteClient.SendAgentAlertMessage("Notecard saved", false);
part.GetProperties(remoteClient);
}
}
}
else
@ -1278,6 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
part.GetProperties(remoteClient);
part.ParentGroup.ResumeScripts();
}
else
{
@ -1347,6 +1353,7 @@ namespace OpenSim.Region.Framework.Scenes
part.GetProperties(remoteClient);
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
part.ParentGroup.ResumeScripts();
}
}
@ -1450,6 +1457,8 @@ namespace OpenSim.Region.Framework.Scenes
destPart.Inventory.CreateScriptInstance(destTaskItem, start_param, false, DefaultScriptEngine, 0);
}
destPart.ParentGroup.ResumeScripts();
ScenePresence avatar;
if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar))
@ -1870,50 +1879,6 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerStopScript(part.LocalId, itemID);
}
internal void SendAttachEvent(uint localID, UUID itemID, UUID avatarID)
{
EventManager.TriggerOnAttach(localID, itemID, avatarID);
}
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
{
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
{
AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
}
}
public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
{
SceneObjectPart part = GetSceneObjectPart(itemID);
if (part == null || part.ParentGroup == null)
return;
UUID inventoryID = part.ParentGroup.GetFromItemID();
ScenePresence presence;
if (TryGetScenePresence(remoteClient.AgentId, out presence))
{
if (!Permissions.CanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition))
return;
presence.Appearance.DetachAttachment(itemID);
IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
if (ava != null)
{
ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
}
part.ParentGroup.DetachToGround();
List<UUID> uuids = new List<UUID>();
uuids.Add(inventoryID);
InventoryService.DeleteItems(remoteClient.AgentId, uuids);
remoteClient.SendRemoveInventoryItem(inventoryID);
}
SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
}
public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
{
EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID);

View File

@ -1131,7 +1131,6 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_scripts_enabled != !ScriptEngine)
{
// Tedd! Here's the method to disable the scripting engine!
if (ScriptEngine)
{
m_log.Info("Stopping all Scripts in Scene");
@ -1153,6 +1152,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ent is SceneObjectGroup)
{
((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
((SceneObjectGroup)ent).ResumeScripts();
}
}
}
@ -2769,14 +2769,13 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
{
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
client.OnObjectDetach += m_sceneGraph.DetachObject;
{
if (AttachmentsModule != null)
{
client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnRezMultipleAttachmentsFromInv += AttachmentsModule.RezMultipleAttachmentsFromInventory;
client.OnObjectAttach += AttachmentsModule.AttachObject;
client.OnObjectDetach += AttachmentsModule.DetachObject;
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
}
}
@ -2925,14 +2924,13 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
{
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
client.OnObjectDetach -= m_sceneGraph.DetachObject;
{
if (AttachmentsModule != null)
{
client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnRezMultipleAttachmentsFromInv -= AttachmentsModule.RezMultipleAttachmentsFromInventory;
client.OnObjectAttach -= AttachmentsModule.AttachObject;
client.OnObjectDetach -= AttachmentsModule.DetachObject;
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
}
}

View File

@ -443,9 +443,7 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
if (group != null)
{
m_parentScene.DetachSingleAttachmentToGround(group.UUID, remoteClient);
}
m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient);
}
protected internal void DetachObject(uint objectLocalID, IClientAPI remoteClient)
@ -1757,6 +1755,7 @@ namespace OpenSim.Region.Framework.Scenes
copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0);
copy.HasGroupChanged = true;
copy.ScheduleGroupForFullUpdate();
copy.ResumeScripts();
// required for physics to update it's position
copy.AbsolutePosition = copy.AbsolutePosition;

View File

@ -416,5 +416,13 @@ namespace OpenSim.Region.Framework.Scenes
scriptModule.SetXMLState(itemID, n.OuterXml);
}
}
public void ResumeScripts()
{
foreach (SceneObjectPart part in m_parts.Values)
{
part.Inventory.ResumeScripts();
}
}
}
}

View File

@ -282,36 +282,32 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
m_part.ParentGroup.Scene.AssetService.Get(
item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset)
{
if (null == asset)
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
item.Name, item.ItemID, m_part.AbsolutePosition,
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
}
else
{
if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID);
AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
if (null == asset)
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
item.Name, item.ItemID, m_part.AbsolutePosition,
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
}
else
{
if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID);
lock (m_items)
{
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
}
string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
m_part.ScheduleFullUpdate();
}
lock (m_items)
{
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
}
);
string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
m_part.ScheduleFullUpdate();
}
}
}
@ -630,16 +626,6 @@ namespace OpenSim.Region.Framework.Scenes
{
item.AssetID = m_items[item.ItemID].AssetID;
}
else if ((InventoryType)item.Type == InventoryType.Notecard)
{
ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
if (presence != null)
{
presence.ControllingClient.SendAgentAlertMessage(
"Notecard saved", false);
}
}
m_items[item.ItemID] = item;
m_inventorySerial++;
@ -1042,5 +1028,28 @@ namespace OpenSim.Region.Framework.Scenes
return ret;
}
public void ResumeScripts()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null)
return;
lock (m_items)
{
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.InvType == (int)InventoryType.LSL)
{
foreach (IScriptModule engine in engines)
{
if (engine != null)
engine.ResumeScript(item.ItemID);
}
}
}
}
}
}
}
}

View File

@ -182,6 +182,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
foreach (SceneObjectGroup sceneObject in sceneObjects)
{
sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0);
sceneObject.ResumeScripts();
}
}

View File

@ -109,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
}
else
{
m_log.WarnFormat("[IRC-Bridge] Not enabled. Connect for region {0} ignored", scene.RegionInfo.RegionName);
//m_log.DebugFormat("[IRC-Bridge] Not enabled. Connect for region {0} ignored", scene.RegionInfo.RegionName);
}
}

View File

@ -142,8 +142,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
}
// If we got all the config options we need, lets start'er'up
m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
m_connectorEnabled = true;
}
}

View File

@ -81,6 +81,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void PostEvent(EventParams data);
void Suspend();
void Resume();
/// <summary>
/// Process the next event queued for this script
/// </summary>

View File

@ -302,6 +302,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
float dz;
Quaternion q = SensePoint.RotationOffset;
if (SensePoint.ParentGroup.RootPart.IsAttachment)
{
// In attachments, the sensor cone always orients with the
// avatar rotation. This may include a nonzero elevation if
// in mouselook.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
q = avatar.Rotation;
}
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);

View File

@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private bool m_startedFromSavedState;
private UUID m_CurrentStateHash;
private UUID m_RegionID;
private bool m_Suspended = false;
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
m_LineMap;
@ -638,6 +639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
/// <returns></returns>
public object EventProcessor()
{
if (m_Suspended)
return 0;
lock (m_Script)
{
EventParams data = null;
@ -1011,5 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
get { return m_RegionID; }
}
public void Suspend()
{
m_Suspended = true;
}
public void Resume()
{
m_Suspended = false;
}
}
}

View File

@ -1488,5 +1488,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return new ArrayList();
}
}
public void SuspendScript(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return;
instance.Suspend();
}
public void ResumeScript(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return;
instance.Resume();
}
}
}

View File

@ -405,9 +405,9 @@ namespace OpenSim.Services.LLLoginService
}
else
{
position = new Vector3(float.Parse(uriMatch.Groups["x"].Value),
float.Parse(uriMatch.Groups["y"].Value),
float.Parse(uriMatch.Groups["z"].Value));
position = new Vector3(float.Parse(uriMatch.Groups["x"].Value, Culture.NumberFormatInfo),
float.Parse(uriMatch.Groups["y"].Value, Culture.NumberFormatInfo),
float.Parse(uriMatch.Groups["z"].Value, Culture.NumberFormatInfo));
string regionName = uriMatch.Groups["region"].ToString();
if (regionName != null)

View File

@ -59,7 +59,8 @@ Once you are presented with a prompt that looks like:
You have successfully started OpenSim.
Before you can log in you will need to create a user account. You can do
Before you can log in you will need to create a user account if you didn't already create
your user as the "Master Avatar" during the region configuration stage. You can do
this by running the "create user" command on the OpenSim console. This will
ask you a series of questions such as first name, last name and password.

View File

@ -1299,7 +1299,7 @@
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Server" path="OpenSim/Server" type="Exe">
<Project frameworkVersion="v3_5" name="Robust" path="OpenSim/Server" type="Exe">
<Configuration name="Debug">
<Options>
<OutputPath>../../bin/</OutputPath>