Merge branch 'master' of ssh://MyConnection/var/git/opensim

remotes/origin/0.6.7-post-fixes
Teravus Ovares (Dan Olivares) 2009-08-19 14:43:18 -04:00
commit 289439c832
37 changed files with 653 additions and 164 deletions

View File

@ -851,7 +851,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Delete the old item
Rest.InventoryServices.DeleteItem(uri);
List<UUID> uuids = new List<UUID>();
uuids.Add(uri.ID);
Rest.InventoryServices.DeleteItems(uri.Owner, uuids);
// Add the new item to the inventory
@ -927,7 +929,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
InventoryItemBase item = (InventoryItemBase) InventoryNode;
Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted",
MsgId, rdata.method, rdata.path);
Rest.InventoryServices.DeleteItem(item);
List<UUID> uuids = new List<UUID>();
uuids.Add(item.ID);
Rest.InventoryServices.DeleteItems(item.Owner, uuids);
rdata.appendStatus(String.Format("<p>Deleted item {0} UUID {1} <p>", item.Name, item.ID));
}

View File

@ -653,7 +653,9 @@ namespace OpenSim.Framework.Communications.Cache
if (RootFolder.DeleteItem(item.ID))
{
return m_InventoryService.DeleteItem(item);
List<UUID> uuids = new List<UUID>();
uuids.Add(itemID);
return m_InventoryService.DeleteItems(this.UserProfile.ID, uuids);
}
}
else

View File

@ -547,7 +547,12 @@ namespace OpenSim.Framework.Communications.Tests
return false;
}
public bool DeleteItem(InventoryItemBase item)
public bool MoveItems(UUID owner, List<InventoryItemBase> items)
{
return false;
}
public bool DeleteItems(UUID owner, List<UUID> items)
{
return false;
}

View File

@ -45,6 +45,8 @@ namespace OpenSim.Framework
public string SimSendKey = String.Empty;
public string UserRecvKey = String.Empty;
public string UserSendKey = String.Empty;
public string ConsoleUser = String.Empty;
public string ConsolePass = String.Empty;
public GridConfig(string description, string filename)
{
@ -95,6 +97,12 @@ namespace OpenSim.Framework
"Allow regions to register immediately upon grid server startup? true/false",
"True",
false);
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Remote console access user name [Default: disabled]", "0", false);
m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Remote console access password [Default: disabled]", "0", false);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -140,6 +148,12 @@ namespace OpenSim.Framework
case "allow_region_registration":
AllowRegionRegistration = (bool)configuration_result;
break;
case "console_user":
ConsoleUser = (string)configuration_result;
break;
case "console_pass":
ConsolePass = (string)configuration_result;
break;
}
return true;

View File

@ -254,10 +254,10 @@ namespace OpenSim.Framework
string newName);
public delegate void MoveInventoryItem(
IClientAPI remoteClient, UUID folderID, UUID itemID, int length, string newName);
IClientAPI remoteClient, List<InventoryItemBase> items);
public delegate void RemoveInventoryItem(
IClientAPI remoteClient, UUID itemID);
IClientAPI remoteClient, List<UUID> itemIDs);
public delegate void RemoveInventoryFolder(
IClientAPI remoteClient, UUID folderID);

View File

@ -78,6 +78,12 @@ namespace OpenSim.Framework
ID = id;
}
public InventoryFolderBase(UUID id, UUID owner)
{
ID = id;
Owner = owner;
}
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
{
ID = id;

View File

@ -46,6 +46,8 @@ namespace OpenSim.Framework
public string UserRecvKey = String.Empty;
public string UserSendKey = String.Empty;
public string UserServerURL = String.Empty;
public string ConsoleUser = String.Empty;
public string ConsolePass = String.Empty;
public MessageServerConfig(string description, string filename)
{
@ -88,6 +90,12 @@ namespace OpenSim.Framework
"Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false);
m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"My Published IP Address", "127.0.0.1", false);
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Remote console access user name [Default: disabled]", "0", false);
m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Remote console access password [Default: disabled]", "0", false);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -130,6 +138,12 @@ namespace OpenSim.Framework
case "published_ip":
MessageServerIP = (string) configuration_result;
break;
case "console_user":
ConsoleUser = (string)configuration_result;
break;
case "console_pass":
ConsolePass = (string)configuration_result;
break;
}
return true;

View File

@ -46,6 +46,8 @@ namespace OpenSim.Framework
public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL;
public uint DefaultUserLevel = 0;
public string LibraryXmlfile = "";
public string ConsoleUser = String.Empty;
public string ConsolePass = String.Empty;
private Uri m_inventoryUrl;
@ -155,6 +157,12 @@ namespace OpenSim.Framework
m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Minimum Level a user should have to login [0 default]", "0", false);
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Remote console access user name [Default: disabled]", "0", false);
m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Remote console access password [Default: disabled]", "0", false);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -209,6 +217,12 @@ namespace OpenSim.Framework
case "library_location":
LibraryXmlfile = (string)configuration_result;
break;
case "console_user":
ConsoleUser = (string)configuration_result;
break;
case "console_pass":
ConsolePass = (string)configuration_result;
break;
}
return true;

View File

@ -31,6 +31,7 @@ using System.IO;
using System.Reflection;
using System.Timers;
using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
@ -46,6 +47,8 @@ namespace OpenSim.Grid.GridServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected GridConfig m_config;
public string m_consoleType = "local";
public IConfigSource m_configSource = null;
public GridConfig Config
{
@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer
public GridServerBase()
{
m_console = new LocalConsole("Grid");
MainConsole.Instance = m_console;
}
protected override void StartupSpecific()
{
switch (m_consoleType)
{
case "rest":
m_console = new RemoteConsole("Grid");
break;
case "basic":
m_console = new CommandConsole("Grid");
break;
default:
m_console = new LocalConsole("Grid");
break;
}
MainConsole.Instance = m_console;
m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
m_log.Info("[GRID]: Starting HTTP process");
m_httpServer = new BaseHttpServer(m_config.HttpPort);
if (m_console is RemoteConsole)
{
RemoteConsole c = (RemoteConsole)m_console;
c.SetServer(m_httpServer);
IConfig netConfig = m_configSource.AddConfig("Network");
netConfig.Set("ConsoleUser", m_config.ConsoleUser);
netConfig.Set("ConsolePass", m_config.ConsolePass);
c.ReadConfig(m_configSource);
}
LoadPlugins();

View File

@ -26,6 +26,7 @@
*/
using log4net.Config;
using Nini.Config;
namespace OpenSim.Grid.GridServer
{
@ -33,10 +34,21 @@ namespace OpenSim.Grid.GridServer
{
public static void Main(string[] args)
{
ArgvConfigSource argvSource = new ArgvConfigSource(args);
argvSource.AddSwitch("Startup", "console", "c");
XmlConfigurator.Configure();
GridServerBase app = new GridServerBase();
IConfig startupConfig = argvSource.Configs["Startup"];
if (startupConfig != null)
{
app.m_consoleType = startupConfig.GetString("console", "local");
}
app.m_configSource = argvSource;
// if (args.Length > 0 && args[0] == "-setuponly")
// {
// app.Config();

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using log4net;
using Nini.Config;
using log4net.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
@ -56,8 +57,22 @@ namespace OpenSim.Grid.MessagingServer
// private UUID m_lastCreatedUser = UUID.Random();
protected static string m_consoleType = "local";
protected static IConfigSource m_config = null;
public static void Main(string[] args)
{
ArgvConfigSource argvSource = new ArgvConfigSource(args);
argvSource.AddSwitch("Startup", "console", "c");
IConfig startupConfig = argvSource.Configs["Startup"];
if (startupConfig != null)
{
m_consoleType = startupConfig.GetString("console", "local");
}
m_config = argvSource;
XmlConfigurator.Configure();
m_log.Info("[SERVER]: Launching MessagingServer...");
@ -70,7 +85,18 @@ namespace OpenSim.Grid.MessagingServer
public OpenMessage_Main()
{
switch (m_consoleType)
{
case "rest":
m_console = new RemoteConsole("Messaging");
break;
case "basic":
m_console = new CommandConsole("Messaging");
break;
default:
m_console = new LocalConsole("Messaging");
break;
}
MainConsole.Instance = m_console;
}
@ -87,10 +113,22 @@ namespace OpenSim.Grid.MessagingServer
private void registerWithUserServer()
{
if (m_userServerModule.registerWithUserServer())
{
if (m_httpServer == null)
{
m_log.Info("[SERVER]: Starting HTTP process");
m_httpServer = new BaseHttpServer(Cfg.HttpPort);
if (m_console is RemoteConsole)
{
RemoteConsole c = (RemoteConsole)m_console;
c.SetServer(m_httpServer);
IConfig netConfig = m_config.AddConfig("Network");
netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
netConfig.Set("ConsolePass", Cfg.ConsolePass);
c.ReadConfig(m_config);
}
m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
@ -102,6 +140,7 @@ namespace OpenSim.Grid.MessagingServer
m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);
m_httpServer.Start();
}
m_log.Info("[SERVER]: Userserver registration was successful");
}
else
@ -114,12 +153,12 @@ namespace OpenSim.Grid.MessagingServer
private void deregisterFromUserServer()
{
m_userServerModule.deregisterWithUserServer();
if (m_httpServer != null)
{
// if (m_httpServer != null)
// {
// try a completely fresh registration, with fresh handlers, too
m_httpServer.Stop();
m_httpServer = null;
}
// m_httpServer.Stop();
// m_httpServer = null;
// }
m_console.Output("[SERVER]: Deregistered from userserver.");
}

View File

@ -43,6 +43,7 @@ using OpenSim.Framework.Statistics;
using OpenSim.Grid.Communications.OGS1;
using OpenSim.Grid.Framework;
using OpenSim.Grid.UserServer.Modules;
using Nini.Config;
namespace OpenSim.Grid.UserServer
{
@ -73,8 +74,22 @@ namespace OpenSim.Grid.UserServer
protected AvatarCreationModule m_appearanceModule;
protected static string m_consoleType = "local";
protected static IConfigSource m_config = null;
public static void Main(string[] args)
{
ArgvConfigSource argvSource = new ArgvConfigSource(args);
argvSource.AddSwitch("Startup", "console", "c");
IConfig startupConfig = argvSource.Configs["Startup"];
if (startupConfig != null)
{
m_consoleType = startupConfig.GetString("console", "local");
}
m_config = argvSource;
XmlConfigurator.Configure();
m_log.Info("Launching UserServer...");
@ -87,7 +102,18 @@ namespace OpenSim.Grid.UserServer
public OpenUser_Main()
{
switch (m_consoleType)
{
case "rest":
m_console = new RemoteConsole("User");
break;
case "basic":
m_console = new CommandConsole("User");
break;
default:
m_console = new LocalConsole("User");
break;
}
MainConsole.Instance = m_console;
}
@ -129,6 +155,16 @@ namespace OpenSim.Grid.UserServer
m_httpServer = new BaseHttpServer(Cfg.HttpPort);
if (m_console is RemoteConsole)
{
RemoteConsole c = (RemoteConsole)m_console;
c.SetServer(m_httpServer);
IConfig netConfig = m_config.AddConfig("Network");
netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
netConfig.Set("ConsolePass", Cfg.ConsolePass);
c.ReadConfig(m_config);
}
RegisterInterface<CommandConsole>(m_console);
RegisterInterface<UserConfig>(Cfg);

View File

@ -6633,9 +6633,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else // Agent
{
//InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null)
{
assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
@ -7027,14 +7027,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (OnMoveInventoryItem != null)
{
handlerMoveInventoryItem = null;
InventoryItemBase itm = null;
List<InventoryItemBase> items = new List<InventoryItemBase>();
foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
{
itm = new InventoryItemBase(datablock.ItemID, AgentId);
itm.Folder = datablock.FolderID;
itm.Name = Util.FieldToString(datablock.NewName);
// weird, comes out as empty string
//m_log.DebugFormat("[XXX] new name: {0}", itm.Name);
items.Add(itm);
}
handlerMoveInventoryItem = OnMoveInventoryItem;
if (handlerMoveInventoryItem != null)
{
handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length,
Util.FieldToString(datablock.NewName));
}
handlerMoveInventoryItem(this, items);
}
}
break;
@ -7053,14 +7060,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (OnRemoveInventoryItem != null)
{
handlerRemoveInventoryItem = null;
List<UUID> uuids = new List<UUID>();
foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
{
uuids.Add(datablock.ItemID);
}
handlerRemoveInventoryItem = OnRemoveInventoryItem;
if (handlerRemoveInventoryItem != null)
{
handlerRemoveInventoryItem(this, datablock.ItemID);
}
handlerRemoveInventoryItem(this, uuids);
}
}
break;
case PacketType.RemoveInventoryFolder:
@ -7116,13 +7126,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (OnRemoveInventoryItem != null)
{
handlerRemoveInventoryItem = null;
List<UUID> uuids = new List<UUID>();
foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData)
{
uuids.Add(datablock.ItemID);
}
handlerRemoveInventoryItem = OnRemoveInventoryItem;
if (handlerRemoveInventoryItem != null)
{
handlerRemoveInventoryItem(this, datablock.ItemID);
}
handlerRemoveInventoryItem(this, uuids);
}
}
break;

View File

@ -128,20 +128,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Store the throttle multiplier for posterity.
throttleMultiplier = userSettings.ClientThrottleMultipler;
int throttleMaxBPS = 1500000;
if (userSettings.TotalThrottleSettings != null)
throttleMaxBPS = userSettings.TotalThrottleSettings.Max;
// Set up the throttle classes (min, max, current) in bits per second
ResendThrottle = new LLPacketThrottle(5000, 100000, 16000, userSettings.ClientThrottleMultipler);
LandThrottle = new LLPacketThrottle(1000, 100000, 2000, userSettings.ClientThrottleMultipler);
WindThrottle = new LLPacketThrottle(0, 100000, 0, userSettings.ClientThrottleMultipler);
CloudThrottle = new LLPacketThrottle(0, 100000, 0, userSettings.ClientThrottleMultipler);
TaskThrottle = new LLPacketThrottle(1000, 800000, 3000, userSettings.ClientThrottleMultipler);
AssetThrottle = new LLPacketThrottle(1000, 800000, 1000, userSettings.ClientThrottleMultipler);
TextureThrottle = new LLPacketThrottle(1000, 800000, 4000, userSettings.ClientThrottleMultipler);
ResendThrottle = new LLPacketThrottle(5000, throttleMaxBPS / 15, 16000, userSettings.ClientThrottleMultipler);
LandThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 15, 2000, userSettings.ClientThrottleMultipler);
WindThrottle = new LLPacketThrottle(0, throttleMaxBPS / 15, 0, userSettings.ClientThrottleMultipler);
CloudThrottle = new LLPacketThrottle(0, throttleMaxBPS / 15, 0, userSettings.ClientThrottleMultipler);
TaskThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 3000, userSettings.ClientThrottleMultipler);
AssetThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 1000, userSettings.ClientThrottleMultipler);
TextureThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 4000, userSettings.ClientThrottleMultipler);
// Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second.
ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings;
if (null == totalThrottleSettings)
{
totalThrottleSettings = new ThrottleSettings(0, 1500000, 28000);
totalThrottleSettings = new ThrottleSettings(0, throttleMaxBPS, 28000);
}
TotalThrottle

View File

@ -155,6 +155,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (config != null)
{
if (config.Contains("client_throttle_max_bps"))
{
int maxBPS = config.GetInt("client_throttle_max_bps", 1500000);
userSettings.TotalThrottleSettings = new ThrottleSettings(0, maxBPS,
maxBPS > 28000 ? maxBPS : 28000);
}
if (config.Contains("client_throttle_multiplier"))
userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier");
if (config.Contains("client_socket_rcvbuf_size"))

View File

@ -130,7 +130,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
else
{
InventoryItemBase baseItem = invService.GetItem(new InventoryItemBase(appearance.Wearables[i].ItemID));
InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID);
baseItem = invService.GetItem(baseItem);
if (baseItem != null)
{

View File

@ -65,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId));
InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId);
item = invService.GetItem(item);
if (item != null)
{
item.Flags = 1;
@ -80,7 +81,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId));
InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId);
item = invService.GetItem(item);
if (item != null)
{
item.Flags = 0;

View File

@ -258,7 +258,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = invService.GetItem(new InventoryItemBase(inventoryEntityID));
InventoryItemBase item = new InventoryItemBase(inventoryEntityID, client.AgentId);
item = invService.GetItem(item);
InventoryFolderBase folder = null;
if (item != null && trashFolder != null)
@ -266,12 +267,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
item.Folder = trashFolder.ID;
// Diva comment: can't we just update this item???
invService.DeleteItem(item);
List<UUID> uuids = new List<UUID>();
uuids.Add(item.ID);
invService.DeleteItems(item.Owner, uuids);
scene.AddInventoryItem(client, item);
}
else
{
folder = invService.GetFolder(new InventoryFolderBase(inventoryEntityID));
folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
folder = invService.GetFolder(folder);
if (folder != null & trashFolder != null)
{
@ -451,10 +455,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
else
{
UUID itemID = new UUID(msg.binaryBucket, 1);
InventoryItemBase item = new InventoryItemBase();
item.ID = itemID;
item.Owner = user.ControllingClient.AgentId;
InventoryItemBase item = new InventoryItemBase(itemID, user.ControllingClient.AgentId);
// Fetch from service
//

View File

@ -181,12 +181,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// <returns>true if the item was successfully updated</returns>
public abstract bool UpdateItem(InventoryItemBase item);
public abstract bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
/// <summary>
/// Delete an item from the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns>
public abstract bool DeleteItem(InventoryItemBase item);
public abstract bool DeleteItems(UUID ownerID, List<UUID> itemIDs);
public abstract InventoryItemBase GetItem(InventoryItemBase item);

View File

@ -290,7 +290,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
{
return new List<InventoryItemBase>();
if (IsLocalGridUser(userID))
return m_GridService.GetFolderItems(userID, folderID);
else
{
UUID sessionID = GetSessionID(userID);
string uri = GetUserInventoryURI(userID) + "/" + userID;
return m_HGService.GetFolderItems(uri, folderID, sessionID);
}
}
public override bool AddFolder(InventoryFolderBase folder)
@ -386,18 +393,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
}
public override bool DeleteItem(InventoryItemBase item)
public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
{
if (item == null)
if (items == null)
return false;
if (items.Count == 0)
return true;
if (IsLocalGridUser(item.Owner))
return m_GridService.DeleteItem(item);
if (IsLocalGridUser(ownerID))
return m_GridService.MoveItems(ownerID, items);
else
{
UUID sessionID = GetSessionID(item.Owner);
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
return m_HGService.DeleteItem(uri, item, sessionID);
UUID sessionID = GetSessionID(ownerID);
string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
return m_HGService.MoveItems(uri, items, sessionID);
}
}
public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
{
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
if (itemIDs == null)
return false;
if (itemIDs.Count == 0)
return true;
if (IsLocalGridUser(ownerID))
return m_GridService.DeleteItems(ownerID, itemIDs);
else
{
UUID sessionID = GetSessionID(ownerID);
string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
return m_HGService.DeleteItems(uri, itemIDs, sessionID);
}
}
@ -483,12 +511,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
string uri = m_LocalGridInventoryURI.TrimEnd('/');
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri);
if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
{
return true;
}
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri);
return false;
}

View File

@ -289,14 +289,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.UpdateItem(item);
}
public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
{
return m_InventoryService.MoveItems(ownerID, items);
}
/// <summary>
/// Delete an item from the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns>
public override bool DeleteItem(InventoryItemBase item)
public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
{
return m_InventoryService.DeleteItem(item);
return m_InventoryService.DeleteItems(ownerID, itemIDs);
}
public override InventoryItemBase GetItem(InventoryItemBase item)

View File

@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
{
return new List<InventoryItemBase>();
UUID sessionID = GetSessionID(userID);
return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID);
}
public override bool AddFolder(InventoryFolderBase folder)
@ -272,13 +273,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID);
}
public override bool DeleteItem(InventoryItemBase item)
public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
{
if (item == null)
if (items == null)
return false;
UUID sessionID = GetSessionID(item.Owner);
return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID);
UUID sessionID = GetSessionID(ownerID);
return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID);
}
public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
{
if (itemIDs == null)
return false;
if (itemIDs.Count == 0)
return true;
UUID sessionID = GetSessionID(ownerID);
return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID);
}
public override InventoryItemBase GetItem(InventoryItemBase item)
@ -320,14 +333,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
private UUID GetSessionID(UUID userID)
{
if (m_Scene == null)
{
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
}
//if (m_Scene == null)
//{
// m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
//}
if (m_UserProfileService == null)
{
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
//m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
return UUID.Zero;
}

View File

@ -966,7 +966,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard));
InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null) // Library item
{
assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
@ -1385,7 +1386,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(script));
InventoryItemBase assetRequestItem = new InventoryItemBase(script, user);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null) // Library item
{
assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script);
@ -1479,7 +1481,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard));
InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null) // Library item
{
assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);

View File

@ -140,7 +140,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
{
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item != null)
{
@ -315,7 +316,8 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
UUID itemID, InventoryItemBase itemUpd)
{
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item != null)
{
@ -408,7 +410,8 @@ namespace OpenSim.Region.Framework.Scenes
{
Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemId));
InventoryItemBase item = new InventoryItemBase(itemId, senderId);
item = InventoryService.GetItem(item);
if ((item != null) && (item.Owner == senderId))
{
@ -474,7 +477,11 @@ namespace OpenSim.Region.Framework.Scenes
if (!Permissions.BypassPermissions())
{
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
InventoryService.DeleteItem(new InventoryItemBase(itemId));
{
List<UUID> items = new List<UUID>();
items.Add(itemId);
InventoryService.DeleteItems(senderId, items);
}
}
return itemCopy;
@ -558,7 +565,8 @@ namespace OpenSim.Region.Framework.Scenes
if (item == null)
{
item = InventoryService.GetItem(new InventoryItemBase(oldItemID));
item = new InventoryItemBase(oldItemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item == null)
{
@ -630,33 +638,13 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="itemID"></param>
/// <param name="length"></param>
/// <param name="newName"></param>
public void MoveInventoryItem(IClientAPI remoteClient, UUID folderID, UUID itemID, int length,
string newName)
public void MoveInventoryItem(IClientAPI remoteClient, List<InventoryItemBase> items)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId);
"[AGENT INVENTORY]: Moving {0} items for user {1}", items.Count, remoteClient.AgentId);
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
if (item != null)
{
if (newName != String.Empty)
{
item.Name = newName;
}
item.Folder = folderID;
// Diva comment: can't we just update?
InventoryService.DeleteItem(item);
AddInventoryItem(remoteClient, item);
}
else
{
m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
return;
}
if (!InventoryService.MoveItems(remoteClient.AgentId, items))
m_log.Warn("[AGENT INVENTORY]: Failed to move items for user " + remoteClient.AgentId);
}
/// <summary>
@ -794,9 +782,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID)
private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs)
{
InventoryService.DeleteItem(new InventoryItemBase(itemID));
//m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId);
InventoryService.DeleteItems(remoteClient.AgentId, itemIDs);
}
/// <summary>
@ -1224,7 +1213,8 @@ namespace OpenSim.Region.Framework.Scenes
UUID copyID = UUID.Random();
if (itemID != UUID.Zero)
{
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
// Try library
if (null == item)
@ -1242,7 +1232,11 @@ namespace OpenSim.Region.Framework.Scenes
if (!Permissions.BypassPermissions())
{
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
RemoveInventoryItem(remoteClient, itemID);
{
List<UUID> uuids = new List<UUID>();
uuids.Add(itemID);
RemoveInventoryItem(remoteClient, uuids);
}
}
}
else
@ -1287,7 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes
if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
{
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
// Try library
// XXX clumsy, possibly should be one call
@ -1672,7 +1667,7 @@ namespace OpenSim.Region.Framework.Scenes
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{
item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID);
item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID);
item = InventoryService.GetItem(item);
//item = userInfo.RootFolder.FindItem(
@ -1834,7 +1829,8 @@ namespace OpenSim.Region.Framework.Scenes
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item != null)
{
@ -1984,7 +1980,8 @@ namespace OpenSim.Region.Framework.Scenes
BypassRayCast, bRayEndIsIntersection,true,scale, false);
// Rez object
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item != null)
{
@ -2135,7 +2132,11 @@ namespace OpenSim.Region.Framework.Scenes
// copy ones will be lost, so avoid it
//
if (!attachment)
InventoryService.DeleteItem(item);
{
List<UUID> uuids = new List<UUID>();
uuids.Add(item.ID);
InventoryService.DeleteItems(item.Owner, uuids);
}
}
}
@ -2309,7 +2310,8 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence presence;
if (TryGetAvatar(remoteClient.AgentId, out presence))
{
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID, remoteClient.AgentId));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
@ -2360,7 +2362,8 @@ namespace OpenSim.Region.Framework.Scenes
if (TryGetAvatar(remoteClient.AgentId, out presence))
{
// XXYY!!
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
if (ava != null)
@ -2393,7 +2396,9 @@ namespace OpenSim.Region.Framework.Scenes
}
part.ParentGroup.DetachToGround();
InventoryService.DeleteItem(new InventoryItemBase(inventoryID));
List<UUID> uuids = new List<UUID>();
uuids.Add(inventoryID);
InventoryService.DeleteItems(remoteClient.AgentId, uuids);
remoteClient.SendRemoveInventoryItem(inventoryID);
}
SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Threading;
using OpenMetaverse;
@ -404,7 +405,8 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item != null)
{
@ -557,9 +559,25 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
/// <param name="folderID"></param>
delegate void PurgeFolderDelegate(UUID userID, UUID folder);
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
{
InventoryFolderBase folder = new InventoryFolderBase(folderID);
PurgeFolderDelegate d = PurgeFolderAsync;
try
{
d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d);
}
catch (Exception e)
{
m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message);
}
}
private void PurgeFolderAsync(UUID userID, UUID folderID)
{
InventoryFolderBase folder = new InventoryFolderBase(folderID, userID);
if (InventoryService.PurgeFolder(folder))
m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID);
@ -567,5 +585,8 @@ namespace OpenSim.Region.Framework.Scenes
m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID);
}
private void PurgeFolderCompleted(IAsyncResult iar)
{
}
}
}

View File

@ -1978,6 +1978,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
}
private LSL_Rotation GetPartRot( SceneObjectPart part )
{
Quaternion q;
if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
{
if (part.ParentGroup.RootPart.AttachmentPoint != 0)
{
ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
if (avatar != null)
if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
q = avatar.CameraRotation; // Mouselook
else
q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
else
q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
}
else
q = part.ParentGroup.GroupRotation; // just the group rotation
return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
}
q = part.GetWorldRotation();
return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
}
public LSL_Rotation llGetLocalRot()
{
m_host.AddScriptLPS(1);
@ -7299,7 +7323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
res.Add(llGetRot());
res.Add(GetPartRot(part));
break;
case (int)ScriptBaseClass.PRIM_TYPE:

View File

@ -65,6 +65,10 @@ namespace OpenSim.Server.Base
//
private bool m_Running = true;
// PID file
//
private string m_pidFile = String.Empty;
// Handle all the automagical stuff
//
public ServicesServerBase(string prompt, string[] args)
@ -211,6 +215,11 @@ namespace OpenSim.Server.Base
}
}
if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty)
{
CreatePIDFile(startupConfig.GetString("PIDFile"));
}
// Register the quit command
//
MainConsole.Instance.Commands.AddCommand("base", false, "quit",
@ -230,6 +239,8 @@ namespace OpenSim.Server.Base
MainConsole.Instance.Prompt();
}
if (m_pidFile != String.Empty)
File.Delete(m_pidFile);
return 0;
}
@ -246,5 +257,22 @@ namespace OpenSim.Server.Base
protected virtual void Initialise()
{
}
protected void CreatePIDFile(string path)
{
try
{
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
FileStream fs = File.Create(path);
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
Byte[] buf = enc.GetBytes(pidstring);
fs.Write(buf, 0, buf.Length);
fs.Close();
m_pidFile = path;
}
catch (Exception)
{
}
}
}
}

View File

@ -105,8 +105,8 @@ namespace OpenSim.Server.Handlers.Inventory
"POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
"POST", "/DeleteItem/", m_InventoryService.DeleteItem, CheckAuthSession));
new RestDeserialiseSecureHandler<List<Guid>, bool>(
"POST", "/DeleteItem/", DeleteItems, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
@ -125,8 +125,8 @@ namespace OpenSim.Server.Handlers.Inventory
"POST", "/NewFolder/", m_InventoryService.AddFolder, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseTrustedHandler<InventoryFolderBase, bool>(
"POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckTrustSource));
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
@ -137,8 +137,12 @@ namespace OpenSim.Server.Handlers.Inventory
"POST", "/AddNewItem/", m_InventoryService.AddItem, CheckTrustSource));
m_httpServer.AddStreamHandler(
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>(
"POST", "/GetItems/", GetFolderItems, CheckTrustSource));
new RestDeserialiseSecureHandler<Guid, List<InventoryItemBase>>(
"POST", "/GetItems/", GetFolderItems, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>(
"POST", "/MoveItems/", MoveItems, CheckAuthSession));
// for persistent active gestures
m_httpServer.AddStreamHandler(
@ -247,6 +251,24 @@ namespace OpenSim.Server.Handlers.Inventory
return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID);
}
public bool DeleteItems(List<Guid> items)
{
List<UUID> uuids = new List<UUID>();
foreach (Guid g in items)
uuids.Add(new UUID(g));
// oops we lost the user info here. Bad bad handlers
return m_InventoryService.DeleteItems(UUID.Zero, uuids);
}
public bool MoveItems(List<InventoryItemBase> items)
{
// oops we lost the user info here. Bad bad handlers
// let's peek at one item
UUID ownerID = UUID.Zero;
if (items.Count > 0)
ownerID = items[0].Owner;
return m_InventoryService.MoveItems(ownerID, items);
}
#endregion
/// <summary>

View File

@ -214,6 +214,19 @@ namespace OpenSim.Services.Connectors.Inventory
return false;
}
public List<InventoryItemBase> GetFolderItems(string id, UUID folderID, UUID sessionID)
{
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.GetFolderItems(userID, folderID, sessionID);
}
return new List<InventoryItemBase>();
}
public bool AddItem(string id, InventoryItemBase item, UUID sessionID)
{
string url = string.Empty;
@ -240,7 +253,7 @@ namespace OpenSim.Services.Connectors.Inventory
return false;
}
public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID)
public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID)
{
string url = string.Empty;
string userID = string.Empty;
@ -248,7 +261,20 @@ namespace OpenSim.Services.Connectors.Inventory
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.UpdateItem(userID, item, sessionID);
return connector.MoveItems(userID, items, sessionID);
}
return false;
}
public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID)
{
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.DeleteItems(userID, itemIDs, sessionID);
}
return false;
}

View File

@ -95,6 +95,13 @@ namespace OpenSim.Services.Connectors
/// <returns>true if the folder was successfully purged</returns>
bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id);
/// <summary>
/// Get items from a folder.
/// </summary>
/// <param name="folder"></param>
/// <returns>true if the folder was successfully purged</returns>
List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID session_id);
/// <summary>
/// Add a new item to the user's inventory
/// </summary>
@ -109,12 +116,14 @@ namespace OpenSim.Services.Connectors
/// <returns>true if the item was successfully updated</returns>
bool UpdateItem(string userID, InventoryItemBase item, UUID session_id);
bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id);
/// <summary>
/// Delete an item from the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns>
bool DeleteItem(string userID, InventoryItemBase item, UUID session_id);
bool DeleteItems(string userID, List<UUID> itemIDs, UUID session_id);
InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id);

View File

@ -334,6 +334,23 @@ namespace OpenSim.Services.Connectors
return false;
}
public List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID sessionID)
{
try
{
InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID));
return SynchronousRestSessionObjectPoster<InventoryFolderBase, List<InventoryItemBase>>.BeginPostObject(
"POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID);
}
catch (Exception e)
{
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed, {0} {1}",
e.Source, e.Message);
}
return null;
}
public bool AddItem(string userID, InventoryItemBase item, UUID sessionID)
{
try
@ -366,12 +383,57 @@ namespace OpenSim.Services.Connectors
return false;
}
public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID)
/**
* MoveItems Async group
*/
delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID);
private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID)
{
try
{
return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
"POST", m_ServerURI + "/DeleteItem/", item, sessionID.ToString(), item.Owner.ToString());
SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject(
"POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString());
// Success
return;
}
catch (Exception e)
{
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.",
e.Source, e.Message);
}
foreach (InventoryItemBase item in items)
{
InventoryItemBase itm = this.QueryItem(userID, item, sessionID);
itm.Name = item.Name;
itm.Folder = item.Folder;
this.UpdateItem(userID, itm, sessionID);
}
}
private void MoveItemsCompleted(IAsyncResult iar)
{
}
public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID)
{
MoveItemsDelegate d = MoveItemsAsync;
d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d);
return true;
}
public bool DeleteItems(string userID, List<UUID> items, UUID sessionID)
{
try
{
List<Guid> guids = new List<Guid>();
foreach (UUID u in items)
guids.Add(u.Guid);
return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
"POST", m_ServerURI + "/DeleteItem/", guids, sessionID.ToString(), userID);
}
catch (Exception e)
{

View File

@ -151,7 +151,12 @@ namespace OpenSim.Services.Connectors
return false;
}
public bool DeleteItem(InventoryItemBase item)
public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
{
return false;
}
public bool DeleteItems(UUID owner, List<UUID> itemIDs)
{
return false;
}

View File

@ -142,12 +142,15 @@ namespace OpenSim.Services.Interfaces
/// <returns>true if the item was successfully updated</returns>
bool UpdateItem(InventoryItemBase item);
bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
/// <summary>
/// Delete an item from the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns>
bool DeleteItem(InventoryItemBase item);
//bool DeleteItem(InventoryItemBase item);
bool DeleteItems(UUID userID, List<UUID> itemIDs);
/// <summary>
/// Get an item, given by its UUID

View File

@ -386,13 +386,33 @@ namespace OpenSim.Services.InventoryService
return true;
}
// See IInventoryServices
public virtual bool DeleteItem(InventoryItemBase item)
public virtual bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
{
m_log.InfoFormat(
"[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
"[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID);
m_Database.deleteInventoryItem(item.ID);
InventoryItemBase itm = null;
foreach (InventoryItemBase item in items)
{
itm = GetInventoryItem(item.ID);
itm.Folder = item.Folder;
if ((item.Name != null) && !item.Name.Equals(string.Empty))
itm.Name = item.Name;
m_Database.updateInventoryItem(itm);
}
return true;
}
// See IInventoryServices
public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs)
{
m_log.InfoFormat(
"[INVENTORY SERVICE]: Deleting {0} items from user {1}", itemIDs.Count, owner);
// uhh.....
foreach (UUID uuid in itemIDs)
m_Database.deleteInventoryItem(uuid);
// FIXME: Should return false on failure
return true;
@ -439,10 +459,12 @@ namespace OpenSim.Services.InventoryService
List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID);
List<UUID> uuids = new List<UUID>();
foreach (InventoryItemBase item in items)
{
DeleteItem(item);
uuids.Add(item.ID);
}
DeleteItems(folder.Owner, uuids);
// FIXME: Should return false on failure
return true;

View File

@ -143,7 +143,12 @@ namespace OpenSim.Tests.Common.Mock
return false;
}
public bool DeleteItem(InventoryItemBase item)
public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
{
return false;
}
public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
{
return false;
}

View File

@ -374,6 +374,9 @@
;
; client_socket_rcvbuf_size = 8388608
; Maximum bits per second to send to any single client. This will override the user's viewer preference settings.
; client_throttle_max_bps = 1500000
[Chat]
; Controls whether the chat module is enabled. Default is true.

View File

@ -911,6 +911,7 @@
<Reference name="OpenMetaverse.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
@ -1178,6 +1179,7 @@
<Reference name="OpenMetaverse.StructuredData.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll"/>
<Reference name="DotNetOpenId.dll"/>
<Files>
@ -1279,6 +1281,7 @@
<Reference name="OpenMetaverse.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>