Merge branch 'careminster-presence-refactor' of www.3dhosting.de:/var/git/careminster into careminster-presence-refactor

avinationmerge
Mike Rieker 2010-07-06 02:23:10 +00:00
commit 6e7f1a3ac1
72 changed files with 937 additions and 387 deletions

View File

@ -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

View File

@ -38,7 +38,7 @@ namespace OpenSim.Data
{
public abstract AssetBase GetAsset(UUID uuid);
public abstract void StoreAsset(AssetBase asset);
public abstract bool StoreAsset(AssetBase asset);
public abstract bool ExistsAsset(UUID uuid);
public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count);

View File

@ -34,7 +34,7 @@ namespace OpenSim.Data
public interface IAssetDataPlugin : IPlugin
{
AssetBase GetAsset(UUID uuid);
void StoreAsset(AssetBase asset);
bool StoreAsset(AssetBase asset);
bool ExistsAsset(UUID uuid);
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
void Initialise(string connect);

View File

@ -143,7 +143,7 @@ namespace OpenSim.Data.MSSQL
/// Create asset in m_database
/// </summary>
/// <param name="asset">the asset</param>
override public void StoreAsset(AssetBase asset)
override public bool StoreAsset(AssetBase asset)
{
string sql =
@ -192,10 +192,12 @@ namespace OpenSim.Data.MSSQL
try
{
command.ExecuteNonQuery();
return true;
}
catch(Exception e)
{
m_log.Error("[ASSET DB]: Error storing item :" + e.Message);
return false;
}
}
}

View File

@ -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;");
}

View File

@ -153,7 +153,7 @@ namespace OpenSim.Data.MySQL
/// </summary>
/// <param name="asset">Asset UUID to create</param>
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
override public void StoreAsset(AssetBase asset)
override public bool StoreAsset(AssetBase asset)
{
lock (m_dbLock)
{
@ -201,12 +201,14 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?data", asset.Data);
cmd.ExecuteNonQuery();
cmd.Dispose();
return true;
}
}
catch (Exception e)
{
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
asset.FullID, asset.Name, e.Message);
return false;
}
}
}

View File

@ -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);

View File

@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLite
/// Create an asset
/// </summary>
/// <param name="asset">Asset Base</param>
override public void StoreAsset(AssetBase asset)
override public bool StoreAsset(AssetBase asset)
{
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
if (ExistsAsset(asset.FullID))
@ -141,6 +141,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
return true;
}
}
}
@ -161,6 +162,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
return true;
}
}
}

View File

@ -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);
}

View File

@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLiteLegacy
/// Create an asset
/// </summary>
/// <param name="asset">Asset Base</param>
override public void StoreAsset(AssetBase asset)
override public bool StoreAsset(AssetBase asset)
{
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
if (ExistsAsset(asset.FullID))
@ -139,6 +139,7 @@ namespace OpenSim.Data.SQLiteLegacy
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
return true;
}
}
}
@ -157,6 +158,7 @@ namespace OpenSim.Data.SQLiteLegacy
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
return true;
}
}
}

View File

@ -60,6 +60,8 @@ namespace OpenSim.Framework
/// </summary>
private AssetMetadata m_metadata;
private int m_uploadAttempts;
// This is needed for .NET serialization!!!
// Do NOT "Optimize" away!
public AssetBase()
@ -197,6 +199,12 @@ namespace OpenSim.Framework
set { m_metadata.Type = value; }
}
public int UploadAttempts
{
get { return m_uploadAttempts; }
set { m_uploadAttempts = value; }
}
/// <summary>
/// Is this a region only asset, or does this exist on the asset server also
/// </summary>

View File

@ -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);

View File

@ -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;
}
}

View File

@ -27,7 +27,7 @@
namespace OpenSim.Framework
{
public enum ParcelMediaCommandEnum
public enum ParcelMediaCommandEnum : int
{
Stop = 0,
Pause = 1,

View File

@ -1196,7 +1196,7 @@ namespace OpenSim.Framework
prim.Textures = this.Textures;
prim.Properties = new Primitive.ObjectProperties();
prim.Properties.Name = "Primitive";
prim.Properties.Name = "Object";
prim.Properties.Description = "";
prim.Properties.CreatorID = UUID.Zero;
prim.Properties.GroupID = UUID.Zero;

View File

@ -40,6 +40,7 @@ using OpenSim.Framework.Console;
namespace OpenSim.Framework
{
[Serializable]
public class RegionLightShareData : ICloneable
{
public UUID regionID = UUID.Zero;

View File

@ -56,12 +56,28 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
{
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 100);
}
/// <summary>
/// Perform a synchronous REST request.
/// </summary>
/// <param name="verb"></param>
/// <param name="requestUrl"></param>
/// <param name="obj"> </param>
/// <param name="timeout"> </param>
/// <returns></returns>
///
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
{
Type type = typeof (TRequest);
TResponse deserial = default(TResponse);
WebRequest request = WebRequest.Create(requestUrl);
request.Method = verb;
request.Timeout = pTimeout * 1000;
if ((verb == "POST") || (verb == "PUT"))
{
@ -81,7 +97,6 @@ namespace OpenSim.Framework.Servers.HttpServer
int length = (int) buffer.Length;
request.ContentLength = length;
Stream requestStream = null;
try
{

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Collections.Generic;
namespace OpenSim.Framework
{
@ -36,33 +37,30 @@ namespace OpenSim.Framework
[Serializable]
public class UndoStack<T>
{
private int m_new = 1;
private int m_old = 0;
private T[] m_Undos;
private List<T> m_undolist;
private int m_max;
public UndoStack(int capacity)
{
m_Undos = new T[capacity + 1];
m_undolist = new List<T>();
m_max = capacity;
}
public bool IsFull
{
get { return m_new == m_old; }
get { return m_undolist.Count >= m_max; }
}
public int Capacity
{
get { return m_Undos.Length - 1; }
get { return m_max; }
}
public int Count
{
get
{
int count = m_new - m_old - 1;
if (count < 0)
count += m_Undos.Length;
return count;
return m_undolist.Count;
}
}
@ -70,45 +68,39 @@ namespace OpenSim.Framework
{
if (IsFull)
{
m_old++;
if (m_old >= m_Undos.Length)
m_old -= m_Undos.Length;
m_undolist.RemoveAt(0);
}
if (++m_new >= m_Undos.Length)
m_new -= m_Undos.Length;
m_Undos[m_new] = item;
m_undolist.Add(item);
}
public T Pop()
{
if (Count > 0)
if (m_undolist.Count > 0)
{
T deleted = m_Undos[m_new];
m_Undos[m_new--] = default(T);
if (m_new < 0)
m_new += m_Undos.Length;
return deleted;
int ind = m_undolist.Count - 1;
T item = m_undolist[ind];
m_undolist.RemoveAt(ind);
return item;
}
else
throw new InvalidOperationException("Cannot pop from emtpy stack");
throw new InvalidOperationException("Cannot pop from empty stack");
}
public T Peek()
{
return m_Undos[m_new];
if (m_undolist.Count > 0)
{
return m_undolist[m_undolist.Count - 1];
}
else
{
return default(T);
}
}
public void Clear()
{
if (Count > 0)
{
for (int i = 0; i < m_Undos.Length; i++)
{
m_Undos[i] = default(T);
}
m_new = 1;
m_old = 0;
}
m_undolist.Clear();
}
}
}

View File

@ -2208,6 +2208,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(sound, ThrottleOutPacketType.Task);
}
public void SendTransferAbort(TransferRequestPacket transferRequest)
{
TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
m_log.Debug("[Assets] Aborting transfer; asset request failed");
OutPacket(abort, ThrottleOutPacketType.Task);
}
public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
{
SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@ -6307,8 +6316,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);
}
}
@ -6898,7 +6907,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);
}
@ -11502,7 +11511,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
//Note, the bool returned from the below function is useless since it is always false.
m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
}
/// <summary>
@ -11551,8 +11563,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
//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.
//We need to send a TransferAbort here, so the client doesn't wait forever for the asset,
//which causes it to not request any more for a while. Which is bad.
SendTransferAbort(transferRequest);
return;
}

View File

@ -900,7 +900,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Start the IClientAPI
// Spin it off so that it doesn't clog up the LLUDPServer
Util.FireAndForget(delegate(object o) { client.Start(); });
//Util.FireAndForget(delegate(object o) { client.Start(); });
// NOTE: DO NOT CALL THIS ASYNCHRONOUSLY!!!!!
// This method will ultimately cause the modules to hook
// client events in OnNewClient. If they can't do this
// before further packets are processed, packets WILL BE LOST.
// This includes the all-important EconomyDataRequest!
// So using FireAndForget here WILL screw up money. Badly.
// You have been warned!
client.Start();
}
else
{

View File

@ -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;

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
end = Utils.Clamp(end, 1, texture.Data.Length);
start = Utils.Clamp(start, 0, end - 1);
m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
if (end - start < texture.Data.Length)
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;

View File

@ -769,8 +769,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;
}

View File

@ -156,11 +156,30 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
return;
}
if (dialog == (byte)InstantMessageDialog.MessageFromAgent ||
dialog == (byte)InstantMessageDialog.MessageFromObject)
DateTime dt = DateTime.UtcNow;
// Ticks from UtcNow, but make it look like local. Evil, huh?
dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
try
{
im.offline = 1;
// Convert that to the PST timezone
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
}
catch
{
m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp.");
}
// And make it look local again to fool the unix time util
dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
im.timestamp = (uint)Util.ToUnixTime(dt);
// If client is null, this message comes from storage and IS offline
if (client != null)
im.offline = 0;
if (m_TransferModule != null)
{

View File

@ -192,6 +192,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// Needed for proper state management for stored group
// invitations
//
im.offline = 1;
// Reconstruct imSessionID
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
{
UUID fromAgentID = new UUID(im.fromAgentID);
UUID sessionID = fromAgentID ^ client.AgentId;
im.imSessionID = new Guid(sessionID.ToString());
}
Scene s = FindScene(client.AgentId);
if (s != null)
s.EventManager.TriggerIncomingInstantMessage(im);
@ -201,35 +212,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private void UndeliveredMessage(GridInstantMessage im)
{
if (im.dialog == 19)
im.offline = 1; // We want them pushed out to the server
if ((im.offline != 0)
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
im.dialog != (byte)InstantMessageDialog.GroupNotice &&
im.dialog != (byte)InstantMessageDialog.InventoryOffered)
{
// It's not delivered. Make sure the scope id is saved
// We don't need the imSessionID here anymore, overwrite it
Scene scene = FindScene(new UUID(im.fromAgentID));
if (scene == null)
scene = m_SceneList[0];
im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString());
return;
}
bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
"POST", m_RestURL+"/SaveMessage/", im);
// It's not delivered. Make sure the scope id is saved
// We don't need the imSessionID here anymore, overwrite it
Scene scene = FindScene(new UUID(im.fromAgentID));
if (scene == null)
scene = m_SceneList[0];
im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString());
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
{
IClientAPI client = FindClient(new UUID(im.fromAgentID));
if (client == null)
return;
bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
"POST", m_RestURL+"/SaveMessage/", im);
client.SendInstantMessage(new GridInstantMessage(
null, new UUID(im.toAgentID),
"System", new UUID(im.fromAgentID),
(byte)InstantMessageDialog.MessageFromAgent,
"User is not logged in. "+
(success ? "Message saved." : "Message not saved"),
false, new Vector3()));
}
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
{
IClientAPI client = FindClient(new UUID(im.fromAgentID));
if (client == null)
return;
client.SendInstantMessage(new GridInstantMessage(
null, new UUID(im.toAgentID),
"System", new UUID(im.fromAgentID),
(byte)InstantMessageDialog.MessageFromAgent,
"User is not logged in. "+
(success ? "Message saved." : "Message not saved"),
false, new Vector3()));
}
}
}

View File

@ -131,6 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return ret;
}
// DO NOT OVERRIDE THIS METHOD
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient)
{

View File

@ -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)
@ -332,7 +324,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (folder == null) // None of the above
{
//folder = userInfo.RootFolder.FindFolder(folderID);
folder = new InventoryFolderBase(folderID);
if (folder == null) // Nowhere to put it

View File

@ -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

View File

@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
return urlcode;
}
string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString();
UrlData urlData = new UrlData();
urlData.hostID = host.UUID;
@ -152,10 +152,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
urlData.urlcode = urlcode;
urlData.requests = new Dictionary<UUID, RequestData>();
m_UrlMap[url] = urlData;
string uri = "/lslhttp/" + urlcode.ToString() + "/";
string uri = "/lslhttp/" + urlcode.ToString();
m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll,
new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents,
@ -386,6 +385,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
return response;
}
public void HttpRequestHandler(UUID requestID, Hashtable request)
{
lock (request)
@ -400,8 +400,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
int pos1 = uri.IndexOf("/");// /lslhttp
int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/
string uri_tmp = uri.Substring(0, pos3 + 1);
int pos3 = pos2 + 37; // /lslhttp/urlcode
string uri_tmp = uri.Substring(0, pos3);
//HTTP server code doesn't provide us with QueryStrings
string pathInfo;
string queryString;

View File

@ -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);
}
}

View File

@ -1303,18 +1303,31 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
{
for (int i = 0; i < data.Count; i++)
lock (m_landList)
{
IncomingLandObjectFromStorage(data[i]);
//Remove all the land objects in the sim and then process our new data
foreach (int n in m_landList.Keys)
{
m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
}
m_landIDList.Initialize();
m_landList.Clear();
for (int i = 0; i < data.Count; i++)
{
IncomingLandObjectFromStorage(data[i]);
}
}
}
public void IncomingLandObjectFromStorage(LandData data)
{
ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
new_land.LandData = data.Copy();
new_land.SetLandBitmapFromByteArray();
AddLandObject(new_land);
new_land.SendLandUpdateToAvatarsOverMe();
}
public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)

View File

@ -544,6 +544,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
m_scene.SaveTerrain();
m_scene.EventManager.TriggerTerrainUpdate();
// Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
//m_scene.CreateTerrainTexture(true);
}

View File

@ -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))

View File

@ -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);

View File

@ -55,8 +55,12 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void OnTerrainTickDelegate();
public delegate void OnTerrainUpdateDelegate();
public event OnTerrainTickDelegate OnTerrainTick;
public event OnTerrainUpdateDelegate OnTerrainUpdate;
public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
public event OnBackupDelegate OnBackup;
@ -716,6 +720,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
public void TriggerTerrainUpdate()
{
OnTerrainUpdateDelegate handlerTerrainUpdate = OnTerrainUpdate;
if (handlerTerrainUpdate != null)
{
foreach (OnTerrainUpdateDelegate d in handlerTerrainUpdate.GetInvocationList())
{
try
{
d();
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerTerrainUpdate failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerTerrainTick()
{

View File

@ -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);
@ -400,9 +400,9 @@ 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;
itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move);
// By default, current equals base
itemCopy.CurrentPermissions = itemCopy.BasePermissions;
itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions;
// If this is an object, replace current perms
// with folded perms
@ -413,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
}
// Ensure there is no escalation
itemCopy.CurrentPermissions &= item.NextPermissions;
itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move);
// Need slam bit on xfer
itemCopy.CurrentPermissions |= 8;
@ -916,14 +916,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.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
@ -1105,13 +1106,13 @@ 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;
(srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
destTaskItem.CurrentPermissions |= 8; // Slam!
}
}
@ -1284,7 +1285,7 @@ namespace OpenSim.Region.Framework.Scenes
}
if (part.Inventory.UpdateInventoryItem(itemInfo))
{
remoteClient.SendAgentAlertMessage("Notecard saved", false);
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
part.GetProperties(remoteClient);
}
}
@ -1377,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"),
Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
remoteClient.AgentId);
AssetService.Store(asset);
@ -1592,18 +1593,36 @@ namespace OpenSim.Region.Framework.Scenes
// for when deleting the object from it
ForceSceneObjectBackup(grp);
if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
if (remoteClient == null)
{
// Autoreturn has a null client. Nothing else does. So
// allow only returns
if (action != DeRezAction.Return)
return;
permissionToTakeCopy = false;
if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
permissionToTake = false;
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
permissionToDelete = false;
}
else
{
if (action == DeRezAction.TakeCopy)
{
if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
permissionToTakeCopy = false;
}
else
{
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;
@ -1614,7 +1633,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
@ -1625,6 +1644,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!permissionToTakeCopy)
return;
permissionToTake = true;
// Don't delete
permissionToDelete = false;
}

View File

@ -1770,6 +1770,7 @@ namespace OpenSim.Region.Framework.Scenes
public void StoreWindlightProfile(RegionLightShareData wl)
{
m_regInfo.WindlightSettings = wl;
wl.Save();
m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
@ -2183,6 +2184,15 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void DeleteAllSceneObjects()
{
DeleteAllSceneObjects(false);
}
/// <summary>
/// Delete every object from the scene. This does not include attachments worn by avatars.
/// </summary>
public void DeleteAllSceneObjects(bool exceptNoCopy)
{
List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
lock (Entities)
{
ICollection<EntityBase> entities = new List<EntityBase>(Entities);
@ -2192,11 +2202,24 @@ namespace OpenSim.Region.Framework.Scenes
if (e is SceneObjectGroup)
{
SceneObjectGroup sog = (SceneObjectGroup)e;
if (!sog.IsAttachment)
DeleteSceneObject((SceneObjectGroup)e, false);
if (sog != null && !sog.IsAttachment)
{
if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
{
DeleteSceneObject((SceneObjectGroup)e, false);
}
else
{
toReturn.Add((SceneObjectGroup)e);
}
}
}
}
}
if (toReturn.Count > 0)
{
returnObjects(toReturn.ToArray(), UUID.Zero);
}
}
/// <summary>

View File

@ -1848,9 +1848,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

View File

@ -349,7 +349,21 @@ namespace OpenSim.Region.Framework.Scenes
public virtual Quaternion Rotation
{
get { return m_rotation; }
set { m_rotation = value; }
set {
lockPartsForRead(true);
try
{
foreach(SceneObjectPart p in m_parts.Values)
{
p.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
}
}
finally
{
lockPartsForRead(false);
}
m_rotation = value;
}
}
public Quaternion GroupRotation
@ -431,7 +445,10 @@ namespace OpenSim.Region.Framework.Scenes
}
lockPartsForRead(true);
foreach (SceneObjectPart part in m_parts.Values)
{
part.IgnoreUndoUpdate = true;
}
if (RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
@ -443,12 +460,12 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
}
foreach (SceneObjectPart part in m_parts.Values)
{
part.IgnoreUndoUpdate = false;
part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
part.GroupPosition = val;
}
lockPartsForRead(false);
//if (m_rootPart.PhysActor != null)
@ -724,7 +741,6 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart part in m_parts.Values)
{
Vector3 partscale = part.Scale;
Vector3 partoffset = part.OffsetPosition;
@ -1471,7 +1487,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
{
part.StoreUndoState();
part.StoreUndoState(UndoType.STATE_PRIM_ALL);
part.OnGrab(offsetPos, remoteClient);
}
@ -1700,7 +1716,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;
@ -1758,7 +1774,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;
@ -1781,7 +1797,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;
@ -1806,16 +1824,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;
lockPartsForRead(true);
@ -1837,12 +1845,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();
}
}
}
@ -3146,7 +3148,6 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.IgnoreUndoUpdate = true;
if (scale.X > m_scene.m_maxNonphys)
scale.X = m_scene.m_maxNonphys;
if (scale.Y > m_scene.m_maxNonphys)
@ -3232,8 +3233,7 @@ namespace OpenSim.Region.Framework.Scenes
y *= a;
z *= a;
}
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
}
}
}
@ -3243,16 +3243,24 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 prevScale = part.Scale;
prevScale.X *= x;
prevScale.Y *= y;
prevScale.Z *= z;
prevScale.Z *= z;;
part.IgnoreUndoUpdate = false;
part.StoreUndoState(UndoType.STATE_GROUP_SCALE);
part.IgnoreUndoUpdate = true;
part.Resize(prevScale);
part.IgnoreUndoUpdate = false;
lockPartsForRead(true);
{
foreach (SceneObjectPart obPart in m_parts.Values)
{
obPart.IgnoreUndoUpdate = true;
if (obPart.UUID != m_rootPart.UUID)
{
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState(UndoType.STATE_GROUP_SCALE);
obPart.IgnoreUndoUpdate = true;
Vector3 currentpos = new Vector3(obPart.OffsetPosition);
currentpos.X *= x;
currentpos.Y *= y;
@ -3265,7 +3273,6 @@ namespace OpenSim.Region.Framework.Scenes
obPart.UpdateOffSet(currentpos);
}
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
}
}
lockPartsForRead(false);
@ -3277,7 +3284,6 @@ namespace OpenSim.Region.Framework.Scenes
}
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
HasGroupChanged = true;
ScheduleGroupForTerseUpdate();
}
@ -3293,14 +3299,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos"></param>
public void UpdateGroupPosition(Vector3 pos)
{
foreach (SceneObjectPart part in Children.Values)
{
part.StoreUndoState();
}
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{
if (IsAttachment)
{
m_rootPart.StoreUndoState(UndoType.STATE_GROUP_POSITION);
m_rootPart.AttachedPos = pos;
}
if (RootPart.GetStatusSandbox())
@ -3333,7 +3336,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetChildPart(localID);
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
parts.StoreUndoState(UndoType.STATE_PRIM_POSITION);
}
if (part != null)
{
@ -3358,7 +3361,7 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart part in Children.Values)
{
part.StoreUndoState();
part.StoreUndoState(UndoType.STATE_PRIM_POSITION);
}
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
Vector3 oldPos =
@ -3383,10 +3386,27 @@ namespace OpenSim.Region.Framework.Scenes
}
lockPartsForRead(false);
AbsolutePosition = newPos;
//We have to set undoing here because otherwise an undo state will be saved
if (!m_rootPart.Undoing)
{
m_rootPart.Undoing = true;
AbsolutePosition = newPos;
m_rootPart.Undoing = false;
}
else
{
AbsolutePosition = newPos;
}
HasGroupChanged = true;
ScheduleGroupForTerseUpdate();
if (m_rootPart.Undoing)
{
ScheduleGroupForFullUpdate();
}
else
{
ScheduleGroupForTerseUpdate();
}
}
public void OffsetForNewRegion(Vector3 offset)
@ -3406,7 +3426,7 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
}
m_rootPart.UpdateRotation(rot);
@ -3430,7 +3450,7 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
}
m_rootPart.UpdateRotation(rot);
@ -3457,7 +3477,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetChildPart(localID);
foreach (SceneObjectPart parts in Children.Values)
{
parts.StoreUndoState();
parts.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
}
if (part != null)
{
@ -3485,15 +3505,24 @@ namespace OpenSim.Region.Framework.Scenes
if (part.UUID == m_rootPart.UUID)
{
UpdateRootRotation(rot);
AbsolutePosition = pos;
if (!m_rootPart.Undoing)
{
m_rootPart.Undoing = true;
AbsolutePosition = pos;
m_rootPart.Undoing = false;
}
else
{
AbsolutePosition = pos;
}
}
else
{
part.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
part.IgnoreUndoUpdate = true;
part.UpdateRotation(rot);
part.OffsetPosition = pos;
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
}
}
}
@ -3507,7 +3536,13 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion axRot = rot;
Quaternion oldParentRot = m_rootPart.RotationOffset;
m_rootPart.StoreUndoState();
m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
bool cancelUndo = false;
if (!m_rootPart.Undoing)
{
m_rootPart.Undoing = true;
cancelUndo = true;
}
m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
@ -3531,18 +3566,13 @@ namespace OpenSim.Region.Framework.Scenes
newRot *= Quaternion.Inverse(axRot);
prim.RotationOffset = newRot;
prim.ScheduleTerseUpdate();
prim.IgnoreUndoUpdate = false;
}
}
foreach (SceneObjectPart childpart in Children.Values)
if (cancelUndo == true)
{
if (childpart != m_rootPart)
{
childpart.IgnoreUndoUpdate = false;
childpart.StoreUndoState();
}
m_rootPart.Undoing = false;
}
lockPartsForRead(false);
m_rootPart.ScheduleTerseUpdate();
@ -3911,7 +3941,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;
}

View File

@ -358,7 +358,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
Quaternion rotationOffset, Vector3 offsetPosition)
{
m_name = "Primitive";
m_name = "Object";
Rezzed = DateTime.UtcNow;
_creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
@ -697,7 +697,7 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_offsetPosition; }
set
{
StoreUndoState();
StoreUndoState(UndoType.STATE_PRIM_POSITION);
m_offsetPosition = value;
if (ParentGroup != null && !ParentGroup.IsDeleted)
@ -759,7 +759,7 @@ namespace OpenSim.Region.Framework.Scenes
set
{
StoreUndoState();
StoreUndoState(UndoType.STATE_PRIM_ROTATION);
m_rotationOffset = value;
PhysicsActor actor = PhysActor;
@ -958,7 +958,7 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_shape.Scale; }
set
{
StoreUndoState();
StoreUndoState(UndoType.STATE_PRIM_SCALE);
if (m_shape != null)
{
m_shape.Scale = value;
@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_redo.Clear();
}
StoreUndoState();
StoreUndoState(UndoType.STATE_ALL);
}
public byte ConvertScriptUintToByte(uint indata)
@ -1625,7 +1625,7 @@ namespace OpenSim.Region.Framework.Scenes
PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
part.Shape = shape;
part.Name = "Primitive";
part.Name = "Object";
part._ownerID = UUID.Random();
return part;
@ -2721,7 +2721,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="scale"></param>
public void Resize(Vector3 scale)
{
StoreUndoState();
StoreUndoState(UndoType.STATE_PRIM_SCALE);
m_shape.Scale = scale;
ParentGroup.HasGroupChanged = true;
@ -3504,10 +3504,9 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.ScheduleGroupForTerseUpdate();
//m_parentGroup.ScheduleGroupForFullUpdate();
}
public void StoreUndoState()
public void StoreUndoState(UndoType type)
{
if (!Undoing)
if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
{
if (!IgnoreUndoUpdate)
{
@ -3518,17 +3517,25 @@ namespace OpenSim.Region.Framework.Scenes
if (m_undo.Count > 0)
{
UndoState last = m_undo.Peek();
if (last != null)
{
if (last.Compare(this))
return;
}
}
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState(this);
UndoState lastUndo = m_undo.Peek();
UndoState nUndo = new UndoState(this, type);
if (lastUndo != null)
{
TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
if (ts.TotalMilliseconds < 500)
{
//Delete the last entry since it was less than 500 milliseconds ago
nUndo.Merge(lastUndo);
m_undo.Pop();
}
}
m_undo.Push(nUndo);
}
@ -4005,11 +4012,13 @@ namespace OpenSim.Region.Framework.Scenes
if (m_undo.Count > 0)
{
UndoState nUndo = null;
UndoState goback = m_undo.Pop();
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
nUndo = new UndoState(this);
nUndo = new UndoState(this, goback.Type);
}
UndoState goback = m_undo.Pop();
if (goback != null)
{
goback.PlaybackState(this);
@ -4024,13 +4033,13 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (m_redo)
{
UndoState gofwd = m_redo.Pop();
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState(this);
UndoState nUndo = new UndoState(this, gofwd.Type);
m_undo.Push(nUndo);
}
UndoState gofwd = m_redo.Pop();
if (gofwd != null)
gofwd.PlayfwdState(this);
}

View File

@ -3730,8 +3730,11 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
{
CollidingMessage.Colliders = colliding;
foreach (SceneObjectGroup att in Attachments)
Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage);
lock (m_attachments)
{
foreach (SceneObjectGroup att in m_attachments)
Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage);
}
}
}

View File

@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
sceneObject.AddPart(part);
part.LinkNum = linkNum;
part.TrimPermissions();
part.StoreUndoState();
part.StoreUndoState(UndoType.STATE_ALL);
reader.Close();
sr.Close();
}
@ -231,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (originalLinkNum != 0)
part.LinkNum = originalLinkNum;
part.StoreUndoState();
part.StoreUndoState(UndoType.STATE_ALL);
reader.Close();
sr.Close();
}

View File

@ -27,48 +27,125 @@
using OpenMetaverse;
using OpenSim.Region.Framework.Interfaces;
using System;
namespace OpenSim.Region.Framework.Scenes
{
[Flags]
public enum UndoType
{
STATE_PRIM_POSITION = 1,
STATE_PRIM_ROTATION = 2,
STATE_PRIM_SCALE = 4,
STATE_PRIM_ALL = 7,
STATE_GROUP_POSITION = 8,
STATE_GROUP_ROTATION = 16,
STATE_GROUP_SCALE = 32,
STATE_GROUP_ALL = 56,
STATE_ALL = 63
}
public class UndoState
{
public Vector3 Position = Vector3.Zero;
public Vector3 Scale = Vector3.Zero;
public Quaternion Rotation = Quaternion.Identity;
public Vector3 GroupPosition = Vector3.Zero;
public Quaternion GroupRotation = Quaternion.Identity;
public Vector3 GroupScale = Vector3.Zero;
public DateTime LastUpdated = DateTime.Now;
public UndoType Type;
public UndoState(SceneObjectPart part)
public UndoState(SceneObjectPart part, UndoType type)
{
Type = type;
if (part != null)
{
if (part.ParentID == 0)
{
Position = part.ParentGroup.AbsolutePosition;
GroupScale = part.ParentGroup.RootPart.Shape.Scale;
//FUBAR WARNING: Do NOT get the group's absoluteposition here
//or you'll experience a loop and/or a stack issue
GroupPosition = part.ParentGroup.RootPart.AbsolutePosition;
GroupRotation = part.ParentGroup.GroupRotation;
Position = part.ParentGroup.RootPart.AbsolutePosition;
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
LastUpdated = DateTime.Now;
}
else
{
GroupScale = part.Shape.Scale;
//FUBAR WARNING: Do NOT get the group's absoluteposition here
//or you'll experience a loop and/or a stack issue
GroupPosition = part.ParentGroup.RootPart.AbsolutePosition;
GroupRotation = part.ParentGroup.Rotation;
Position = part.OffsetPosition;
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
LastUpdated = DateTime.Now;
}
}
}
public void Merge(UndoState last)
{
if ((Type & UndoType.STATE_GROUP_POSITION) == 0 || ((last.Type & UndoType.STATE_GROUP_POSITION) >= (Type & UndoType.STATE_GROUP_POSITION)))
{
GroupPosition = last.GroupPosition;
Position = last.Position;
}
if ((Type & UndoType.STATE_GROUP_SCALE) == 0 || ((last.Type & UndoType.STATE_GROUP_SCALE) >= (Type & UndoType.STATE_GROUP_SCALE)))
{
GroupScale = last.GroupScale;
Scale = last.Scale;
}
if ((Type & UndoType.STATE_GROUP_ROTATION) == 0 || ((last.Type & UndoType.STATE_GROUP_ROTATION) >= (Type & UndoType.STATE_GROUP_ROTATION)))
{
GroupRotation = last.GroupRotation;
Rotation = last.Rotation;
}
if ((Type & UndoType.STATE_PRIM_POSITION) == 0 || ((last.Type & UndoType.STATE_PRIM_POSITION) >= (Type & UndoType.STATE_PRIM_POSITION)))
{
Position = last.Position;
}
if ((Type & UndoType.STATE_PRIM_SCALE) == 0 || ((last.Type & UndoType.STATE_PRIM_SCALE) >= (Type & UndoType.STATE_PRIM_SCALE)))
{
Scale = last.Scale;
}
if ((Type & UndoType.STATE_PRIM_ROTATION) == 0 || ((last.Type & UndoType.STATE_PRIM_ROTATION) >= (Type & UndoType.STATE_PRIM_ROTATION)))
{
Rotation = last.Rotation;
}
Type = Type | last.Type;
}
public bool Compare(UndoState undo)
{
if (undo == null || Position == null) return false;
if (undo.Position == Position && undo.Rotation == Rotation && undo.Scale == Scale && undo.GroupPosition == GroupPosition && undo.GroupScale == GroupScale && undo.GroupRotation == GroupRotation)
{
return true;
}
else
{
return false;
}
}
public bool Compare(SceneObjectPart part)
{
if (part != null)
{
if (part.ParentID == 0)
{
if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation)
if (Position == part.ParentGroup.RootPart.AbsolutePosition && Rotation == part.ParentGroup.Rotation && GroupPosition == part.ParentGroup.RootPart.AbsolutePosition && part.ParentGroup.Rotation == GroupRotation && part.Shape.Scale == GroupScale)
return true;
else
return false;
}
else
{
if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale)
if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale && GroupPosition == part.ParentGroup.RootPart.AbsolutePosition && part.ParentGroup.Rotation == GroupRotation && part.Shape.Scale == GroupScale)
return true;
else
return false;
@ -78,62 +155,70 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
public void PlaybackState(SceneObjectPart part)
private void RestoreState(SceneObjectPart part)
{
bool GroupChange = false;
if ((Type & UndoType.STATE_GROUP_POSITION) != 0
|| (Type & UndoType.STATE_GROUP_ROTATION) != 0
|| (Type & UndoType.STATE_GROUP_SCALE) != 0)
{
GroupChange = true;
}
if (part != null)
{
part.Undoing = true;
if (part.ParentID == 0)
if (part.ParentID == 0 && GroupChange == false)
{
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
part.RotationOffset = Rotation;
part.ParentGroup.UpdateSinglePosition(Position, part.LocalId);
part.ParentGroup.UpdateSingleRotation(Rotation, part.LocalId);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate();
}
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale); part.ScheduleTerseUpdate();
if (GroupChange)
{
part.ParentGroup.RootPart.Undoing = true;
if (GroupPosition != Vector3.Zero)
{
//Calculate the scale...
Vector3 gs = part.Shape.Scale;
float scale = GroupScale.Z / gs.Z;
//Scale first since it can affect our position
part.ParentGroup.GroupResize(gs * scale, part.LocalId);
part.ParentGroup.AbsolutePosition = GroupPosition;
part.ParentGroup.UpdateGroupRotationR(GroupRotation);
}
part.ParentGroup.RootPart.Undoing = false;
}
else
{
if (Position != Vector3.Zero) //We can use this for all the updates since all are set
{
part.OffsetPosition = Position;
part.UpdateRotation(Rotation);
part.Resize(Scale); part.ScheduleTerseUpdate();
}
}
}
part.Undoing = false;
}
}
public void PlaybackState(SceneObjectPart part)
{
RestoreState(part);
}
public void PlayfwdState(SceneObjectPart part)
{
if (part != null)
{
part.Undoing = true;
if (part.ParentID == 0)
{
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate();
}
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ScheduleTerseUpdate();
}
part.Undoing = false;
}
RestoreState(part);
}
}
public class LandUndoState
@ -161,3 +246,4 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}

View File

@ -722,11 +722,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (money != null)
{
// do the transaction, that is if the agent has got sufficient funds
if (!money.GroupCreationCovered(remoteClient)) {
if (!money.AmountCovered(remoteClient, money.GroupCreationCharge)) {
remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group.");
return UUID.Zero;
}
money.ApplyGroupCreationCharge(GetRequestingAgentID(remoteClient));
money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation");
}
UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));

View File

@ -73,7 +73,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics)
: base(Unchanged, false)
{
m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false);
m_UnchangedEntity = Unchanged.Copy(false);
}
public ContentManagementEntity(string objectXML, Scene scene, bool physics)

View File

@ -80,7 +80,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary>
public MetaEntity(SceneObjectGroup orig, bool physics)
{
m_Entity = orig.Copy(orig.RootPart.OwnerID, orig.RootPart.GroupID, false);
m_Entity = orig.Copy(false);
Initialize(physics);
}

View File

@ -108,6 +108,16 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
public event ObjectPaid OnObjectPaid;
public int UploadCharge
{
get { return 0; }
}
public int GroupCreationCharge
{
get { return 0; }
}
/// <summary>
/// Startup
/// </summary>
@ -188,17 +198,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
// Please do not refactor these to be just one method
// Existing implementations need the distinction
//
public void ApplyUploadCharge(UUID agentID)
{
}
public void ApplyGroupCreationCharge(UUID agentID)
{
}
public void ApplyCharge(UUID agentID, int amount, string text)
{
}
public void ApplyUploadCharge(UUID agentID, int amount, string text)
{
}
public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount)
{
@ -268,27 +273,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
}
public EconomyData GetEconomyData()
{
EconomyData edata = new EconomyData();
edata.ObjectCapacity = ObjectCapacity;
edata.ObjectCount = ObjectCount;
edata.PriceEnergyUnit = PriceEnergyUnit;
edata.PriceGroupCreate = PriceGroupCreate;
edata.PriceObjectClaim = PriceObjectClaim;
edata.PriceObjectRent = PriceObjectRent;
edata.PriceObjectScaleFactor = PriceObjectScaleFactor;
edata.PriceParcelClaim = PriceParcelClaim;
edata.PriceParcelClaimFactor = PriceParcelClaimFactor;
edata.PriceParcelRent = PriceParcelRent;
edata.PricePublicObjectDecay = PricePublicObjectDecay;
edata.PricePublicObjectDelete = PricePublicObjectDelete;
edata.PriceRentLight = PriceRentLight;
edata.PriceUpload = PriceUpload;
edata.TeleportMinPrice = TeleportMinPrice;
return edata;
}
private void GetClientFunds(IClientAPI client)
{
CheckExistAndRefreshFunds(client.AgentId);
@ -790,7 +774,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
//m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString());
}
public int GetBalance(IClientAPI client)
public int GetBalance(UUID agentID)
{
return 0;
}
@ -798,16 +782,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
// Please do not refactor these to be just one method
// Existing implementations need the distinction
//
public bool UploadCovered(IClientAPI client)
public bool UploadCovered(IClientAPI client, int amount)
{
return AmountCovered(client, PriceUpload);
return true;
}
public bool GroupCreationCovered(IClientAPI client)
{
return AmountCovered(client, PriceGroupCreate);
}
public bool AmountCovered(IClientAPI client, int amount)
{
return true;

View File

@ -675,7 +675,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
d.Vector3 pos = d.BodyGetPosition(Body);
Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f);
// Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f);
Vector3 posChange = new Vector3();
posChange.X = pos.X - m_lastPositionVector.X;
posChange.Y = pos.Y - m_lastPositionVector.Y;

View File

@ -1576,19 +1576,19 @@ Console.WriteLine(" JointCreateFixed");
//Console.WriteLine("Move " + m_primName);
if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
// NON-'VEHICLES' are dealt with here
if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
{
d.Vector3 avel2 = d.BodyGetAngularVel(Body);
/*
if (m_angularlock.X == 1)
avel2.X = 0;
if (m_angularlock.Y == 1)
avel2.Y = 0;
if (m_angularlock.Z == 1)
avel2.Z = 0;
d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z);
*/
}
// if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
// {
// d.Vector3 avel2 = d.BodyGetAngularVel(Body);
// /*
// if (m_angularlock.X == 1)
// avel2.X = 0;
// if (m_angularlock.Y == 1)
// avel2.Y = 0;
// if (m_angularlock.Z == 1)
// avel2.Z = 0;
// d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z);
// */
// }
//float PID_P = 900.0f;
float m_mass = CalculateMass();

View File

@ -3252,7 +3252,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here
// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString());
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp;
DateTime dt = DateTime.UtcNow;
// Ticks from UtcNow, but make it look like local. Evil, huh?
dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
try
{
// Convert that to the PST timezone
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
}
catch
{
// No logging here, as it could be VERY spammy
}
// And make it look local again to fool the unix time util
dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
msg.timestamp = (uint)Util.ToUnixTime(dt);
//if (client != null)
//{
msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName;
@ -5247,7 +5267,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ',':
if (parens == 0)
{
result.Add(src.Substring(start,length).Trim());
result.Add(new LSL_String(src.Substring(start,length).Trim()));
start += length+1;
length = 0;
}
@ -9369,7 +9389,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (aList.Data[i] != null)
{
switch ((ParcelMediaCommandEnum) aList.Data[i])
switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString()))
{
case ParcelMediaCommandEnum.Url:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL));
@ -9804,19 +9824,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llXorBase64StringsCorrect(string str1, string str2)
{
m_host.AddScriptLPS(1);
string ret = String.Empty;
string src1 = llBase64ToString(str1);
string src2 = llBase64ToString(str2);
int c = 0;
for (int i = 0; i < src1.Length; i++)
{
ret += (char) (src1[i] ^ src2[c]);
c++;
if (c >= src2.Length)
c = 0;
if (str1 == String.Empty)
return String.Empty;
if (str2 == String.Empty)
return str1;
byte[] data1 = Convert.FromBase64String(str1);
byte[] data2 = Convert.FromBase64String(str2);
byte[] d2 = new Byte[data1.Length];
int pos = 0;
if (data1.Length <= data2.Length)
{
Array.Copy(data2, 0, d2, 0, data1.Length);
}
return llStringToBase64(ret);
else
{
while (pos < data1.Length)
{
int len = data1.Length - pos;
if (len > data2.Length)
len = data2.Length;
Array.Copy(data2, 0, d2, pos, len);
pos += len;
}
}
for (pos = 0 ; pos < data1.Length ; pos++ )
data1[pos] ^= d2[pos];
return Convert.ToBase64String(data1);
}
public LSL_String llHTTPRequest(string url, LSL_List parameters, string body)

View File

@ -73,6 +73,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
m_LSFunctionsEnabled = true;
if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
m_LSFunctionsEnabled = true;
m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
if (m_comms == null)
m_LSFunctionsEnabled = false;

View File

@ -663,13 +663,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
Object[] ret;
if (start < 0)
start=m_data.Length-start;
start=m_data.Length+start;
if (start < 0)
start=0;
if (end < 0)
end=m_data.Length-end;
end=m_data.Length+end;
if (end < 0)
end=0;

View File

@ -556,6 +556,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (stateSource == (int)StateSource.ScriptedRez)
{
lock (m_CompileDict)
{
m_CompileDict[itemID] = 0;
}
DoOnRezScript(parms);
}
else
@ -835,8 +840,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
item.Name, startParam, postOnRez,
stateSource, m_MaxScriptQueue);
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString());
m_log.DebugFormat(
"[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
if (presence != null)
{
@ -1356,9 +1363,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string xml = instance.GetXMLState();
XmlDocument sdoc = new XmlDocument();
sdoc.LoadXml(xml);
XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
XmlNode rootNode = rootL[0];
bool loadedState = true;
try
{
sdoc.LoadXml(xml);
}
catch (System.Xml.XmlException e)
{
loadedState = false;
}
XmlNodeList rootL = null;
XmlNode rootNode = null;
if (loadedState)
{
rootL = sdoc.GetElementsByTagName("ScriptState");
rootNode = rootL[0];
}
// Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
XmlDocument doc = new XmlDocument();
@ -1374,8 +1395,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
stateData.Attributes.Append(engineName);
doc.AppendChild(stateData);
XmlNode xmlstate = null;
// Add <ScriptState>...</ScriptState>
XmlNode xmlstate = doc.ImportNode(rootNode, true);
if (loadedState)
{
xmlstate = doc.ImportNode(rootNode, true);
}
else
{
xmlstate = doc.CreateElement("", "ScriptState", "");
}
stateData.AppendChild(xmlstate);
string assemName = instance.GetAssemblyName();

View File

@ -230,6 +230,12 @@ namespace OpenSim.Server.Base
"shutdown",
"Quit the application", HandleQuit);
// Register a command to read other commands from a file
MainConsole.Instance.Commands.AddCommand("base", false, "command-script",
"command-script <script>",
"Run a command script from file", HandleScript);
// Allow derived classes to perform initialization that
// needs to be done after the console has opened
//
@ -259,6 +265,41 @@ namespace OpenSim.Server.Base
m_log.Info("[CONSOLE] Quitting");
}
protected virtual void HandleScript(string module, string[] parms)
{
if (parms.Length != 2)
{
return;
}
RunCommandScript(parms[1]);
}
/// <summary>
/// Run an optional startup list of commands
/// </summary>
/// <param name="fileName"></param>
private void RunCommandScript(string fileName)
{
if (File.Exists(fileName))
{
m_log.Info("[COMMANDFILE]: Running " + fileName);
using (StreamReader readFile = File.OpenText(fileName))
{
string currentCommand;
while ((currentCommand = readFile.ReadLine()) != null)
{
if (currentCommand != String.Empty)
{
m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
MainConsole.Instance.RunCommand(currentCommand);
}
}
}
}
}
protected virtual void ReadConfig()
{
}

View File

@ -44,6 +44,8 @@ namespace OpenSim.Server.Handlers.Asset
{
public class XInventoryInConnector : ServiceConnector
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IInventoryService m_InventoryService;
private string m_ConfigName = "InventoryService";
@ -53,6 +55,8 @@ namespace OpenSim.Server.Handlers.Asset
if (configName != String.Empty)
m_ConfigName = configName;
m_log.DebugFormat("[XInventoryInConnector]: Starting with config name {0}", m_ConfigName);
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));

View File

@ -277,7 +277,7 @@ namespace OpenSim.Server.Handlers.Simulation
//responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead
}
// subclasses cab override this
// subclasses can override this
protected virtual bool UpdateAgent(GridRegion destination, AgentData agent)
{
return m_SimulationService.UpdateAgent(destination, agent);
@ -285,6 +285,16 @@ namespace OpenSim.Server.Handlers.Simulation
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
{
if (m_SimulationService == null)
{
m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
responsedata["content_type"] = "application/json";
responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
responsedata["str_response_string"] = string.Empty;
return;
}
GridRegion destination = new GridRegion();
destination.RegionID = regionID;

View File

@ -144,7 +144,10 @@ namespace OpenSim.Services.AssetService
public string Store(AssetBase asset)
{
//m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
m_Database.StoreAsset(asset);
if (!m_Database.StoreAsset(asset))
{
return UUID.Zero.ToString();
}
return asset.ID;
}

View File

@ -30,6 +30,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Timers;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
@ -48,7 +49,9 @@ namespace OpenSim.Services.Connectors
private string m_ServerURI = String.Empty;
private IImprovedAssetCache m_Cache = null;
private int m_retryCounter;
private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>();
private Timer m_retryTimer;
public AssetServicesConnector()
{
}
@ -85,6 +88,55 @@ namespace OpenSim.Services.Connectors
MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset",
"dump asset <id> <file>",
"dump one cached asset", HandleDumpAsset);
m_retryTimer = new Timer();
m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck);
m_retryTimer.Interval = 60000;
}
protected void retryCheck(object source, ElapsedEventArgs e)
{
m_retryCounter++;
if (m_retryCounter > 60) m_retryCounter -= 60;
List<int> keys = new List<int>();
foreach (int a in m_retryQueue.Keys)
{
keys.Add(a);
}
foreach (int a in keys)
{
//We exponentially fall back on frequency until we reach one attempt per hour
//The net result is that we end up in the queue for roughly 24 hours..
//24 hours worth of assets could be a lot, so the hope is that the region admin
//will have gotten the asset connector back online quickly!
int timefactor = a ^ 2;
if (timefactor > 60)
{
timefactor = 60;
}
//First, find out if we care about this timefactor
if (timefactor % a == 0)
{
//Yes, we do!
List<AssetBase> retrylist = m_retryQueue[a];
m_retryQueue.Remove(a);
foreach(AssetBase ass in retrylist)
{
Store(ass); //Store my ass. This function will put it back in the dictionary if it fails
}
}
}
if (m_retryQueue.Count == 0)
{
//It might only be one tick per minute, but I have
//repented and abandoned my wasteful ways
m_retryCounter = 0;
m_retryTimer.Stop();
}
}
protected void SetCache(IImprovedAssetCache cache)
@ -99,8 +151,8 @@ namespace OpenSim.Services.Connectors
AssetBase asset = null;
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset == null)
if (asset == null || asset.Data == null || asset.Data.Length == 0)
{
asset = SynchronousRestObjectRequester.
MakeRequest<int, AssetBase>("GET", uri, 0);
@ -177,7 +229,7 @@ namespace OpenSim.Services.Connectors
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset == null)
if (asset == null || asset.Data == null || asset.Data.Length == 0)
{
bool result = false;
@ -204,11 +256,10 @@ namespace OpenSim.Services.Connectors
public string Store(AssetBase asset)
{
if (m_Cache != null)
m_Cache.Cache(asset);
if (asset.Temporary || asset.Local)
{
if (m_Cache != null)
m_Cache.Cache(asset);
return asset.ID;
}
@ -218,24 +269,57 @@ namespace OpenSim.Services.Connectors
try
{
newID = SynchronousRestObjectRequester.
MakeRequest<AssetBase, string>("POST", uri, asset);
MakeRequest<AssetBase, string>("POST", uri, asset, 25);
if (newID == null || newID == "")
{
newID = UUID.Zero.ToString();
}
}
catch (Exception e)
{
m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message);
newID = UUID.Zero.ToString();
}
if (newID != String.Empty)
if (newID == UUID.Zero.ToString())
{
// Placing this here, so that this work with old asset servers that don't send any reply back
// SynchronousRestObjectRequester returns somethins that is not an empty string
if (newID != null)
asset.ID = newID;
if (m_Cache != null)
m_Cache.Cache(asset);
//The asset upload failed, put it in a queue for later
asset.UploadAttempts++;
if (asset.UploadAttempts > 30)
{
//By this stage we've been in the queue for a good few hours;
//We're going to drop the asset.
m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString());
}
else
{
if (!m_retryQueue.ContainsKey(asset.UploadAttempts))
{
m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>());
}
List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts];
m_queue.Add(asset);
m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString());
m_retryTimer.Start();
}
}
return newID;
else
{
if (asset.UploadAttempts > 0)
{
m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString());
}
if (newID != String.Empty)
{
// Placing this here, so that this work with old asset servers that don't send any reply back
// SynchronousRestObjectRequester returns somethins that is not an empty string
if (newID != null)
asset.ID = newID;
if (m_Cache != null)
m_Cache.Cache(asset);
}
}
return asset.ID;
}
public bool UpdateContent(string id, byte[] data)

View File

@ -371,7 +371,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns>
public bool Delete(string id)
{
string errorMessage = String.Empty;
//string errorMessage = String.Empty;
string url = m_serverUrl + id;
if (m_cache != null)

View File

@ -255,7 +255,11 @@ namespace OpenSim.Services.GridService
{
m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName);
}
regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName;
string name = regInfo.RegionName;
regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort;
if (name != string.Empty)
regInfo.RegionName += ":" + name;
// Try get the map image
//regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
// I need a texture that works for this... the one I tried doesn't seem to be working

View File

@ -108,13 +108,13 @@ namespace OpenSim.Services.InventoryService
// Warp! Root folder for travelers
XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "agentID", "folderName"},
new string[] { principalID.ToString(), "Suitcase" });
new string[] { principalID.ToString(), "My Suitcase" });
if (folders.Length > 0)
return ConvertToOpenSim(folders[0]);
// make one
XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "Suitcase");
XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Suitcase");
return ConvertToOpenSim(suitcase);
}

View File

@ -200,7 +200,14 @@ namespace OpenSim.Services.InventoryService
if (folders.Length == 0)
return null;
return ConvertToOpenSim(folders[0]);
XInventoryFolder root = null;
foreach (XInventoryFolder folder in folders)
if (folder.folderName == "My Inventory")
root = folder;
if (folders == null) // oops
root = folders[0];
return ConvertToOpenSim(root);
}
public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)

View File

@ -175,6 +175,9 @@ namespace OpenSim.Services.LLLoginService
private string firstname;
private string lastname;
// Web map
private string mapTileURL;
// Error Flags
private string errorReason;
private string errorMessage;
@ -223,7 +226,7 @@ namespace OpenSim.Services.LLLoginService
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
GridRegion home, IPEndPoint clientIP)
GridRegion home, IPEndPoint clientIP, string mapTileURL)
: this()
{
FillOutInventoryData(invSkel, libService);
@ -239,6 +242,7 @@ namespace OpenSim.Services.LLLoginService
Message = message;
BuddList = ConvertFriendListItem(friendsList);
StartLocation = where;
MapTileURL = mapTileURL;
FillOutHomeData(pinfo, home);
LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
@ -411,6 +415,7 @@ namespace OpenSim.Services.LLLoginService
InitialOutfitHash["folder_name"] = "Nightclub Female";
InitialOutfitHash["gender"] = "female";
initialOutfit.Add(InitialOutfitHash);
mapTileURL = String.Empty;
}
@ -474,6 +479,9 @@ namespace OpenSim.Services.LLLoginService
responseData["region_x"] = (Int32)(RegionX);
responseData["region_y"] = (Int32)(RegionY);
if (mapTileURL != String.Empty)
responseData["map-server-url"] = mapTileURL;
if (m_buddyList != null)
{
responseData["buddy-list"] = m_buddyList.ToArray();
@ -570,6 +578,9 @@ namespace OpenSim.Services.LLLoginService
map["region_x"] = OSD.FromInteger(RegionX);
map["region_y"] = OSD.FromInteger(RegionY);
if (mapTileURL != String.Empty)
map["map-server-url"] = OSD.FromString(mapTileURL);
if (m_buddyList != null)
{
map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray());
@ -653,7 +664,7 @@ namespace OpenSim.Services.LLLoginService
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
if (InvFolder.ParentID == UUID.Zero)
if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == "My Inventory")
{
rootID = InvFolder.ID;
}
@ -921,6 +932,12 @@ namespace OpenSim.Services.LLLoginService
set { home = value; }
}
public string MapTileURL
{
get { return mapTileURL; }
set { mapTileURL = value; }
}
public string Message
{
get { return welcomeMessage; }

View File

@ -73,6 +73,7 @@ namespace OpenSim.Services.LLLoginService
protected int m_MinLoginLevel;
protected string m_GatekeeperURL;
protected bool m_AllowRemoteSetLoginLevel;
protected string m_MapTileURL;
IConfig m_LoginServerConfig;
@ -100,6 +101,7 @@ namespace OpenSim.Services.LLLoginService
m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
// These are required; the others aren't
if (accountService == string.Empty || authService == string.Empty)
@ -362,7 +364,7 @@ namespace OpenSim.Services.LLLoginService
// Finally, fill out the response and return it
//
LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP);
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL);
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
return response;

View File

@ -54,9 +54,10 @@ namespace OpenSim.Tests.Common.Mock
return assets.Find(x=>x.FullID == uuid);
}
public void StoreAsset(AssetBase asset)
public bool StoreAsset(AssetBase asset)
{
assets.Add(asset);
return true;
}
public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); }

View File

@ -36,9 +36,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\bin\log4net.dll</HintPath>
</Reference>
<Reference Include="OpenSim.Server, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Robust, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\bin\OpenSim.Server.exe</HintPath>
<HintPath>..\..\..\bin\Robust.exe</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">

View File

@ -887,6 +887,13 @@
Enabled = true
RepoPath = "git"
;How many frames between the scheduled commits?
CommitFrameInterval = 360000
;Should we automatically commit when necessary to avoid objects never making it into the repo?
UseSafetyCommit = true
[SVN]
Enabled = false
Directory = SVNmodule\repo

Binary file not shown.

View File

@ -198,6 +198,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; CHANGE THIS
ExternalName = "http://127.0.0.1:8002"
; Does this grid allow incoming links to any region in it?
; If false, HG TPs happen only to the Default regions specified in [GridService] section
AllowTeleportsToAnyRegion = true
[UserAgentService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"
;; for the service

View File

@ -134,6 +134,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
WelcomeMessage = "Welcome, Avatar!"
AllowRemoteSetLoginLevel = "false"
; For snowglobe's web map
; MapTileURL = "";
[GridInfoService]
; These settings are used to return information on a get_grid_info call.

View File

@ -68,3 +68,8 @@
[GatekeeperService]
ExternalName = "http://127.0.0.1:9000"
; Does this grid allow incoming links to any region in it?
; If false, HG TPs happen only to the Default regions specified in [GridService] section
AllowTeleportsToAnyRegion = true

View File

@ -1407,6 +1407,7 @@
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="System.Drawing"/>
<Reference name="System.Web"/>
@ -2405,6 +2406,7 @@
<ReferencePath>../../../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/>
<Reference name="System.Web"/>
<Reference name="System.Xml"/>