From b7f1fc116eb37a651a80bc09df11fa47540a1df9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Nov 2009 20:21:46 +0000 Subject: Prevent a nullref if a recipient of a group message gas left the scene --- .../Avatar/InstantMessage/OfflineMessageModule.cs | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 1614b70..7f9e5af 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -164,19 +164,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage Listmsglist = SynchronousRestObjectPoster.BeginPostObject>( "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); - foreach (GridInstantMessage im in msglist) + if (msglist != null) { - // client.SendInstantMessage(im); - - // Send through scene event manager so all modules get a chance - // to look at this message before it gets delivered. - // - // Needed for proper state management for stored group - // invitations - // - Scene s = FindScene(client.AgentId); - if (s != null) - s.EventManager.TriggerIncomingInstantMessage(im); + foreach (GridInstantMessage im in msglist) + { + // client.SendInstantMessage(im); + + // Send through scene event manager so all modules get a chance + // to look at this message before it gets delivered. + // + // Needed for proper state management for stored group + // invitations + // + Scene s = FindScene(client.AgentId); + if (s != null) + s.EventManager.TriggerIncomingInstantMessage(im); + } } } -- cgit v1.1 From 73c2162ff60850d96761aa07a1950dbbb2ec3e80 Mon Sep 17 00:00:00 2001 From: CasperW Date: Mon, 23 Nov 2009 19:51:40 +0100 Subject: Fixed nullrefs --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 42 ++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index cd59bdb..5c24f03 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -266,25 +266,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat } // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); - - ((Scene)c.Scene).ForEachScenePresence( - delegate(ScenePresence presence) - { - // ignore chat from child agents - if (presence.IsChildAgent) return; - - IClientAPI client = presence.ControllingClient; - - // don't forward SayOwner chat from objects to - // non-owner agents - if ((c.Type == ChatTypeEnum.Owner) && - (null != c.SenderObject) && - (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) - return; - - client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, - (byte)sourceType, (byte)ChatAudibleLevel.Fully); - }); + if (c.Scene != null) + { + ((Scene)c.Scene).ForEachScenePresence + ( + delegate(ScenePresence presence) + { + // ignore chat from child agents + if (presence.IsChildAgent) return; + + IClientAPI client = presence.ControllingClient; + + // don't forward SayOwner chat from objects to + // non-owner agents + if ((c.Type == ChatTypeEnum.Owner) && + (null != c.SenderObject) && + (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) + return; + + client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, + (byte)sourceType, (byte)ChatAudibleLevel.Fully); + } + ); + } } -- cgit v1.1 From 8383bde76880fc94a6644422d45baa28252b0231 Mon Sep 17 00:00:00 2001 From: CasperW Date: Tue, 24 Nov 2009 18:18:19 +0100 Subject: Removed some extra debug chatter --- .../CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index d9a021f..b60b32b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -389,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { // Check if this is ours to handle // - m_log.Info("OnFridInstantMessage"); + //m_log.Info("OnFridInstantMessage"); if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered) return; -- cgit v1.1 From d5aceb6d95779b19d13eef9f2427c79233166a63 Mon Sep 17 00:00:00 2001 From: CasperW Date: Tue, 24 Nov 2009 23:33:12 +0100 Subject: Append a prefix to the god avatar names appearing in chat whilst in god mode (disabled by default, config entry admin_prefix) --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 5c24f03..1e63e3e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat private int m_shoutdistance = 100; private int m_whisperdistance = 10; private List m_scenes = new List(); - + private string m_adminPrefix = ""; internal object m_syncy = new object(); internal IConfig m_config; @@ -76,6 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); + m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); } public virtual void AddRegion(Scene scene) @@ -185,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) { string fromName = c.From; + string fromNamePrefix = ""; UUID fromID = UUID.Zero; string message = c.Message; IScene scene = c.Scene; @@ -207,7 +209,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat fromPos = avatar.AbsolutePosition; fromName = avatar.Name; fromID = c.Sender.AgentId; - + if (avatar.GodLevel > 200) + { + fromNamePrefix = m_adminPrefix; + } break; case ChatSourceType.Object: @@ -227,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat s.ForEachScenePresence( delegate(ScenePresence presence) { - TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); + TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); } ); } -- cgit v1.1 From 51bb31156502c391ac84aa207fce125a4299d755 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 18 Jan 2010 02:53:31 +0000 Subject: Add chat banning. Staff patch --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 51 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index e3e8718..acc3a78 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -49,6 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat private int m_shoutdistance = 100; private int m_whisperdistance = 10; private List m_scenes = new List(); + private List FreezeCache = new List(); private string m_adminPrefix = ""; internal object m_syncy = new object(); @@ -172,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat return; } - DeliverChatToAvatars(ChatSourceType.Agent, c); + if (FreezeCache.Contains(c.Sender.AgentId.ToString())) + { + if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) + c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); + } + else + { + DeliverChatToAvatars(ChatSourceType.Agent, c); + } } public virtual void OnChatFromWorld(Object sender, OSChatMessage c) @@ -232,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat s.ForEachScenePresence( delegate(ScenePresence presence) { - TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); + ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); + if (Presencecheck != null) + { + if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true) + { + TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); + } + } + } ); } @@ -322,5 +339,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); } + + Dictionary Timers = new Dictionary(); + public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) + { + System.Threading.Timer Timer; + if (flags == 0) + { + FreezeCache.Add(target.ToString()); + System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); + Timer = new System.Threading.Timer(timeCB, target, 30000, 0); + Timers.Add(target, Timer); + } + else + { + FreezeCache.Remove(target.ToString()); + Timers.TryGetValue(target, out Timer); + Timers.Remove(target); + Timer.Dispose(); + } + } + + private void OnEndParcelFrozen(object avatar) + { + UUID target = (UUID)avatar; + FreezeCache.Remove(target.ToString()); + System.Threading.Timer Timer; + Timers.TryGetValue(target, out Timer); + Timers.Remove(target); + Timer.Dispose(); + } } } -- cgit v1.1 From e9c9a74e0ade505ee8d8d8e7790141f758a65f61 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 26 Jan 2010 15:12:41 +0000 Subject: Some merge fixups --- .../CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 3e86848..8f289c0 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -180,11 +180,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private void RetrieveInstantMessages(IClientAPI client) { - if (m_RestURL != "") - { - m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); + if (m_RestURL == String.Empty) + return; + + m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); - List msglist = SynchronousRestObjectPoster.BeginPostObject>( + List msglist = SynchronousRestObjectPoster.BeginPostObject>( "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); if (msglist != null) -- cgit v1.1 From cfca9e1e811f6cdea6b7c3338f7f783a07f8e0ac Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jan 2010 07:20:13 +0000 Subject: Revert "Updates all IRegionModules to the new style region modules." This reverts commit ec3c31e61e5e540f822891110df9bc978655bbaf. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 29 +++------- .../CoreModules/Avatar/Combat/CombatModule.cs | 32 +++-------- .../CoreModules/Avatar/Dialog/DialogModule.cs | 32 +++-------- .../CoreModules/Avatar/Friends/FriendsModule.cs | 54 +++++-------------- .../CoreModules/Avatar/Gestures/GesturesModule.cs | 30 ++--------- .../Region/CoreModules/Avatar/Gods/GodsModule.cs | 28 ++-------- .../CoreModules/Avatar/Groups/GroupsModule.cs | 35 +++--------- .../Avatar/InstantMessage/InstantMessageModule.cs | 53 ++++++------------ .../Avatar/InstantMessage/MessageTransferModule.cs | 54 ++++++------------- .../Avatar/InstantMessage/MuteListModule.cs | 48 ++++++----------- .../Avatar/InstantMessage/OfflineMessageModule.cs | 41 +++++--------- .../Avatar/InstantMessage/PresenceModule.cs | 61 +++++++-------------- .../Inventory/Archiver/InventoryArchiverModule.cs | 35 +++--------- .../Inventory/Transfer/InventoryTransferModule.cs | 63 ++++++---------------- .../Region/CoreModules/Avatar/Lure/LureModule.cs | 61 ++++++--------------- .../CoreModules/Avatar/ObjectCaps/ObjectAdd.cs | 55 +++++++------------ .../Avatar/Profiles/AvatarProfilesModule.cs | 32 +++++------ 17 files changed, 202 insertions(+), 541 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 6bbbd56..35c59aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -28,7 +28,6 @@ using System; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,8 +38,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class AvatarFactoryModule : IAvatarFactory, ISharedRegionModule + public class AvatarFactoryModule : IAvatarFactory, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene = null; @@ -77,16 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return appearance; } - public void Initialise(IConfigSource source) - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { scene.RegisterModuleInterface(this); scene.EventManager.OnNewClient += NewClient; @@ -95,18 +84,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_scene = scene; } - } - public void RegionLoaded(Scene scene) - { } - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - scene.EventManager.OnNewClient -= NewClient; - } - public void PostInitialise() { } @@ -120,6 +100,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory get { return "Default Avatar Factory"; } } + public bool IsSharedModule + { + get { return false; } + } + public void NewClient(IClientAPI client) { client.OnAvatarNowWearing += AvatarIsWearing; diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index b7d12aa..61b6d65 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -35,8 +34,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class CombatModule : ISharedRegionModule + public class CombatModule : IRegionModule { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -55,17 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule /// /// /// - public void Initialise(IConfigSource config) - { - - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { lock (m_scenel) { @@ -83,17 +71,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.EventManager.OnAvatarKilled -= KillAvatar; - scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - m_scenel.Remove(scene.RegionInfo.RegionHandle); - } - public void PostInitialise() { } @@ -107,6 +84,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule get { return "CombatModule"; } } + public bool IsSharedModule + { + get { return true; } + } + private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar) { if (killerObjectLocalID == 0) diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index ecffc7a..72ec869 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -25,11 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,46 +37,28 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Dialog { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class DialogModule : ISharedRegionModule, IDialogModule + public class DialogModule : IRegionModule, IDialogModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; - public void Initialise(IConfigSource source) - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { m_scene = scene; m_scene.RegisterModuleInterface(this); - + m_scene.AddCommand( this, "alert", "alert ", "Send an alert to a user", HandleAlertConsoleCommand); m_scene.AddCommand( this, "alert general", "alert general ", "Send an alert to everyone", HandleAlertConsoleCommand); } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } - - public void PostInitialise() { } + + public void PostInitialise() {} public void Close() {} public string Name { get { return "Dialog Module"; } } + public bool IsSharedModule { get { return false; } } public void SendAlertToUser(IClientAPI client, string message) { diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 7254180..086d4fe 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -31,7 +31,6 @@ using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -82,8 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends - Terminate Friendship messages (single) */ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class FriendsModule : ISharedRegionModule, IFriendsModule + public class FriendsModule : IRegionModule, IFriendsModule { private class Transaction { @@ -113,23 +111,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private IGridService m_gridServices = null; - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - - } - - public void PostInitialise() - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { lock (m_scenes) { @@ -144,9 +128,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) m_scenes[scene.RegionInfo.RegionHandle] = scene; } - + scene.RegisterModuleInterface(this); - + scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; @@ -154,34 +138,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.EventManager.OnClientClosed += ClientClosed; } - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (m_scenes.Count > 0) { - m_TransferModule = scene.RequestModuleInterface(); - m_gridServices = scene.GridService; + m_TransferModule = m_initialScene.RequestModuleInterface(); + m_gridServices = m_initialScene.GridService; } if (m_TransferModule == null) m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); } - public void RemoveRegion(Scene scene) - { - MainServer.Instance.RemoveXmlRPCHandler("presence_update_bulk"); - MainServer.Instance.RemoveXmlRPCHandler("terminate_friend"); - - if (m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) - m_scenes.Remove(scene.RegionInfo.RegionHandle); - - scene.UnregisterModuleInterface(this); - - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - scene.EventManager.OnMakeChildAgent -= MakeChildAgent; - scene.EventManager.OnClientClosed -= ClientClosed; - } - public void Close() { } @@ -191,6 +158,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends get { return "FriendsModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion #region IInterregionFriendsComms diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index c306f94..8ce5092 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs @@ -25,10 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,41 +37,23 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Gestures { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class GesturesModule : INonSharedRegionModule + public class GesturesModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; - public void Initialise(IConfigSource source) - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { m_scene = scene; + m_scene.EventManager.OnNewClient += OnNewClient; } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if(m_scene == scene) - m_scene = null; - scene.EventManager.OnNewClient -= OnNewClient; - } + public void PostInitialise() {} public void Close() {} public string Name { get { return "Gestures Module"; } } + public bool IsSharedModule { get { return false; } } private void OnNewClient(IClientAPI client) { diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 3914f2e..50171a3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -25,9 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -36,8 +34,7 @@ using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Gods { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class GodsModule : INonSharedRegionModule, IGodsModule + public class GodsModule : IRegionModule, IGodsModule { /// Special UUID for actions that apply to all agents private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); @@ -45,34 +42,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods protected Scene m_scene; protected IDialogModule m_dialogModule; - public void Initialise(IConfigSource source) - { - - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { m_scene = scene; m_dialogModule = m_scene.RequestModuleInterface(); m_scene.RegisterModuleInterface(this); } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } + public void PostInitialise() {} public void Close() {} public string Name { get { return "Gods Module"; } } + public bool IsSharedModule { get { return false; } } public void RequestGodlikePowers( UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index 7ff8d30..31363e5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs @@ -25,11 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -38,8 +36,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Groups { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class GroupsModule : ISharedRegionModule + public class GroupsModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -58,9 +55,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups private static GroupMembershipData osGroup = new GroupMembershipData(); - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { IConfig groupsConfig = config.Configs["Groups"]; @@ -79,15 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups if (groupsConfig.GetString("Module", "Default") != "Default") return; } - } - - public Type ReplaceableInterface - { - get { return null; } - } - public void AddRegion(Scene scene) - { lock (m_SceneList) { if (!m_SceneList.Contains(scene)) @@ -110,19 +99,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (m_SceneList.Contains(scene)) - m_SceneList.Remove(scene); - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnClientClosed -= OnClientClosed; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - } - public void PostInitialise() { } @@ -147,6 +123,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups get { return "GroupsModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion private void OnNewClient(IClientAPI client) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index e1bde4b..9a68749 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -24,12 +24,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,8 +36,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class InstantMessageModule : ISharedRegionModule + public class InstantMessageModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -51,11 +47,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private readonly List m_scenes = new List(); - #region ISharedRegionModule Members + #region IRegionModule Members private IMessageTransferModule m_TransferModule = null; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (config.Configs["Messaging"] != null) { @@ -66,15 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } m_enabled = true; - } - - public Type ReplaceableInterface - { - get { return null; } - } - public void AddRegion(Scene scene) - { lock (m_scenes) { if (!m_scenes.Contains(scene)) @@ -86,27 +74,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - public void RegionLoaded(Scene scene) - { - if (!m_enabled) - return; - - m_TransferModule = - m_scenes[0].RequestModuleInterface(); - - if (m_TransferModule == null) - m_log.Error("[INSTANT MESSAGE]: No message transfer module, " + - "IM will not work!"); - } - - public void RemoveRegion(Scene scene) - { - if (m_scenes.Contains(scene)) - m_scenes.Remove(scene); - scene.EventManager.OnClientConnect -= OnClientConnect; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - } - void OnClientConnect(IClientCore client) { IClientIM clientIM; @@ -118,6 +85,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage public void PostInitialise() { + if (!m_enabled) + return; + + m_TransferModule = + m_scenes[0].RequestModuleInterface(); + + if (m_TransferModule == null) + m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+ + "IM will not work!"); } public void Close() @@ -129,6 +105,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage get { return "InstantMessageModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion public void OnInstantMessage(IClientAPI client, GridInstantMessage im) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 16bdfdd..e5159b3 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -41,8 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule + public class MessageTransferModule : IRegionModule, IMessageTransferModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -52,9 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage protected Dictionary m_UserRegionMap = new Dictionary(); public event UndeliveredMessage OnUndeliveredMessage; - private bool m_enabled = true; - public virtual void Initialise(IConfigSource config) + public virtual void Initialise(Scene scene, IConfigSource config) { IConfig cnf = config.Configs["Messaging"]; if (cnf != null && cnf.GetString( @@ -62,49 +59,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage "MessageTransferModule") { m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); - m_enabled = false; + return; } cnf = config.Configs["Startup"]; if (cnf != null) m_Gridmode = cnf.GetBoolean("gridmode", false); - } - public Type ReplaceableInterface - { - get { return null; } - } + // m_Enabled = true; - public void AddRegion(Scene scene) - { - if (m_enabled) + lock (m_Scenes) { - lock (m_Scenes) + if (m_Scenes.Count == 0) { - if (m_Scenes.Count == 0) - { - MainServer.Instance.AddXmlRPCHandler( - "grid_instant_message", processXMLRPCGridInstantMessage); - } - - m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); - scene.RegisterModuleInterface(this); - m_Scenes.Add(scene); + MainServer.Instance.AddXmlRPCHandler( + "grid_instant_message", processXMLRPCGridInstantMessage); } - } - } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (m_Scenes.Contains(scene)) - m_Scenes.Remove(scene); - MainServer.Instance.RemoveXmlRPCHandler( - "grid_instant_message"); - scene.UnregisterModuleInterface(this); + m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); + scene.RegisterModuleInterface(this); + m_Scenes.Add(scene); + } } public virtual void PostInitialise() @@ -120,6 +95,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage get { return "MessageTransferModule"; } } + public virtual bool IsSharedModule + { + get { return true; } + } + public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) { UUID toAgentID = new UUID(im.toAgentID); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs index 3570495..2d4a635 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -40,8 +39,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.MuteList { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MuteListModule : ISharedRegionModule + public class MuteListModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -49,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList private List m_SceneList = new List(); private string m_RestURL = String.Empty; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (!enabled) return; @@ -68,24 +66,19 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList enabled = false; return; } - m_RestURL = cnf.GetString("MuteListURL", ""); - if (m_RestURL == "") - { - m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling"); - enabled = false; - return; - } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { lock (m_SceneList) { + if (m_SceneList.Count == 0) + { + m_RestURL = cnf.GetString("MuteListURL", ""); + if (m_RestURL == "") + { + m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling"); + enabled = false; + return; + } + } if (!m_SceneList.Contains(scene)) m_SceneList.Add(scene); @@ -93,18 +86,6 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (m_SceneList.Contains(scene)) - m_SceneList.Remove(scene); - - scene.EventManager.OnNewClient -= OnNewClient; - } - public void PostInitialise() { if (!enabled) @@ -121,6 +102,11 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList get { return "MuteListModule"; } } + public bool IsSharedModule + { + get { return true; } + } + public void Close() { } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 8f289c0..0727fa9 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -41,8 +40,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class OfflineMessageModule : ISharedRegionModule + public class OfflineMessageModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -51,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private string m_RestURL = String.Empty; private bool m_ForwardOfflineGroupMessages = true; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (!enabled) return; @@ -85,23 +83,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } } - } - } - - public Type ReplaceableInterface - { - get { return null; } - } + if (!m_SceneList.Contains(scene)) + m_SceneList.Add(scene); - public void AddRegion(Scene scene) - { - if (!m_SceneList.Contains(scene)) - m_SceneList.Add(scene); - - scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnNewClient += OnNewClient; + } } - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (!enabled) return; @@ -131,22 +120,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled"); } - public void RemoveRegion(Scene scene) - { - if (m_SceneList.Contains(scene)) - m_SceneList.Remove(scene); - scene.EventManager.OnNewClient -= OnNewClient; - } - - public void PostInitialise() - { - } - public string Name { get { return "OfflineMessageModule"; } } + public bool IsSharedModule + { + get { return true; } + } + public void Close() { } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index f5498f4..f5ab454 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs @@ -24,14 +24,11 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -using System; using System.Collections; using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -42,8 +39,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class PresenceModule : ISharedRegionModule, IPresenceModule + public class PresenceModule : IRegionModule, IPresenceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -63,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage public event PresenceChange OnPresenceChange; public event BulkPresenceData OnBulkPresenceData; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { lock (m_Scenes) { @@ -82,38 +78,28 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage m_Gridmode = cnf.GetBoolean("gridmode", false); m_Enabled = true; - } - } - } - public Type ReplaceableInterface - { - get { return null; } - } + m_initialScene = scene; + } - public void AddRegion(Scene scene) - { - if (m_Enabled) - { - m_initialScene = scene; if (m_Gridmode) NotifyMessageServerOfStartup(scene); m_Scenes.Add(scene); + } - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; - scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; - } + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; + scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; } - public void RegionLoaded(Scene scene) + public void PostInitialise() { } - public void RemoveRegion(Scene scene) + public void Close() { if (!m_Gridmode || !m_Enabled) return; @@ -130,28 +116,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - NotifyMessageServerOfShutdown(scene); - if(m_Scenes.Contains(scene)) - m_Scenes.Remove(scene); - - scene.UnregisterModuleInterface(this); - - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; - scene.EventManager.OnMakeChildAgent -= OnMakeChildAgent; - } - - public void PostInitialise() - { + lock (m_Scenes) + { + foreach (Scene scene in m_Scenes) + NotifyMessageServerOfShutdown(scene); + } } - public void Close() + public string Name { + get { return "PresenceModule"; } } - public string Name + public bool IsSharedModule { - get { return "PresenceModule"; } + get { return true; } } public void RequestBulkPresenceData(UUID[] users) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index a04ab22..ecd60bd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -42,11 +41,10 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] /// /// This module loads and saves OpenSimulator inventory archives /// - public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule + public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -84,28 +82,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver DisablePresenceChecks = disablePresenceChecks; } - public void Initialise(IConfigSource source) - { - - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { if (m_scenes.Count == 0) { scene.RegisterModuleInterface(this); OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; - + scene.AddCommand( this, "load iar", "load iar []", - "Load user inventory archive.", HandleLoadInvConsoleCommand); - + "Load user inventory archive.", HandleLoadInvConsoleCommand); + scene.AddCommand( this, "save iar", "save iar []", @@ -113,21 +101,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_aScene = scene; } - + m_scenes[scene.RegionInfo.RegionID] = scene; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - if(m_scenes.ContainsKey(scene.RegionInfo.RegionID)) - m_scenes.Remove(scene.RegionInfo.RegionID); - } - public void PostInitialise() {} public void Close() {} diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index abf440e..b60b32b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -40,8 +39,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule + public class InventoryTransferModule : IInventoryTransferModule, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -52,11 +50,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer new Dictionary(); private IMessageTransferModule m_TransferModule = null; - private bool m_enabled = true; - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (config.Configs["Messaging"] != null) { @@ -65,61 +62,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer if (config.Configs["Messaging"].GetString( "InventoryTransferModule", "InventoryTransferModule") != "InventoryTransferModule") - m_enabled = false; + return; } - } - - public Type ReplaceableInterface - { - get { return null; } - } - public void AddRegion(Scene scene) - { - if (m_enabled) + if (!m_Scenelist.Contains(scene)) { - if (!m_Scenelist.Contains(scene)) - { - m_Scenelist.Add(scene); + m_Scenelist.Add(scene); - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnClientClosed += ClientLoggedOut; - scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; - } + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnClientClosed += ClientLoggedOut; + scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; } } - public void RegionLoaded(Scene scene) + public void PostInitialise() { - if (m_enabled) + if (m_Scenelist.Count > 0) { - if (m_Scenelist.Count > 0) - { - m_TransferModule = m_Scenelist[0].RequestModuleInterface(); - if (m_TransferModule == null) - m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); - } + m_TransferModule = m_Scenelist[0].RequestModuleInterface(); + if (m_TransferModule == null) + m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); } } - public void RemoveRegion(Scene scene) - { - if (m_Scenelist.Contains(scene)) - m_Scenelist.Remove(scene); - - scene.UnregisterModuleInterface(this); - - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnClientClosed -= ClientLoggedOut; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - } - - public void PostInitialise() - { - } - public void Close() { } diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index 973d27f..261bd6c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -38,72 +37,36 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Lure { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class LureModule : ISharedRegionModule + public class LureModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly List m_scenes = new List(); - private bool m_enabled = true; - private IMessageTransferModule m_TransferModule = null; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (config.Configs["Messaging"] != null) { if (config.Configs["Messaging"].GetString( "LureModule", "LureModule") != "LureModule") - m_enabled = false; + return; } - } - - public Type ReplaceableInterface - { - get { return null; } - } - public void AddRegion(Scene scene) - { - if (m_enabled) + lock (m_scenes) { - lock (m_scenes) + if (!m_scenes.Contains(scene)) { - if (!m_scenes.Contains(scene)) - { - m_scenes.Add(scene); - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnIncomingInstantMessage += - OnGridInstantMessage; - } + m_scenes.Add(scene); + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnIncomingInstantMessage += + OnGridInstantMessage; } } } - public void RegionLoaded(Scene scene) - { - if (m_enabled) - { - m_TransferModule = - m_scenes[0].RequestModuleInterface(); - - if (m_TransferModule == null) - m_log.Error("[INSTANT MESSAGE]: No message transfer module, " + - "lures will not work!"); - } - } - - public void RemoveRegion(Scene scene) - { - if (m_scenes.Contains(scene)) - m_scenes.Remove(scene); - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnIncomingInstantMessage -= - OnGridInstantMessage; - } - void OnNewClient(IClientAPI client) { client.OnInstantMessage += OnInstantMessage; @@ -113,6 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure public void PostInitialise() { + m_TransferModule = + m_scenes[0].RequestModuleInterface(); + + if (m_TransferModule == null) + m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+ + "lures will not work!"); } public void Close() diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs index 748b42c..63a93aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs @@ -29,7 +29,6 @@ using System; using System.Collections; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -42,54 +41,24 @@ using Caps=OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class ObjectAdd : ISharedRegionModule + public class ObjectAdd : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource pSource) + public void Initialise(Scene pScene, IConfigSource pSource) { - - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - m_scene = scene; + m_scene = pScene; m_scene.EventManager.OnRegisterCaps += RegisterCaps; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.EventManager.OnRegisterCaps -= RegisterCaps; - } - public void PostInitialise() { } - public void Close() - { - - } - - public string Name - { - get { return "ObjectAddModule"; } - } - public void RegisterCaps(UUID agentID, Caps caps) { UUID capuuid = UUID.Random(); @@ -379,6 +348,22 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps Array.Reverse(resultbytes); return String.Format("{0}",Convert.ToBase64String(resultbytes)); } + + public void Close() + { + + } + + public string Name + { + get { return "ObjectAddModule"; } + } + + public bool IsSharedModule + { + get { return false; } + } + #endregion } } diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs index 7fcb0e1..8cf58c6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs @@ -30,7 +30,6 @@ using System.Collections; using System.Globalization; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,17 +38,20 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Profiles { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class AvatarProfilesModule : INonSharedRegionModule + public class AvatarProfilesModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; private IProfileModule m_profileModule = null; private bool m_enabled = true; - #region INonSharedRegionModule Members + public AvatarProfilesModule() + { + } - public void Initialise(IConfigSource config) + #region IRegionModule Members + + public void Initialise(Scene scene, IConfigSource config) { IConfig profileConfig = config.Configs["Profile"]; if (profileConfig != null) @@ -60,31 +62,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles return; } } - } - - public Type ReplaceableInterface - { - get { return null; } - } - public void AddRegion(Scene scene) - { m_scene = scene; m_scene.EventManager.OnNewClient += NewClient; } - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (!m_enabled) return; m_profileModule = m_scene.RequestModuleInterface(); } - public void RemoveRegion(Scene scene) - { - scene.EventManager.OnNewClient -= NewClient; - } - public void Close() { } @@ -94,6 +83,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles get { return "AvatarProfilesModule"; } } + public bool IsSharedModule + { + get { return false; } + } + #endregion public void NewClient(IClientAPI client) -- cgit v1.1 From 0f3314c04ccd07e0ff9b5be69903b0a72dd73115 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 8 Apr 2010 15:00:01 -0700 Subject: Backported GetTextureModule and IAssetService.GetCached() --- .../CoreModules/Avatar/Assets/GetTextureModule.cs | 220 +++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs new file mode 100644 index 0000000..53d2cef --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -0,0 +1,220 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; + +namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps +{ + #region Stream Handler + + public delegate byte[] StreamHandlerCallback(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse); + + public class StreamHandler : BaseStreamHandler + { + StreamHandlerCallback m_callback; + + public StreamHandler(string httpMethod, string path, StreamHandlerCallback callback) + : base(httpMethod, path) + { + m_callback = callback; + } + + public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + return m_callback(path, request, httpRequest, httpResponse); + } + } + + #endregion Stream Handler + + public class GetTextureModule : IRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; + private IAssetService m_assetService; + + #region IRegionModule Members + + public void Initialise(Scene pScene, IConfigSource pSource) + { + m_scene = pScene; + } + + public void PostInitialise() + { + m_assetService = m_scene.RequestModuleInterface(); + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + public void Close() { } + + public string Name { get { return "GetTextureModule"; } } + public bool IsSharedModule { get { return false; } } + + public void RegisterCaps(UUID agentID, Caps caps) + { + UUID capID = UUID.Random(); + + m_log.Info("[GETTEXTURE]: /CAPS/" + capID); + caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); + } + + #endregion + + private byte[] ProcessGetTexture(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + // TODO: Change this to a config option + const string REDIRECT_URL = null; + + // Try to parse the texture ID from the request URL + NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); + string textureStr = query.GetOne("texture_id"); + + if (m_assetService == null) + { + m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; + return null; + } + + UUID textureID; + if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) + { + AssetBase texture; + + if (!String.IsNullOrEmpty(REDIRECT_URL)) + { + // Only try to fetch locally cached textures. Misses are redirected + texture = m_assetService.GetCached(textureID.ToString()); + + if (texture != null) + { + SendTexture(httpRequest, httpResponse, texture); + } + else + { + string textureUrl = REDIRECT_URL + textureID.ToString(); + m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl); + httpResponse.RedirectLocation = textureUrl; + } + } + else + { + // Fetch locally or remotely. Misses return a 404 + texture = m_assetService.Get(textureID.ToString()); + + if (texture != null) + { + SendTexture(httpRequest, httpResponse, texture); + } + else + { + m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; + } + } + } + else + { + m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url); + } + + httpResponse.Send(); + return null; + } + + private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture) + { + string range = request.Headers.GetOne("Range"); + if (!String.IsNullOrEmpty(range)) + { + // Range request + int start, end; + if (TryParseRange(range, out start, out end)) + { + 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); + + if (end - start < texture.Data.Length) + response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; + + response.ContentLength = end - start; + response.ContentType = texture.Metadata.ContentType; + + response.Body.Write(texture.Data, start, end - start); + } + else + { + m_log.Warn("Malformed Range header: " + range); + response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest; + } + } + else + { + // Full content request + response.ContentLength = texture.Data.Length; + response.ContentType = texture.Metadata.ContentType; + response.Body.Write(texture.Data, 0, texture.Data.Length); + } + } + + private bool TryParseRange(string header, out int start, out int end) + { + if (header.StartsWith("bytes=")) + { + string[] rangeValues = header.Substring(6).Split('-'); + if (rangeValues.Length == 2) + { + if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end)) + return true; + } + } + + start = end = 0; + return false; + } + } +} -- cgit v1.1 From 54cedfe4320573ac302b11716e293086110a4f9b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 8 Apr 2010 15:57:00 -0700 Subject: Changed the GetTextureModule backport to work with the 0.6.9 codebase --- .../Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 53d2cef..3b66859 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps // Try to parse the texture ID from the request URL NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); - string textureStr = query.GetOne("texture_id"); + string textureStr = GetOne(query, "texture_id"); if (m_assetService == null) { @@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture) { - string range = request.Headers.GetOne("Range"); + string range = GetOne(request.Headers, "Range"); if (!String.IsNullOrEmpty(range)) { // Range request @@ -216,5 +216,14 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps start = end = 0; return false; } + + private static string GetOne(NameValueCollection collection, string key) + { + string[] values = collection.GetValues(key); + if (values != null && values.Length > 0) + return values[0]; + + return null; + } } } -- cgit v1.1 From 80024c023ad134416038b68a29d5e583f5d5e8a0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 19 Apr 2010 18:44:21 +0200 Subject: Remove the event trigger for the attach event from the attachment module. The script engine already triggers this internally. --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 77e73fb..9178a0e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); // Do this last so that event listeners have access to all the effects of the attachment - m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); + //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); } else { -- cgit v1.1 From de63b60748e33fb5089a463b7a114bb2de33bb5f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 19 Apr 2010 19:27:45 +0200 Subject: Avoid duplicate script resumes. Move resume calls to more logical places --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 9178a0e..354994b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -239,6 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Fire after attach, so we don't get messy perms dialogs // 3 == AttachedRez objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); + objatt.ResumeScripts(); // Do this last so that event listeners have access to all the effects of the attachment //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); @@ -250,7 +251,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments itemID, remoteClient.Name, AttachmentPt); } - objatt.ResumeScripts(); return objatt; } -- cgit v1.1 From 780630d7c05f7306ffceb52db0eda1401112f426 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 23 Apr 2010 14:41:20 +0200 Subject: Fix a nullref in attachment handling. Add some debug to find the attachment state issue --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 354994b..a667b80 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -271,7 +271,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = m_scene.InventoryService.GetItem(item); + if (m_scene.InventoryService != null) + item = m_scene.InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); } -- cgit v1.1 From 56f60a04d943c3270819ac66a3ae80773b6352e1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 23 Apr 2010 20:18:34 +0200 Subject: Add an additional serialization call do the detach procedure. This call is executed only for it's side effects, which are to block until attach(NULL_KEY) completes, before commencing detachment. --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a667b80..8307467 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -35,6 +35,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.CoreModules.Avatar.Attachments { @@ -405,6 +406,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (group.GetFromItemID() == itemID) { m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); + // CM / XMREngine!!!! Needed to conclude attach event + SceneObjectSerializer.ToOriginalXmlFormat(group); group.DetachToInventoryPrep(); m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); -- cgit v1.1 From 71f42f185a48ef96391b39fa0197c1a8b793e969 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 24 Apr 2010 16:45:25 +0200 Subject: Plumb a data path to initialize an attachment from an alternate source --- .../Avatar/Attachments/AttachmentsModule.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8307467..1992bd4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Reflection; +using System.Xml; using log4net; using Nini.Config; using OpenMetaverse; @@ -191,8 +192,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public UUID RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) + { + return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); + } + + public UUID RezSingleAttachmentFromInventory( + IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) { - SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); + SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); if (updateInventoryStatus) { @@ -211,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( - IClientAPI remoteClient, UUID itemID, uint AttachmentPt) + IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) { IInventoryAccessModule invAccess = m_scene.RequestModuleInterface(); if (invAccess != null) @@ -237,6 +244,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (tainted) objatt.HasGroupChanged = true; + if (doc != null) + objatt.LoadScriptState(doc); + // Fire after attach, so we don't get messy perms dialogs // 3 == AttachedRez objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); @@ -318,6 +328,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { // XXYY!! InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + if (item == null) + m_log.Error("[ATTACHMENT]: item == null"); + if (m_scene == null) + m_log.Error("[ATTACHMENT]: m_scene == null"); + if (m_scene.InventoryService == null) + m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); item = m_scene.InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); -- cgit v1.1 From 87664017773227d07b39382efa2aa94f22bbe6c6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 3 May 2010 04:28:30 +0200 Subject: Adapt CM to the new CHANGED_OWNER handling --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1992bd4..4fac01f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -245,7 +245,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments objatt.HasGroupChanged = true; if (doc != null) + { objatt.LoadScriptState(doc); + objatt.ResetOwnerChangeFlag(); + } // Fire after attach, so we don't get messy perms dialogs // 3 == AttachedRez -- cgit v1.1 From 49efec2ef17ece206f73acf1665bf973a6204b87 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 4 May 2010 23:45:59 +0200 Subject: Strip estate message sending out from the estate management module and the dialog module. Convert it to an event on the estate module interface. The old implementation did the same as message to region, a button that is right next to it on the UI. This implementation prevented people from adding a more sane one in a module. --- OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index c31266c..da38ede 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -132,14 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); } - public void SendNotificationToUsersInEstate( - UUID fromAvatarID, string fromAvatarName, string message) - { - // TODO: This does not yet do what it says on the tin - it only sends the message to users in the same - // region as the sending avatar. - SendNotificationToUsersInRegion(fromAvatarID, fromAvatarName, message); - } - public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) { UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); -- cgit v1.1 From 2fe669448f8cfefe2ef6e046faec3c0e709a41e4 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 10 May 2010 05:43:16 -0700 Subject: Greatly improve login time for users with large friends lists by requesting all unknown UUID's in one go rather than individually --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 45 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index febd4ca..57dde76 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return false; } } - + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected List m_Scenes = new List(); @@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends newFriends.RegionID = UUID.Zero; m_Friends.Add(client.AgentId, newFriends); - + //StatusChange(client.AgentId, true); } @@ -289,7 +289,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Inform the friends that this user is online StatusChange(agentID, true); - + // Register that we need to send the list of online friends to this user lock (m_NeedsListOfFriends) if (!m_NeedsListOfFriends.Contains(agentID)) @@ -442,11 +442,44 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) friendList.Add(fi); } + /* foreach (FriendInfo fi in friendList) { // Notify about this user status StatusNotify(fi, agentID, online); } + */ + + StatusNotifyMass(friendList, agentID, online); + } + } + + private void StatusNotifyMass(List friendList, UUID userID, bool online) + { + string[] friendIDs = new string[friendList.Count]; + int notlocal = 0; + for (int x = 0; x < friendList.Count; x++) + { + UUID friendID = UUID.Zero; + if (UUID.TryParse(friendList[x].Friend, out friendID)) + { + if (!LocalStatusNotification(userID, friendID, online)) + { + friendIDs[notlocal++] = friendID.ToString(); + } + } + } + + PresenceInfo[] friendSessions = PresenceService.GetAgents(friendIDs); + + for (int x = 0; x < friendSessions.GetLength(0); x++) + { + PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); + if (friendSession != null) + { + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.StatusNotify(region, userID, new UUID(friendIDs[x]), online); + } } } @@ -459,7 +492,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Try local if (LocalStatusNotification(userID, friendID, online)) return; - + // The friend is not here [as root]. Let's forward. PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); @@ -476,7 +509,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) - { + { // we got a friendship offer UUID principalID = new UUID(im.fromAgentID); UUID friendID = new UUID(im.toAgentID); @@ -688,7 +721,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // we're done return true; } - + return false; } -- cgit v1.1 From ab716125d7aa80efe2b3904490f10fd045da94c7 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 10 May 2010 05:51:49 -0700 Subject: Correct an odd merge anomaly --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 8f84d81..5dc9c44 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -471,7 +471,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends for (int x = 0; x < friendSessions.GetLength(0); x++) { - PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); + PresenceInfo friendSession = friendSessions[x]; if (friendSession != null) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); -- cgit v1.1 From 98bd3e1f3498600e9299252723a8365ce8fd77fd Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Wed, 12 May 2010 07:14:06 -0700 Subject: Don't convert UUID -> ToString for every friend (Minor optimisation based on profiler feedback) --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 5dc9c44..5339dee 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -201,9 +201,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends UserFriendData data = m_Friends[principalID]; + string searchFor = friendID.ToString(); foreach (FriendInfo fi in data.Friends) { - if (fi.Friend == friendID.ToString()) + if (fi.Friend == searchFor) return (uint)fi.TheirFlags; } return 0; -- cgit v1.1 From eb5a95d26bca4840f5a082156c0a37afed166fb1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 18 May 2010 03:02:36 +0200 Subject: Prevent an "index out of range" error on login --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 5339dee..30eb9b8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -454,9 +454,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private void StatusNotifyMass(List friendList, UUID userID, bool online) { - string[] friendIDs = new string[friendList.Count]; + int fct = friendList.Count; + string[] friendIDs = new string[fct]; int notlocal = 0; - for (int x = 0; x < friendList.Count; x++) + for (int x = 0 ; x < fct ; x++) { UUID friendID = UUID.Zero; if (UUID.TryParse(friendList[x].Friend, out friendID)) @@ -472,6 +473,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends for (int x = 0; x < friendSessions.GetLength(0); x++) { + if (friendIDs.Length <= x) + continue; PresenceInfo friendSession = friendSessions[x]; if (friendSession != null) { -- cgit v1.1 From ef1496ca2d22ad3d24bc9b53830a49f5a9c550d8 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 14 Jun 2010 04:28:38 -0700 Subject: Add "alert dialog" for sending dialogs to users from the console --- OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index b5c3176..4e36c5d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -55,6 +55,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog m_scene.AddCommand( this, "alert general", "alert general ", "Send an alert to everyone", HandleAlertConsoleCommand); + + m_scene.AddCommand( + this, "alert dialog", "alert dialog ", "Send a dialog alert to everyone", HandleAlertConsoleCommand); + + } public void PostInitialise() {} @@ -181,6 +186,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); SendGeneralAlert(message); } + else if (cmdparams[1] == "dialog") + { + string message = CombineParams(cmdparams, 2); + + m_log.InfoFormat( + "[DIALOG]: Sending dialog alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); + SendNotificationToUsersInRegion(UUID.Zero, "System", message); + } else { string firstName = cmdparams[1]; -- cgit v1.1 From 95c763201f6f777557bc1c88e4bcbfbfd0aeebda Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Jun 2010 06:36:46 +0200 Subject: Set the offline flag in inventory offers --- .../CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 2f1e9dd..0d04491 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -241,6 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer im.imSessionID = itemID.Guid; } + im.offline = 1; // Remember these + // Send the IM to the recipient. The item is already // in their inventory, so it will not be lost if // they are offline. -- cgit v1.1 From 5c02fb435db171daf6d1ef360340137b3b0fd467 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 22 Jun 2010 17:35:00 +0200 Subject: Security fix: Allow only textures to be fetched using HTTP texture cap --- OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index f8e3d59..75efb79 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -131,6 +131,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps if (texture != null) { + if (texture.Type != (sbyte)AssetType.Texture) + { + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; + httpResponse.Send(); + return null; + } SendTexture(httpRequest, httpResponse, texture); } else @@ -147,6 +153,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps if (texture != null) { + if (texture.Type != (sbyte)AssetType.Texture) + { + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; + httpResponse.Send(); + return null; + } SendTexture(httpRequest, httpResponse, texture); } else -- cgit v1.1 From b012e963d7fac1b877cf1a4738967538f20332b2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 24 Jun 2010 18:48:40 +0200 Subject: New viewers don't set the "save offline IM" flag anymore. Set it serverside so messages get saved --- .../CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index ab141eb..2dc7384 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -156,6 +156,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } + if (dialog == (byte)InstantMessageDialog.MessageFromAgent || + dialog == (byte)InstantMessageDialog.MessageFromObject) + { + im.offline = 1; + } + if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im, -- cgit v1.1 From 2cc1f14b0c938cff51b7bbf3f13a51b306f87e1b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 24 Jun 2010 19:37:02 +0200 Subject: Replace the imSessionID, which is useless out of context, with the scope id in saved IMs --- .../CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 9412735..5f9f518 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -204,6 +204,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if ((im.offline != 0) && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { + // 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()); + bool success = SynchronousRestObjectPoster.BeginPostObject( "POST", m_RestURL+"/SaveMessage/", im); -- cgit v1.1 From cbca58401ab67035c8c9aa20a0cf4bccd8cc8bef Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 24 Jun 2010 20:46:24 +0200 Subject: Add the object owner UUID into the binary bucket of object to user IM --- .../Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 5f9f518..a2dc91f 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -201,6 +201,8 @@ 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))) { -- cgit v1.1 From 3e908023b2f7e9edb77687089f2363a77b13d1fc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 28 Jun 2010 08:58:51 +0200 Subject: Force IM timestamps to current server time to prevent "Saved on" headers while the sender is online --- .../Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 2dc7384..a7aa4ea 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -156,6 +156,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } + // Force timestamp to server time to avoid "Saved on" headers + // being generated for online users + im.timestamp = (uint)Util.UnixTimeSinceEpoch(); + if (dialog == (byte)InstantMessageDialog.MessageFromAgent || dialog == (byte)InstantMessageDialog.MessageFromObject) { -- cgit v1.1 From edcfaf60c99b7cde324621c2ffcfbb16e4eb4c5e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 3 Jul 2010 20:27:00 +0200 Subject: Fix IMs the right way. This sets it up so that timestamps are actually in PST (to match viewer time), does correct storage and retrieval of IMs, corrects the session ID and makes sure IMs don't get marked "saved" if they're live. Removes the group IM save option, which our group IM module never had in the first place, as saving group chatter makes no sense at all. --- .../Avatar/InstantMessage/InstantMessageModule.cs | 27 +++++++-- .../Avatar/InstantMessage/OfflineMessageModule.cs | 65 +++++++++++++--------- 2 files changed, 60 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index a7aa4ea..ffdac58 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -156,16 +156,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } - // Force timestamp to server time to avoid "Saved on" headers - // being generated for online users - im.timestamp = (uint)Util.UnixTimeSinceEpoch(); + DateTime dt = DateTime.UtcNow; - if (dialog == (byte)InstantMessageDialog.MessageFromAgent || - dialog == (byte)InstantMessageDialog.MessageFromObject) + // 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 { - im.offline = 1; + 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) { m_TransferModule.SendInstantMessage(im, diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index a2dc91f..feeb9e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -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( - "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; - - 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())); - } + bool success = SynchronousRestObjectPoster.BeginPostObject( + "POST", m_RestURL+"/SaveMessage/", im); + + 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())); } } } -- cgit v1.1 From 0c445239a68688311d6fa7405ef13ceb3e773930 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 19:21:01 +0200 Subject: Remove useless quaternion parameter from AttachObject sig --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d3d6f25..08b2315 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments get { return false; } } - public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) + public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) { m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); @@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; // Calls attach with a Zero position - if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) + if (AttachObject(remoteClient, objectLocalID, AttachmentPt, Vector3.Zero, false)) { m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); @@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } public bool AttachObject( - IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) + IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Vector3 attachPos, bool silent) { SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); if (group != null) @@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments tainted = true; AttachObject( - remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); + remoteClient, objatt.LocalId, AttachmentPt, objatt.AbsolutePosition, false); //objatt.ScheduleGroupForFullUpdate(); if (tainted) -- cgit v1.1 From bebbe407ee166a0aa22f0ec8d14ada780924f9af Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 19:58:23 +0200 Subject: Major attachments cleanup. Remove unused AttachObject ClientView method Clean up use of AttachObject throughout, reduce number of overloads and number of parameters --- .../Avatar/Attachments/AttachmentsModule.cs | 101 ++++++++++----------- 1 file changed, 47 insertions(+), 54 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 08b2315..902fb88 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -71,6 +71,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments get { return false; } } + // Called by client + // public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) { m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); @@ -86,7 +88,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; // Calls attach with a Zero position - if (AttachObject(remoteClient, objectLocalID, AttachmentPt, Vector3.Zero, false)) + if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false)) { m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); @@ -108,72 +110,64 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } - public bool AttachObject( - IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Vector3 attachPos, bool silent) + public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) { - SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); - if (group != null) + Vector3 attachPos = group.AbsolutePosition; + + if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) { - if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) + // If the attachment point isn't the same as the one previously used + // set it's offset position = 0 so that it appears on the attachment point + // and not in a weird location somewhere unknown. + if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) { - // If the attachment point isn't the same as the one previously used - // set it's offset position = 0 so that it appears on the attachment point - // and not in a weird location somewhere unknown. - if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) - { - attachPos = Vector3.Zero; - } - - // AttachmentPt 0 means the client chose to 'wear' the attachment. - if (AttachmentPt == 0) - { - // Check object for stored attachment point - AttachmentPt = (uint)group.GetAttachmentPoint(); - } - - // if we still didn't find a suitable attachment point....... - if (AttachmentPt == 0) - { - // Stick it on left hand with Zero Offset from the attachment point. - AttachmentPt = (uint)AttachmentPoint.LeftHand; - attachPos = Vector3.Zero; - } + attachPos = Vector3.Zero; + } - group.SetAttachmentPoint((byte)AttachmentPt); - group.AbsolutePosition = attachPos; + // AttachmentPt 0 means the client chose to 'wear' the attachment. + if (AttachmentPt == 0) + { + // Check object for stored attachment point + AttachmentPt = (uint)group.GetAttachmentPoint(); + } - // Saves and gets itemID - UUID itemId; + // if we still didn't find a suitable attachment point....... + if (AttachmentPt == 0) + { + // Stick it on left hand with Zero Offset from the attachment point. + AttachmentPt = (uint)AttachmentPoint.LeftHand; + attachPos = Vector3.Zero; + } - if (group.GetFromItemID() == UUID.Zero) - { - m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); - } - else - { - itemId = group.GetFromItemID(); - } + group.SetAttachmentPoint((byte)AttachmentPt); + group.AbsolutePosition = attachPos; - SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); + // Saves and gets itemID + UUID itemId; - group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); - - // In case it is later dropped again, don't let - // it get cleaned up - group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - group.HasGroupChanged = false; + if (group.GetFromItemID() == UUID.Zero) + { + m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); } else { - remoteClient.SendAgentAlertMessage( - "You don't have sufficient permissions to attach this object", false); - - return false; + itemId = group.GetFromItemID(); } + + SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); + + group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); + + // In case it is later dropped again, don't let + // it get cleaned up + group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); + group.HasGroupChanged = false; } else { - m_log.DebugFormat("[ATTACHMENTS MODULE]: AttachObject found no such scene object {0}", objectLocalID); + remoteClient.SendAgentAlertMessage( + "You don't have sufficient permissions to attach this object", false); + return false; } @@ -245,8 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; - AttachObject( - remoteClient, objatt.LocalId, AttachmentPt, objatt.AbsolutePosition, false); + AttachObject(remoteClient, objatt, AttachmentPt, false); //objatt.ScheduleGroupForFullUpdate(); if (tainted) -- cgit v1.1 From d665f0ae66adc82ada320e3150a580be2fcb928f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 20:46:26 +0200 Subject: Detach attachments displaced by other attachments --- .../Avatar/Attachments/AttachmentsModule.cs | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 902fb88..34198d2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -142,19 +142,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments group.SetAttachmentPoint((byte)AttachmentPt); group.AbsolutePosition = attachPos; - // Saves and gets itemID - UUID itemId; + // Remove any previous attachments + ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); + UUID itemID = UUID.Zero; + if (sp != null) + { + foreach(SceneObjectGroup grp in sp.Attachments) + { + if (grp.GetAttachmentPoint() == (byte)AttachmentPt) + { + itemID = grp.GetFromItemID(); + break; + } + } + if (itemID != UUID.Zero) + DetachSingleAttachmentToInv(itemID, remoteClient); + } if (group.GetFromItemID() == UUID.Zero) { - m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); + m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); } else { - itemId = group.GetFromItemID(); + itemID = group.GetFromItemID(); } - SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); + SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); -- cgit v1.1 From c41d418380789255de778499c426d293969760f5 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 17 Jul 2010 16:32:55 +0200 Subject: Allow communicating with blue box dialogs across a region border via a child agent --- OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 4e36c5d..fb0bd1a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -86,14 +86,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { ScenePresence sp = m_scene.GetScenePresence(agentID); - if (sp != null && !sp.IsChildAgent) + if (sp != null) sp.ControllingClient.SendAgentAlertMessage(message, modal); } public void SendAlertToUser(string firstName, string lastName, string message, bool modal) { ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); - if (presence != null && !presence.IsChildAgent) + if (presence != null) presence.ControllingClient.SendAgentAlertMessage(message, modal); } @@ -101,8 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { m_scene.ForEachScenePresence(delegate(ScenePresence presence) { - if (!presence.IsChildAgent) - presence.ControllingClient.SendAlertMessage(message); + presence.ControllingClient.SendAlertMessage(message); }); } @@ -124,7 +123,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog } ScenePresence sp = m_scene.GetScenePresence(avatarID); - if (sp != null && !sp.IsChildAgent) + if (sp != null) sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); } @@ -133,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { ScenePresence sp = m_scene.GetScenePresence(avatarID); - if (sp != null && !sp.IsChildAgent) + if (sp != null) sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); } @@ -154,7 +153,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog ScenePresence sp = m_scene.GetScenePresence(avatarid); - if (sp != null && !sp.IsChildAgent) + if (sp != null) sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); } @@ -218,4 +217,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog return result; } } -} \ No newline at end of file +} -- cgit v1.1 From f9280374d2e44f66145718c880119383c2dc2a71 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 30 Jul 2010 15:03:03 +0200 Subject: Bannination fixes. Objects in nonpublic parcels were muted by default. Gods were muted, too. --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 9c8cbc6..50d2f9d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -244,7 +244,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); if (Presencecheck != null) { - if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true) + // This will pass all chat from objects. Not + // perfect, but it will do. For now. Better + // than the prior behavior of muting all + // objects on a parcel with access restrictions + if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) { TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); } -- cgit v1.1 From d57bfec702fd6eb067ab5d46cb791690ae81e10d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 4 Aug 2010 02:16:46 +0200 Subject: A god is a god is a god is a god. Right? Right. You're a god from 200, let's show it! --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 50d2f9d..06b1b00 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -218,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat fromPos = avatar.AbsolutePosition; fromName = avatar.Name; fromID = c.Sender.AgentId; - if (avatar.GodLevel > 200) + if (avatar.GodLevel >= 200) { fromNamePrefix = m_adminPrefix; } -- cgit v1.1 From 5ff9db7388b5b05e49092d8ee59b3d1b5c963e78 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 4 Aug 2010 02:51:41 +0200 Subject: Clean up some messiness in IM sending. Having offline IM enabled now no longer suppresses "Inventory Saved" messages. --- .../Avatar/InstantMessage/InstantMessageModule.cs | 3 ++- .../Avatar/InstantMessage/MessageTransferModule.cs | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index ffdac58..cbea54c 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -187,7 +187,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage delegate(bool success) { if (dialog == (uint)InstantMessageDialog.StartTyping || - dialog == (uint)InstantMessageDialog.StopTyping) + dialog == (uint)InstantMessageDialog.StopTyping || + dialog == (uint)InstantMessageDialog.MessageFromObject) { return; } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 83209fc..d025f0c 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -185,13 +185,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; - // If this event has handlers, then the IM will be considered - // delivered. This will suppress the error message. + // If this event has handlers, then an IM from an agent will be + // considered delivered. This will suppress the error message. // if (handlerUndeliveredMessage != null) { handlerUndeliveredMessage(im); - result(true); + if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) + result(true); + else + result(false); return; } @@ -504,14 +507,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage // if (upd.RegionID == prevRegionID) { - m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); + // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); HandleUndeliveredMessage(im, result); return; } } else { - m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); + // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); HandleUndeliveredMessage(im, result); return; } -- cgit v1.1 From a48c4932108c68156ee62e9e39da618e55d85902 Mon Sep 17 00:00:00 2001 From: sacha Date: Wed, 4 Aug 2010 08:16:55 +0000 Subject: Cost Reduction : Removing verbose message.... --- .../CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 0d04491..98545f9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -153,7 +153,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { - m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog); + //m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog); Scene scene = FindClientScene(client.AgentId); -- cgit v1.1 From fa11ac8c851d4471640dfb0381ca285d0e5299d7 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 7 Aug 2010 05:42:30 +0200 Subject: Change the (hackish) constant to match the changed enum for attachs --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index e557d2c..c802490 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -293,8 +293,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } // Fire after attach, so we don't get messy perms dialogs - // 3 == AttachedRez - objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); + // 4 == AttachedRez + objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); objatt.ResumeScripts(); // Do this last so that event listeners have access to all the effects of the attachment -- cgit v1.1 From e69efdd4ce7e989d04adf685d6fa7a704c609377 Mon Sep 17 00:00:00 2001 From: sacha Date: Sat, 7 Aug 2010 13:13:27 +0000 Subject: Clean the loo after use please !!!!! No need to keep useless debug message ! Never heard of wasted cpucycle you darn kid ! --- .../CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index d025f0c..e1ee0b1 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { UUID toAgentID = new UUID(im.toAgentID); - m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString()); + //m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString()); // Try root avatar only first foreach (Scene scene in m_Scenes) @@ -140,12 +140,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) { - m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); + // m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); // Local message ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; if (!user.IsChildAgent) { - m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); + // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); user.ControllingClient.SendInstantMessage(im); // Message sent @@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage // Local message ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; - m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); + // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); user.ControllingClient.SendInstantMessage(im); // Message sent -- cgit v1.1 From 047a4764f22340667ea8c3b11a56ed54011aded9 Mon Sep 17 00:00:00 2001 From: sacha Date: Sat, 7 Aug 2010 13:19:53 +0000 Subject: and another one... --- .../Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index cbea54c..1603c07 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } catch { - m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp."); + //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 -- cgit v1.1 From 19debab060b246f61d633b06d926a068001f6510 Mon Sep 17 00:00:00 2001 From: meta7 Date: Sat, 7 Aug 2010 08:17:11 -0700 Subject: Fix the general alert message so it doesn't get sent to child agents --- .../CoreModules/Avatar/Dialog/DialogModule.cs | 443 +++++++++++---------- 1 file changed, 223 insertions(+), 220 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index fb0bd1a..1498dba 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -1,220 +1,223 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; - -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; - -namespace OpenSim.Region.CoreModules.Avatar.Dialog -{ - public class DialogModule : IRegionModule, IDialogModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected Scene m_scene; - - public void Initialise(Scene scene, IConfigSource source) - { - m_scene = scene; - m_scene.RegisterModuleInterface(this); - - m_scene.AddCommand( - this, "alert", "alert ", "Send an alert to a user", HandleAlertConsoleCommand); - - m_scene.AddCommand( - this, "alert general", "alert general ", "Send an alert to everyone", HandleAlertConsoleCommand); - - m_scene.AddCommand( - this, "alert dialog", "alert dialog ", "Send a dialog alert to everyone", HandleAlertConsoleCommand); - - - } - - public void PostInitialise() {} - public void Close() {} - public string Name { get { return "Dialog Module"; } } - public bool IsSharedModule { get { return false; } } - - public void SendAlertToUser(IClientAPI client, string message) - { - SendAlertToUser(client, message, false); - } - - public void SendAlertToUser(IClientAPI client, string message, bool modal) - { - client.SendAgentAlertMessage(message, modal); - } - - public void SendAlertToUser(UUID agentID, string message) - { - SendAlertToUser(agentID, message, false); - } - - public void SendAlertToUser(UUID agentID, string message, bool modal) - { - ScenePresence sp = m_scene.GetScenePresence(agentID); - - if (sp != null) - sp.ControllingClient.SendAgentAlertMessage(message, modal); - } - - public void SendAlertToUser(string firstName, string lastName, string message, bool modal) - { - ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); - if (presence != null) - presence.ControllingClient.SendAgentAlertMessage(message, modal); - } - - public void SendGeneralAlert(string message) - { - m_scene.ForEachScenePresence(delegate(ScenePresence presence) - { - presence.ControllingClient.SendAlertMessage(message); - }); - } - - public void SendDialogToUser( - UUID avatarID, string objectName, UUID objectID, UUID ownerID, - string message, UUID textureID, int ch, string[] buttonlabels) - { - UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); - string ownerFirstName, ownerLastName; - if (account != null) - { - ownerFirstName = account.FirstName; - ownerLastName = account.LastName; - } - else - { - ownerFirstName = "(unknown"; - ownerLastName = "user)"; - } - - ScenePresence sp = m_scene.GetScenePresence(avatarID); - if (sp != null) - sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); - } - - public void SendUrlToUser( - UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) - { - ScenePresence sp = m_scene.GetScenePresence(avatarID); - - if (sp != null) - sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); - } - - public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) - { - UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); - string ownerFirstName, ownerLastName; - if (account != null) - { - ownerFirstName = account.FirstName; - ownerLastName = account.LastName; - } - else - { - ownerFirstName = "(unknown"; - ownerLastName = "user)"; - } - - ScenePresence sp = m_scene.GetScenePresence(avatarid); - - if (sp != null) - sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); - } - - public void SendNotificationToUsersInRegion( - UUID fromAvatarID, string fromAvatarName, string message) - { - m_scene.ForEachScenePresence(delegate(ScenePresence presence) - { - if (!presence.IsChildAgent) - presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); - }); - } - - /// - /// Handle an alert command from the console. - /// - /// - /// - public void HandleAlertConsoleCommand(string module, string[] cmdparams) - { - if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) - return; - - if (cmdparams[1] == "general") - { - string message = CombineParams(cmdparams, 2); - - m_log.InfoFormat( - "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); - SendGeneralAlert(message); - } - else if (cmdparams[1] == "dialog") - { - string message = CombineParams(cmdparams, 2); - - m_log.InfoFormat( - "[DIALOG]: Sending dialog alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); - SendNotificationToUsersInRegion(UUID.Zero, "System", message); - } - else - { - string firstName = cmdparams[1]; - string lastName = cmdparams[2]; - string message = CombineParams(cmdparams, 3); - - m_log.InfoFormat( - "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", - m_scene.RegionInfo.RegionName, firstName, lastName, message); - SendAlertToUser(firstName, lastName, message, false); - } - } - - private string CombineParams(string[] commandParams, int pos) - { - string result = string.Empty; - for (int i = pos; i < commandParams.Length; i++) - { - result += commandParams[i] + " "; - } - - return result; - } - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; + +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; + +namespace OpenSim.Region.CoreModules.Avatar.Dialog +{ + public class DialogModule : IRegionModule, IDialogModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected Scene m_scene; + + public void Initialise(Scene scene, IConfigSource source) + { + m_scene = scene; + m_scene.RegisterModuleInterface(this); + + m_scene.AddCommand( + this, "alert", "alert ", "Send an alert to a user", HandleAlertConsoleCommand); + + m_scene.AddCommand( + this, "alert general", "alert general ", "Send an alert to everyone", HandleAlertConsoleCommand); + + m_scene.AddCommand( + this, "alert dialog", "alert dialog ", "Send a dialog alert to everyone", HandleAlertConsoleCommand); + + + } + + public void PostInitialise() {} + public void Close() {} + public string Name { get { return "Dialog Module"; } } + public bool IsSharedModule { get { return false; } } + + public void SendAlertToUser(IClientAPI client, string message) + { + SendAlertToUser(client, message, false); + } + + public void SendAlertToUser(IClientAPI client, string message, bool modal) + { + client.SendAgentAlertMessage(message, modal); + } + + public void SendAlertToUser(UUID agentID, string message) + { + SendAlertToUser(agentID, message, false); + } + + public void SendAlertToUser(UUID agentID, string message, bool modal) + { + ScenePresence sp = m_scene.GetScenePresence(agentID); + + if (sp != null) + sp.ControllingClient.SendAgentAlertMessage(message, modal); + } + + public void SendAlertToUser(string firstName, string lastName, string message, bool modal) + { + ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); + if (presence != null) + presence.ControllingClient.SendAgentAlertMessage(message, modal); + } + + public void SendGeneralAlert(string message) + { + m_scene.ForEachScenePresence(delegate(ScenePresence presence) + { + if (!presence.IsChildAgent) + { + presence.ControllingClient.SendAlertMessage(message); + } + }); + } + + public void SendDialogToUser( + UUID avatarID, string objectName, UUID objectID, UUID ownerID, + string message, UUID textureID, int ch, string[] buttonlabels) + { + UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); + string ownerFirstName, ownerLastName; + if (account != null) + { + ownerFirstName = account.FirstName; + ownerLastName = account.LastName; + } + else + { + ownerFirstName = "(unknown"; + ownerLastName = "user)"; + } + + ScenePresence sp = m_scene.GetScenePresence(avatarID); + if (sp != null) + sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); + } + + public void SendUrlToUser( + UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) + { + ScenePresence sp = m_scene.GetScenePresence(avatarID); + + if (sp != null) + sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); + } + + public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) + { + UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); + string ownerFirstName, ownerLastName; + if (account != null) + { + ownerFirstName = account.FirstName; + ownerLastName = account.LastName; + } + else + { + ownerFirstName = "(unknown"; + ownerLastName = "user)"; + } + + ScenePresence sp = m_scene.GetScenePresence(avatarid); + + if (sp != null) + sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); + } + + public void SendNotificationToUsersInRegion( + UUID fromAvatarID, string fromAvatarName, string message) + { + m_scene.ForEachScenePresence(delegate(ScenePresence presence) + { + if (!presence.IsChildAgent) + presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); + }); + } + + /// + /// Handle an alert command from the console. + /// + /// + /// + public void HandleAlertConsoleCommand(string module, string[] cmdparams) + { + if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) + return; + + if (cmdparams[1] == "general") + { + string message = CombineParams(cmdparams, 2); + + m_log.InfoFormat( + "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); + SendGeneralAlert(message); + } + else if (cmdparams[1] == "dialog") + { + string message = CombineParams(cmdparams, 2); + + m_log.InfoFormat( + "[DIALOG]: Sending dialog alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); + SendNotificationToUsersInRegion(UUID.Zero, "System", message); + } + else + { + string firstName = cmdparams[1]; + string lastName = cmdparams[2]; + string message = CombineParams(cmdparams, 3); + + m_log.InfoFormat( + "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", + m_scene.RegionInfo.RegionName, firstName, lastName, message); + SendAlertToUser(firstName, lastName, message, false); + } + } + + private string CombineParams(string[] commandParams, int pos) + { + string result = string.Empty; + for (int i = pos; i < commandParams.Length; i++) + { + result += commandParams[i] + " "; + } + + return result; + } + } +} -- cgit v1.1 From 8886afd31961e1a838cb15df863ff9155885e0c6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 21:59:52 +0200 Subject: Fix yet another cause of "Ghost attachments" --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index bd9e621..100b55c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -271,8 +271,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; - AttachObject(remoteClient, objatt, AttachmentPt, false); - //objatt.ScheduleGroupForFullUpdate(); + // This will throw if the attachment fails + try + { + AttachObject(remoteClient, objatt, AttachmentPt, false); + } + catch + { + // Make sure the object doesn't stick around and bail + m_scene.DeleteSceneObject(objatt, false); + return null; + } if (tainted) objatt.HasGroupChanged = true; @@ -616,4 +625,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.HasGroupChanged = false; } } -} \ No newline at end of file +} -- cgit v1.1 From 512ded6eb57019aed8aaa73d64b62d29450023cf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Sep 2010 21:07:09 +0200 Subject: Catch a nullref --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 5378930..7c95658 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -334,7 +334,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (m_scene.InventoryService != null) item = m_scene.InventoryService.GetItem(item); - presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); + if (presence.Appearance != null) + presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); } return att.UUID; -- cgit v1.1 From 251f2444d049ed525ef41c4c4792ec446c53b973 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Sep 2010 01:50:48 +0200 Subject: Revert "* Changed 11 calls for session info to the more optimized API method" This reverts commit 5dc9ea2f2487804d788b4b80d40d91bd792de4c2. Also makes online indicators and IM more robust --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 103 ++++++++++++++------- .../Avatar/InstantMessage/MessageTransferModule.cs | 13 ++- 2 files changed, 83 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index a49e71e..21ed9dc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -317,7 +317,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends continue; UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); - PresenceInfo presence = PresenceService.GetAgent(fromAgentID); + + PresenceInfo presence = null; + PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); + if (presences != null && presences.Length > 0) + presence = presences[0]; + if (presence != null) + im.offline = 0; im.fromAgentID = fromAgentID.Guid; im.fromAgentName = account.FirstName + " " + account.LastName; @@ -430,13 +436,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The friend is not here [as root]. Let's forward. - PresenceInfo friendSession = PresenceService.GetAgent(friendID); - if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check + PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); + if (friendSessions != null && friendSessions.Length > 0) { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); - m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); + PresenceInfo friendSession = null; + foreach (PresenceInfo pinfo in friendSessions) + if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad + { + friendSession = pinfo; + break; + } + + if (friendSession != null) + { + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); + m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); + } } + + // Friend is not online. Ignore. } else { @@ -477,11 +496,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The prospective friend is not here [as root]. Let's forward. - PresenceInfo friendSession = PresenceService.GetAgent(friendID); - if (friendSession != null) + PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); + if (friendSessions != null && friendSessions.Length > 0) { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); + PresenceInfo friendSession = friendSessions[0]; + if (friendSession != null) + { + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); + } } // If the prospective friend is not online, he'll get the message upon login. } @@ -508,12 +531,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } // The friend is not here - PresenceInfo friendSession = PresenceService.GetAgent(friendID); - if (friendSession != null) + PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); + if (friendSessions != null && friendSessions.Length > 0) { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); - client.SendAgentOnline(new UUID[] { friendID }); + PresenceInfo friendSession = friendSessions[0]; + if (friendSession != null) + { + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); + client.SendAgentOnline(new UUID[] { friendID }); + } } } @@ -532,14 +559,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipDenied(agentID, client.Name, friendID)) return; - PresenceInfo friendSession = PresenceService.GetAgent(friendID); - if (friendSession != null) + PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); + if (friendSessions != null && friendSessions.Length > 0) { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - if (region != null) - m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); - else - m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); + PresenceInfo friendSession = friendSessions[0]; + if (friendSession != null) + { + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + if (region != null) + m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); + else + m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); + } } } @@ -561,11 +592,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipTerminated(exfriendID)) return; - PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); - if (friendSession != null) + PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); + if (friendSessions != null && friendSessions.Length > 0) { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); + PresenceInfo friendSession = friendSessions[0]; + if (friendSession != null) + { + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); + } } } @@ -604,13 +639,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalGrantRights(requester, target, myFlags, rights)) return; - PresenceInfo friendSession = PresenceService.GetAgent(target); - if (friendSession != null) + PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); + if (friendSessions != null && friendSessions.Length > 0) { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - // TODO: You might want to send the delta to save the lookup - // on the other end!! - m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); + PresenceInfo friendSession = friendSessions[0]; + if (friendSession != null) + { + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + // TODO: You might want to send the delta to save the lookup + // on the other end!! + m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); + } } } } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index a6894ff..2a405ac 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -497,7 +497,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (lookupAgent) { // Non-cached user agent lookup. - upd = PresenceService.GetAgent(toAgentID); + PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); + if (presences != null && presences.Length > 0) + { + foreach (PresenceInfo p in presences) + { + if (p.RegionID != UUID.Zero) + { + upd = p; + break; + } + } + } if (upd != null) { -- cgit v1.1 From 52dd547863c0cdd22f53f0efcaef11ae096855a0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 11:31:52 +0200 Subject: Make SendKillObject send multiple localIDs in one packet. This avoids the halting visual behavior of large group deletes and eliminates the packet flood --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 87c9100..6ff0ffc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -616,7 +616,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // if (so.IsSelected) { - m_scene.SendKillObject(so.RootPart.LocalId); + m_scene.SendKillObject(new List { so.RootPart.LocalId }); } so.IsSelected = false; // fudge.... -- cgit v1.1 From c2971a6398f21cb3eb6c9cad46348a035eb2a0f5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Oct 2010 20:15:02 +0200 Subject: Add group invites to the list of messages that get offlined --- OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index feeb9e6..d3db5b7 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -215,6 +215,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && im.dialog != (byte)InstantMessageDialog.MessageFromAgent && im.dialog != (byte)InstantMessageDialog.GroupNotice && + im.dialog != (byte)InstantMessageDialog.GroupInvitation && im.dialog != (byte)InstantMessageDialog.InventoryOffered) { return; -- cgit v1.1 From 82e534a0291c2a2c54ad95991d7b8ed6b6524839 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 4 Nov 2010 19:07:43 +0100 Subject: Fix avatar to avatar inventory gives across servers --- .../Inventory/Transfer/InventoryTransferModule.cs | 58 +++++++++++++++++++--- 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 6badc74..e9e7c25 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer if (im.binaryBucket.Length < 17) // Invalid return; - UUID receipientID = new UUID(im.toAgentID); - ScenePresence user = scene.GetScenePresence(receipientID); + UUID recipientID = new UUID(im.toAgentID); + ScenePresence user = scene.GetScenePresence(recipientID); UUID copyID; // First byte is the asset type @@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer folderID, new UUID(im.toAgentID)); InventoryFolderBase folderCopy - = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); + = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); if (folderCopy == null) { @@ -419,22 +419,64 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer /// /// /// - private void OnGridInstantMessage(GridInstantMessage msg) + private void OnGridInstantMessage(GridInstantMessage im) { // Check if this is ours to handle // - Scene scene = FindClientScene(new UUID(msg.toAgentID)); + Scene scene = FindClientScene(new UUID(im.toAgentID)); if (scene == null) return; // Find agent to deliver to // - ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); + ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); + if (user == null) + return; + + // This requires a little bit of processing because we have to make the + // new item visible in the recipient's inventory here + // + if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) + { + if (im.binaryBucket.Length < 17) // Invalid + return; + + UUID recipientID = new UUID(im.toAgentID); + + // First byte is the asset type + AssetType assetType = (AssetType)im.binaryBucket[0]; + + if (AssetType.Folder == assetType) + { + UUID folderID = new UUID(im.binaryBucket, 1); - // Just forward to local handling - OnInstantMessage(user.ControllingClient, msg); + InventoryFolderBase given = + new InventoryFolderBase(folderID, recipientID); + InventoryFolderBase folder = + scene.InventoryService.GetFolder(given); + + if (folder != null) + user.ControllingClient.SendBulkUpdateInventory(folder); + } + else + { + UUID itemID = new UUID(im.binaryBucket, 1); + + InventoryItemBase given = + new InventoryItemBase(itemID, recipientID); + InventoryItemBase item = + scene.InventoryService.GetItem(given); + + if (item != null) + { + user.ControllingClient.SendBulkUpdateInventory(item); + } + } + } + // Just forward to the client + user.ControllingClient.SendInstantMessage(im); } } } -- cgit v1.1 From 4db60a5a40580bf5aa56d80c319534e2e312a306 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Nov 2010 15:24:08 +0100 Subject: Fix the inventory transfer module to not cause duplicated text IMs --- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index e9e7c25..528bc8d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -473,10 +473,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer user.ControllingClient.SendBulkUpdateInventory(item); } } + user.ControllingClient.SendInstantMessage(im); + } + else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || + im.dialog == (byte) InstantMessageDialog.InventoryDeclined) + { + user.ControllingClient.SendInstantMessage(im); } - - // Just forward to the client - user.ControllingClient.SendInstantMessage(im); } } } -- cgit v1.1 From 7a9c57a81ec979564b089429bb93655912f823a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 01:35:45 +0100 Subject: When detaching a scripted item, always consider it modified. Script states will have changed and for real usability, we need to save it. It bloats assets, but that can't be avoided. --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 6122cc2..929db21 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -527,10 +527,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// - protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) + public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) { if (grp != null) { + // If an item contains scripts, it's always changed. + // This ensures script state is saved on detach + foreach (SceneObjectPart p in grp.Parts) + if (p.Inventory.ContainsScripts()) + grp.HasGroupChanged = true; + if (!grp.HasGroupChanged) { m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID); -- cgit v1.1 From 4f15b8d4e6be1e1fe88ad32aa43595861d1005ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 20:44:39 +0100 Subject: Change the way attachments are persisted. Editing a worn attachment will now save properly, as will the results of a resizer script working. Attachment positions are no longer saved on each move, but instead are saved once on logout. Attachment script states are saved as part of the attachment now when detaching. --- .../Avatar/Attachments/AttachmentsModule.cs | 40 +++++++--------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 929db21..fc92fc3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -276,6 +276,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (objatt != null) { + // Loading the inventory from XML will have set this, but + // there is no way the object could have changed yet, + // since scripts aren't running yet. So, clear it here. + objatt.HasGroupChanged = false; bool tainted = false; if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; @@ -486,9 +490,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); // CM / XMREngine!!!! Needed to conclude attach event - SceneObjectSerializer.ToOriginalXmlFormat(group); + //SceneObjectSerializer.ToOriginalXmlFormat(group); group.DetachToInventoryPrep(); m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); + + // If an item contains scripts, it's always changed. + // This ensures script state is saved on detach + foreach (SceneObjectPart p in group.Parts) + if (p.Inventory.ContainsScripts()) + group.HasGroupChanged = true; + UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); m_scene.DeleteSceneObject(group, false); return; @@ -497,25 +508,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } - public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos) - { - // If this is an attachment, then we need to save the modified - // object back into the avatar's inventory. First we save the - // attachment point information, then we update the relative - // positioning (which caused this method to get driven in the - // first place. Then we have to mark the object as NOT an - // attachment. This is necessary in order to correctly save - // and retrieve GroupPosition information for the attachment. - // Then we save the asset back into the appropriate inventory - // entry. Finally, we restore the object's attachment status. - byte attachmentPoint = sog.GetAttachmentPoint(); - sog.UpdateGroupPosition(pos); - sog.RootPart.IsAttachment = false; - sog.AbsolutePosition = sog.RootPart.AttachedPos; - UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); - sog.SetAttachmentPoint(attachmentPoint); - } - /// /// Update the attachment asset for the new sog details if they have changed. /// @@ -531,12 +523,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { if (grp != null) { - // If an item contains scripts, it's always changed. - // This ensures script state is saved on detach - foreach (SceneObjectPart p in grp.Parts) - if (p.Inventory.ContainsScripts()) - grp.HasGroupChanged = true; - if (!grp.HasGroupChanged) { m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID); @@ -548,7 +534,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments grp.UUID, grp.GetAttachmentPoint()); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = m_scene.InventoryService.GetItem(item); @@ -642,7 +627,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // In case it is later dropped again, don't let // it get cleaned up so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.HasGroupChanged = false; } } } -- cgit v1.1 From b3a71c6df1538c61247f7d4711aba4c840508db8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 24 Nov 2010 18:56:25 +0100 Subject: Prevent an overlength button label from producing a debug dump and aborting the script. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 30 +++++----------------- 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 0df4585..ab1c206 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -183,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory }); } - // m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); + m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); } // Process the visual params, this may change height as well @@ -196,12 +196,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory sp.SetHeight(sp.Appearance.AvatarHeight); } } - - // Send the appearance back to the avatar, not clear that this is needed - sp.ControllingClient.SendAvatarDataImmediate(sp); - // AvatarAppearance avp = sp.Appearance; - // sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes()); - } @@ -274,21 +268,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // Send the appearance to everyone in the scene sp.SendAppearanceToAllOtherAgents(); - // sp.ControllingClient.SendAvatarDataImmediate(sp); - - // Send the appearance back to the avatar - // AvatarAppearance avp = sp.Appearance; - // sp.ControllingClient.SendAppearance(avp.Owner, avp.VisualParams, avp.Texture.GetBytes()); - -/* -// this needs to be fixed, the flag should be on scene presence not the region module - // Start the animations if necessary - if (!m_startAnimationSet) - { - sp.Animator.UpdateMovementAnimations(); - m_startAnimationSet = true; - } -*/ } private void HandleAppearanceSave(UUID agentid) @@ -374,6 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId); + // operate on a copy of the appearance so we don't have to lock anything AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false); foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) @@ -388,9 +368,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory SetAppearanceAssets(sp.UUID, ref avatAppearance); // could get fancier with the locks here, but in the spirit of "last write wins" - // this should work correctly + // this should work correctly, also, we don't need to send the appearance here + // since the "iswearing" will trigger a new set of visual param and baked texture changes + // when those complete, the new appearance will be sent sp.Appearance = avatAppearance; - m_scene.AvatarService.SetAppearance(client.AgentId, sp.Appearance); + QueueAppearanceSave(client.AgentId); } private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) -- cgit v1.1 From 385a6c4b344200ef183ce63edacec77fb18bcabc Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 26 Nov 2010 23:20:43 +0100 Subject: Convert the scope id in the im session id to a URL variable. Fixes offline group notice attachments not working --- .../Avatar/InstantMessage/OfflineMessageModule.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index d3db5b7..164ae50 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -195,14 +195,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 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); @@ -226,10 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage Scene scene = FindScene(new UUID(im.fromAgentID)); if (scene == null) scene = m_SceneList[0]; - im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString()); bool success = SynchronousRestObjectPoster.BeginPostObject( - "POST", m_RestURL+"/SaveMessage/", im); + "POST", m_RestURL+"/SaveMessage/?scope=" + + scene.RegionInfo.ScopeID.ToString(), im); if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) { -- cgit v1.1 From 0f1fc7999417a2e1188de26d4ac9c881ea7bb684 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 28 Nov 2010 20:14:58 +0100 Subject: Implement god summons --- .../Region/CoreModules/Avatar/Lure/LureModule.cs | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d1d7df2..a09e72b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs @@ -150,12 +150,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure m_log.DebugFormat("TP invite with message {0}", message); - GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, - client.FirstName+" "+client.LastName, targetid, - (byte)InstantMessageDialog.RequestTeleport, false, - message, dest, false, presence.AbsolutePosition, - new Byte[0]); - + GridInstantMessage m; + + if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (scene.Permissions.IsAdministrator(targetid))) + { + m = new GridInstantMessage(scene, client.AgentId, + client.FirstName+" "+client.LastName, targetid, + (byte)InstantMessageDialog.GodLikeRequestTeleport, false, + message, dest, false, presence.AbsolutePosition, + new Byte[0]); + } + else + { + m = new GridInstantMessage(scene, client.AgentId, + client.FirstName+" "+client.LastName, targetid, + (byte)InstantMessageDialog.RequestTeleport, false, + message, dest, false, presence.AbsolutePosition, + new Byte[0]); + } + if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m, @@ -190,7 +203,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure { // Forward remote teleport requests // - if (msg.dialog != 22) + if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport && + msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport) return; if (m_TransferModule != null) -- cgit v1.1 From b08cc63003bcba51f9c735154d41f290f5c56010 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 29 Nov 2010 21:45:03 +0100 Subject: Change inworld restart to use blue boxes rather than notices to match SL --- OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index a09e72b..6532bbb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs @@ -148,11 +148,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure (uint)presence.AbsolutePosition.Y, (uint)presence.AbsolutePosition.Z); - m_log.DebugFormat("TP invite with message {0}", message); + m_log.DebugFormat("[LURE]: TP invite with message {0}", message); GridInstantMessage m; - if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (scene.Permissions.IsAdministrator(targetid))) + if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) { m = new GridInstantMessage(scene, client.AgentId, client.FirstName+" "+client.LastName, targetid, -- cgit v1.1 From ab2adaf3418e5a64c7d94305d45489310eaa2ab0 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 29 Nov 2010 16:24:16 -0800 Subject: Various bug fixes for appearance handling --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 93 ++++++++++++++-------- 1 file changed, 59 insertions(+), 34 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index ab1c206..63e7ddc 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -115,8 +115,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory #endregion + public bool ValidateBakedTextureCache(IClientAPI client) { + return ValidateBakedTextureCache(client, true); + } + + private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly) + { ScenePresence sp = m_scene.GetScenePresence(client.AgentId); if (sp == null) { @@ -131,15 +137,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { int idx = AvatarAppearance.BAKE_INDICES[i]; Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - if (face == null || face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) + + // if there is no texture entry, skip it + if (face == null) continue; + // if the texture is one of the "defaults" then skip it + // this should probably be more intelligent (skirt texture doesnt matter + // if the avatar isnt wearing a skirt) but if any of the main baked + // textures is default then the rest should be as well + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + continue; + defonly = false; // found a non-default texture reference if (! CheckBakedTextureAsset(client,face.TextureID,idx)) - return false; + { + // the asset didn't exist if we are only checking, then we found a bad + // one and we're done otherwise, ask for a rebake + if (checkonly) return false; + + m_log.WarnFormat("[AVFACTORY] missing baked texture {0}, request rebake",face.TextureID); + client.SendRebakeAvatarTextures(face.TextureID); + } } + m_log.WarnFormat("[AVFACTORY]: complete texture check for {0}",client.AgentId); + // If we only found default textures, then the appearance is not cached return (defonly ? false : true); } @@ -158,7 +182,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return; } - // m_log.WarnFormat("[AVFACTORY]: Start SetAppearance for {0}",client.AgentId); + m_log.WarnFormat("[AVFACTORY]: start SetAppearance for {0}",client.AgentId); bool changed = false; @@ -166,47 +190,40 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // going to be handled correctly but it does serialize the updates to the appearance lock (m_setAppearanceLock) { + // Process the visual params, this may change height as well + if (visualParams != null) + { + changed = sp.Appearance.SetVisualParams(visualParams); + if (sp.Appearance.AvatarHeight > 0) + sp.SetHeight(sp.Appearance.AvatarHeight); + } + + // Process the baked texture array if (textureEntry != null) { - changed = sp.Appearance.SetTextureEntries(textureEntry); + changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; - // m_log.WarnFormat("[AVFACTORY]: Prepare to check textures for {0}",client.AgentId); + m_log.WarnFormat("[AVFACTORY]: received texture update for {0}",client.AgentId); + Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); }); - for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) - { - int idx = AvatarAppearance.BAKE_INDICES[i]; - Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) - Util.FireAndForget(delegate(object o) { - if (! CheckBakedTextureAsset(client,face.TextureID,idx)) - client.SendRebakeAvatarTextures(face.TextureID); - }); - } + // This appears to be set only in the final stage of the appearance + // update transaction. In theory, we should be able to do an immediate + // appearance send and save here. - m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); + QueueAppearanceSave(client.AgentId); + QueueAppearanceSend(client.AgentId); } - // Process the visual params, this may change height as well - if (visualParams != null) - { - if (sp.Appearance.SetVisualParams(visualParams)) - { - changed = true; - if (sp.Appearance.AvatarHeight > 0) - sp.SetHeight(sp.Appearance.AvatarHeight); - } - } } - - // If something changed in the appearance then queue an appearance save - if (changed) - QueueAppearanceSave(client.AgentId); +// // If something changed in the appearance then queue an appearance save +// if (changed) +// QueueAppearanceSave(client.AgentId); - // And always queue up an appearance update to send out - QueueAppearanceSend(client.AgentId); +// // And always queue up an appearance update to send out +// QueueAppearanceSend(client.AgentId); - // m_log.WarnFormat("[AVFACTORY]: Complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); + // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); } /// @@ -229,6 +246,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory #region UpdateAppearanceTimer + /// + /// Queue up a request to send appearance, makes it possible to + /// accumulate changes without sending out each one separately. + /// public void QueueAppearanceSend(UUID agentid) { // m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); @@ -268,6 +289,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // Send the appearance to everyone in the scene sp.SendAppearanceToAllOtherAgents(); + + // Send animations back to the avatar as well + sp.Animator.SendAnimPack(); } private void HandleAppearanceSave(UUID agentid) @@ -355,7 +379,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // operate on a copy of the appearance so we don't have to lock anything AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false); - + sp.Appearance.ResetBakedTextures(); // this makes sure we don't reuse old textures if the baking takes time + foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) { if (wear.Type < AvatarWearable.MAX_WEARABLES) -- cgit v1.1 From a4f7937eb338df588c02ce44200876210d0d58c3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 7 Dec 2010 03:08:48 +0100 Subject: Add the interface needed to revive calling cards --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 45c3f49..613a054 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -516,6 +516,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); + ICallingCardModule ccm = client.Scene.RequestModuleInterface(); + if (ccm != null) + { + ccm.CreateCallingCard(agentID, friendID, UUID.Zero); + } + // Update the local cache UpdateFriendsCache(agentID); @@ -679,6 +685,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); + ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface(); + if (ccm != null) + { + ccm.CreateCallingCard(friendID, userID, UUID.Zero); + } + + // Update the local cache UpdateFriendsCache(friendID); -- cgit v1.1 From d3b081744ecb67dda7447e102e92739158a06d16 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 12 Dec 2010 22:12:50 +0100 Subject: Prevent objects that are worn from ground from vanishing from the scene --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 9 --------- 1 file changed, 9 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f924b30..25d4f21 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -606,15 +606,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (!silent) { - // Killing it here will cause the client to deselect it - // It then reappears on the avatar, deselected - // through the full update below - // - if (so.IsSelected) - { - m_scene.SendKillObject(new List { so.RootPart.LocalId }); - } - so.IsSelected = false; // fudge.... so.ScheduleGroupForFullUpdate(); } -- cgit v1.1 From 8186bf25253924e80c640ba03432d3b6211a4d41 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Dec 2010 07:29:23 +0100 Subject: Remove some code that was meant to fool the viewer into thinking SLT. It never worked and it turned out the issues were really in the backend. --- .../Avatar/InstantMessage/InstantMessageModule.cs | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 347708d..feb5fb8 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -156,31 +156,32 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } - DateTime dt = DateTime.UtcNow; + //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 - { - //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); + //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 + //{ + // //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); // If client is null, this message comes from storage and IS offline if (client != null) im.offline = 0; + if (im.offline == 0) + im.timestamp = (uint)Util.UnixTimeSinceEpoch(); + if (m_TransferModule != null) { if (client != null) -- cgit v1.1 From dfc0c8dca6fb3d2673d948401e6c8dfe8a25b114 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 29 Dec 2010 15:13:10 +0100 Subject: Remove the restriction on communication across scopes. This will allow cross-scope users to IM each other. --- .../Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index a3e3b4e..2f8bcd7 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -532,7 +532,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (upd != null) { - GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, + GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, upd.RegionID); if (reginfo != null) { -- cgit v1.1 From 24a997eb7ccb59f2c7bbc52cd1ddb9a7801e6aac Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 30 Dec 2010 20:57:56 +0100 Subject: Add MessageKey to section Messaging, a key that prevents injection of IM from external sources --- .../Avatar/InstantMessage/MessageTransferModule.cs | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 2f8bcd7..0d5401b 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private bool m_Enabled = false; + protected string m_MessageKey = String.Empty; protected List m_Scenes = new List(); protected Dictionary m_UserRegionMap = new Dictionary(); @@ -66,14 +67,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage public virtual void Initialise(IConfigSource config) { IConfig cnf = config.Configs["Messaging"]; - if (cnf != null && cnf.GetString( - "MessageTransferModule", "MessageTransferModule") != - "MessageTransferModule") + if (cnf != null) { - m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); - return; - } + if (cnf.GetString("MessageTransferModule", + "MessageTransferModule") != "MessageTransferModule") + { + return; + } + m_MessageKey = cnf.GetString("MessageKey", String.Empty); + } + m_log.Debug("[MESSAGE TRANSFER]: Module enabled"); m_Enabled = true; } @@ -250,6 +254,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") && requestData.ContainsKey("binary_bucket")) { + if (m_MessageKey != String.Empty) + { + XmlRpcResponse error_resp = new XmlRpcResponse(); + Hashtable error_respdata = new Hashtable(); + error_respdata["success"] = "FALSE"; + error_resp.Value = error_respdata; + + if (!requestData.Contains("message_key")) + return error_resp; + if (m_MessageKey != (string)requestData["message_key"]) + return error_resp; + } + // Do the easy way of validating the UUIDs UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); @@ -681,6 +698,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage gim["position_z"] = msg.Position.Z.ToString(); gim["region_id"] = msg.RegionID.ToString(); gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); + if (m_MessageKey != String.Empty) + gim["message_key"] = m_MessageKey; return gim; } -- cgit v1.1 From 5432dfd53a19456c28f37379cd89a888d2c615d0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 2 Jan 2011 01:29:22 +0100 Subject: Allow cross-scope friendships to work, and also allow other cross scope name resolution --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 613a054..3148871 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -489,7 +489,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends im.imSessionID = im.fromAgentID; // Try the local sim - UserAccount account = UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, agentID); + UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, agentID); im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; if (LocalFriendshipOffered(friendID, im)) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs index 496f2ab..1b53a42 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs @@ -116,7 +116,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (!UUID.TryParse(request["ToID"].ToString(), out toID)) return FailureResult(); - UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID); + UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(UUID.Zero, fromID); string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID, -- cgit v1.1 From 69666be28c5700b94be54d6165c9f59d681a4f4f Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 13 Jan 2011 16:05:17 +0100 Subject: Implement kicking, freezing and unfreezing users in the same sim via profile god buttons. --- .../Region/CoreModules/Avatar/Gods/GodsModule.cs | 175 ++++++++++++++------- 1 file changed, 117 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 5ec64d5..9fd3318 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -31,16 +31,40 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; +using System; +using System.Reflection; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using System.Xml; +using log4net; +using Mono.Addins; +using OpenMetaverse.Messages.Linden; +using OpenMetaverse.StructuredData; +using OpenSim.Framework.Capabilities; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OSDArray = OpenMetaverse.StructuredData.OSDArray; +using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.CoreModules.Avatar.Gods { public class GodsModule : IRegionModule, IGodsModule { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// Special UUID for actions that apply to all agents private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); protected Scene m_scene; protected IDialogModule m_dialogModule; + + protected Dictionary m_capsDict = + new Dictionary(); public void Initialise(Scene scene, IConfigSource source) { @@ -48,6 +72,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods m_dialogModule = m_scene.RequestModuleInterface(); m_scene.RegisterModuleInterface(this); m_scene.EventManager.OnNewClient += SubscribeToClientEvents; + m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; + m_scene.EventManager.OnClientClosed += OnClientClosed; } public void PostInitialise() {} @@ -67,6 +93,50 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods client.OnRequestGodlikePowers -= RequestGodlikePowers; } + private void OnClientClosed(UUID agentID, Scene scene) + { + m_capsDict.Remove(agentID); + } + + private void OnRegisterCaps(UUID agentID, Caps caps) + { + string uri = "/CAPS/" + UUID.Random(); + m_capsDict[agentID] = uri; + + caps.RegisterHandler("UntrustedSimulatorMessage", + new RestStreamHandler("POST", uri, + HandleUntrustedSimulatorMessage)); + } + + private string HandleUntrustedSimulatorMessage(string request, + string path, string param, OSHttpRequest httpRequest, + OSHttpResponse httpResponse) + { + OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); + + string message = osd["message"].AsString(); + + if (message == "GodKickUser") + { + OSDMap body = (OSDMap)osd["body"]; + OSDArray userInfo = (OSDArray)body["UserInfo"]; + OSDMap userData = (OSDMap)userInfo[0]; + + UUID agentID = userData["AgentID"].AsUUID(); + UUID godID = userData["GodID"].AsUUID(); + UUID godSessionID = userData["GodSessionID"].AsUUID(); + uint kickFlags = userData["KickFlags"].AsUInteger(); + string reason = userData["Reason"].AsString(); + + KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason)); + } + else + { + m_log.ErrorFormat("[GOD]: Unhandled UntrustedSimulatorMessage: {0}", message); + } + return String.Empty; + } + public void RequestGodlikePowers( UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) { @@ -115,71 +185,60 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods /// The message to send to the user after it's been turned into a field public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) { - UUID kickUserID = ALL_AGENTS; - + if (!m_scene.Permissions.IsGod(godID)) + return; + + ScenePresence god = m_scene.GetScenePresence(godID); + if (god == null || god.ControllingClient.SessionId != sessionID) + return; + ScenePresence sp = m_scene.GetScenePresence(agentID); - if (sp != null || agentID == kickUserID) + switch (kickflags) { - if (m_scene.Permissions.IsGod(godID)) + case 0: + if (sp != null) { - if (kickflags == 0) - { - if (agentID == kickUserID) - { - string reasonStr = Utils.BytesToString(reason); - - m_scene.ForEachClient( - delegate(IClientAPI controller) - { - if (controller.AgentId != godID) - controller.Kick(reasonStr); - } - ); - - // This is a bit crude. It seems the client will be null before it actually stops the thread - // The thread will kill itself eventually :/ - // Is there another way to make sure *all* clients get this 'inter region' message? - m_scene.ForEachScenePresence( - delegate(ScenePresence p) - { - if (p.UUID != godID && !p.IsChildAgent) - { - // Possibly this should really be p.Close() though that method doesn't send a close - // to the client - p.ControllingClient.Close(); - } - } - ); - } - else - { - m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent); - - sp.ControllingClient.Kick(Utils.BytesToString(reason)); - sp.ControllingClient.Close(); - } - } - - if (kickflags == 1) - { - sp.AllowMovement = false; - m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); - m_dialogModule.SendAlertToUser(godID, "User Frozen"); - } - - if (kickflags == 2) - { - sp.AllowMovement = true; - m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); - m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); - } + KickPresence(sp, Utils.BytesToString(reason)); } - else + else if (agentID == ALL_AGENTS) + { + m_scene.ForEachScenePresence( + delegate(ScenePresence p) + { + if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID))) + KickPresence(p, Utils.BytesToString(reason)); + } + ); + } + break; + case 1: + if (sp != null) { - m_dialogModule.SendAlertToUser(godID, "Kick request denied"); + sp.AllowMovement = false; + m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); + m_dialogModule.SendAlertToUser(godID, "User Frozen"); } + break; + case 2: + if (sp != null) + { + sp.AllowMovement = true; + m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); + m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); + } + break; + default: + break; } } + + private void KickPresence(ScenePresence sp, string reason) + { + if (sp.IsChildAgent) + return; + sp.ControllingClient.Kick(reason); + sp.Scene.IncomingCloseAgent(sp.UUID); + } } -} \ No newline at end of file +} -- cgit v1.1 From fe2d9be0cff649fad7fee78b257686954262e3cd Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Jan 2011 03:35:45 +0100 Subject: Implement nonlocal god kicks and freezes --- .../Region/CoreModules/Avatar/Gods/GodsModule.cs | 39 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 9fd3318..a83b3df 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -74,6 +74,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods m_scene.EventManager.OnNewClient += SubscribeToClientEvents; m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; m_scene.EventManager.OnClientClosed += OnClientClosed; + scene.EventManager.OnIncomingInstantMessage += + OnIncomingInstantMessage; } public void PostInitialise() {} @@ -128,6 +130,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods uint kickFlags = userData["KickFlags"].AsUInteger(); string reason = userData["Reason"].AsString(); + ScenePresence god = m_scene.GetScenePresence(godID); + if (god == null || god.ControllingClient.SessionId != godSessionID) + return String.Empty; + KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason)); } else @@ -188,12 +194,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods if (!m_scene.Permissions.IsGod(godID)) return; - ScenePresence god = m_scene.GetScenePresence(godID); - if (god == null || god.ControllingClient.SessionId != sessionID) - return; - ScenePresence sp = m_scene.GetScenePresence(agentID); + if (sp == null && agentID != ALL_AGENTS) + { + IMessageTransferModule transferModule = + m_scene.RequestModuleInterface(); + if (transferModule != null) + { + m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); + transferModule.SendInstantMessage(new GridInstantMessage( + m_scene, godID, "God", agentID, (byte)250, false, + Utils.BytesToString(reason), UUID.Zero, true, + new Vector3(), new byte[] {(byte)kickflags}), + delegate(bool success) {} ); + } + return; + } + switch (kickflags) { case 0: @@ -240,5 +258,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods sp.ControllingClient.Kick(reason); sp.Scene.IncomingCloseAgent(sp.UUID); } + + private void OnIncomingInstantMessage(GridInstantMessage msg) + { + if (msg.dialog == (uint)250) // Nonlocal kick + { + UUID agentID = new UUID(msg.toAgentID); + string reason = msg.message; + UUID godID = new UUID(msg.fromAgentID); + uint kickMode = (uint)msg.binaryBucket[0]; + + KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason)); + } + } } } -- cgit v1.1 From ddb4de139ccd6eff117ac322e94b323bd91212ee Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 17 Jan 2011 21:22:32 +0100 Subject: Change gesture activation to not quash any other flags --- OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index 7303fe7..914990c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures item = invService.GetItem(item); if (item != null) { - item.Flags = 1; + item.Flags |= 1; invService.UpdateItem(item); } else @@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures item = invService.GetItem(item); if (item != null) { - item.Flags = 0; + item.Flags &= ~1; invService.UpdateItem(item); } else @@ -93,4 +93,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name); } } -} \ No newline at end of file +} -- cgit v1.1 From 6becaf65e15e3fde2d910925b4f7ff09971121f3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 7 Feb 2011 22:28:59 +0000 Subject: Fix merge issues --- .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 68538c9..a71def7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -128,11 +128,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver + " is the user's last name." + Environment.NewLine + " is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine + "-p|--profile= adds the url of the profile service to the saved user information." + Environment.NewLine -<<<<<<< HEAD:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs -======= + "-c|--creators preserves information about foreign creators." + Environment.NewLine + "-v|--verbose extra debug messages." + Environment.NewLine ->>>>>>> master:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs + " is the filesystem path at which to save the IAR." + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), HandleSaveInvConsoleCommand); @@ -399,11 +396,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver OptionSet ops = new OptionSet(); //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); -<<<<<<< HEAD:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs -======= ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); ->>>>>>> master:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs List mainParams = ops.Parse(cmdparams); -- cgit v1.1 From 86decb2aa8727a0c2ff51dd5c9a12d122585df3c Mon Sep 17 00:00:00 2001 From: Mike Rieker Date: Sun, 20 Feb 2011 15:57:57 +0000 Subject: throttle group notices to max of 4 threads at a time ...otherwise it can create hundreds of threads and hang --- .../Avatar/InstantMessage/MessageTransferModule.cs | 64 +++++++++++++++++----- 1 file changed, 50 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index dd9819a..a81ec7c 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -449,24 +449,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return resp; } - /// - /// delegate for sending a grid instant message asynchronously - /// - public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID); + private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); - protected virtual void GridInstantMessageCompleted(IAsyncResult iar) - { - GridInstantMessageDelegate icon = - (GridInstantMessageDelegate)iar.AsyncState; - icon.EndInvoke(iar); - } + private class GIM { + public GridInstantMessage im; + public MessageResultNotification result; + }; + private Queue pendingInstantMessages = new Queue(); + private int numInstantMessageThreads = 0; - protected virtual void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) + private void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) { - GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; + lock (pendingInstantMessages) { + if (numInstantMessageThreads >= 4) { + GIM gim = new GIM(); + gim.im = im; + gim.result = result; + pendingInstantMessages.Enqueue(gim); + } else { + ++ numInstantMessageThreads; + m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: ++numInstantMessageThreads={0}", numInstantMessageThreads); + GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsyncMain; + d.BeginInvoke(im, result, GridInstantMessageCompleted, d); + } + } + } - d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d); + private void GridInstantMessageCompleted(IAsyncResult iar) + { + GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState; + d.EndInvoke(iar); } /// @@ -481,8 +494,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage /// Pass in 0 the first time this method is called. It will be called recursively with the last /// regionhandle tried /// - protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) + private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result) { + GIM gim; + do { + try { + SendGridInstantMessageViaXMLRPCAsync(im, result, UUID.Zero); + } catch (Exception e) { + m_log.Error("[SendGridInstantMessageViaXMLRPC]: exception " + e.Message); + } + lock (pendingInstantMessages) { + if (pendingInstantMessages.Count > 0) { + gim = pendingInstantMessages.Dequeue(); + im = gim.im; + result = gim.result; + } else { + gim = null; + -- numInstantMessageThreads; + m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: --numInstantMessageThreads={0}", numInstantMessageThreads); + } + } + } while (gim != null); + } + private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) + { + UUID toAgentID = new UUID(im.toAgentID); PresenceInfo upd = null; -- cgit v1.1 From 04dc43f591b8059ece94901ae32cf5485e8e9273 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Feb 2011 04:02:16 +0100 Subject: Prevent attaching things you don't own from inworld. Simple solution for a complex issue --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8c92588..dc33dbb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -119,6 +119,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; } + if (part.OwnerID != remoteClient.AgentId) // Not ours + { + remoteClient.SendAgentAlertMessage( + "You don't have sufficient permissions to attach this object", false); + return; + } + // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // be removed when that functionality is implemented in opensim AttachmentPt &= 0x7f; -- cgit v1.1 From edf9f3d6305cfca07f9f0f99558a9adb139cef59 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 23 Mar 2011 00:01:41 +0100 Subject: Raise the position for lures by 2m to prevent the target avatar getting stuck in a prim. --- OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index 6532bbb..a12b57a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs @@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure scene.RegionInfo.RegionHandle, (uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.Y, - (uint)presence.AbsolutePosition.Z); + (uint)presence.AbsolutePosition.Z + 2); m_log.DebugFormat("[LURE]: TP invite with message {0}", message); -- cgit v1.1 From 3dc9b0ef1827f8d21396475870094c5debe394d2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 23 Mar 2011 00:32:19 +0100 Subject: Remove a spammy debug --- .../Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index a81ec7c..c1caf44 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -469,7 +469,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage pendingInstantMessages.Enqueue(gim); } else { ++ numInstantMessageThreads; - m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: ++numInstantMessageThreads={0}", numInstantMessageThreads); + //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: ++numInstantMessageThreads={0}", numInstantMessageThreads); GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsyncMain; d.BeginInvoke(im, result, GridInstantMessageCompleted, d); } @@ -511,7 +511,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } else { gim = null; -- numInstantMessageThreads; - m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: --numInstantMessageThreads={0}", numInstantMessageThreads); + //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: --numInstantMessageThreads={0}", numInstantMessageThreads); } } } while (gim != null); -- cgit v1.1 From 1b7fec0842a91705f053cbded365f6172b09d554 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 20 Jun 2011 03:20:32 +0200 Subject: Remove friends debug spam --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index c8167c5..4350cde 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -843,7 +843,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) { - m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); + //m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { -- cgit v1.1 From 96174595da269f50d37c88c213ad00b79a7c7c83 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 23 Jul 2011 11:39:32 +0100 Subject: Fix LLTextBox to work with the updated libOMV --- OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 8a16582..f343f80 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -141,10 +141,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); string ownerFirstName, ownerLastName; + UUID ownerID = UUID.Zero; if (account != null) { ownerFirstName = account.FirstName; ownerLastName = account.LastName; + ownerID = account.PrincipalID; } else { @@ -155,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog ScenePresence sp = m_scene.GetScenePresence(avatarid); if (sp != null) - sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); + sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerID, ownerFirstName, ownerLastName, objectid); } public void SendNotificationToUsersInRegion( -- cgit v1.1 From 03f6734f4367b08e2b181ed68bc80b885e76148f Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 7 Sep 2011 09:42:18 -0700 Subject: First set of merge fixes --- .../Avatar/InstantMessage/OfflineMessageModule.cs | 89 +++++++++------------- 1 file changed, 38 insertions(+), 51 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index d9dcee7..3373bd5 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -172,10 +172,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private void RetrieveInstantMessages(IClientAPI client) { if (m_RestURL == String.Empty) - { + { return; - } - else + } + else { m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId); @@ -183,64 +183,51 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage = SynchronousRestObjectRequester.MakeRequest>( "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); - if (msglist != null) - { - foreach (GridInstantMessage im in msglist) + if (msglist != null) { - // client.SendInstantMessage(im); - - // Send through scene event manager so all modules get a chance - // to look at this message before it gets delivered. - // - // Needed for proper state management for stored group - // invitations - // - - im.offline = 1; - - Scene s = FindScene(client.AgentId); - if (s != null) - s.EventManager.TriggerIncomingInstantMessage(im); + foreach (GridInstantMessage im in msglist) + { + // client.SendInstantMessage(im); + + // Send through scene event manager so all modules get a chance + // to look at this message before it gets delivered. + // + // Needed for proper state management for stored group + // invitations + // + + im.offline = 1; + + Scene s = FindScene(client.AgentId); + if (s != null) + s.EventManager.TriggerIncomingInstantMessage(im); + } } } } private void UndeliveredMessage(GridInstantMessage im) { - if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && - im.dialog != (byte)InstantMessageDialog.MessageFromAgent && - im.dialog != (byte)InstantMessageDialog.GroupNotice && - im.dialog != (byte)InstantMessageDialog.GroupInvitation && - im.dialog != (byte)InstantMessageDialog.InventoryOffered) + if ((im.offline != 0) + && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { bool success = SynchronousRestObjectRequester.MakeRequest( - "POST", m_RestURL+"/SaveMessage/", im); - return; - } - - // 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]; - - bool success = SynchronousRestObjectPoster.BeginPostObject( - "POST", m_RestURL+"/SaveMessage/?scope=" + - scene.RegionInfo.ScopeID.ToString(), im); + "POST", m_RestURL + "/SaveMessage/", im); - 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())); + 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())); + } } } } -- cgit v1.1 From cda4cd6b551156ed503a5f284ad6c5a9a0e1c5a5 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 14 Sep 2011 18:46:42 -0700 Subject: Merge fixes, and fix the build --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8be0455..218b7b8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // If we're an NPC then skip all the item checks and manipulations since we don't have an // inventory right now. if (sp.PresenceType == PresenceType.Npc) - RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p); + RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); else RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); } @@ -343,17 +343,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); } - public UUID RezSingleAttachmentFromInventory( + public ISceneEntity RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) - ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); - { + ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); if (sp == null) { m_log.ErrorFormat( "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", remoteClient.Name, remoteClient.AgentId); return null; } // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // be removed when that functionality is implemented in opensim AttachmentPt &= 0x7f; - SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); + SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc); if (updateInventoryStatus) { @@ -367,7 +366,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( - IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) + IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) { IInventoryAccessModule invAccess = m_scene.RequestModuleInterface(); if (invAccess != null) @@ -462,9 +461,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (!att.IsDeleted) attachmentPoint = att.AttachmentPoint; - ScenePresence presence; - if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) - { InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); if (m_scene.InventoryService != null) item = m_scene.InventoryService.GetItem(item); -- cgit v1.1 From 1129b8062985f0252bea26c5e67b957a41cb457d Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 14 Sep 2011 19:31:55 -0700 Subject: Fix a rather stupid VS warning "The operation overflows at compile time in checked mode" - doesn't make much sense to me, but for some reason it doesn't like 256 - 6 when 256 is a constant... --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2bf418d..a130ed2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -834,14 +834,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", // grp.Name, grp.LocalId, remoteClient.Name); - + uint regionSize = Constants.RegionSize; //Avoid VS error "The operation overflows at compile time in checked mode" Vector3 inventoryStoredPosition = new Vector3 (((grp.AbsolutePosition.X > (int)Constants.RegionSize) - ? Constants.RegionSize - 6 + ? regionSize - 6 : grp.AbsolutePosition.X) , (grp.AbsolutePosition.Y > (int)Constants.RegionSize) - ? Constants.RegionSize - 6 + ? regionSize - 6 : grp.AbsolutePosition.Y, grp.AbsolutePosition.Z); -- cgit v1.1 From 9b6ce41b0e52a91d1f84b158ae5996957df636ba Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 28 Oct 2011 23:10:22 +0200 Subject: Reduce severity and remove duplication if a common log message regarding baked textures --- .../Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 236a47c..eff6911 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -325,8 +325,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (checkonly) return false; - m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID); - sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); } } @@ -348,7 +346,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { if (m_scene.AssetService.Get(textureID.ToString()) == null) { - m_log.WarnFormat("[AVFACTORY]: Missing baked texture {0} ({1}) for avatar {2}", + m_log.InfoFormat("[AVFACTORY]: Missing baked texture {0} ({1}) for avatar {2}", textureID, idx, sp.Name); return false; } -- cgit v1.1 From 175d74e68c72be653f6c05241e3400168f7297a9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 28 Oct 2011 23:10:54 +0200 Subject: Fix the offline message module to revert core changes and restore avn specific behavior --- .../Avatar/InstantMessage/OfflineMessageModule.cs | 46 +++++++++++++--------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 3373bd5..5ab604f 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -208,26 +208,36 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private void UndeliveredMessage(GridInstantMessage im) { - 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.GroupInvitation && + im.dialog != (byte)InstantMessageDialog.InventoryOffered) { - bool success = SynchronousRestObjectRequester.MakeRequest( - "POST", m_RestURL + "/SaveMessage/", im); + return; + } - 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())); - } + Scene scene = FindScene(new UUID(im.fromAgentID)); + if (scene == null) + scene = m_SceneList[0]; + + bool success = SynchronousRestObjectRequester.MakeRequest( + "POST", m_RestURL+"/SaveMessage/?scope=" + + scene.RegionInfo.ScopeID.ToString(), im); + + 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())); } } } -- cgit v1.1 From 17f32b77736a369a309819678fc00ecff8ce875b Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 14 Nov 2011 20:33:39 +0000 Subject: Fix build break --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 74f32e7..8e5de7d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -357,7 +357,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends im.offline = 0; im.fromAgentID = fromAgentID.Guid; im.fromAgentName = firstname + " " + lastname; - im.offline = (byte)((presence == null) ? 1 : 0); im.imSessionID = im.fromAgentID; im.message = FriendshipMessage(fid); @@ -583,7 +582,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends ICallingCardModule ccm = client.Scene.RequestModuleInterface(); if (ccm != null) { - ccm.CreateCallingCard(agentID, friendID, UUID.Zero); + ccm.CreateCallingCard(client.AgentId, friendID, UUID.Zero); } // Update the local cache -- cgit v1.1 From 09c043fe524f1b62c9e4286197a3f0cf70eca791 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Dec 2011 21:26:43 +0100 Subject: Adapt GodsModule to core changes --- OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index f73f9c1..1492302 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -111,8 +111,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods } private string HandleUntrustedSimulatorMessage(string request, - string path, string param, OSHttpRequest httpRequest, - OSHttpResponse httpResponse) + string path, string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) { OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); -- cgit v1.1 From 62d0a0cdbf076b0d763afe5bf7c6f8ae780f5efb Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 6 Dec 2011 22:58:00 +0100 Subject: Remove harmless merge artefact --- .../CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index b33342f..aa211ba 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer im.imSessionID = itemID.Guid; } - im.offline = 1; // Remember these + im.offline = 0; // Send the IM to the recipient. The item is already // in their inventory, so it will not be lost if -- cgit v1.1 From d6486fe14a77b74235eaa9e1feab36f923dc6ee9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Dec 2011 00:43:59 +0100 Subject: Fix task inventory giving --- .../Avatar/InstantMessage/MessageTransferModule.cs | 25 ++++++------------- .../Avatar/InstantMessage/OfflineMessageModule.cs | 3 ++- .../Inventory/Transfer/InventoryTransferModule.cs | 29 +++++----------------- 3 files changed, 16 insertions(+), 41 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 712632b..6064ddc 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -146,20 +146,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage ScenePresence sp = scene.GetScenePresence(toAgentID); if (sp != null && !sp.IsChildAgent) { -// m_log.DebugFormat( -// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", -// toAgentID.ToString(), scene.RegionInfo.RegionName); - - ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; - if (!user.IsChildAgent) - { - // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); - user.ControllingClient.SendInstantMessage(im); + // Local message +// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); + sp.ControllingClient.SendInstantMessage(im); - // Message sent - result(true); - return; - } + // Message sent + result(true); + return; } } @@ -172,10 +165,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (sp != null) { // Local message - ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; - - // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); - user.ControllingClient.SendInstantMessage(im); +// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); + sp.ControllingClient.SendInstantMessage(im); // Message sent result(true); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 5ab604f..b27b07d 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage im.dialog != (byte)InstantMessageDialog.MessageFromAgent && im.dialog != (byte)InstantMessageDialog.GroupNotice && im.dialog != (byte)InstantMessageDialog.GroupInvitation && - im.dialog != (byte)InstantMessageDialog.InventoryOffered) + im.dialog != (byte)InstantMessageDialog.InventoryOffered && + im.dialog != (byte)InstantMessageDialog.TaskInventoryOffered) { return; } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index aa211ba..677fab9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -265,7 +265,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer }); } } - else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) + else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || + im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) { ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); @@ -276,30 +277,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer else { if (m_TransferModule != null) - m_TransferModule.SendInstantMessage(im, delegate(bool success) { - - // justincc - FIXME: Comment out for now. This code was added in commit db91044 Mon Aug 22 2011 - // and is apparently supposed to fix bulk inventory updates after accepting items. But - // instead it appears to cause two copies of an accepted folder for the receiving user in - // at least some cases. Folder/item update is already done when the offer is made (see code above) - -// // Send BulkUpdateInventory -// IInventoryService invService = scene.InventoryService; -// UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip -// -// InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId); -// folder = invService.GetFolder(folder); -// -// ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID)); -// -// // If the user has left the scene by the time the message comes back then we can't send -// // them the update. -// if (fromUser != null) -// fromUser.ControllingClient.SendBulkUpdateInventory(folder); - }); + m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); } } - else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) + else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined || + im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined) { // Here, the recipient is local and we can assume that the // inventory is loaded. Courtesy of the above bulk update, @@ -335,6 +317,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { folder.ParentID = trashFolder.ID; invService.MoveFolder(folder); + client.SendBulkUpdateInventory(folder); } } -- cgit v1.1 From f317953290f7240768bf52238541663134ac76ea Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Dec 2011 01:02:46 +0100 Subject: Fix up intersim give messaging --- .../Inventory/Transfer/InventoryTransferModule.cs | 42 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 677fab9..8824cab 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -474,8 +474,48 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } user.ControllingClient.SendInstantMessage(im); } + if (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered) + { + if (im.binaryBucket.Length < 1) // Invalid + return; + + UUID recipientID = new UUID(im.toAgentID); + + // Bucket is the asset type + AssetType assetType = (AssetType)im.binaryBucket[0]; + + if (AssetType.Folder == assetType) + { + UUID folderID = new UUID(im.imSessionID); + + InventoryFolderBase given = + new InventoryFolderBase(folderID, recipientID); + InventoryFolderBase folder = + scene.InventoryService.GetFolder(given); + + if (folder != null) + user.ControllingClient.SendBulkUpdateInventory(folder); + } + else + { + UUID itemID = new UUID(im.imSessionID); + + InventoryItemBase given = + new InventoryItemBase(itemID, recipientID); + InventoryItemBase item = + scene.InventoryService.GetItem(given); + + if (item != null) + { + user.ControllingClient.SendBulkUpdateInventory(item); + } + } + user.ControllingClient.SendInstantMessage(im); + } else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || - im.dialog == (byte) InstantMessageDialog.InventoryDeclined) + im.dialog == (byte) InstantMessageDialog.InventoryDeclined || + im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined || + im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) { user.ControllingClient.SendInstantMessage(im); } -- cgit v1.1 From ccba04f3451c5034669bbd999cd9ab2a3e8bd5a0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Dec 2011 01:27:52 +0100 Subject: Fix intersim object give messages --- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 8824cab..da708d2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -510,6 +510,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer user.ControllingClient.SendBulkUpdateInventory(item); } } + + // Fix up binary bucket since this may be 17 chars long here + Byte[] bucket = new Byte[1]; + bucket[0] = im.binaryBucket[0]; + im.binaryBucket = bucket; + user.ControllingClient.SendInstantMessage(im); } else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || -- cgit v1.1 From 323ffd7a893e76f097487c1ab461923d996dc1ca Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 10 Dec 2011 15:28:32 +0100 Subject: Fix a regression that causes data from the attachments module to fail loading --- .../Avatar/Attachments/AttachmentsModule.cs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 70d9f23..eca9c3b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -755,6 +755,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (tainted) objatt.HasGroupChanged = true; + if (doc != null) + { + objatt.LoadScriptState(doc); + objatt.ResetOwnerChangeFlag(); + } + // Fire after attach, so we don't get messy perms dialogs // 4 == AttachedRez objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); @@ -771,20 +777,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", itemID, sp.Name, attachmentPt); } - - if (doc != null) - { - objatt.LoadScriptState(doc); - objatt.ResetOwnerChangeFlag(); - } - - // Fire after attach, so we don't get messy perms dialogs - // 4 == AttachedRez - objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); - objatt.ResumeScripts(); - - // Do this last so that event listeners have access to all the effects of the attachment - m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); } } -- cgit v1.1 From efe51fd5cba9bf3ed1cd37f71f8af888dbf0a386 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Jan 2012 12:06:21 +0100 Subject: Don't try to save a NPCs attachment states on NPC delete --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index eca9c3b..83beff4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -468,6 +468,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp) { + // Saving attachments for NPCs messes them up for the real owner! + INPCModule module = m_scene.RequestModuleInterface(); + if (module != null) + { + if (module.IsNPC(sp.UUID, m_scene)) + return; + } + if (grp.HasGroupChanged || grp.ContainsScripts()) { m_log.DebugFormat( -- cgit v1.1 From 08b6b3bb48fb9872fda04c06e7ba82b25c811ab6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 17 Jan 2012 17:36:26 +0100 Subject: Add some logging --- .../Avatar/InstantMessage/InstantMessageModule.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 1af4d68..727f1c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.Reflection; +using System.Timers; using log4net; using Nini.Config; using OpenMetaverse; @@ -42,6 +43,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + private Timer m_logTimer = new Timer(10000); + private List m_logData = new List(); + private string m_restUrl; + /// /// Is this module enabled? /// @@ -61,9 +66,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage "InstantMessageModule", "InstantMessageModule") != "InstantMessageModule") return; + m_restUrl = config.Configs["Messaging"].GetString("LogURL", String.Empty); } m_enabled = true; + m_logTimer.AutoReset = false; + m_logTimer.Elapsed += LogTimerElapsed; } public void AddRegion(Scene scene) @@ -148,6 +156,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { byte dialog = im.dialog; + if (client != null && dialog == (byte)InstantMessageDialog.MessageFromAgent) + LogInstantMesssage(im); + if (dialog != (byte)InstantMessageDialog.MessageFromAgent && dialog != (byte)InstantMessageDialog.StartTyping && dialog != (byte)InstantMessageDialog.StopTyping @@ -226,5 +237,35 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage // OnInstantMessage(null, msg); } + + private void LogInstantMesssage(GridInstantMessage im) + { + if (m_logData.Count < 20) + { + // Restart the log write timer + m_logTimer.Stop(); + } + if (!m_logTimer.Enabled) + m_logTimer.Start(); + + lock (m_logData) + { + m_logData.Add(im); + } + } + + private void LogTimerElapsed(object source, ElapsedEventArgs e) + { + lock (m_logData) + { + if (m_restUrl != String.Empty && m_logData.Count > 0) + { + bool success = SynchronousRestObjectRequester.MakeRequest, bool>("POST", m_restUrl + "/LogMessages/", m_logData); + if (!success) + m_log.ErrorFormat("[INSTANT MESSAGE]: Failed to save log data"); + } + m_logData.Clear(); + } + } } } -- cgit v1.1 From e5ae84b42b453feb2cf835d1c8cd91f5195dd250 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Feb 2012 01:04:54 +0100 Subject: Re-Add the reading of attachment data hat was lost in the merge --- .../Avatar/Attachments/AttachmentsModule.cs | 47 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f7e3a59..5ca2ce4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -39,6 +39,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Attachments { @@ -116,6 +117,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name); + XmlDocument doc = new XmlDocument(); + string stateData = String.Empty; + + IAttachmentsService attServ = m_scene.RequestModuleInterface(); + if (attServ != null) + { + m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service"); + stateData = attServ.Get(sp.UUID.ToString()); + if (stateData != String.Empty) + { + try + { + doc.LoadXml(stateData); + } + catch { } + } + } + + Dictionary itemData = new Dictionary(); + + XmlNodeList nodes = doc.GetElementsByTagName("Attachment"); + if (nodes.Count > 0) + { + foreach (XmlNode n in nodes) + { + XmlElement elem = (XmlElement)n; + string itemID = elem.GetAttribute("ItemID"); + string xml = elem.InnerXml; + + itemData[new UUID(itemID)] = xml; + } + } + + List attachments = sp.Appearance.GetAttachments(); foreach (AvatarAttachment attach in attachments) { @@ -135,12 +170,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments try { + string xmlData; + XmlDocument d = null; + UUID asset; + if (itemData.TryGetValue(attach.ItemID, out xmlData)) + { + d = new XmlDocument(); + d.LoadXml(xmlData); + m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", attach.ItemID); + } + // If we're an NPC then skip all the item checks and manipulations since we don't have an // inventory right now. if (sp.PresenceType == PresenceType.Npc) RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); else - RezSingleAttachmentFromInventory(sp, attach.ItemID, p); + RezSingleAttachmentFromInventory(sp, attach.ItemID, p, true, d); } catch (Exception e) { -- cgit v1.1 From 6af01f6767838235091b9e34cdaea05951d68f68 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 8 Feb 2012 23:14:53 +0000 Subject: initial introdution of physics actor building control. --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 5ca2ce4..c5cec59 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -417,7 +417,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.AttachedAvatar = UUID.Zero; rootPart.SetParentLocalId(0); so.ClearPartAttachmentData(); - rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive); + rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); so.HasGroupChanged = true; rootPart.Rezzed = DateTime.Now; rootPart.RemFlag(PrimFlags.TemporaryOnRez); -- cgit v1.1 From 5eb1679367754d530edb4c50d432847ed1a027af Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Feb 2012 12:25:16 +0100 Subject: Delay the sending of the initial werables update until the inventory and VFS in the viewer are ready. We're much faster than SL and that exposes this race condition. Also reinstate the extra avatar data send on login --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index b0cee03..93e22e0 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -551,12 +551,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// private void Client_OnRequestWearables(IClientAPI client) { - // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId); - ScenePresence sp = m_scene.GetScenePresence(client.AgentId); - if (sp != null) - client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); - else - m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); + Util.FireAndForget(delegate(object x) + { + Thread.Sleep(2000); + + // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId); + ScenePresence sp = m_scene.GetScenePresence(client.AgentId); + if (sp != null) + client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); + else + m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); + }); } /// -- cgit v1.1 From c82709c0d6c72852d8614651f9cb31df09fff883 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 02:36:34 +0100 Subject: Implement llSetKeyframedMotion. No persistence, no region crossing. Yet. --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 93e22e0..2bebd30 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -553,7 +553,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { Util.FireAndForget(delegate(object x) { - Thread.Sleep(2000); + Thread.Sleep(4000); // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId); ScenePresence sp = m_scene.GetScenePresence(client.AgentId); -- cgit v1.1 From 44ce068d6cd8afe3780b26f77d2a1b39ac81ef44 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 11 Mar 2012 18:21:47 +0100 Subject: Allow RLV to redirect received folders to #RLV folder --- .../Inventory/Transfer/InventoryTransferModule.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index da708d2..80554fb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -268,6 +268,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) { + UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip + IInventoryService invService = scene.InventoryService; + + // Special case: folder redirect. + // RLV uses this + if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) + { + InventoryFolderBase folder = new InventoryFolderBase(inventoryID, client.AgentId); + folder = invService.GetFolder(folder); + + if (folder != null) + { + if (im.binaryBucket.Length >= 16) + { + UUID destFolderID = new UUID(im.binaryBucket, 0); + if (destFolderID != UUID.Zero) + { + InventoryFolderBase destFolder = new InventoryFolderBase(destFolderID, client.AgentId); + destFolder = invService.GetFolder(destFolder); + if (destFolder != null) + { + if (folder.ParentID != destFolder.ID) + { + folder.ParentID = destFolder.ID; + invService.MoveFolder(folder); + client.SendBulkUpdateInventory(folder); + } + } + } + } + } + } + ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); if (user != null) // Local -- cgit v1.1 From a85876bc17881845faf28ba8edf8c2429a03a486 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 23:51:44 +0200 Subject: Committing the Avination calling card module --- .../Avatar/Friends/CallingCardModule.cs | 286 +++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs new file mode 100644 index 0000000..5e2a651 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs @@ -0,0 +1,286 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Mono.Addins; + +namespace Careminster.XCallingCard.Modules +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XCallingCard")] + public class CallingCardModule : ISharedRegionModule, ICallingCardModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + protected List m_Scenes = new List(); + protected bool m_Enabled = true; + + public void Initialise(IConfigSource source) + { + IConfig ccConfig = source.Configs["XCallingCard"]; + if (ccConfig != null) + m_Enabled = ccConfig.GetBoolean("Enabled", true); + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + m_Scenes.Add(scene); + + scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + m_Scenes.Remove(scene); + + scene.EventManager.OnNewClient -= OnNewClient; + scene.EventManager.OnIncomingInstantMessage += + OnIncomingInstantMessage; + + scene.UnregisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + scene.EventManager.OnNewClient += OnNewClient; + } + + public void PostInitialise() + { + } + + public void Close() + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public string Name + { + get { return "XCallingCardModule"; } + } + + private void OnNewClient(IClientAPI client) + { + client.OnOfferCallingCard += OnOfferCallingCard; + client.OnAcceptCallingCard += OnAcceptCallingCard; + client.OnDeclineCallingCard += OnDeclineCallingCard; + } + + private void OnOfferCallingCard(IClientAPI client, UUID destID, UUID transactionID) + { + ScenePresence sp = GetClientPresence(client.AgentId); + if (sp != null) + { + // If we're in god mode, we reverse the meaning. Offer + // calling card becomes "Take a calling card" for that + // person, no matter if they agree or not. + if (sp.GodLevel >= 200) + { + CreateCallingCard(client.AgentId, destID, UUID.Zero, true); + return; + } + } + + IClientAPI dest = FindClientObject(destID); + if (dest != null) + { + DoCallingCardOffer(dest, client.AgentId); + return; + } + + IMessageTransferModule transferModule = + m_Scenes[0].RequestModuleInterface(); + + if (transferModule != null) + { + transferModule.SendInstantMessage(new GridInstantMessage( + client.Scene, client.AgentId, + client.FirstName+" "+client.LastName, + destID, (byte)211, false, + String.Empty, + transactionID, false, new Vector3(), new byte[0]), + delegate(bool success) {} ); + } + } + + private void DoCallingCardOffer(IClientAPI dest, UUID from) + { + UUID itemID = CreateCallingCard(dest.AgentId, from, UUID.Zero, false); + + dest.SendOfferCallingCard(from, itemID); + } + + // Create a calling card in the user's inventory. This is called + // from direct calling card creation, when the offer is forwarded, + // and from the friends module when the friend is confirmed. + // Because of the latter, it will send a bulk inventory update + // if the receiving user is in the same simulator. + public UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID) + { + return CreateCallingCard(userID, creatorID, folderID, false); + } + + private UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID, bool isGod) + { + IUserAccountService userv = m_Scenes[0].UserAccountService; + if (userv == null) + return UUID.Zero; + + UserAccount info = userv.GetUserAccount(UUID.Zero, creatorID); + if (info == null) + return UUID.Zero; + + IInventoryService inv = m_Scenes[0].InventoryService; + if (inv == null) + return UUID.Zero; + + if (folderID == UUID.Zero) + { + InventoryFolderBase folder = inv.GetFolderForType(userID, + AssetType.CallingCard); + + if (folder == null) // Nowhere to put it + return UUID.Zero; + + folderID = folder.ID; + } + + m_log.DebugFormat("[XCALLINGCARD]: Creating calling card for {0} in inventory of {1}", info.Name, userID); + + InventoryItemBase item = new InventoryItemBase(); + item.AssetID = UUID.Zero; + item.AssetType = (int)AssetType.CallingCard; + item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + if (isGod) + item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Move); + + item.EveryOnePermissions = (uint)PermissionMask.None; + item.CurrentPermissions = item.BasePermissions; + item.NextPermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + + item.ID = UUID.Random(); + item.CreatorId = creatorID.ToString(); + item.Owner = userID; + item.GroupID = UUID.Zero; + item.GroupOwned = false; + item.Folder = folderID; + + item.CreationDate = Util.UnixTimeSinceEpoch(); + item.InvType = (int)InventoryType.CallingCard; + item.Flags = 0; + + item.Name = info.Name; + item.Description = ""; + + item.SalePrice = 10; + item.SaleType = (byte)SaleType.Not; + + inv.AddItem(item); + + IClientAPI client = FindClientObject(userID); + if (client != null) + client.SendBulkUpdateInventory(item); + + return item.ID; + } + + private void OnAcceptCallingCard(IClientAPI client, UUID transactionID, UUID folderID) + { + } + + private void OnDeclineCallingCard(IClientAPI client, UUID transactionID) + { + IInventoryService invService = m_Scenes[0].InventoryService; + + InventoryFolderBase trashFolder = + invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); + + InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId); + item = invService.GetItem(item); + + if (item != null && trashFolder != null) + { + item.Folder = trashFolder.ID; + List uuids = new List(); + uuids.Add(item.ID); + invService.DeleteItems(item.Owner, uuids); + m_Scenes[0].AddInventoryItem(client, item); + } + } + + public IClientAPI FindClientObject(UUID agentID) + { + Scene scene = GetClientScene(agentID); + if (scene == null) + return null; + + ScenePresence presence = scene.GetScenePresence(agentID); + if (presence == null) + return null; + + return presence.ControllingClient; + } + + private Scene GetClientScene(UUID agentId) + { + lock (m_Scenes) + { + foreach (Scene scene in m_Scenes) + { + ScenePresence presence = scene.GetScenePresence(agentId); + if (presence != null) + { + if (!presence.IsChildAgent) + return scene; + } + } + } + return null; + } + + private ScenePresence GetClientPresence(UUID agentId) + { + lock (m_Scenes) + { + foreach (Scene scene in m_Scenes) + { + ScenePresence presence = scene.GetScenePresence(agentId); + if (presence != null) + { + if (!presence.IsChildAgent) + return presence; + } + } + } + return null; + } + + private void OnIncomingInstantMessage(GridInstantMessage msg) + { + if (msg.dialog == (uint)211) + { + IClientAPI client = FindClientObject(new UUID(msg.toAgentID)); + if (client == null) + return; + + DoCallingCardOffer(client, new UUID(msg.fromAgentID)); + } + } + } +} -- cgit v1.1 From 4358bb8f850863aec8a519c6f533c298630dc1af Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 May 2012 00:50:47 +0200 Subject: Fix the log standing attach-from-world bug. --- .../Avatar/Attachments/AttachmentsModule.cs | 51 ++++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 78ae5e9..d7c7283 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -631,19 +631,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", // grp.Name, grp.LocalId, remoteClient.Name); - Vector3 inventoryStoredPosition = new Vector3 - (((grp.AbsolutePosition.X > (int)Constants.RegionSize) - ? (float)Constants.RegionSize - 6 - : grp.AbsolutePosition.X) - , - (grp.AbsolutePosition.Y > (int)Constants.RegionSize) - ? (float)Constants.RegionSize - 6 - : grp.AbsolutePosition.Y, - grp.AbsolutePosition.Z); - - Vector3 originalPosition = grp.AbsolutePosition; - - grp.AbsolutePosition = inventoryStoredPosition; +// Vector3 inventoryStoredPosition = new Vector3 +// (((grp.AbsolutePosition.X > (int)Constants.RegionSize) +// ? (float)Constants.RegionSize - 6 +// : grp.AbsolutePosition.X) +// , +// (grp.AbsolutePosition.Y > (int)Constants.RegionSize) +// ? (float)Constants.RegionSize - 6 +// : grp.AbsolutePosition.Y, +// grp.AbsolutePosition.Z); +// +// Vector3 originalPosition = grp.AbsolutePosition; +// +// grp.AbsolutePosition = inventoryStoredPosition; // If we're being called from a script, then trying to serialize that same script's state will not complete // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if @@ -651,7 +651,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // without state on relog. Arguably, this is what we want anyway. string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false); - grp.AbsolutePosition = originalPosition; +// grp.AbsolutePosition = originalPosition; AssetBase asset = m_scene.CreateAsset( grp.GetPartName(grp.LocalId), @@ -679,21 +679,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments else // oopsies item.Folder = UUID.Zero; + // Nix the special bits we used to use for slam and the folded perms + uint allowablePermissionsMask = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move); + if ((sp.UUID != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions()) { - item.BasePermissions = grp.RootPart.NextOwnerMask; - item.CurrentPermissions = grp.RootPart.NextOwnerMask; - item.NextPermissions = grp.RootPart.NextOwnerMask; - item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; - item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; + item.BasePermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.CurrentPermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; } else { - item.BasePermissions = grp.RootPart.BaseMask; - item.CurrentPermissions = grp.RootPart.OwnerMask; - item.NextPermissions = grp.RootPart.NextOwnerMask; - item.EveryOnePermissions = grp.RootPart.EveryoneMask; - item.GroupPermissions = grp.RootPart.GroupMask; + item.BasePermissions = grp.RootPart.BaseMask & allowablePermissionsMask; + item.CurrentPermissions = grp.RootPart.OwnerMask & allowablePermissionsMask; + item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.EveryOnePermissions = grp.RootPart.EveryoneMask & allowablePermissionsMask; + item.GroupPermissions = grp.RootPart.GroupMask & allowablePermissionsMask; } item.CreationDate = Util.UnixTimeSinceEpoch(); -- cgit v1.1 From 28e5abd9176aeba3b5004d07748ae88cccbcd57a Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Jun 2012 21:05:56 +0200 Subject: Fix llAttachToAvatar and "Attach" viewer option to preserve saved attach positions. --- .../Avatar/Attachments/AttachmentsModule.cs | 26 ++++++++++++++++++---- .../Attachments/Tests/AttachmentsModuleTests.cs | 4 ++-- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d7c7283..fd7cad2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sp.ClearAttachments(); } - public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) + public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData) { lock (sp.AttachmentsSyncLock) { @@ -273,9 +273,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments attachPos = Vector3.Zero; } + if (useAttachData) + { + group.RootPart.RotationOffset = group.RootPart.AttachRotation; + attachPos = group.RootPart.AttachOffset; + if (attachmentPt == 0) + { + attachmentPt = group.RootPart.AttachPoint; + if (attachmentPt == 0) + { + attachmentPt = (uint)AttachmentPoint.LeftHand; + attachPos = Vector3.Zero; + } + } + else if (group.RootPart.AttachPoint != attachmentPt) + { + attachPos = Vector3.Zero; + } + } group.AttachmentPoint = attachmentPt; group.AbsolutePosition = attachPos; - + // We also don't want to do any of the inventory operations for an NPC. if (sp.PresenceType != PresenceType.Npc) { @@ -792,7 +810,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // This will throw if the attachment fails try { - AttachObject(sp, objatt, attachmentPt, false); + AttachObject(sp, objatt, attachmentPt, false, false); } catch (Exception e) { @@ -947,7 +965,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments AttachmentPt &= 0x7f; // Calls attach with a Zero position - if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) + if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true)) { m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index bfe5e4a..7119ad2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; - m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); + m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false, false); // Check status on scene presence Assert.That(m_presence.HasAttachments(), Is.True); @@ -317,4 +317,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); // } } -} \ No newline at end of file +} -- cgit v1.1 From c87f0ac2261d1aa5226957aff63bfc8ac0efaffd Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 28 Jun 2012 21:23:42 +0200 Subject: Fix llRegionSayTo the right way --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 4d8fb90..357c2af 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -199,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat UUID fromID = UUID.Zero; string message = c.Message; IScene scene = c.Scene; + UUID destination = c.Destination; Vector3 fromPos = c.Position; Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); @@ -222,6 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat { fromNamePrefix = m_adminPrefix; } + destination = UUID.Zero; // Avatars cant "SayTo" break; case ChatSourceType.Object: @@ -244,9 +246,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat { // This should use ForEachClient, but clients don't have a position. // If camera is moved into client, then camera position can be used + // MT: No, it can't, as chat is heard from the avatar position, not + // the camera position. s.ForEachRootScenePresence( delegate(ScenePresence presence) { + if (destination != UUID.Zero && presence.UUID != destination) + return; ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); if (Presencecheck != null) { @@ -346,8 +352,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat UUID fromAgentID, string fromName, ChatTypeEnum type, string message, ChatSourceType src) { - // don't send stuff to child agents - if (presence.IsChildAgent) return false; + // don't send llRegionSay to child agents. Send normal chat because you + // can't talk across sim borders if it's not done + if (type == ChatTypeEnum.Broadcast && presence.IsChildAgent) return false; Vector3 fromRegionPos = fromPos + regionPos; Vector3 toRegionPos = presence.AbsolutePosition + -- cgit v1.1 From a1a22a2f1034a1feb67b141abf4b138248cdb356 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 28 Jun 2012 22:02:20 +0100 Subject: Revert "Mantis 5977 Corrections to llRegionSayTo" This reverts commit 679da63da617d031e5e7ae3f2d2a29db1a23ace3. Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 50 +++++++--------------- 1 file changed, 16 insertions(+), 34 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 6ffc7e6..5649855 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -197,7 +197,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat string fromName = c.From; string fromNamePrefix = ""; UUID fromID = UUID.Zero; - UUID targetID = c.TargetUUID; string message = c.Message; IScene scene = c.Scene; Vector3 fromPos = c.Position; @@ -236,31 +235,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat message = message.Substring(0, 1000); // m_log.DebugFormat( -// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}", -// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID); +// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}", +// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); HashSet receiverIDs = new HashSet(); - + foreach (Scene s in m_scenes) { - if (targetID == UUID.Zero) - { - // This should use ForEachClient, but clients don't have a position. - // If camera is moved into client, then camera position can be used - s.ForEachRootScenePresence( - delegate(ScenePresence presence) - { - if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false)) - receiverIDs.Add(presence.UUID); - } - ); - } - else - { - // This is a send to a specific client eg from llRegionSayTo - // no need to check distance etc, jand send is as say - ScenePresence presence = s.GetScenePresence(targetID); - if (presence != null && !presence.IsChildAgent) + // This should use ForEachClient, but clients don't have a position. + // If camera is moved into client, then camera position can be used + s.ForEachRootScenePresence( + delegate(ScenePresence presence) { ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); if (Presencecheck != null) @@ -271,14 +256,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // objects on a parcel with access restrictions if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) { - if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType, false)) + if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) receiverIDs.Add(presence.UUID); } } } - } + ); } - + (scene as Scene).EventManager.TriggerOnChatToClients( fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); } @@ -358,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat /// precondition protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, UUID fromAgentID, string fromName, ChatTypeEnum type, - string message, ChatSourceType src, bool ignoreDistance) + string message, ChatSourceType src) { // don't send stuff to child agents if (presence.IsChildAgent) return false; @@ -369,15 +354,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); - - if (!ignoreDistance) + + if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || + type == ChatTypeEnum.Say && dis > m_saydistance || + type == ChatTypeEnum.Shout && dis > m_shoutdistance) { - if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || - type == ChatTypeEnum.Say && dis > m_saydistance || - type == ChatTypeEnum.Shout && dis > m_shoutdistance) - { - return false; - } + return false; } // TODO: should change so the message is sent through the avatar rather than direct to the ClientView -- cgit v1.1 From 0d26e271c9a60d959b643500a83aee3e67c4d035 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jun 2012 01:02:22 +0200 Subject: stop chat being sent to child avs again. --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 357c2af..6215526 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -352,9 +352,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat UUID fromAgentID, string fromName, ChatTypeEnum type, string message, ChatSourceType src) { - // don't send llRegionSay to child agents. Send normal chat because you - // can't talk across sim borders if it's not done - if (type == ChatTypeEnum.Broadcast && presence.IsChildAgent) return false; + // don't send chat to child agents + if (presence.IsChildAgent) return false; Vector3 fromRegionPos = fromPos + regionPos; Vector3 toRegionPos = presence.AbsolutePosition + -- cgit v1.1 From 1598f9d1790d18f0ebd78bddc088b6e57829aca5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 20 Jul 2012 11:54:59 +0200 Subject: Fix the order of operations on detach. The object must always be serialized while still in the scene to avoid losing important script state. DeleteSceneObject can not be called before doing this! --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 394b90a..f073c4a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -757,18 +757,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); sp.RemoveAttachment(so); - // We can only remove the script instances from the script engine after we've retrieved their xml state - // when we update the attachment item. - m_scene.DeleteSceneObject(so, false, false); - // Prepare sog for storage so.AttachedAvatar = UUID.Zero; so.RootPart.SetParentLocalId(0); so.IsAttachment = false; - so.AbsolutePosition = so.RootPart.AttachedPos; + + // We cannot use AbsolutePosition here because that would + // attempt to cross the prim as it is detached + so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); UpdateKnownItem(sp, so, true); - so.RemoveScriptInstances(true); + + // This MUST happen AFTER serialization because it will + // either stop or remove the scripts. Both will cause scripts + // to be serialized in a stopped state with the true run + // state already lost. + m_scene.DeleteSceneObject(so, false, true); } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( -- cgit v1.1 From 9e00e2ddecdafa489de0ae67b78cf6971e55fe80 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 23 Jul 2012 21:08:02 +0200 Subject: Change attachment handling to remove object from the scene first as per justincc's original work. Sample scripts before doing so. Also refactor some crucial common code and eliminate parameters that were only ever used with the same constant value. --- .../Avatar/Attachments/AttachmentsModule.cs | 87 ++++++++++++++-------- 1 file changed, 58 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f073c4a..31e8a2e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Reflection; +using System.IO; using System.Xml; using log4net; using Mono.Addins; @@ -248,7 +249,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } - public void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted) + public void DeRezAttachments(IScenePresence sp) { if (!Enabled) return; @@ -259,18 +260,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { foreach (SceneObjectGroup so in sp.GetAttachments()) { - // We can only remove the script instances from the script engine after we've retrieved their xml state - // when we update the attachment item. - m_scene.DeleteSceneObject(so, false, false); - - if (saveChanged || saveAllScripted) - { - so.IsAttachment = false; - so.AbsolutePosition = so.RootPart.AttachedPos; - UpdateKnownItem(sp, so, saveAllScripted); - } - - so.RemoveScriptInstances(true); + UpdateDetachedObject(sp, so); } sp.ClearAttachments(); @@ -597,7 +587,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// - private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted) + private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, string scriptedState) { // Saving attachments for NPCs messes them up for the real owner! INPCModule module = m_scene.RequestModuleInterface(); @@ -607,13 +597,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; } - if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts())) + if (grp.HasGroupChanged) { // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", // grp.UUID, grp.AttachmentPoint); - string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); + string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID); item = m_scene.InventoryService.GetItem(item); @@ -750,29 +740,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return newItem; } - private void DetachSingleAttachmentToInvInternal(IScenePresence sp, SceneObjectGroup so) + private string GetObjectScriptStates(SceneObjectGroup grp) { - // m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name); + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + grp.SaveScriptedState(writer); + } - m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); - sp.RemoveAttachment(so); + return sw.ToString(); + } + } + + private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so) + { + // Don't save attachments for HG visitors, it + // messes up their inventory. When a HG visitor logs + // out on a foreign grid, their attachments will be + // reloaded in the state they were in when they left + // the home grid. This is best anyway as the visited + // grid may use an incompatible script engine. + bool saveChanged + = sp.PresenceType != PresenceType.Npc + && (m_scene.UserManagementModule == null + || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID)); + + // Scripts MUST be snapshotted before the object is + // removed from the scene because doing otherwise will + // clobber the run flag + string scriptedState = GetObjectScriptStates(so); + + // Remove the object from the scene so no more updates + // are sent. Doing this before the below changes will ensure + // updates can't cause "HUD artefacts" + m_scene.DeleteSceneObject(so, false, false); // Prepare sog for storage so.AttachedAvatar = UUID.Zero; so.RootPart.SetParentLocalId(0); so.IsAttachment = false; - // We cannot use AbsolutePosition here because that would - // attempt to cross the prim as it is detached - so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); + if (saveChanged) + { + // We cannot use AbsolutePosition here because that would + // attempt to cross the prim as it is detached + so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); + + UpdateKnownItem(sp, so, scriptedState); + } + + // Now, remove the scripts + so.RemoveScriptInstances(true); + } - UpdateKnownItem(sp, so, true); + private void DetachSingleAttachmentToInvInternal(IScenePresence sp, SceneObjectGroup so) + { + // m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name); + + m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); + sp.RemoveAttachment(so); - // This MUST happen AFTER serialization because it will - // either stop or remove the scripts. Both will cause scripts - // to be serialized in a stopped state with the true run - // state already lost. - m_scene.DeleteSceneObject(so, false, true); + UpdateDetachedObject(sp, so); } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( -- cgit v1.1 From 0993af08718eaf6956facd3f2ee77cef602de259 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jul 2012 11:38:30 +0200 Subject: Allow load and save of IAR without a password. The password must still be present on the command line for compatibility, but is ignored. Avination's IAR operations are administratively done and the staff doesn't have the passwords of the users. --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index cf87010..7d1fe68 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -492,6 +492,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return null; } + return account; + /* try { string encpass = Util.Md5Hash(pass); @@ -512,6 +514,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e.Message); return null; } + */ } /// -- cgit v1.1 From f71ed7eb79091de370800362f716d214dd27b03a Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 20 Aug 2012 15:35:06 +0200 Subject: Fix scripted detach of temp attachments --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 88ca9db..951afd7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -526,10 +526,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) { - // As per Linden spec, detach (take) is disabled for temp attachs - if (so.FromItemID == UUID.Zero) - return; - lock (sp.AttachmentsSyncLock) { // Save avatar attachment information @@ -1050,7 +1046,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); - if (sp != null && group != null) + if (sp != null && group != null && group.FromItemID != UUID.Zero) DetachSingleAttachmentToInv(sp, group); } @@ -1068,7 +1064,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments foreach (SceneObjectGroup group in attachments) { - if (group.FromItemID == itemID) + if (group.FromItemID == itemID && group.FromItemID != UUID.Zero) { DetachSingleAttachmentToInv(sp, group); return; -- cgit v1.1 From 0556bbefdda9643abf4bbba08ab8e3f066501b74 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 9 Sep 2012 16:30:01 +0200 Subject: Catch zero UUIDs in LSL and shout as an error. Also catch attempts to send IM to UUID.Zero because it ties up XMLRPC handlers needlessly. --- .../Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 1406aae..0c067d7 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -137,6 +137,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { UUID toAgentID = new UUID(im.toAgentID); + if (toAgentID == UUID.Zero) + return; + // Try root avatar only first foreach (Scene scene in m_Scenes) { -- cgit v1.1 From a76ce4f64d6f19e508d8e6f4d12e8f79f6880895 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 16 Sep 2012 22:50:35 +0200 Subject: Make the agent being kicked a child agent first so there won't be a ghost --- OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 1492302..716cc69 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -256,7 +256,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods if (sp.IsChildAgent) return; sp.ControllingClient.Kick(reason); - sp.Scene.IncomingCloseAgent(sp.UUID); + sp.MakeChildAgent(); + sp.ControllingClient.Close(); } private void OnIncomingInstantMessage(GridInstantMessage msg) -- cgit v1.1 From f433ee317be85fdf49bad84946a2e771ee1d6204 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Oct 2012 23:02:01 +0100 Subject: Attempt to fix Mantis #6311. Honor a destination folder if one is given --- .../Inventory/Transfer/InventoryTransferModule.cs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 81de29c..c14cb17 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -313,6 +313,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); } } + else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) + { + UUID destinationFolderID = UUID.Zero; + + if (im.binaryBucket != null && im.binaryBucket.Length >= 16) + { + destinationFolderID = new UUID(im.binaryBucket, 0); + } + + if (destinationFolderID != UUID.Zero) + { + IInventoryService invService = scene.InventoryService; + + UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip + + InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); + item = invService.GetItem(item); + InventoryFolderBase folder = null; + + if (item != null) // It's an item + { + item.Folder = destinationFolderID; + + invService.DeleteItems(item.Owner, new List() { item.ID }); + scene.AddInventoryItem(client, item); + } + else + { + folder = new InventoryFolderBase(inventoryID, client.AgentId); + folder = invService.GetFolder(folder); + + if (folder != null) // It's a folder + { + folder.ParentID = destinationFolderID; + invService.MoveFolder(folder); + } + } + } + } else if ( im.dialog == (byte)InstantMessageDialog.InventoryDeclined || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) -- cgit v1.1 From 9be2d5c77da8c2fc6c953e26a8b1412642588eb2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 7 Oct 2012 03:03:24 +0100 Subject: Fix merge issues --- OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | 2 +- OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 716cc69..82816d9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods transferModule.SendInstantMessage(new GridInstantMessage( m_scene, godID, "God", agentID, (byte)250, false, Utils.BytesToString(reason), UUID.Zero, true, - new Vector3(), new byte[] {(byte)kickflags}), + new Vector3(), new byte[] {(byte)kickflags}, true), delegate(bool success) {} ); } return; diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index a889984..1949459 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure client.FirstName+" "+client.LastName, targetid, (byte)InstantMessageDialog.GodLikeRequestTeleport, false, message, dest, false, presence.AbsolutePosition, - new Byte[0]); + new Byte[0], true); } else { @@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure client.FirstName+" "+client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, - new Byte[0]); + new Byte[0], true); } if (m_TransferModule != null) -- cgit v1.1 From 01f498bfb4e011d8c291fc7e87cd207215d7032d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 11 Oct 2012 21:10:25 +0200 Subject: Remove spammy debug for IM --- .../CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 0c067d7..e962624 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -164,8 +164,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage // try child avatar second foreach (Scene scene in m_Scenes) { - m_log.DebugFormat( - "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); + //m_log.DebugFormat( + // "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); ScenePresence sp = scene.GetScenePresence(toAgentID); if (sp != null) @@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); + //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); SendGridInstantMessageViaXMLRPC(im, result); } -- cgit v1.1 From aba078c93f4966cf6be10fc02228323843b9249e Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 14 Oct 2012 17:32:46 +0200 Subject: Fix perms when linking an object. Set root part perms to the perms of the link set to make the build floater behave consistently. Fixes permissions exploit introduced on 23 August. --- .../Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index e962624..edd9707 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); + m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); SendGridInstantMessageViaXMLRPC(im, result); } -- cgit v1.1 From d2499c4c314b290c42f454913305d97c6eec92d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 15:54:46 +0000 Subject: *TEST* Use new avatar size in ubitODE. --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 8496005..d557a28 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -174,12 +174,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // m_log.DebugFormat( // "[AVFACTORY]: Setting visual params for {0} to {1}", // client.Name, string.Join(", ", visualParamsStrings)); - +/* float oldHeight = sp.Appearance.AvatarHeight; changed = sp.Appearance.SetVisualParams(visualParams); if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); + */ + float oldoff = sp.Appearance.AvatarFeetOffset; + Vector3 oldbox = sp.Appearance.AvatarBoxSize; + changed = sp.Appearance.SetVisualParams(visualParams); + float off = sp.Appearance.AvatarFeetOffset; + Vector3 box = sp.Appearance.AvatarBoxSize; + if(oldoff != off || oldbox != box) + ((ScenePresence)sp).SetSize(box,off); + } // Process the baked texture array -- cgit v1.1 From 93bede4e6aa0838e14f39f5e641b028267d2683c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:26:58 +0000 Subject: revert the use of avatar skeleton and use avatar size provided by viewers, since at least for now seems good enought --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index d557a28..4c42397 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -145,6 +145,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory SetAppearance(sp, appearance.Texture, appearance.VisualParams); } + + public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) + { + float oldoff = sp.Appearance.AvatarFeetOffset; + Vector3 oldbox = sp.Appearance.AvatarBoxSize; + + SetAppearance(sp, textureEntry, visualParams); + sp.Appearance.SetSize(avSize); + + float off = sp.Appearance.AvatarFeetOffset; + Vector3 box = sp.Appearance.AvatarBoxSize; + if (oldoff != off || oldbox != box) + ((ScenePresence)sp).SetSize(box, off); + } + /// /// Set appearance data (texture asset IDs and slider settings) /// @@ -181,13 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); */ - float oldoff = sp.Appearance.AvatarFeetOffset; - Vector3 oldbox = sp.Appearance.AvatarBoxSize; +// float oldoff = sp.Appearance.AvatarFeetOffset; +// Vector3 oldbox = sp.Appearance.AvatarBoxSize; changed = sp.Appearance.SetVisualParams(visualParams); - float off = sp.Appearance.AvatarFeetOffset; - Vector3 box = sp.Appearance.AvatarBoxSize; - if(oldoff != off || oldbox != box) - ((ScenePresence)sp).SetSize(box,off); +// float off = sp.Appearance.AvatarFeetOffset; +// Vector3 box = sp.Appearance.AvatarBoxSize; +// if(oldoff != off || oldbox != box) +// ((ScenePresence)sp).SetSize(box,off); } @@ -620,12 +635,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) + private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) { // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); ScenePresence sp = m_scene.GetScenePresence(client.AgentId); if (sp != null) - SetAppearance(sp, textureEntry, visualParams); + SetAppearance(sp, textureEntry, visualParams,avSize); else m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); } -- cgit v1.1 From 20773dcfccc04d8af14e27f87746711bfaba07b1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 02:55:36 +0000 Subject: add a Check method to flotsamAssetCache, so to check if a asset is in cache without actually loading it. Make use limited use of it in avatarfactory textures check. Also on llclientview HandleAgentTextureCached that now should work. Other asset cache modules for now will return false, so are broken. baked textures logic still unchanged. *UNTESTED* --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 51 ++++++++++++++++------ 1 file changed, 38 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 4c42397..3532b1d 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -361,6 +361,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public bool ValidateBakedTextureCache(IScenePresence sp) { bool defonly = true; // are we only using default textures + IImprovedAssetCache cache = m_scene.RequestModuleInterface(); // Process the texture entry for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) @@ -385,8 +386,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory defonly = false; // found a non-default texture reference - if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) - return false; + if (cache != null) + { + if (!cache.Check(face.TextureID.ToString())) + return false; + } + else + { + if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) + return false; + } } // m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); @@ -398,6 +407,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) { int texturesRebaked = 0; + IImprovedAssetCache cache = m_scene.RequestModuleInterface(); for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { @@ -421,21 +431,36 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (missingTexturesOnly) { - if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) + if (cache != null) { - continue; + if (cache.Check(face.TextureID.ToString())) + continue; + else + { + m_log.DebugFormat( + "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + face.TextureID, idx, sp.Name); + } } else { - // On inter-simulator teleports, this occurs if baked textures are not being stored by the - // grid asset service (which means that they are not available to the new region and so have - // to be re-requested from the client). - // - // The only available core OpenSimulator behaviour right now - // is not to store these textures, temporarily or otherwise. - m_log.DebugFormat( - "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", - face.TextureID, idx, sp.Name); + if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) + { + continue; + } + + else + { + // On inter-simulator teleports, this occurs if baked textures are not being stored by the + // grid asset service (which means that they are not available to the new region and so have + // to be re-requested from the client). + // + // The only available core OpenSimulator behaviour right now + // is not to store these textures, temporarily or otherwise. + m_log.DebugFormat( + "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + face.TextureID, idx, sp.Name); + } } } else -- cgit v1.1 From 77cc7ce399d1b1a710f3b3f4337932febdef66c8 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 21 Dec 2012 19:12:30 -0500 Subject: * Partial Commit for Avatar Appearance to include the functionality of Cached Bakes. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 34 ++++++++++++++++------ .../Tests/AvatarFactoryModuleTests.cs | 4 +-- 2 files changed, 27 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 3532b1d..3080023 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -140,18 +140,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - public void SetAppearance(IScenePresence sp, AvatarAppearance appearance) + public void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems) { - SetAppearance(sp, appearance.Texture, appearance.VisualParams); + SetAppearance(sp, appearance.Texture, appearance.VisualParams, cacheItems); } - public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) + public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) { float oldoff = sp.Appearance.AvatarFeetOffset; Vector3 oldbox = sp.Appearance.AvatarBoxSize; - SetAppearance(sp, textureEntry, visualParams); + SetAppearance(sp, textureEntry, visualParams, cacheItems); sp.Appearance.SetSize(avSize); float off = sp.Appearance.AvatarFeetOffset; @@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams) + public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems) { // m_log.DebugFormat( // "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}", @@ -205,11 +205,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // ((ScenePresence)sp).SetSize(box,off); } - + //if (cacheItems.Length > 0) + //{ + sp.Appearance.WearableCacheItems = cacheItems; + //} // Process the baked texture array if (textureEntry != null) { -// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); + m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); // WriteBakedTexturesReport(sp, m_log.DebugFormat); @@ -278,6 +281,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return GetBakedTextureFaces(sp); } + public WearableCacheItem[] GetCachedItems(UUID agentId) + { + ScenePresence sp = m_scene.GetScenePresence(agentId); + Dictionary bakedTextures = GetBakedTextureFaces(sp); + + WearableCacheItem[] items = sp.Appearance.WearableCacheItems; + //foreach (WearableCacheItem item in items) + //{ + + //} + return items; + } + public bool SaveBakedTextures(UUID agentId) { ScenePresence sp = m_scene.GetScenePresence(agentId); @@ -660,12 +676,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) + private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) { // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); ScenePresence sp = m_scene.GetScenePresence(client.AgentId); if (sp != null) - SetAppearance(sp, textureEntry, visualParams,avSize); + SetAppearance(sp, textureEntry, visualParams,avSize, cacheItems); else m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 848b3bf..e21547c 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory for (byte i = 0; i < visualParams.Length; i++) visualParams[i] = i; - afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); + afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]); // TODO: Check baked texture Assert.AreEqual(visualParams, sp.Appearance.VisualParams); @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); eyesFace.TextureID = eyesTextureId; - afm.SetAppearance(sp, bakedTextureEntry, visualParams); + afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]); afm.SaveBakedTextures(userId); // Dictionary bakedTextures = afm.GetBakedTextureFaces(userId); -- cgit v1.1 From 6797ac14741851efa5ba60a00891e18cf7755c80 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 29 Dec 2012 08:53:58 -0500 Subject: * This finishes the implementation of AgentCachedTexture. Requires the XBakes Module and service for full functionality. Previous no-cache functionality works without the service and module. In some ways, I would have been happier not putting an AssetBase in WearableCacheItem.. but turns out it was probably unavoidable. No additional locks, yay. --- .../Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 3080023..27cf204 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -205,10 +205,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // ((ScenePresence)sp).SetSize(box,off); } - //if (cacheItems.Length > 0) - //{ - sp.Appearance.WearableCacheItems = cacheItems; - //} + // Process the baked texture array if (textureEntry != null) { @@ -284,8 +281,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public WearableCacheItem[] GetCachedItems(UUID agentId) { ScenePresence sp = m_scene.GetScenePresence(agentId); - Dictionary bakedTextures = GetBakedTextureFaces(sp); - WearableCacheItem[] items = sp.Appearance.WearableCacheItems; //foreach (WearableCacheItem item in items) //{ -- cgit v1.1 From 3e0e9a096287512f1e53b4f54c5e916958774d8e Mon Sep 17 00:00:00 2001 From: teravus Date: Wed, 16 Jan 2013 17:59:13 -0500 Subject: * Enables loading cached bakes on teleport by filling in the appropriate avatar fields from the bake data. No more auto rebaking on teleport assuming your wearables, bakes and cache are consistent. * Speeds up appearance sending.. since there's nothing to wait for. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 73 +++++++++++++++++++++- 1 file changed, 71 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 27cf204..7ec2860 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -373,6 +373,52 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { bool defonly = true; // are we only using default textures IImprovedAssetCache cache = m_scene.RequestModuleInterface(); + IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); + WearableCacheItem[] wearableCache = null; + + // Cache wearable data for teleport. + // Only makes sense if there's a bake module and a cache module + if (bakedModule != null && cache != null) + { + try + { + wearableCache = bakedModule.Get(sp.UUID); + } + catch (Exception) + { + + } + if (wearableCache != null) + { + for (int i = 0; i < wearableCache.Length; i++) + { + cache.Cache(wearableCache[i].TextureAsset); + } + } + } + /* + IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); + if (invService.GetRootFolder(userID) != null) + { + WearableCacheItem[] wearableCache = null; + if (bakedModule != null) + { + try + { + wearableCache = bakedModule.Get(userID); + appearance.WearableCacheItems = wearableCache; + appearance.WearableCacheItemsDirty = false; + foreach (WearableCacheItem item in wearableCache) + { + appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID; + } + } + catch (Exception) + { + + } + } + */ // Process the texture entry for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) @@ -380,9 +426,32 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory int idx = AvatarAppearance.BAKE_INDICES[i]; Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - // if there is no texture entry, skip it + // No face, so lets check our baked service cache, teleport or login. if (face == null) - continue; + { + if (wearableCache != null) + { + // If we find the an appearance item, set it as the textureentry and the face + WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache); + if (searchitem != null) + { + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx); + sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID; + face = sp.Appearance.Texture.FaceTextures[idx]; + } + else + { + // if there is no texture entry and no baked cache, skip it + continue; + } + } + else + { + //No texture entry face and no cache. Skip this face. + continue; + } + } + // m_log.DebugFormat( // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", -- cgit v1.1 From 13232718262920101ee50cfbe87192096c5c3805 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 19 Jan 2013 13:21:43 +0100 Subject: Kill the dumb Opensimulator Testing group again - for good. --- OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index af54c1a..d2ef6b1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs @@ -73,17 +73,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups } else { - m_Enabled = groupsConfig.GetBoolean("Enabled", false); - if (!m_Enabled) + if (groupsConfig.GetBoolean("Enabled", false)) { - m_log.Info("[GROUPS]: Groups disabled in configuration"); - return; + if (groupsConfig.GetString("Module", "Default") == "Default") + m_Enabled = true; } - - if (groupsConfig.GetString("Module", "Default") != "Default") - return; } - } public void AddRegion(Scene scene) -- cgit v1.1 From bd77e2b7bac54112040706eb26f2d787f668d8a9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 19 Jan 2013 14:29:09 +0100 Subject: Remove the core groups module --- .../CoreModules/Avatar/Groups/GroupsModule.cs | 252 --------------------- 1 file changed, 252 deletions(-) delete mode 100644 OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs deleted file mode 100644 index d2ef6b1..0000000 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -using Mono.Addins; - -namespace OpenSim.Region.CoreModules.Avatar.Groups -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")] - public class GroupsModule : ISharedRegionModule - { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Dictionary m_GroupMap = - new Dictionary(); - - private Dictionary m_ClientMap = - new Dictionary(); - - private UUID opensimulatorGroupID = - new UUID("00000000-68f9-1111-024e-222222111123"); - - private List m_SceneList = new List(); - - private static GroupMembershipData osGroup = - new GroupMembershipData(); - - private bool m_Enabled = false; - - #region ISharedRegionModule Members - - public void Initialise(IConfigSource config) - { - IConfig groupsConfig = config.Configs["Groups"]; - - if (groupsConfig == null) - { - m_log.Info("[GROUPS]: No configuration found. Using defaults"); - } - else - { - if (groupsConfig.GetBoolean("Enabled", false)) - { - if (groupsConfig.GetString("Module", "Default") == "Default") - m_Enabled = true; - } - } - } - - public void AddRegion(Scene scene) - { - if (!m_Enabled) - return; - - lock (m_SceneList) - { - if (!m_SceneList.Contains(scene)) - { - if (m_SceneList.Count == 0) - { - osGroup.GroupID = opensimulatorGroupID; - osGroup.GroupName = "OpenSimulator Testing"; - osGroup.GroupPowers = - (uint)(GroupPowers.AllowLandmark | - GroupPowers.AllowSetHome); - m_GroupMap[opensimulatorGroupID] = osGroup; - } - m_SceneList.Add(scene); - } - } - - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnClientClosed += OnClientClosed; - // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; - } - - public void RemoveRegion(Scene scene) - { - if (!m_Enabled) - return; - - lock (m_SceneList) - { - if (m_SceneList.Contains(scene)) - m_SceneList.Remove(scene); - } - - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnClientClosed -= OnClientClosed; - } - - public void RegionLoaded(Scene scene) - { - } - - public void PostInitialise() - { - } - - public void Close() - { - if (!m_Enabled) - return; - -// m_log.Debug("[GROUPS]: Shutting down group module."); - - lock (m_ClientMap) - { - m_ClientMap.Clear(); - } - - lock (m_GroupMap) - { - m_GroupMap.Clear(); - } - } - - public string Name - { - get { return "GroupsModule"; } - } - - public Type ReplaceableInterface - { - get { return null; } - } - - #endregion - - private void OnNewClient(IClientAPI client) - { - // Subscribe to instant messages -// client.OnInstantMessage += OnInstantMessage; - client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; - client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; - lock (m_ClientMap) - { - if (!m_ClientMap.ContainsKey(client.AgentId)) - { - m_ClientMap.Add(client.AgentId, client); - } - } - - GroupMembershipData[] updateGroups = new GroupMembershipData[1]; - updateGroups[0] = osGroup; - - client.SendGroupMembership(updateGroups); - } - - private void OnAgentDataUpdateRequest(IClientAPI remoteClient, - UUID AgentID, UUID SessionID) - { - UUID ActiveGroupID; - string ActiveGroupName; - ulong ActiveGroupPowers; - - string firstname = remoteClient.FirstName; - string lastname = remoteClient.LastName; - - string ActiveGroupTitle = "I IZ N0T"; - - ActiveGroupID = osGroup.GroupID; - ActiveGroupName = osGroup.GroupName; - ActiveGroupPowers = osGroup.GroupPowers; - - remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, - lastname, ActiveGroupPowers, ActiveGroupName, - ActiveGroupTitle); - } - -// private void OnInstantMessage(IClientAPI client, GridInstantMessage im) -// { -// } - -// private void OnGridInstantMessage(GridInstantMessage msg) -// { -// // Trigger the above event handler -// OnInstantMessage(null, msg); -// } - - private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client) - { - string groupnamereply = "Unknown"; - UUID groupUUID = UUID.Zero; - - lock (m_GroupMap) - { - if (m_GroupMap.ContainsKey(id)) - { - GroupMembershipData grp = m_GroupMap[id]; - groupnamereply = grp.GroupName; - groupUUID = grp.GroupID; - } - } - remote_client.SendGroupNameReply(groupUUID, groupnamereply); - } - - private void OnClientClosed(UUID agentID, Scene scene) - { - lock (m_ClientMap) - { - if (m_ClientMap.ContainsKey(agentID)) - { -// IClientAPI cli = m_ClientMap[agentID]; -// if (cli != null) -// { -// //m_log.Info("[GROUPS]: Removing all reference to groups for " + cli.Name); -// } -// else -// { -// //m_log.Info("[GROUPS]: Removing all reference to groups for " + agentID.ToString()); -// } - m_ClientMap.Remove(agentID); - } - } - } - } -} -- cgit v1.1 From 564b513963bd35e072b0a1f760cfc5ac8675f776 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 26 Jan 2013 07:31:54 -0500 Subject: * This update is ugly as sin, but it 'fills in the blanks' of your appearance when your inventory items go missing. This repairs appearance from missing wearables immediately on the V1 appearance pipeline, the second login on Firestorm. It only replaces the essential body parts that are missing.. hair, skin, eyes, shape... so if you delete all your wearables, you will rez naked. Anyway, this is still experimental.. I need another day of playing with this to handle all of the situations. One thing that I still need to do is try and get the assets.. and if we can't get the assets for some reason, skip and replace that part of the outfit. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 263 ++++++++++++++++++++- 1 file changed, 259 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 7ec2860..fd442dc 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -674,20 +674,53 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) { IInventoryService invService = m_scene.InventoryService; - + bool resetwearable = false; if (invService.GetRootFolder(userID) != null) { for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) { for (int j = 0; j < appearance.Wearables[i].Count; j++) { + // Check if the default wearables are not set if (appearance.Wearables[i][j].ItemID == UUID.Zero) + { + switch ((WearableType) i) + { + case WearableType.Eyes: + case WearableType.Hair: + case WearableType.Shape: + case WearableType.Skin: + //case WearableType.Underpants: + TryAndRepair((WearableType)i, invService, userID, appearance); + resetwearable = true; + m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values."); + resetwearable = true; + break; + + } continue; + } - // Ignore ruth's assets + // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) + { + switch ((WearableType)i) + { + case WearableType.Eyes: + case WearableType.Hair: + case WearableType.Shape: + case WearableType.Skin: + //case WearableType.Underpants: + TryAndRepair((WearableType)i, invService, userID, appearance); + + m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i); + resetwearable = true; + break; + + } continue; - + } + InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); baseItem = invService.GetItem(baseItem); @@ -701,17 +734,239 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", appearance.Wearables[i][j].ItemID, (WearableType)i); - appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID); + TryAndRepair((WearableType)i, invService, userID, appearance); + resetwearable = true; + } } } + + // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... + if (appearance.Wearables[(int) WearableType.Eyes] == null) + { + m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes)); + + TryAndRepair(WearableType.Eyes, invService, userID, appearance); + resetwearable = true; + } + else + { + if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero) + { + m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}", + appearance.Wearables[(int) WearableType.Eyes][0].ItemID, + appearance.Wearables[(int) WearableType.Eyes][0].AssetID); + TryAndRepair(WearableType.Eyes, invService, userID, appearance); + resetwearable = true; + + } + + } + // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... + if (appearance.Wearables[(int)WearableType.Shape] == null) + { + m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape)); + + TryAndRepair(WearableType.Shape, invService, userID, appearance); + resetwearable = true; + } + else + { + if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero) + { + m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}", + appearance.Wearables[(int)WearableType.Shape][0].ItemID, + appearance.Wearables[(int)WearableType.Shape][0].AssetID); + TryAndRepair(WearableType.Shape, invService, userID, appearance); + resetwearable = true; + + } + + } + // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... + if (appearance.Wearables[(int)WearableType.Hair] == null) + { + m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair)); + + TryAndRepair(WearableType.Hair, invService, userID, appearance); + resetwearable = true; + } + else + { + if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero) + { + m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}", + appearance.Wearables[(int)WearableType.Hair][0].ItemID, + appearance.Wearables[(int)WearableType.Hair][0].AssetID); + TryAndRepair(WearableType.Hair, invService, userID, appearance); + resetwearable = true; + + } + + } + // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... + if (appearance.Wearables[(int)WearableType.Skin] == null) + { + m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin)); + + TryAndRepair(WearableType.Skin, invService, userID, appearance); + resetwearable = true; + } + else + { + if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero) + { + m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}", + appearance.Wearables[(int)WearableType.Skin][0].ItemID, + appearance.Wearables[(int)WearableType.Skin][0].AssetID); + TryAndRepair(WearableType.Skin, invService, userID, appearance); + resetwearable = true; + + } + + } + if (resetwearable) + { + ScenePresence presence = null; + if (m_scene.TryGetScenePresence(userID, out presence)) + { + presence.ControllingClient.SendWearables(presence.Appearance.Wearables, + presence.Appearance.Serial++); + } + } + } else { m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); } } + private void TryAndRepair(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance) + { + UUID defaultwearable = GetDefaultItem(type); + if (defaultwearable != UUID.Zero) + { + UUID newInvItem = UUID.Random(); + InventoryItemBase itembase = new InventoryItemBase(newInvItem, userID) + { + AssetID = + defaultwearable, + AssetType + = + (int) + AssetType + .Bodypart, + CreatorId + = + userID + .ToString + (), + //InvType = (int)InventoryType.Wearable, + + Description + = + "Failed Wearable Replacement", + Folder = + invService + .GetFolderForType + (userID, + AssetType + .Bodypart) + .ID, + Flags = (uint) type, + Name = Enum.GetName(typeof (WearableType), type), + BasePermissions = (uint) PermissionMask.Copy, + CurrentPermissions = (uint) PermissionMask.Copy, + EveryOnePermissions = (uint) PermissionMask.Copy, + GroupPermissions = (uint) PermissionMask.Copy, + NextPermissions = (uint) PermissionMask.Copy + }; + invService.AddItem(itembase); + UUID LinkInvItem = UUID.Random(); + itembase = new InventoryItemBase(LinkInvItem, userID) + { + AssetID = + newInvItem, + AssetType + = + (int) + AssetType + .Link, + CreatorId + = + userID + .ToString + (), + InvType = (int) InventoryType.Wearable, + + Description + = + "Failed Wearable Replacement", + Folder = + invService + .GetFolderForType + (userID, + AssetType + .CurrentOutfitFolder) + .ID, + Flags = (uint) type, + Name = Enum.GetName(typeof (WearableType), type), + BasePermissions = (uint) PermissionMask.Copy, + CurrentPermissions = (uint) PermissionMask.Copy, + EveryOnePermissions = (uint) PermissionMask.Copy, + GroupPermissions = (uint) PermissionMask.Copy, + NextPermissions = (uint) PermissionMask.Copy + }; + invService.AddItem(itembase); + appearance.Wearables[(int)type] = new AvatarWearable(newInvItem, GetDefaultItem(type)); + ScenePresence presence = null; + if (m_scene.TryGetScenePresence(userID, out presence)) + { + m_scene.SendInventoryUpdate(presence.ControllingClient, + invService.GetFolderForType(userID, + AssetType + .CurrentOutfitFolder), + false, true); + } + } + } + private UUID GetDefaultItem(WearableType wearable) + { + // These are Urban male.. but it doesn't matter as long as the assets exist. + UUID ret = UUID.Zero; + switch (wearable) + { + case WearableType.Eyes: + ret = new UUID("46d7f979-c060-0ad6-5d3c-8de38c941c8d"); + break; + case WearableType.Hair: + ret = new UUID("21ae002d-57af-441a-81ff-86f5f674b9b9"); + break; + case WearableType.Pants: + ret = new UUID("e3440698-48fd-41ac-af9b-f680547cbef2"); + break; + case WearableType.Shape: + ret = new UUID("7c1f1354-2aba-4e55-8357-1545c2c003ce"); + break; + case WearableType.Shirt: + ret = new UUID("f8fefa00-b019-4072-9c04-ff79c65348b9"); + break; + case WearableType.Shoes: + ret = new UUID("6455d2cf-0ee1-4c9a-9812-da03371bf719"); + break; + case WearableType.Skin: + ret = new UUID("29c99e80-cf59-4fa0-9f8e-e4a1ccaf2fa3"); + break; + case WearableType.Socks: + ret = new UUID("96472ac3-1e18-49e5-b2e4-17c03791ea96"); + break; + case WearableType.Underpants: + ret = new UUID("d6c7b174-8a2d-473f-a80f-3b7d7b7b3a96"); + break; + } + return ret; + } #endregion #region Client Event Handlers -- cgit v1.1 From 2a558c7346fc5070d98fb96e8495a67d23f04ea7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 28 Jan 2013 01:20:16 +0100 Subject: Change default avatar replacements to be ruth rather than urban male --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index fd442dc..a9d11d5 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -932,36 +932,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } private UUID GetDefaultItem(WearableType wearable) { - // These are Urban male.. but it doesn't matter as long as the assets exist. + // These are ruth UUID ret = UUID.Zero; switch (wearable) { case WearableType.Eyes: - ret = new UUID("46d7f979-c060-0ad6-5d3c-8de38c941c8d"); + ret = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7"); break; case WearableType.Hair: - ret = new UUID("21ae002d-57af-441a-81ff-86f5f674b9b9"); + ret = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); break; case WearableType.Pants: - ret = new UUID("e3440698-48fd-41ac-af9b-f680547cbef2"); + ret = new UUID("00000000-38f9-1111-024e-222222111120"); break; case WearableType.Shape: - ret = new UUID("7c1f1354-2aba-4e55-8357-1545c2c003ce"); + ret = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); break; case WearableType.Shirt: - ret = new UUID("f8fefa00-b019-4072-9c04-ff79c65348b9"); - break; - case WearableType.Shoes: - ret = new UUID("6455d2cf-0ee1-4c9a-9812-da03371bf719"); + ret = new UUID("00000000-38f9-1111-024e-222222111110"); break; case WearableType.Skin: - ret = new UUID("29c99e80-cf59-4fa0-9f8e-e4a1ccaf2fa3"); + ret = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); break; - case WearableType.Socks: - ret = new UUID("96472ac3-1e18-49e5-b2e4-17c03791ea96"); + case WearableType.Undershirt: + ret = new UUID("16499ebb-3208-ec27-2def-481881728f47"); break; case WearableType.Underpants: - ret = new UUID("d6c7b174-8a2d-473f-a80f-3b7d7b7b3a96"); + ret = new UUID("4ac2e9c7-3671-d229-316a-67717730841d"); break; } -- cgit v1.1 From e83893c8bcb26d0af191df7e19c5059c80896f51 Mon Sep 17 00:00:00 2001 From: teravus Date: Tue, 29 Jan 2013 06:12:04 -0500 Subject: * This Checks the asset of each wearable asynchronously and repairs if it's required. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 35 ++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index a9d11d5..1adff7e 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -691,7 +691,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory case WearableType.Shape: case WearableType.Skin: //case WearableType.Underpants: - TryAndRepair((WearableType)i, invService, userID, appearance); + TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); resetwearable = true; m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values."); resetwearable = true; @@ -711,7 +711,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory case WearableType.Shape: case WearableType.Skin: //case WearableType.Underpants: - TryAndRepair((WearableType)i, invService, userID, appearance); + TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i); resetwearable = true; @@ -727,6 +727,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (baseItem != null) { appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); + int unmodifiedWearableIndexForClosure = i; + m_scene.AssetService.Get(baseItem.AssetID.ToString(), this, + delegate(string x, object y, AssetBase z) + { + if (z == null) + { + TryAndRepairBrokenWearable( + (WearableType)unmodifiedWearableIndexForClosure, invService, + userID, appearance); + } + }); } else { @@ -734,7 +745,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", appearance.Wearables[i][j].ItemID, (WearableType)i); - TryAndRepair((WearableType)i, invService, userID, appearance); + TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); resetwearable = true; } @@ -746,7 +757,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes)); - TryAndRepair(WearableType.Eyes, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); resetwearable = true; } else @@ -756,7 +767,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}", appearance.Wearables[(int) WearableType.Eyes][0].ItemID, appearance.Wearables[(int) WearableType.Eyes][0].AssetID); - TryAndRepair(WearableType.Eyes, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); resetwearable = true; } @@ -767,7 +778,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape)); - TryAndRepair(WearableType.Shape, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance); resetwearable = true; } else @@ -777,7 +788,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}", appearance.Wearables[(int)WearableType.Shape][0].ItemID, appearance.Wearables[(int)WearableType.Shape][0].AssetID); - TryAndRepair(WearableType.Shape, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance); resetwearable = true; } @@ -788,7 +799,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair)); - TryAndRepair(WearableType.Hair, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance); resetwearable = true; } else @@ -798,7 +809,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}", appearance.Wearables[(int)WearableType.Hair][0].ItemID, appearance.Wearables[(int)WearableType.Hair][0].AssetID); - TryAndRepair(WearableType.Hair, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance); resetwearable = true; } @@ -809,7 +820,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin)); - TryAndRepair(WearableType.Skin, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance); resetwearable = true; } else @@ -819,7 +830,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}", appearance.Wearables[(int)WearableType.Skin][0].ItemID, appearance.Wearables[(int)WearableType.Skin][0].AssetID); - TryAndRepair(WearableType.Skin, invService, userID, appearance); + TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance); resetwearable = true; } @@ -841,7 +852,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); } } - private void TryAndRepair(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance) + private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance) { UUID defaultwearable = GetDefaultItem(type); if (defaultwearable != UUID.Zero) -- cgit v1.1 From 797bfbfcfaf5485db755ad6a5b19a064210505fd Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Mar 2013 12:02:22 +0100 Subject: Multiattach, part 1 --- .../Avatar/Attachments/AttachmentsModule.cs | 46 +++++++++------------- .../Attachments/Tests/AttachmentsModuleTests.cs | 4 +- 2 files changed, 20 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index acd156e..9647217 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -236,9 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // If we're an NPC then skip all the item checks and manipulations since we don't have an // inventory right now. if (sp.PresenceType == PresenceType.Npc) - RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); + RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null, true); else - RezSingleAttachmentFromInventory(sp, attach.ItemID, p, d); + RezSingleAttachmentFromInventory(sp, attach.ItemID, p | (uint)0x80, d); } catch (Exception e) { @@ -284,12 +284,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sp.ClearAttachments(); } - public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp) + public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool append) { if (!Enabled) return false; - if (AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp)) + if (AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp, append)) { m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); return true; @@ -298,7 +298,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return false; } - private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp) + private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool append) { lock (sp.AttachmentsSyncLock) { @@ -326,10 +326,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments Vector3 attachPos = group.AbsolutePosition; - // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should - // be removed when that functionality is implemented in opensim - attachmentPt &= 0x7f; - // If the attachment point isn't the same as the one previously used // set it's offset position = 0 so that it appears on the attachment point // and not in a weird location somewhere unknown. @@ -375,7 +371,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments group.AbsolutePosition = attachPos; if (sp.PresenceType != PresenceType.Npc) - UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp); + UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp, append); AttachToAgent(sp, group, attachmentPt, attachPos, silent); } @@ -383,21 +379,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return true; } - private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp) + private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append) { // Remove any previous attachments List attachments = sp.GetAttachments(attachmentPt); // At the moment we can only deal with a single attachment - if (attachments.Count != 0) + if (attachments.Count != 0 && !append) { if (attachments[0].FromItemID != UUID.Zero) DetachSingleAttachmentToInvInternal(sp, attachments[0]); - // Error logging commented because UUID.Zero now means temp attachment -// else -// m_log.WarnFormat( -// "[ATTACHMENTS MODULE]: When detaching existing attachment {0} {1} at point {2} to make way for {3} {4} for {5}, couldn't find the associated item ID to adjust inventory attachment record!", -// attachments[0].Name, attachments[0].LocalId, attachmentPt, group.Name, group.LocalId, sp.Name); } // Add the new attachment to inventory if we don't already have it. @@ -407,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (newAttachmentItemID == UUID.Zero) newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID; - ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group); + ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append); } } @@ -425,8 +416,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}", // (AttachmentPoint)AttachmentPt, itemID, sp.Name); - // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should - // be removed when that functionality is implemented in opensim + bool append = (AttachmentPt & 0x80) != 0; AttachmentPt &= 0x7f; // Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such). @@ -455,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return null; } - return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc); + return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc, append); } public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List> rezlist) @@ -847,7 +837,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( - IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) + IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc, bool append) { if (m_invAccessModule == null) return null; @@ -885,7 +875,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // This will throw if the attachment fails try { - AttachObjectInternal(sp, objatt, attachmentPt, false, false, false); + AttachObjectInternal(sp, objatt, attachmentPt, false, false, false, append); } catch (Exception e) { @@ -936,7 +926,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// - private void ShowAttachInUserInventory(IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att) + private void ShowAttachInUserInventory(IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att, bool append) { // m_log.DebugFormat( // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", @@ -959,7 +949,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (item == null) return; - bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); + int attFlag = append ? 0x80 : 0; + bool changed = sp.Appearance.SetAttachment((int)AttachmentPt | attFlag, itemID, item.AssetID); if (changed && m_scene.AvatarFactory != null) { // m_log.DebugFormat( @@ -1043,12 +1034,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; } - // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should - // be removed when that functionality is implemented in opensim + bool append = (AttachmentPt & 0x80) != 0; AttachmentPt &= 0x7f; // Calls attach with a Zero position - if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, false)) + if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, false, append)) { // m_log.Debug( // "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 4e9d3f9..545aeda 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -197,7 +197,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); m_numberOfAttachEventsFired = 0; - scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false); + scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false); // Check status on scene presence Assert.That(sp.HasAttachments(), Is.True); @@ -254,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests sp2.AbsolutePosition = new Vector3(0, 0, 0); sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); - scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false); + scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false); Assert.That(sp.HasAttachments(), Is.False); Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); -- cgit v1.1 From 9ffa08ea6b10d96a906b4896087ac3c2abd1b798 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Mar 2013 15:11:30 +0100 Subject: Limit each attachment point to 5 items as per spec --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 9647217..7cc5092 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -381,14 +381,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append) { - // Remove any previous attachments List attachments = sp.GetAttachments(attachmentPt); - // At the moment we can only deal with a single attachment - if (attachments.Count != 0 && !append) + // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones + while (attachments.Count >= 5) { if (attachments[0].FromItemID != UUID.Zero) DetachSingleAttachmentToInvInternal(sp, attachments[0]); + attachments.RemoveAt(0); + } + + // If we're not appending, remove the rest as well + if (attachments.Count != 0 && !append) + { + foreach (SceneObjectGroup g in attachments) + { + if (g.FromItemID != UUID.Zero) + DetachSingleAttachmentToInvInternal(sp, g); + } } // Add the new attachment to inventory if we don't already have it. -- cgit v1.1 From 566ab7ccf92c607fa06e38700c8094680eea704c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 19 Mar 2013 01:19:33 +0000 Subject: Fix merge artefacts --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 6 +++--- .../CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 296f198..c94d152 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -304,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (!Enabled) return false; - AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp, append); + return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp, false, append); } /// @@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// If true then scripts are resumed on the attached object. - private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool append) + private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool resumeScripts, bool append) { // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", @@ -917,7 +917,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments objatt.ResetOwnerChangeFlag(); } - AttachObjectInternal(sp, objatt, attachmentPt, false, true, false, append); + AttachObjectInternal(sp, objatt, attachmentPt, false, true, false, true, append); } catch (Exception e) { diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index da4bc83..dee8ce3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID); m_numberOfAttachEventsFired = 0; - scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, false); + scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, false, false, false); // Check status on scene presence Assert.That(sp.HasAttachments(), Is.True); @@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Test wearing a different attachment from the ground. { - scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false); + scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false); // Check status on scene presence Assert.That(sp.HasAttachments(), Is.True); @@ -310,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Test rewearing an already worn attachment from ground. Nothing should happen. { - scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false); + scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false); // Check status on scene presence Assert.That(sp.HasAttachments(), Is.True); -- cgit v1.1 From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Mar 2013 18:56:28 +0100 Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions" --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 1 + OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs | 1 + 2 files changed, 2 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 51fe1ea..bc79944 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -40,6 +40,7 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using Mono.Addins; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs index 5ec0ea9..b44a5c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs @@ -36,6 +36,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using Mono.Addins; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.CoreModules.Avatar.Friends { -- cgit v1.1 From 51e05dcb5be80bc93061443072fd5587f83052e6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Apr 2013 01:37:18 +0200 Subject: Gods module cleanup --- OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 9fa9be1..d2e71a7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -67,9 +67,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods protected Scene m_scene; protected IDialogModule m_dialogModule; - protected Dictionary m_capsDict = - new Dictionary(); - protected IDialogModule DialogModule { get @@ -91,7 +88,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods m_scene.RegisterModuleInterface(this); m_scene.EventManager.OnNewClient += SubscribeToClientEvents; m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; - m_scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnIncomingInstantMessage += OnIncomingInstantMessage; } @@ -127,15 +123,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods client.OnRequestGodlikePowers -= RequestGodlikePowers; } - private void OnClientClosed(UUID agentID, Scene scene) - { - m_capsDict.Remove(agentID); - } - private void OnRegisterCaps(UUID agentID, Caps caps) { string uri = "/CAPS/" + UUID.Random(); - m_capsDict[agentID] = uri; caps.RegisterHandler("UntrustedSimulatorMessage", new RestStreamHandler("POST", uri, -- cgit v1.1 From 2093d87e20956b9b6bad34668ae230fdafeeaeda Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 24 Apr 2013 19:00:41 -0700 Subject: Make the kicked user's avie truly disappear when it's god-kicked. --- OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index d2e71a7..fa8c3f3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -278,8 +278,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods if (sp.IsChildAgent) return; sp.ControllingClient.Kick(reason); - sp.MakeChildAgent(); - sp.ControllingClient.Close(); + sp.Scene.IncomingCloseAgent(sp.UUID, true); } private void OnIncomingInstantMessage(GridInstantMessage msg) -- cgit v1.1 From 5a4cb539d2e685d604b00419040da4a752e074aa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 29 Apr 2013 17:14:44 +0100 Subject: Fix bug where an agent that declined an inventory offer and subsequently emptied their trash would make the item invalid in the giver's inventory This was because the original item/folder ID was sent in the session slot of the offer IM rather than the copy. --- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index ae58dfd..f122d00 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -213,7 +213,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer user.ControllingClient.SendBulkUpdateInventory(folderCopy); // HACK!! - im.imSessionID = folderID.Guid; + // Insert the ID of the copied item into the IM so that we know which item to move to trash if it + // is rejected. + // XXX: This is probably a misuse of the session ID slot. + im.imSessionID = copyID.Guid; } else { @@ -243,7 +246,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer user.ControllingClient.SendBulkUpdateInventory(itemCopy); // HACK!! - im.imSessionID = itemID.Guid; + // Insert the ID of the copied item into the IM so that we know which item to move to trash if it + // is rejected. + // XXX: This is probably a misuse of the session ID slot. + im.imSessionID = copyID.Guid; } im.offline = 0; -- cgit v1.1 From 8582b2b992e5d7747b8c4945959bd1c29a29839f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 8 Jun 2013 02:32:05 +0200 Subject: Make objects attached from the ground appear in inventory again. Fixes a number of interaction issues causing client crashes. --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index cb724aa..f2f789b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -1147,7 +1147,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments AttachmentPt &= 0x7f; // Calls attach with a Zero position - if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, false, append)) + if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, true, append)) { if (DebugLevel > 0) m_log.Debug( -- cgit v1.1 From bdc48e3e0f746fb691d99c17bd0e45bb3ca3e493 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 1 Aug 2013 23:30:32 +0200 Subject: Make attachment state load work again --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f2f789b..6495f3f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -302,7 +302,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // If we're an NPC then skip all the item checks and manipulations since we don't have an // inventory right now. RezSingleAttachmentFromInventoryInternal( - sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p, true, null); + sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p, true, d); } catch (Exception e) { -- cgit v1.1 From 598f63e984222a89ded65465674868df452cbeed Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 2 Aug 2013 00:06:39 +0100 Subject: Make atachment state load work again --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7b12c81..e1ca6cd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -363,7 +363,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // inventory right now. SceneObjectGroup objatt = RezSingleAttachmentFromInventoryInternal( - sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true, null); + sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true, d); if (ThrottlePer100PrimsRezzed > 0) -- cgit v1.1 From 01c3be27460fd3f28efd17b8d6606b883350f653 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 24 Aug 2013 05:55:53 -0500 Subject: * Fix a null ref that causes a stack unwind when crossing borders. Less stack unwinding.. the faster it goes. * Tweak XEngine so that it's partially functional again. It's still not great, but basic things work. --- OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 343cdb5..c52d586 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -182,6 +182,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule try { ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); + if (obj == null) + return; if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage) { -- cgit v1.1 From ece2d24077cacba677de5cebdd3a9da463306ecd Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 5 Oct 2013 17:36:58 -0500 Subject: * Fixes cases where Last Attachment Point gets overwritten with 0 when it shouldn't * Fixes cases where Last Attachment Point doesn't get written when it should. * Fixes Null Reference in BaseHttpServer when shutting down, null path provided. * Drop then Wear retains Last Attachment Point --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 81a7278..051e959 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -685,6 +685,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (changed && m_scene.AvatarFactory != null) m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); + so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint; + sp.RemoveAttachment(so); so.FromItemID = UUID.Zero; @@ -699,7 +701,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.ClearPartAttachmentData(); rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); so.HasGroupChanged = true; - so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint; rootPart.Rezzed = DateTime.Now; rootPart.RemFlag(PrimFlags.TemporaryOnRez); so.AttachToBackup(); -- cgit v1.1 From 958a8f274b8a25703935ab4092f190e9d54b8559 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Dec 2013 01:29:15 +0000 Subject: Revert "Add support for user preferences (im via email)" This reverts commit 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b. --- .../Avatar/UserProfiles/UserProfileModule.cs | 67 ---------------------- 1 file changed, 67 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index b21082f..56ff2bd 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -270,10 +270,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles // Notes client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest); client.OnAvatarNotesUpdate += NotesUpdate; - - // Preferences - client.OnUserInfoRequest += UserPreferencesRequest; - client.OnUpdateUserInfo += UpdateUserPreferences; } #endregion Region Event Handlers @@ -803,69 +799,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles } #endregion Notes - #region User Preferences - /// - /// Updates the user preferences. - /// - /// - /// Im via email. - /// - /// - /// Visible. - /// - /// - /// Remote client. - /// - public void UpdateUserPreferences(bool imViaEmail, bool visible, IClientAPI remoteClient) - { - UserPreferences pref = new UserPreferences(); - - pref.UserId = remoteClient.AgentId; - pref.IMViaEmail = imViaEmail; - pref.Visible = visible; - - string serverURI = string.Empty; - bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); - - object Pref = pref; - if(!JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString())) - { - m_log.InfoFormat("[PROFILES]: UserPreferences update error"); - remoteClient.SendAgentAlertMessage("Error updating preferences", false); - return; - } - } - - /// - /// Users the preferences request. - /// - /// - /// Remote client. - /// - public void UserPreferencesRequest(IClientAPI remoteClient) - { - UserPreferences pref = new UserPreferences(); - - pref.UserId = remoteClient.AgentId; - - string serverURI = string.Empty; - bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); - - - object Pref = (object)pref; - if(!JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) - { - m_log.InfoFormat("[PROFILES]: UserPreferences request error"); - remoteClient.SendAgentAlertMessage("Error requesting preferences", false); - return; - } - pref = (UserPreferences) Pref; - - remoteClient.SendUserInfoReply(pref.IMViaEmail, pref.Visible, pref.EMail); - - } - #endregion User Preferences - #region Avatar Properties /// /// Update the avatars interests . -- cgit v1.1 From bb841ea9cefb937c548646d366f689ef3bb80c61 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 6 Apr 2014 23:22:37 +0200 Subject: Change OfflineMessageModule to support more differentiated return values and allow support for mobile devices and other non-viewer logins --- .../Avatar/InstantMessage/OfflineMessageModule.cs | 55 ++++++++++++++++++---- 1 file changed, 47 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 2d46276..41958b3 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -40,6 +40,13 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { + public struct SendReply + { + public bool Success; + public string Message; + public int Disposition; + } + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")] public class OfflineMessageModule : ISharedRegionModule { @@ -50,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private string m_RestURL = String.Empty; IMessageTransferModule m_TransferModule = null; private bool m_ForwardOfflineGroupMessages = true; + private Dictionary> m_repliesSent= new Dictionary>(); public void Initialise(IConfigSource config) { @@ -169,6 +177,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private void OnNewClient(IClientAPI client) { client.OnRetrieveInstantMessages += RetrieveInstantMessages; + client.OnLogout += OnClientLoggedOut; + } + + public void OnClientLoggedOut(IClientAPI client) + { + m_repliesSent.Remove(client); } private void RetrieveInstantMessages(IClientAPI client) @@ -228,7 +242,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (scene == null) scene = m_SceneList[0]; - bool success = SynchronousRestObjectRequester.MakeRequest( + SendReply reply = SynchronousRestObjectRequester.MakeRequest( "POST", m_RestURL+"/SaveMessage/?scope=" + scene.RegionInfo.ScopeID.ToString(), im); @@ -238,13 +252,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 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())); + if (reply.Message == String.Empty) + reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved"); + + bool sendReply = true; + + switch (reply.Disposition) + { + case 0: // Normal + break; + case 1: // Only once per user + if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID))) + { + sendReply = false; + } + else + { + if (!m_repliesSent.ContainsKey(client)) + m_repliesSent[client] = new List(); + m_repliesSent[client].Add(new UUID(im.toAgentID)); + } + break; + } + + if (sendReply) + { + client.SendInstantMessage(new GridInstantMessage( + null, new UUID(im.toAgentID), + "System", new UUID(im.fromAgentID), + (byte)InstantMessageDialog.MessageFromAgent, + reply.Message, + false, new Vector3())); + } } } } -- cgit v1.1 From bef76bf3c59f920a62cd34ae43f3a5327a40b696 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Jul 2014 01:52:26 +0200 Subject: Fix duplicate attach message being sent to objects picked up from the ground --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d47ca4b..0825a01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -715,6 +715,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); + + // Attach (NULL) stops scripts. We don't want that. Resume them. + so.ResumeScripts(); } public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) @@ -1244,7 +1247,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments + ", AttachmentPoint: " + AttachmentPt); // Save avatar attachment information - m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); + m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); } } catch (Exception e) -- cgit v1.1 From e5f9f064a706d6be40e3da075f89b170aeb0ee1d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 1 Aug 2014 01:43:12 +0100 Subject: filter local chat from avatars or attachment acording to parcel hide ( not fully tested) --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 37 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 5cbfec6..9b41083 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -216,6 +216,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); + bool checkParcelHide = false; + UUID sourceParcelID = UUID.Zero; + Vector3 hidePos = fromPos; + if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel; switch (sourceType) @@ -237,15 +241,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat } destination = UUID.Zero; // Avatars cant "SayTo" ownerID = c.Sender.AgentId; - + checkParcelHide = true; + hidePos = fromPos; break; case ChatSourceType.Object: fromID = c.SenderUUID; if (c.SenderObject != null && c.SenderObject is SceneObjectPart) + { ownerID = ((SceneObjectPart)c.SenderObject).OwnerID; - + if (((SceneObjectPart)c.SenderObject).ParentGroup.IsAttachment) + { + checkParcelHide = true; + hidePos = ((SceneObjectPart)c.SenderObject).ParentGroup.AbsolutePosition; + } + } break; } @@ -258,13 +269,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); HashSet receiverIDs = new HashSet(); - + + if (checkParcelHide) + { + checkParcelHide = false; + if (c.Type < ChatTypeEnum.DebugChannel && destination == UUID.Zero) + { + ILandObject srcland = (scene as Scene).LandChannel.GetLandObject(hidePos.X, hidePos.Y); + if (srcland != null && !srcland.LandData.SeeAVs) + { + sourceParcelID = srcland.LandData.GlobalID; + checkParcelHide = true; + } + } + } + foreach (Scene s in m_scenes) { // This should use ForEachClient, but clients don't have a position. // If camera is moved into client, then camera position can be used // MT: No, it can't, as chat is heard from the avatar position, not // the camera position. + s.ForEachScenePresence( delegate(ScenePresence presence) { @@ -277,6 +303,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // perfect, but it will do. For now. Better // than the prior behavior of muting all // objects on a parcel with access restrictions + if (checkParcelHide) + { + if (sourceParcelID != Presencecheck.LandData.GlobalID) + return; + } if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) { if (destination != UUID.Zero) -- cgit v1.1 From e87f70e277e78fb37100b2750fcb09b3aacb1734 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 2 Aug 2014 22:45:28 +0100 Subject: god also read local chat --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 9b41083..71ceb65 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -238,10 +238,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat if (avatar.GodLevel >= 200) { fromNamePrefix = m_adminPrefix; + checkParcelHide = false; + } + else + { + checkParcelHide = true; } destination = UUID.Zero; // Avatars cant "SayTo" ownerID = c.Sender.AgentId; - checkParcelHide = true; + hidePos = fromPos; break; -- cgit v1.1 From ca8b0e6a1d373b55137febaafd2797e59016d5a8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:00:01 +0100 Subject: replace debug msgs by others --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0825a01..c8a25dd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -388,6 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments Dictionary scriptStates = new Dictionary(); + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); foreach (SceneObjectGroup so in attachments) { // Scripts MUST be snapshotted before the object is @@ -398,13 +399,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments scriptStates[so] = PrepareScriptInstanceForSave(so, false); } + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter UpdateDetachedObject loop"); lock (sp.AttachmentsSyncLock) { foreach (SceneObjectGroup so in attachments) UpdateDetachedObject(sp, so, scriptStates[so]); - + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter ClearAttachments"); sp.ClearAttachments(); } + m_log.DebugFormat("[ATTACHMENTS MODULE]: derez done"); + } public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) @@ -1014,6 +1018,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Remove the object from the scene so no more updates // are sent. Doing this before the below changes will ensure // updates can't cause "HUD artefacts" + + m_log.WarnFormat("[ATTACHMENTS MODULE]: DeleteSceneObject"); + m_scene.DeleteSceneObject(so, false, false); // Prepare sog for storage @@ -1023,6 +1030,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (saveChanged) { + m_log.WarnFormat("[ATTACHMENTS MODULE]: saveChanged true"); + // We cannot use AbsolutePosition here because that would // attempt to cross the prim as it is detached so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); @@ -1031,7 +1040,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } // Now, remove the scripts + m_log.WarnFormat("[ATTACHMENTS MODULE]: remove scripts"); so.RemoveScriptInstances(true); + m_log.WarnFormat("[ATTACHMENTS MODULE]: UpdateDetachedObject done"); } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( -- cgit v1.1 From c2d9a6499ac2655e6d43f528b839d81e14fdb64f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:08:13 +0100 Subject: dont get script states for NPCs on deRez --- .../Avatar/Attachments/AttachmentsModule.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index c8a25dd..9e6ed91 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -388,15 +388,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments Dictionary scriptStates = new Dictionary(); - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); - foreach (SceneObjectGroup so in attachments) + if (sp.PresenceType != PresenceType.Npc) { - // Scripts MUST be snapshotted before the object is - // removed from the scene because doing otherwise will - // clobber the run flag - // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from - // scripts performing attachment operations at the same time. Getting object states stops the scripts. - scriptStates[so] = PrepareScriptInstanceForSave(so, false); + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); + foreach (SceneObjectGroup so in attachments) + { + // Scripts MUST be snapshotted before the object is + // removed from the scene because doing otherwise will + // clobber the run flag + // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from + // scripts performing attachment operations at the same time. Getting object states stops the scripts. + scriptStates[so] = PrepareScriptInstanceForSave(so, false); + } } m_log.DebugFormat("[ATTACHMENTS MODULE]: enter UpdateDetachedObject loop"); -- cgit v1.1 From 6b3f10790eb72a6c0fa3e5d088d681d28fc835dd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:35:16 +0100 Subject: bugg --- .../Avatar/Attachments/AttachmentsModule.cs | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 9e6ed91..5bc6631 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -390,7 +390,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (sp.PresenceType != PresenceType.Npc) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); foreach (SceneObjectGroup so in attachments) { // Scripts MUST be snapshotted before the object is @@ -400,18 +399,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // scripts performing attachment operations at the same time. Getting object states stops the scripts. scriptStates[so] = PrepareScriptInstanceForSave(so, false); } - } - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter UpdateDetachedObject loop"); - lock (sp.AttachmentsSyncLock) - { - foreach (SceneObjectGroup so in attachments) - UpdateDetachedObject(sp, so, scriptStates[so]); - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter ClearAttachments"); - sp.ClearAttachments(); + lock (sp.AttachmentsSyncLock) + { + foreach (SceneObjectGroup so in attachments) + UpdateDetachedObject(sp, so, scriptStates[so]); + sp.ClearAttachments(); + } } - m_log.DebugFormat("[ATTACHMENTS MODULE]: derez done"); - + else + { + lock (sp.AttachmentsSyncLock) + { + foreach (SceneObjectGroup so in attachments) + UpdateDetachedObject(sp, so, String.Empty); + sp.ClearAttachments(); + } + } } public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) -- cgit v1.1 From 21aa325883caac80749dec417411ab678e8f9646 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:41:48 +0100 Subject: remove debug msgs at attachments deRez --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 5bc6631..2c7cd40 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -1025,9 +1025,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Remove the object from the scene so no more updates // are sent. Doing this before the below changes will ensure // updates can't cause "HUD artefacts" - - m_log.WarnFormat("[ATTACHMENTS MODULE]: DeleteSceneObject"); - + m_scene.DeleteSceneObject(so, false, false); // Prepare sog for storage @@ -1037,8 +1035,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (saveChanged) { - m_log.WarnFormat("[ATTACHMENTS MODULE]: saveChanged true"); - // We cannot use AbsolutePosition here because that would // attempt to cross the prim as it is detached so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); @@ -1047,9 +1043,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } // Now, remove the scripts - m_log.WarnFormat("[ATTACHMENTS MODULE]: remove scripts"); so.RemoveScriptInstances(true); - m_log.WarnFormat("[ATTACHMENTS MODULE]: UpdateDetachedObject done"); } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( -- cgit v1.1 From 8cf945544cd993b68329d00832f7c9b74570af28 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 00:43:57 +0100 Subject: local chat gods bug fix --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 71ceb65..dcfc630 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -236,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat fromName = avatar.Name; fromID = c.Sender.AgentId; if (avatar.GodLevel >= 200) - { + { // let gods speak to outside or things may get confusing fromNamePrefix = m_adminPrefix; checkParcelHide = false; } @@ -310,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // objects on a parcel with access restrictions if (checkParcelHide) { - if (sourceParcelID != Presencecheck.LandData.GlobalID) + if (sourceParcelID != Presencecheck.LandData.GlobalID && presence.GodLevel < 200) return; } if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) -- cgit v1.1 From c3f9c99fb32d15e57b24502b71c79fe028ed3007 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 05:20:45 +0100 Subject: DANGER... changed bakedtextures caching. Assuming grid baking is cache only, reduced number of accesses to it. TESTING --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 279 +++++++++++++++------ 1 file changed, 198 insertions(+), 81 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 09cc998..b4aefce 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -188,27 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // Process the visual params, this may change height as well if (visualParams != null) { - // string[] visualParamsStrings = new string[visualParams.Length]; - // for (int i = 0; i < visualParams.Length; i++) - // visualParamsStrings[i] = visualParams[i].ToString(); - // m_log.DebugFormat( - // "[AVFACTORY]: Setting visual params for {0} to {1}", - // client.Name, string.Join(", ", visualParamsStrings)); -/* - float oldHeight = sp.Appearance.AvatarHeight; - changed = sp.Appearance.SetVisualParams(visualParams); - - if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) - ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); - */ -// float oldoff = sp.Appearance.AvatarFeetOffset; -// Vector3 oldbox = sp.Appearance.AvatarBoxSize; changed = sp.Appearance.SetVisualParams(visualParams); -// float off = sp.Appearance.AvatarFeetOffset; -// Vector3 box = sp.Appearance.AvatarBoxSize; -// if(oldoff != off || oldbox != box) -// ((ScenePresence)sp).SetSize(box,off); - } // Process the baked texture array @@ -222,9 +202,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // WriteBakedTexturesReport(sp, m_log.DebugFormat); + // If bake textures are missing and this is not an NPC, request a rebake from client - if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc)) - RequestRebake(sp, true); + // rebake may messup caching, and should not be needed + + +// if (!UpdateBakedTextureCache(sp,cacheItems) && (((ScenePresence)sp).PresenceType != PresenceType.Npc)) +// RequestRebake(sp, true); + + UpdateBakedTextureCache(sp, cacheItems); // This appears to be set only in the final stage of the appearance // update transaction. In theory, we should be able to do an immediate @@ -377,13 +363,138 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } + // called on textures update + public bool UpdateBakedTextureCache(IScenePresence sp, WearableCacheItem[] cacheItems) + { + bool defonly = true; // are we only using default textures + + // uploaded baked textures will be in assets local cache + IAssetService cache = m_scene.AssetService; + + int validDirtyBakes = 0; + int hits = 0; + + // our main cacheIDs mapper is p.Appearance.WearableCacheItems + WearableCacheItem[] wearableCache = sp.Appearance.WearableCacheItems; + + if (wearableCache == null) + { + wearableCache = WearableCacheItem.GetDefaultCacheItem(); + } + + // Process received baked textures + for (int i = 0; i < cacheItems.Length; i++) + { + int idx = (int)cacheItems[i].TextureIndex; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; + + // No face + if (face == null) + { + // for some reason viewer is cleaning this + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx); + sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; + continue; + } + else + { + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + { + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; + continue; + } + + defonly = false; // found a non-default texture reference + + if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID) + { + if(wearableCache[idx].CacheId != cacheItems[i].CacheId) + { + wearableCache[idx].CacheId = cacheItems[i].CacheId; + validDirtyBakes++; + hits++; + //assuming this can only happen if asset is in cache + } + continue; + } + + + wearableCache[idx].TextureAsset = null; + if (cache != null) + wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString()); + + if (wearableCache[idx].TextureAsset != null) + { + wearableCache[idx].CacheId = cacheItems[i].CacheId; + wearableCache[idx].TextureID = sp.Appearance.Texture.FaceTextures[idx].TextureID; + validDirtyBakes++; + hits++; + } + else + { + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; + continue; + } + } + } + + sp.Appearance.WearableCacheItems = wearableCache; + + // if we got a full set of baked textures save all in BakedTextureModule + + if (validDirtyBakes == cacheItems.Length) + { + IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface(); + if (m_BakedTextureModule != null) + { + m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); + + m_BakedTextureModule.Store(sp.UUID, wearableCache); + } + } + + // debug + for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) + { + int j = AvatarAppearance.BAKE_INDICES[iter]; + m_log.Debug("[UpdateBCache] {" + iter + "/" + + sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + + sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + + sp.Appearance.WearableCacheItems[j].TextureID); + } + + // If we only found default textures, then the appearance is not cached + return (defonly ? false : true); + } + + // called when we get a new root avatar public bool ValidateBakedTextureCache(IScenePresence sp) { bool defonly = true; // are we only using default textures - IImprovedAssetCache cache = m_scene.RequestModuleInterface(); + IAssetService cache = m_scene.AssetService; IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); WearableCacheItem[] wearableCache = null; + // debug + for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) + { + int j = AvatarAppearance.BAKE_INDICES[iter]; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[iter]; + if(face != null) + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - " + face.TextureID); + else + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture"); + } + + + int hits = 0; // Cache wearable data for teleport. // Only makes sense if there's a bake module and a cache module if (bakedModule != null && cache != null) @@ -394,41 +505,35 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } catch (Exception) { - + wearableCache = null; } + if (wearableCache != null) { for (int i = 0; i < wearableCache.Length; i++) { - cache.Cache(wearableCache[i].TextureAsset); - } - } - } - /* - IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); - if (invService.GetRootFolder(userID) != null) - { - WearableCacheItem[] wearableCache = null; - if (bakedModule != null) - { - try - { - wearableCache = bakedModule.Get(userID); - appearance.WearableCacheItems = wearableCache; - appearance.WearableCacheItemsDirty = false; - foreach (WearableCacheItem item in wearableCache) + + m_log.Debug("[ValidateBakedCache] got bakedModule cache"); + + if (wearableCache[i].TextureAsset != null) { - appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID; + wearableCache[i].TextureAsset.Temporary = true; + wearableCache[i].TextureAsset.Local = true; + cache.Store(wearableCache[i].TextureAsset); + } + else + { + wearableCache[i].TextureID = UUID.Zero; + wearableCache[i].CacheId = UUID.Zero; } - } - catch (Exception) - { - } } - */ + } + + if(wearableCache == null) + wearableCache = WearableCacheItem.GetDefaultCacheItem(); - // Process the texture entry + // Process the baked textures for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { int idx = AvatarAppearance.BAKE_INDICES[i]; @@ -437,61 +542,73 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // No face, so lets check our baked service cache, teleport or login. if (face == null) { - if (wearableCache != null) + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); + if (wearableCache[idx].TextureID != UUID.Zero) { - // If we find the an appearance item, set it as the textureentry and the face - WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache); - if (searchitem != null) - { - sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx); - sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID; - face = sp.Appearance.Texture.FaceTextures[idx]; - } - else - { - // if there is no texture entry and no baked cache, skip it - continue; - } + sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; + face = sp.Appearance.Texture.FaceTextures[idx]; + // let run to end of loop to check cache } else { - //No texture entry face and no cache. Skip this face. + sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; + face = sp.Appearance.Texture.FaceTextures[idx]; + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; continue; } } - - -// m_log.DebugFormat( -// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", -// face.TextureID, idx, client.Name, client.AgentId); + - // if the texture is one of the "defaults" then skip it - // this should probably be more intelligent (skirt texture doesnt matter - // if the avatar isnt wearing a skirt) but if any of the main baked - // textures is default then the rest should be as well if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + { + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; continue; - + } + defonly = false; // found a non-default texture reference - if (cache != null) + if(wearableCache[idx].TextureID != sp.Appearance.Texture.FaceTextures[idx].TextureID) { - if (!cache.Check(face.TextureID.ToString())) - return false; + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; + continue; } - else + + wearableCache[idx].TextureAsset = null; + if (cache != null) { - if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) - return false; + wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); + if (wearableCache[idx].TextureAsset == null) + { + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + } + else + hits++; } } -// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); + sp.Appearance.WearableCacheItems = wearableCache; + + m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2} {3}", sp.Name, sp.UUID, hits, defonly.ToString()); + // debug + for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) + { + int j = AvatarAppearance.BAKE_INDICES[iter]; + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + + sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + + sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + + sp.Appearance.WearableCacheItems[j].TextureID); + } // If we only found default textures, then the appearance is not cached return (defonly ? false : true); } - public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) { int texturesRebaked = 0; -- cgit v1.1 From b7f24bacce523240b73fba7ea0f3403dc59c3596 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 06:09:56 +0100 Subject: bugg --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 54 +++++++++++----------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index b4aefce..877231a 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -481,6 +481,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory IAssetService cache = m_scene.AssetService; IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); WearableCacheItem[] wearableCache = null; + WearableCacheItem[] bakedModuleCache = null; + + wearableCache = WearableCacheItem.GetDefaultCacheItem(); // debug for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) @@ -493,46 +496,47 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture"); } - int hits = 0; // Cache wearable data for teleport. // Only makes sense if there's a bake module and a cache module if (bakedModule != null && cache != null) { + m_log.Debug("[ValidateBakedCache] calling bakedModule"); try { - wearableCache = bakedModule.Get(sp.UUID); + bakedModuleCache = bakedModule.Get(sp.UUID); } catch (Exception) { - wearableCache = null; + bakedModuleCache = null; } - if (wearableCache != null) + if (bakedModuleCache != null) { - for (int i = 0; i < wearableCache.Length; i++) - { + m_log.Debug("[ValidateBakedCache] got bakedModule cache " + wearableCache.Length); - m_log.Debug("[ValidateBakedCache] got bakedModule cache"); + // old store have diferent sizes and index starts at 1 + int offset = 0; + if (bakedModuleCache[0].TextureIndex == 1) + offset = -1; + int j; - if (wearableCache[i].TextureAsset != null) - { - wearableCache[i].TextureAsset.Temporary = true; - wearableCache[i].TextureAsset.Local = true; - cache.Store(wearableCache[i].TextureAsset); - } - else + for (int i = 0; i < bakedModuleCache.Length; i++) + { + j = (int)bakedModuleCache[i].TextureIndex + offset; + + if (bakedModuleCache[i].TextureAsset != null) { - wearableCache[i].TextureID = UUID.Zero; - wearableCache[i].CacheId = UUID.Zero; + wearableCache[j].TextureID = bakedModuleCache[i].TextureID; + wearableCache[j].CacheId = bakedModuleCache[i].TextureID; + bakedModuleCache[i].TextureAsset.Temporary = true; + bakedModuleCache[i].TextureAsset.Local = true; + cache.Store(bakedModuleCache[i].TextureAsset); } } } } - if(wearableCache == null) - wearableCache = WearableCacheItem.GetDefaultCacheItem(); - // Process the baked textures for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { @@ -540,7 +544,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; // No face, so lets check our baked service cache, teleport or login. - if (face == null) + if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) { sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); if (wearableCache[idx].TextureID != UUID.Zero) @@ -554,24 +558,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; face = sp.Appearance.Texture.FaceTextures[idx]; wearableCache[idx].CacheId = UUID.Zero; - wearableCache[idx].TextureID = UUID.Zero; wearableCache[idx].TextureAsset = null; continue; } } - if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) { - wearableCache[idx].CacheId = UUID.Zero; - wearableCache[idx].TextureID = UUID.Zero; - wearableCache[idx].TextureAsset = null; + defonly = false; // found a non-default texture reference continue; } - defonly = false; // found a non-default texture reference - - if(wearableCache[idx].TextureID != sp.Appearance.Texture.FaceTextures[idx].TextureID) + if(wearableCache[idx].TextureID != face.TextureID) { wearableCache[idx].CacheId = UUID.Zero; wearableCache[idx].TextureID = UUID.Zero; -- cgit v1.1 From 12d8ed2dcdc354d0059b63a2139f544c3c7b30b8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 07:08:01 +0100 Subject: only send to bakedmodule the baked textures :) --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 877231a..a19790d 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -422,7 +422,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } continue; } - wearableCache[idx].TextureAsset = null; if (cache != null) @@ -456,7 +455,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); - m_BakedTextureModule.Store(sp.UUID, wearableCache); + WearableCacheItem[] toBakedModule = new WearableCacheItem[AvatarAppearance.BAKE_INDICES.Length]; + + for (int i = 0; i < cacheItems.Length; i++) + { + int idx = (int)cacheItems[i].TextureIndex; + cacheItems[i].CacheId = wearableCache[idx].CacheId; + cacheItems[i].TextureID = wearableCache[idx].TextureID; + cacheItems[i].TextureAsset = wearableCache[idx].TextureAsset; + } + m_BakedTextureModule.Store(sp.UUID, cacheItems); } } @@ -513,22 +521,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (bakedModuleCache != null) { - m_log.Debug("[ValidateBakedCache] got bakedModule cache " + wearableCache.Length); - - // old store have diferent sizes and index starts at 1 - int offset = 0; - if (bakedModuleCache[0].TextureIndex == 1) - offset = -1; - int j; + m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); for (int i = 0; i < bakedModuleCache.Length; i++) { - j = (int)bakedModuleCache[i].TextureIndex + offset; + int j = (int)bakedModuleCache[i].TextureIndex; if (bakedModuleCache[i].TextureAsset != null) { wearableCache[j].TextureID = bakedModuleCache[i].TextureID; wearableCache[j].CacheId = bakedModuleCache[i].TextureID; + wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; bakedModuleCache[i].TextureAsset.Temporary = true; bakedModuleCache[i].TextureAsset.Local = true; cache.Store(bakedModuleCache[i].TextureAsset); -- cgit v1.1 From a95afb7fc59db4c88855ba79a97046afa24a8eac Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 07:36:23 +0100 Subject: bug --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index a19790d..edf62db 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -530,7 +530,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (bakedModuleCache[i].TextureAsset != null) { wearableCache[j].TextureID = bakedModuleCache[i].TextureID; - wearableCache[j].CacheId = bakedModuleCache[i].TextureID; + wearableCache[j].CacheId = bakedModuleCache[i].CacheId; wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; bakedModuleCache[i].TextureAsset.Temporary = true; bakedModuleCache[i].TextureAsset.Local = true; -- cgit v1.1 From dfa9ba0937f6e2d30e1d541d64533ede4ecb671e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 08:47:03 +0100 Subject: minor clean, dont check for cache if we aren't using it.. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 28 ++++------------------ 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index edf62db..2e5c58a 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -493,18 +493,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache = WearableCacheItem.GetDefaultCacheItem(); - // debug - for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) - { - int j = AvatarAppearance.BAKE_INDICES[iter]; - Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[iter]; - if(face != null) - m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - " + face.TextureID); - else - m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture"); - } - - int hits = 0; + int hits = 0; // Cache wearable data for teleport. // Only makes sense if there's a bake module and a cache module if (bakedModule != null && cache != null) @@ -546,7 +535,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory int idx = AvatarAppearance.BAKE_INDICES[i]; Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - // No face, so lets check our baked service cache, teleport or login. + // No face, so lets check our cache if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) { sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); @@ -560,8 +549,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; face = sp.Appearance.Texture.FaceTextures[idx]; - wearableCache[idx].CacheId = UUID.Zero; - wearableCache[idx].TextureAsset = null; +// lets try not invalidating the cache entry +// wearableCache[idx].CacheId = UUID.Zero; +// wearableCache[idx].TextureAsset = null; continue; } } @@ -624,14 +614,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (face == null) continue; -// m_log.DebugFormat( -// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", -// face.TextureID, idx, client.Name, client.AgentId); - - // if the texture is one of the "defaults" then skip it - // this should probably be more intelligent (skirt texture doesnt matter - // if the avatar isnt wearing a skirt) but if any of the main baked - // textures is default then the rest should be as well if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) continue; -- cgit v1.1 From 38e2e5942cfe7d7534038e72d8c2ac9325bd8741 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 19:16:51 +0100 Subject: bug on upload new bakes decision --- .../Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 2e5c58a..448f7b3 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -417,9 +417,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { wearableCache[idx].CacheId = cacheItems[i].CacheId; validDirtyBakes++; - hits++; + //assuming this can only happen if asset is in cache } + hits++; continue; } @@ -448,7 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // if we got a full set of baked textures save all in BakedTextureModule - if (validDirtyBakes == cacheItems.Length) + if (validDirtyBakes > 0 && hits == cacheItems.Length) { IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface(); if (m_BakedTextureModule != null) -- cgit v1.1 From f78894759442e0a9a3f36d33b40e1199eff19a15 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 21:24:52 +0100 Subject: make grid baked textures override the ones on appearance. Due to bug somewhere they are always bad at ValidateBakedTextures entry. ( even if they where good and on assets cache we whould need to generate the cacheID hash ) --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 95 ++++++++++++++-------- 1 file changed, 60 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 448f7b3..a1b17d4 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -494,7 +494,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache = WearableCacheItem.GetDefaultCacheItem(); - int hits = 0; + int hits = 0; + bool gotbacked = false; + // Cache wearable data for teleport. // Only makes sense if there's a bake module and a cache module if (bakedModule != null && cache != null) @@ -525,8 +527,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory bakedModuleCache[i].TextureAsset.Temporary = true; bakedModuleCache[i].TextureAsset.Local = true; cache.Store(bakedModuleCache[i].TextureAsset); + } } + gotbacked = true; } } @@ -536,52 +540,73 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory int idx = AvatarAppearance.BAKE_INDICES[i]; Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - // No face, so lets check our cache - if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + // on tp viewer assumes servers did the cache work + // and tp propagation of baked textures is broken somewhere + // so make grid cache be mandatory + if (gotbacked) { - sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); - if (wearableCache[idx].TextureID != UUID.Zero) - { - sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; - face = sp.Appearance.Texture.FaceTextures[idx]; - // let run to end of loop to check cache - } - else + m_log.Debug("[ValidateBakedCache] bakedModule cache override"); + + sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; + face = sp.Appearance.Texture.FaceTextures[idx]; + + // this should be removed + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) { - sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; - face = sp.Appearance.Texture.FaceTextures[idx]; -// lets try not invalidating the cache entry -// wearableCache[idx].CacheId = UUID.Zero; -// wearableCache[idx].TextureAsset = null; - continue; + defonly = false; // found a non-default texture reference } - } - if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) - { - defonly = false; // found a non-default texture reference continue; } - - if(wearableCache[idx].TextureID != face.TextureID) + else { - wearableCache[idx].CacheId = UUID.Zero; - wearableCache[idx].TextureID = UUID.Zero; - wearableCache[idx].TextureAsset = null; - continue; - } + // No face, so lets check our cache + if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + { + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); + if (wearableCache[idx].TextureID != UUID.Zero) + { + sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; + face = sp.Appearance.Texture.FaceTextures[idx]; + // let run to end of loop to check cache + } + else + { + sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; + face = sp.Appearance.Texture.FaceTextures[idx]; + // lets try not invalidating the cache entry + // wearableCache[idx].CacheId = UUID.Zero; + // wearableCache[idx].TextureAsset = null; + continue; + } + } - wearableCache[idx].TextureAsset = null; - if (cache != null) - { - wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); - if (wearableCache[idx].TextureAsset == null) + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + { + defonly = false; // found a non-default texture reference + continue; + } + + if (wearableCache[idx].TextureID != face.TextureID) { wearableCache[idx].CacheId = UUID.Zero; wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; + continue; + } + + wearableCache[idx].TextureAsset = null; + if (cache != null) + { + wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); + if (wearableCache[idx].TextureAsset == null) + { + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + } + else + hits++; } - else - hits++; } } -- cgit v1.1 From 6d372f3d9e4762ec607ce73d3be947dd449ec1fc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 21:37:11 +0100 Subject: remove annoying debug msg . still a lot of spam, but to remove later --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index a1b17d4..43e03c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -545,7 +545,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // so make grid cache be mandatory if (gotbacked) { - m_log.Debug("[ValidateBakedCache] bakedModule cache override"); +// m_log.Debug("[ValidateBakedCache] bakedModule cache override"); sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; face = sp.Appearance.Texture.FaceTextures[idx]; -- cgit v1.1 From 73cbdf2c6b8934ff87a5c95dede0d7dc892381f9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 22:00:23 +0100 Subject: bug --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 43e03c9..797ec2b 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -546,7 +546,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (gotbacked) { // m_log.Debug("[ValidateBakedCache] bakedModule cache override"); - + if(sp.Appearance.Texture.FaceTextures[idx] == null) + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; face = sp.Appearance.Texture.FaceTextures[idx]; -- cgit v1.1 From 9aa6389b8ba37715e0b68071040d2a9c488515ad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 Aug 2014 02:22:18 +0100 Subject: lock set appearence during ValidateBakedTextureCache there seems to be a overlap in same cases --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 190 +++++++++++---------- 1 file changed, 97 insertions(+), 93 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 797ec2b..9b13a09 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -487,131 +487,135 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public bool ValidateBakedTextureCache(IScenePresence sp) { bool defonly = true; // are we only using default textures - IAssetService cache = m_scene.AssetService; - IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); - WearableCacheItem[] wearableCache = null; - WearableCacheItem[] bakedModuleCache = null; - wearableCache = WearableCacheItem.GetDefaultCacheItem(); + lock (m_setAppearanceLock) + { + IAssetService cache = m_scene.AssetService; + IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); + WearableCacheItem[] wearableCache = null; + WearableCacheItem[] bakedModuleCache = null; - int hits = 0; - bool gotbacked = false; + wearableCache = WearableCacheItem.GetDefaultCacheItem(); - // Cache wearable data for teleport. - // Only makes sense if there's a bake module and a cache module - if (bakedModule != null && cache != null) - { - m_log.Debug("[ValidateBakedCache] calling bakedModule"); - try - { - bakedModuleCache = bakedModule.Get(sp.UUID); - } - catch (Exception) - { - bakedModuleCache = null; - } + int hits = 0; + bool gotbacked = false; - if (bakedModuleCache != null) + // Cache wearable data for teleport. + // Only makes sense if there's a bake module and a cache module + if (bakedModule != null && cache != null) { - m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); + m_log.Debug("[ValidateBakedCache] calling bakedModule"); + try + { + bakedModuleCache = bakedModule.Get(sp.UUID); + } + catch (Exception) + { + bakedModuleCache = null; + } - for (int i = 0; i < bakedModuleCache.Length; i++) + if (bakedModuleCache != null) { - int j = (int)bakedModuleCache[i].TextureIndex; + m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); - if (bakedModuleCache[i].TextureAsset != null) + for (int i = 0; i < bakedModuleCache.Length; i++) { - wearableCache[j].TextureID = bakedModuleCache[i].TextureID; - wearableCache[j].CacheId = bakedModuleCache[i].CacheId; - wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; - bakedModuleCache[i].TextureAsset.Temporary = true; - bakedModuleCache[i].TextureAsset.Local = true; - cache.Store(bakedModuleCache[i].TextureAsset); + int j = (int)bakedModuleCache[i].TextureIndex; + + if (bakedModuleCache[i].TextureAsset != null) + { + wearableCache[j].TextureID = bakedModuleCache[i].TextureID; + wearableCache[j].CacheId = bakedModuleCache[i].CacheId; + wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; + bakedModuleCache[i].TextureAsset.Temporary = true; + bakedModuleCache[i].TextureAsset.Local = true; + cache.Store(bakedModuleCache[i].TextureAsset); + } } + gotbacked = true; } - gotbacked = true; } - } - // Process the baked textures - for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) - { - int idx = AvatarAppearance.BAKE_INDICES[i]; - Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - - // on tp viewer assumes servers did the cache work - // and tp propagation of baked textures is broken somewhere - // so make grid cache be mandatory - if (gotbacked) + // Process the baked textures + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { -// m_log.Debug("[ValidateBakedCache] bakedModule cache override"); - if(sp.Appearance.Texture.FaceTextures[idx] == null) - sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); - sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; - face = sp.Appearance.Texture.FaceTextures[idx]; + int idx = AvatarAppearance.BAKE_INDICES[i]; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - // this should be removed - if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + // on tp viewer assumes servers did the cache work + // and tp propagation of baked textures is broken somewhere + // so make grid cache be mandatory + if (gotbacked) { - defonly = false; // found a non-default texture reference - } + // m_log.Debug("[ValidateBakedCache] bakedModule cache override"); + if (sp.Appearance.Texture.FaceTextures[idx] == null) + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); + sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; + face = sp.Appearance.Texture.FaceTextures[idx]; + + // this should be removed + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + { + defonly = false; // found a non-default texture reference + } - continue; - } - else - { - // No face, so lets check our cache - if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + continue; + } + else { - sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); - if (wearableCache[idx].TextureID != UUID.Zero) + // No face, so lets check our cache + if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) { - sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; - face = sp.Appearance.Texture.FaceTextures[idx]; - // let run to end of loop to check cache + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); + if (wearableCache[idx].TextureID != UUID.Zero) + { + sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; + face = sp.Appearance.Texture.FaceTextures[idx]; + // let run to end of loop to check cache + } + else + { + sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; + face = sp.Appearance.Texture.FaceTextures[idx]; + // lets try not invalidating the cache entry + // wearableCache[idx].CacheId = UUID.Zero; + // wearableCache[idx].TextureAsset = null; + continue; + } } - else + + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) { - sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; - face = sp.Appearance.Texture.FaceTextures[idx]; - // lets try not invalidating the cache entry - // wearableCache[idx].CacheId = UUID.Zero; - // wearableCache[idx].TextureAsset = null; + defonly = false; // found a non-default texture reference continue; } - } - if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) - { - defonly = false; // found a non-default texture reference - continue; - } - - if (wearableCache[idx].TextureID != face.TextureID) - { - wearableCache[idx].CacheId = UUID.Zero; - wearableCache[idx].TextureID = UUID.Zero; - wearableCache[idx].TextureAsset = null; - continue; - } - - wearableCache[idx].TextureAsset = null; - if (cache != null) - { - wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); - if (wearableCache[idx].TextureAsset == null) + if (wearableCache[idx].TextureID != face.TextureID) { wearableCache[idx].CacheId = UUID.Zero; wearableCache[idx].TextureID = UUID.Zero; + wearableCache[idx].TextureAsset = null; + continue; + } + + wearableCache[idx].TextureAsset = null; + if (cache != null) + { + wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); + if (wearableCache[idx].TextureAsset == null) + { + wearableCache[idx].CacheId = UUID.Zero; + wearableCache[idx].TextureID = UUID.Zero; + } + else + hits++; } - else - hits++; } } - } - sp.Appearance.WearableCacheItems = wearableCache; + sp.Appearance.WearableCacheItems = wearableCache; + } m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2} {3}", sp.Name, sp.UUID, hits, defonly.ToString()); // debug -- cgit v1.1 From ebbf236abccedb269dcb45050794677db37d24ff Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 Aug 2014 02:25:31 +0100 Subject: of course.. bug.. --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 9b13a09..ccc6861 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -487,6 +487,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public bool ValidateBakedTextureCache(IScenePresence sp) { bool defonly = true; // are we only using default textures + int hits = 0; lock (m_setAppearanceLock) { @@ -497,7 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache = WearableCacheItem.GetDefaultCacheItem(); - int hits = 0; + bool gotbacked = false; // Cache wearable data for teleport. -- cgit v1.1 From 0a9925ff4aff0dbe40b73ded834059373cc04620 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 11 Aug 2014 00:28:14 +0100 Subject: validatebaked still not ok --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index ccc6861..a9aa7c4 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -587,10 +587,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) - { - defonly = false; // found a non-default texture reference continue; - } if (wearableCache[idx].TextureID != face.TextureID) { @@ -603,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache[idx].TextureAsset = null; if (cache != null) { - wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); + wearableCache[idx].TextureAsset = m_scene.AssetService.GetCached(face.TextureID.ToString()); if (wearableCache[idx].TextureAsset == null) { wearableCache[idx].CacheId = UUID.Zero; @@ -611,6 +608,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } else hits++; + defonly = false; // found a non-default texture reference } } } @@ -630,7 +628,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } // If we only found default textures, then the appearance is not cached - return (defonly ? false : true); + // return (defonly ? false : true); + return (hits >= AvatarAppearance.BAKE_INDICES.Length - 1); // skirt is optional } public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) { -- cgit v1.1 From 9217d5ca315f4d0bc5b7803e0ca676217cf09ab9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 11 Aug 2014 00:44:34 +0100 Subject: will get there.. --- .../Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index a9aa7c4..330ed56 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -556,11 +556,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory face = sp.Appearance.Texture.FaceTextures[idx]; // this should be removed - if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) - { + if (face.TextureID != UUID.Zero && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) defonly = false; // found a non-default texture reference - } - + else + hits++; continue; } else -- cgit v1.1 From 306875fc61d1a1974fa21a174ecd9f65a271f34c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 11 Aug 2014 00:49:11 +0100 Subject: ... one day.. --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 330ed56..d5f271d 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -557,9 +557,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // this should be removed if (face.TextureID != UUID.Zero && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) + { defonly = false; // found a non-default texture reference - else hits++; + } continue; } else -- cgit v1.1 From e860dd33fa7a69e25bbab3f720710c9a7c50ed48 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 11 Aug 2014 00:54:30 +0100 Subject: remove confusing defonly control --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index d5f271d..2290c44 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -366,8 +366,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // called on textures update public bool UpdateBakedTextureCache(IScenePresence sp, WearableCacheItem[] cacheItems) { - bool defonly = true; // are we only using default textures - // uploaded baked textures will be in assets local cache IAssetService cache = m_scene.AssetService; @@ -409,8 +407,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory continue; } - defonly = false; // found a non-default texture reference - if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID) { if(wearableCache[idx].CacheId != cacheItems[i].CacheId) @@ -479,14 +475,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory sp.Appearance.WearableCacheItems[j].TextureID); } - // If we only found default textures, then the appearance is not cached - return (defonly ? false : true); + return (hits == cacheItems.Length); } // called when we get a new root avatar public bool ValidateBakedTextureCache(IScenePresence sp) { - bool defonly = true; // are we only using default textures int hits = 0; lock (m_setAppearanceLock) @@ -557,10 +551,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // this should be removed if (face.TextureID != UUID.Zero && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) - { - defonly = false; // found a non-default texture reference hits++; - } + continue; } else @@ -608,7 +600,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } else hits++; - defonly = false; // found a non-default texture reference } } } @@ -616,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory sp.Appearance.WearableCacheItems = wearableCache; } - m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2} {3}", sp.Name, sp.UUID, hits, defonly.ToString()); + m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2}", sp.Name, sp.UUID, hits); // debug for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { @@ -627,10 +618,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory sp.Appearance.WearableCacheItems[j].TextureID); } - // If we only found default textures, then the appearance is not cached - // return (defonly ? false : true); return (hits >= AvatarAppearance.BAKE_INDICES.Length - 1); // skirt is optional } + public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) { int texturesRebaked = 0; -- cgit v1.1 From 1bd13155e682aed90e27946290b3673938a15b8c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 13 Aug 2014 20:43:26 +0100 Subject: put back baked textures debug msgs at start of validatebaked... --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 2290c44..e34bac9 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -492,6 +492,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache = WearableCacheItem.GetDefaultCacheItem(); + + m_log.DebugFormat("[AVFACTORY]: ValidateBakedTextureCache start for {0} {1}", sp.Name, sp.UUID); + // debug + for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) + { + int j = AvatarAppearance.BAKE_INDICES[iter]; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[iter]; + if (face != null) + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - " + face.TextureID); + else + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture"); + } bool gotbacked = false; -- cgit v1.1 From a1cc218f10be109e6cca19f8e39d877243974984 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 01:53:51 +0100 Subject: *DANGER* make baked textures cross and make use of it * UNTESTED * issue: alll this seems to be sent back to childs, need to stop that --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 187 ++++++++++----------- 1 file changed, 92 insertions(+), 95 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e34bac9..186d82b 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -487,140 +487,137 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { IAssetService cache = m_scene.AssetService; IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); - WearableCacheItem[] wearableCache = null; WearableCacheItem[] bakedModuleCache = null; - wearableCache = WearableCacheItem.GetDefaultCacheItem(); + if (cache == null) + return false; + WearableCacheItem[] wearableCache = sp.Appearance.WearableCacheItems; + // big debug m_log.DebugFormat("[AVFACTORY]: ValidateBakedTextureCache start for {0} {1}", sp.Name, sp.UUID); - // debug for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { int j = AvatarAppearance.BAKE_INDICES[iter]; - Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[iter]; - if (face != null) - m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - " + face.TextureID); - else - m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture"); - } - - bool gotbacked = false; - - // Cache wearable data for teleport. - // Only makes sense if there's a bake module and a cache module - if (bakedModule != null && cache != null) - { - m_log.Debug("[ValidateBakedCache] calling bakedModule"); - try + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[j]; + if (wearableCache == null) { - bakedModuleCache = bakedModule.Get(sp.UUID); + if (face != null) + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t- " + face.TextureID); + else + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t- No texture"); } - catch (Exception) + else { - bakedModuleCache = null; + if (face != null) + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " ft- " + face.TextureID + + "}: cc-" + + wearableCache[j].CacheId + ", ct-" + + wearableCache[j].TextureID + ); + else + m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture" + + "}: cc-" + + wearableCache[j].CacheId + ", ct-" + + wearableCache[j].TextureID + ); } + } - if (bakedModuleCache != null) + bool wearableCacheValid = false; + if (wearableCache == null) + { + wearableCache = WearableCacheItem.GetDefaultCacheItem(); + } + else + { + // we may have received a full cache + // check same coerence and store + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { - m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); - - for (int i = 0; i < bakedModuleCache.Length; i++) + int idx = AvatarAppearance.BAKE_INDICES[i]; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; + if (face != null && face.TextureID == wearableCache[idx].TextureID && wearableCache[idx].TextureAsset != null) { - int j = (int)bakedModuleCache[i].TextureIndex; - - if (bakedModuleCache[i].TextureAsset != null) - { - wearableCache[j].TextureID = bakedModuleCache[i].TextureID; - wearableCache[j].CacheId = bakedModuleCache[i].CacheId; - wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; - bakedModuleCache[i].TextureAsset.Temporary = true; - bakedModuleCache[i].TextureAsset.Local = true; - cache.Store(bakedModuleCache[i].TextureAsset); - - } + hits++; + wearableCache[idx].TextureAsset.Temporary = true; + wearableCache[idx].TextureAsset.Local = true; + cache.Store(wearableCache[idx].TextureAsset); } - gotbacked = true; } + + wearableCacheValid = (hits >= AvatarAppearance.BAKE_INDICES.Length - 1); // skirt is optional + if (wearableCacheValid) + m_log.Debug("[ValidateBakedCache] have valid local cache"); } - // Process the baked textures - for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) + if (!wearableCacheValid) { - int idx = AvatarAppearance.BAKE_INDICES[i]; - Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; + hits = 0; + bool gotbacked = false; - // on tp viewer assumes servers did the cache work - // and tp propagation of baked textures is broken somewhere - // so make grid cache be mandatory - if (gotbacked) + if (bakedModule != null) { - // m_log.Debug("[ValidateBakedCache] bakedModule cache override"); - if (sp.Appearance.Texture.FaceTextures[idx] == null) - sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); - sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; - face = sp.Appearance.Texture.FaceTextures[idx]; - - // this should be removed - if (face.TextureID != UUID.Zero && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) - hits++; - - continue; - } - else - { - // No face, so lets check our cache - if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + m_log.Debug("[ValidateBakedCache] local cache invalid, calling bakedModule"); + try { - sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); - if (wearableCache[idx].TextureID != UUID.Zero) - { - sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; - face = sp.Appearance.Texture.FaceTextures[idx]; - // let run to end of loop to check cache - } - else - { - sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; - face = sp.Appearance.Texture.FaceTextures[idx]; - // lets try not invalidating the cache entry - // wearableCache[idx].CacheId = UUID.Zero; - // wearableCache[idx].TextureAsset = null; - continue; - } + bakedModuleCache = bakedModule.Get(sp.UUID); } - - if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) - continue; - - if (wearableCache[idx].TextureID != face.TextureID) + catch (Exception) { - wearableCache[idx].CacheId = UUID.Zero; - wearableCache[idx].TextureID = UUID.Zero; - wearableCache[idx].TextureAsset = null; - continue; + bakedModuleCache = null; } - wearableCache[idx].TextureAsset = null; - if (cache != null) + if (bakedModuleCache != null) { - wearableCache[idx].TextureAsset = m_scene.AssetService.GetCached(face.TextureID.ToString()); - if (wearableCache[idx].TextureAsset == null) + m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); + + for (int i = 0; i < bakedModuleCache.Length; i++) { - wearableCache[idx].CacheId = UUID.Zero; - wearableCache[idx].TextureID = UUID.Zero; + int j = (int)bakedModuleCache[i].TextureIndex; + + if (bakedModuleCache[i].TextureAsset != null) + { + wearableCache[j].TextureID = bakedModuleCache[i].TextureID; + wearableCache[j].CacheId = bakedModuleCache[i].CacheId; + wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; + bakedModuleCache[i].TextureAsset.Temporary = true; + bakedModuleCache[i].TextureAsset.Local = true; + cache.Store(bakedModuleCache[i].TextureAsset); + + } } - else + gotbacked = true; + } + } + + if (gotbacked) + { + // force the ones we got + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) + { + int idx = AvatarAppearance.BAKE_INDICES[i]; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; + + if (sp.Appearance.Texture.FaceTextures[idx] == null) + sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); + sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; + face = sp.Appearance.Texture.FaceTextures[idx]; + + // this should be removed + if (face.TextureID != UUID.Zero && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) hits++; + continue; } } } sp.Appearance.WearableCacheItems = wearableCache; + } - m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2}", sp.Name, sp.UUID, hits); // debug + m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2}", sp.Name, sp.UUID, hits); for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { int j = AvatarAppearance.BAKE_INDICES[iter]; -- cgit v1.1 From ab4df26309dee8b973a38e43c975ba6e573701d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 03:47:18 +0100 Subject: only try external baked texture module on login --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 62 +++++++++++++--------- 1 file changed, 36 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 186d82b..3c626ad 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -551,44 +551,54 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_log.Debug("[ValidateBakedCache] have valid local cache"); } + bool checkExternal = false; + if (!wearableCacheValid) { + ScenePresence ssp = null; + if (sp is ScenePresence) + { + ssp = (ScenePresence)sp; + checkExternal = (((uint)ssp.TeleportFlags & (uint)TeleportFlags.ViaLogin) != 0) && + bakedModule != null; + } + } + + if (checkExternal) + { hits = 0; bool gotbacked = false; - if (bakedModule != null) + m_log.Debug("[ValidateBakedCache] local cache invalid, calling bakedModule"); + try { - m_log.Debug("[ValidateBakedCache] local cache invalid, calling bakedModule"); - try - { - bakedModuleCache = bakedModule.Get(sp.UUID); - } - catch (Exception) - { - bakedModuleCache = null; - } + bakedModuleCache = bakedModule.Get(sp.UUID); + } + catch (Exception) + { + bakedModuleCache = null; + } + + if (bakedModuleCache != null) + { + m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); - if (bakedModuleCache != null) + for (int i = 0; i < bakedModuleCache.Length; i++) { - m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); + int j = (int)bakedModuleCache[i].TextureIndex; - for (int i = 0; i < bakedModuleCache.Length; i++) + if (bakedModuleCache[i].TextureAsset != null) { - int j = (int)bakedModuleCache[i].TextureIndex; - - if (bakedModuleCache[i].TextureAsset != null) - { - wearableCache[j].TextureID = bakedModuleCache[i].TextureID; - wearableCache[j].CacheId = bakedModuleCache[i].CacheId; - wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; - bakedModuleCache[i].TextureAsset.Temporary = true; - bakedModuleCache[i].TextureAsset.Local = true; - cache.Store(bakedModuleCache[i].TextureAsset); - - } + wearableCache[j].TextureID = bakedModuleCache[i].TextureID; + wearableCache[j].CacheId = bakedModuleCache[i].CacheId; + wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; + bakedModuleCache[i].TextureAsset.Temporary = true; + bakedModuleCache[i].TextureAsset.Local = true; + cache.Store(bakedModuleCache[i].TextureAsset); + } - gotbacked = true; } + gotbacked = true; } if (gotbacked) -- cgit v1.1 From 96cc4e5b95eb7f5b886a0fc0765866d062b3651a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 04:01:54 +0100 Subject: reduced debug msgs --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 3c626ad..be85947 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -466,6 +466,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } // debug + m_log.Debug("[UpdateBCache] hits: " +hits.ToString()); +/* for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { int j = AvatarAppearance.BAKE_INDICES[iter]; @@ -474,7 +476,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + sp.Appearance.WearableCacheItems[j].TextureID); } - +*/ return (hits == cacheItems.Length); } @@ -496,6 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // big debug m_log.DebugFormat("[AVFACTORY]: ValidateBakedTextureCache start for {0} {1}", sp.Name, sp.UUID); +/* for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { int j = AvatarAppearance.BAKE_INDICES[iter]; @@ -523,7 +526,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory ); } } - +*/ bool wearableCacheValid = false; if (wearableCache == null) { @@ -628,6 +631,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // debug m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2}", sp.Name, sp.UUID, hits); +/* for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { int j = AvatarAppearance.BAKE_INDICES[iter]; @@ -636,7 +640,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + sp.Appearance.WearableCacheItems[j].TextureID); } - +*/ return (hits >= AvatarAppearance.BAKE_INDICES.Length - 1); // skirt is optional } -- cgit v1.1 From d64fb216d2ef3180d1531034d74d4b01e616333b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 15:39:46 +0100 Subject: try external bakedModule when local cache is invalid and not just at login --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index be85947..dc16593 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -466,7 +466,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } // debug - m_log.Debug("[UpdateBCache] hits: " +hits.ToString()); + m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString()); /* for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { @@ -558,12 +558,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (!wearableCacheValid) { - ScenePresence ssp = null; - if (sp is ScenePresence) + // only use external bake module on login condition check +// ScenePresence ssp = null; +// if (sp is ScenePresence) { - ssp = (ScenePresence)sp; - checkExternal = (((uint)ssp.TeleportFlags & (uint)TeleportFlags.ViaLogin) != 0) && - bakedModule != null; +// ssp = (ScenePresence)sp; +// checkExternal = (((uint)ssp.TeleportFlags & (uint)TeleportFlags.ViaLogin) != 0) && +// bakedModule != null; + + // or do it anytime we dont have the cache + checkExternal = bakedModule != null; } } @@ -572,7 +576,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory hits = 0; bool gotbacked = false; - m_log.Debug("[ValidateBakedCache] local cache invalid, calling bakedModule"); + m_log.Debug("[ValidateBakedCache] local cache invalid, checking bakedModule"); try { bakedModuleCache = bakedModule.Get(sp.UUID); @@ -584,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (bakedModuleCache != null) { - m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); + m_log.Debug("[ValidateBakedCache] got bakedModule " + bakedModuleCache.Length + " cached textures"); for (int i = 0; i < bakedModuleCache.Length; i++) { @@ -630,7 +634,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } // debug - m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2}", sp.Name, sp.UUID, hits); + m_log.DebugFormat("[ValidateBakedCache]: Completed texture check for {0} {1} with {2} hits", sp.Name, sp.UUID, hits); /* for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { -- cgit v1.1 From 2d352e6348a54716664af5dd8b5ca0bfd33a5743 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Sep 2014 02:19:53 +0100 Subject: *NEEDS more testing* on attachment drop: fix adding prims to physics engine, remove disturbing phantom flag. On attach: fix removing prims from physics engine, delete any keyframeMotion, remove physical flag. This is executed in all attachs possible only need on attach from the scene (?), but its where original code removed only root part from physics engine --- .../Avatar/Attachments/AttachmentsModule.cs | 35 +++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2c7cd40..0361741 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -710,13 +710,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.AttachedAvatar = UUID.Zero; rootPart.SetParentLocalId(0); so.ClearPartAttachmentData(); - rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); + + rootPart.Flags &= ~PrimFlags.Phantom; +// rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); + so.ApplyPhysics(); + so.HasGroupChanged = true; rootPart.Rezzed = DateTime.Now; rootPart.RemFlag(PrimFlags.TemporaryOnRez); so.AttachToBackup(); m_scene.EventManager.TriggerParcelPrimCountTainted(); - rootPart.ScheduleFullUpdate(); + + so.ScheduleGroupForFullUpdate(); + rootPart.ClearUndoState(); List uuids = new List(); @@ -907,8 +913,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.AttachedAvatar = sp.UUID; - if (so.RootPart.PhysActor != null) - so.RootPart.RemoveFromPhysics(); +// if (so.RootPart.PhysActor != null) +// so.RootPart.RemoveFromPhysics(); + + foreach (SceneObjectPart part in so.Parts) + { + if (part.KeyframeMotion != null) + { + part.KeyframeMotion.Delete(); + part.KeyframeMotion = null; + } + +// if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) +// { +// PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? +// } +// else + if (part.PhysActor != null) + { + part.RemoveFromPhysics(); + } + } + + so.RootPart.Flags &= ~PrimFlags.Physics; so.AbsolutePosition = attachOffset; so.RootPart.AttachedPos = attachOffset; -- cgit v1.1 From 25b4e268a3cb48e3b9c85dfe7887bb1fbbdb0a1c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Sep 2014 11:16:59 +0100 Subject: change attachment drop, to make object Phanton. THis is not as SL, but rez position is automatic and object interpenetrations will happen including with the avatar, with the usual ugly effects. --- .../Avatar/Attachments/AttachmentsModule.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0361741..414bae6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -701,28 +701,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sp.RemoveAttachment(so); so.FromItemID = UUID.Zero; + so.AttachedAvatar = UUID.Zero; + so.ClearPartAttachmentData(); + SceneObjectPart rootPart = so.RootPart; + + rootPart.SetParentLocalId(0); so.AbsolutePosition = absolutePos; if (absoluteRot != Quaternion.Identity) { so.UpdateGroupRotationR(absoluteRot); } - so.AttachedAvatar = UUID.Zero; - rootPart.SetParentLocalId(0); - so.ClearPartAttachmentData(); - rootPart.Flags &= ~PrimFlags.Phantom; +// rootPart.RemFlag(PrimFlags.TemporaryOnRez); +// rootPart.AddFlag(PrimFlags.Phantom); + // rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); - so.ApplyPhysics(); + + // not physical, not temporary, phaton, not volume detector + so.UpdatePrimFlags(rootPart.LocalId,false,false,true,false); so.HasGroupChanged = true; rootPart.Rezzed = DateTime.Now; - rootPart.RemFlag(PrimFlags.TemporaryOnRez); so.AttachToBackup(); m_scene.EventManager.TriggerParcelPrimCountTainted(); - so.ScheduleGroupForFullUpdate(); - rootPart.ClearUndoState(); List uuids = new List(); @@ -735,6 +738,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Attach (NULL) stops scripts. We don't want that. Resume them. so.ResumeScripts(); + so.ScheduleGroupForFullUpdate(); } public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) -- cgit v1.1 From 93143ba0123cab8a3e92b93aa6dee371c1e39b8b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Sep 2014 23:44:29 +0100 Subject: on drop send full update on root prim, terse on others ( as sl ). Fix count down of number of physicial prims on attach, if removing them --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 414bae6..ea6174a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -719,7 +719,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); // not physical, not temporary, phaton, not volume detector - so.UpdatePrimFlags(rootPart.LocalId,false,false,true,false); + so.UpdatePrimFlags(rootPart.LocalId,false,false,true,rootPart.VolumeDetectActive); so.HasGroupChanged = true; rootPart.Rezzed = DateTime.Now; @@ -738,7 +738,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Attach (NULL) stops scripts. We don't want that. Resume them. so.ResumeScripts(); - so.ScheduleGroupForFullUpdate(); + so.ScheduleGroupForTerseUpdate(); + so.RootPart.ScheduleFullUpdate(); } public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) @@ -935,6 +936,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // else if (part.PhysActor != null) { + if(part.PhysActor.IsPhysical) + so.Scene.RemovePhysicalPrim(1); part.RemoveFromPhysics(); } } -- cgit v1.1 From 136749c651daeb017089274890c1fa3ddd7dc0eb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Sep 2014 03:45:26 +0100 Subject: drop attachments with original physical proprieties --- .../Avatar/Attachments/AttachmentsModule.cs | 27 +++++----------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index ea6174a..6371a1f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -713,13 +713,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.UpdateGroupRotationR(absoluteRot); } -// rootPart.RemFlag(PrimFlags.TemporaryOnRez); -// rootPart.AddFlag(PrimFlags.Phantom); - -// rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); + rootPart.RemFlag(PrimFlags.TemporaryOnRez); // not physical, not temporary, phaton, not volume detector - so.UpdatePrimFlags(rootPart.LocalId,false,false,true,rootPart.VolumeDetectActive); +// so.UpdatePrimFlags(rootPart.LocalId,false,false,true,rootPart.VolumeDetectActive); + + // restore full physical state instead + so.ApplyPhysics(); so.HasGroupChanged = true; rootPart.Rezzed = DateTime.Now; @@ -918,32 +918,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.AttachedAvatar = sp.UUID; -// if (so.RootPart.PhysActor != null) -// so.RootPart.RemoveFromPhysics(); - foreach (SceneObjectPart part in so.Parts) { if (part.KeyframeMotion != null) - { - part.KeyframeMotion.Delete(); - part.KeyframeMotion = null; - } + part.KeyframeMotion.Suspend(); -// if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) -// { -// PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? -// } -// else if (part.PhysActor != null) { - if(part.PhysActor.IsPhysical) - so.Scene.RemovePhysicalPrim(1); part.RemoveFromPhysics(); } } - so.RootPart.Flags &= ~PrimFlags.Physics; - so.AbsolutePosition = attachOffset; so.RootPart.AttachedPos = attachOffset; so.IsAttachment = true; -- cgit v1.1 From f4efa25820a9195a95968a589a9e439f21bd072b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Sep 2014 03:54:27 +0100 Subject: remove messing with KeyframeMotion on attach --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 6371a1f..3ae0dea 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -920,8 +920,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments foreach (SceneObjectPart part in so.Parts) { - if (part.KeyframeMotion != null) - part.KeyframeMotion.Suspend(); +// if (part.KeyframeMotion != null) +// part.KeyframeMotion.Suspend(); if (part.PhysActor != null) { -- cgit v1.1 From ce8ea55f4e863acad6597f5c199eecaa8726b117 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Sep 2014 17:25:07 +0100 Subject: ... and a few more.. --- .../Avatar/UserProfiles/UserProfileModule.cs | 49 ++++++++++++++-------- 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index d359ebc..db8405b 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -1239,19 +1239,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles return false; } - Stream rstream = webResponse.GetResponseStream(); - OSDMap mret = new OSDMap(); - try - { - mret = (OSDMap)OSDParser.DeserializeJson(rstream); - } - catch (Exception e) + + using (Stream rstream = webResponse.GetResponseStream()) { - m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); - return false; + try + { + mret = (OSDMap)OSDParser.DeserializeJson(rstream); + } + catch (Exception e) + { + m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); + if (webResponse != null) + webResponse.Close(); + return false; + } } + if (webResponse != null) + webResponse.Close(); if (mret.ContainsKey("error")) return false; @@ -1315,19 +1321,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles return false; } - Stream rstream = webResponse.GetResponseStream(); - OSDMap response = new OSDMap(); - try - { - response = (OSDMap)OSDParser.DeserializeJson(rstream); - } - catch (Exception e) + + using (Stream rstream = webResponse.GetResponseStream()) { - m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); - return false; + try + { + response = (OSDMap)OSDParser.DeserializeJson(rstream); + } + catch (Exception e) + { + m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); + if (webResponse != null) + webResponse.Close(); + return false; + } } + if (webResponse != null) + webResponse.Close(); + if(response.ContainsKey("error")) { data = response["error"]; -- cgit v1.1 From 9c552212a983c7e076c53340af9f47584d641aff Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 19 Sep 2014 16:51:51 +0100 Subject: exclude npcs from baked cache --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index dc16593..bd243ad 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -366,6 +366,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // called on textures update public bool UpdateBakedTextureCache(IScenePresence sp, WearableCacheItem[] cacheItems) { + // npcs dont have baked cache + if (((ScenePresence)sp).isNPC) + return true; + // uploaded baked textures will be in assets local cache IAssetService cache = m_scene.AssetService; @@ -485,6 +489,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { int hits = 0; + if (((ScenePresence)sp).isNPC) + return true; + lock (m_setAppearanceLock) { IAssetService cache = m_scene.AssetService; @@ -650,6 +657,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) { + if (((ScenePresence)sp).isNPC) + return 0; + int texturesRebaked = 0; IImprovedAssetCache cache = m_scene.RequestModuleInterface(); -- cgit v1.1 From 736490dcb60047e6060c13c990f13dc0c1bf0ea6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Oct 2014 18:13:44 +0000 Subject: dont send baked textures assets, but send cache information --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index bd243ad..297044f 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -547,12 +547,20 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { int idx = AvatarAppearance.BAKE_INDICES[i]; Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - if (face != null && face.TextureID == wearableCache[idx].TextureID && wearableCache[idx].TextureAsset != null) + if (face != null && face.TextureID == wearableCache[idx].TextureID) { - hits++; - wearableCache[idx].TextureAsset.Temporary = true; - wearableCache[idx].TextureAsset.Local = true; - cache.Store(wearableCache[idx].TextureAsset); + if (wearableCache[idx].TextureAsset != null) + { + hits++; + wearableCache[idx].TextureAsset.Temporary = true; + wearableCache[idx].TextureAsset.Local = true; + cache.Store(wearableCache[idx].TextureAsset); + + } + else if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null) + { + hits++; + } } } -- cgit v1.1 From c46c3a27aeee2bd26ed0cfbcdc9d73a29603f479 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Oct 2014 18:53:11 +0000 Subject: do consider skirt baked texture on validation --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 297044f..f8bb435 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -543,6 +543,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { // we may have received a full cache // check same coerence and store + wearableCacheValid = true; for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { int idx = AvatarAppearance.BAKE_INDICES[i]; @@ -555,16 +556,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache[idx].TextureAsset.Temporary = true; wearableCache[idx].TextureAsset.Local = true; cache.Store(wearableCache[idx].TextureAsset); - + } else if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null) { hits++; } + else + { + wearableCacheValid = false; + break; + } } } - - wearableCacheValid = (hits >= AvatarAppearance.BAKE_INDICES.Length - 1); // skirt is optional + + wearableCacheValid = (wearableCacheValid && (hits >= AvatarAppearance.BAKE_INDICES.Length - 1)); if (wearableCacheValid) m_log.Debug("[ValidateBakedCache] have valid local cache"); } -- cgit v1.1 From afa246695131a578853e78b4b6ad55ff08fc81cc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 29 Oct 2014 06:35:23 +0000 Subject: Fix baked textures for regions without external Xbakes adding rebake requests. Those may also be trigger if for same reason one is missing even with Xbakes. Later we can let this regions send the assets on teleports, changing how those are serialized --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 67 +++++++++++----------- 1 file changed, 35 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index f8bb435..878d2fa 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -202,14 +202,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // WriteBakedTexturesReport(sp, m_log.DebugFormat); - - // If bake textures are missing and this is not an NPC, request a rebake from client - // rebake may messup caching, and should not be needed - - -// if (!UpdateBakedTextureCache(sp,cacheItems) && (((ScenePresence)sp).PresenceType != PresenceType.Npc)) -// RequestRebake(sp, true); - UpdateBakedTextureCache(sp, cacheItems); // This appears to be set only in the final stage of the appearance @@ -372,6 +364,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // uploaded baked textures will be in assets local cache IAssetService cache = m_scene.AssetService; + IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface(); int validDirtyBakes = 0; int hits = 0; @@ -384,6 +377,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache = WearableCacheItem.GetDefaultCacheItem(); } + List missing = new List(); + // Process received baked textures for (int i = 0; i < cacheItems.Length; i++) { @@ -411,19 +406,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory continue; } - if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID) +/* + if (face.TextureID == wearableCache[idx].TextureID && m_BakedTextureModule != null) { - if(wearableCache[idx].CacheId != cacheItems[i].CacheId) + if (wearableCache[idx].CacheId != cacheItems[i].CacheId) { wearableCache[idx].CacheId = cacheItems[i].CacheId; validDirtyBakes++; - + //assuming this can only happen if asset is in cache } hits++; continue; } - +*/ + wearableCache[idx].TextureAsset = null; if (cache != null) wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString()); @@ -431,7 +428,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (wearableCache[idx].TextureAsset != null) { wearableCache[idx].CacheId = cacheItems[i].CacheId; - wearableCache[idx].TextureID = sp.Appearance.Texture.FaceTextures[idx].TextureID; + wearableCache[idx].TextureID = face.TextureID; validDirtyBakes++; hits++; } @@ -440,6 +437,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache[idx].CacheId = UUID.Zero; wearableCache[idx].TextureID = UUID.Zero; wearableCache[idx].TextureAsset = null; + missing.Add(face.TextureID); continue; } } @@ -451,7 +449,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (validDirtyBakes > 0 && hits == cacheItems.Length) { - IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface(); if (m_BakedTextureModule != null) { m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); @@ -469,8 +466,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } + if(missing.Count > 0) + { + foreach(UUID id in missing) + sp.ControllingClient.SendRebakeAvatarTextures(id); + } + // debug - m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString()); + m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString() + " rebakes " + missing.Count); /* for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { @@ -548,25 +551,26 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { int idx = AvatarAppearance.BAKE_INDICES[i]; Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - if (face != null && face.TextureID == wearableCache[idx].TextureID) + if (face != null) { - if (wearableCache[idx].TextureAsset != null) + if (face.TextureID == wearableCache[idx].TextureID && + face.TextureID != UUID.Zero) { - hits++; - wearableCache[idx].TextureAsset.Temporary = true; - wearableCache[idx].TextureAsset.Local = true; - cache.Store(wearableCache[idx].TextureAsset); - - } - else if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null) - { - hits++; - } - else - { - wearableCacheValid = false; - break; + if (wearableCache[idx].TextureAsset != null) + { + hits++; + wearableCache[idx].TextureAsset.Temporary = true; + wearableCache[idx].TextureAsset.Local = true; + cache.Store(wearableCache[idx].TextureAsset); + continue; + } + if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null) + { + hits++; + continue; + } } + wearableCacheValid = false; } } @@ -623,7 +627,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory bakedModuleCache[i].TextureAsset.Temporary = true; bakedModuleCache[i].TextureAsset.Local = true; cache.Store(bakedModuleCache[i].TextureAsset); - } } gotbacked = true; -- cgit v1.1 From 7723b1bcd37a0da340373d854b9a5b620c8e6de5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 29 Oct 2014 06:55:04 +0000 Subject: bug fix and don't send to xbakes if requesting rebakes --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 878d2fa..97b540a 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -420,16 +420,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory continue; } */ - wearableCache[idx].TextureAsset = null; if (cache != null) wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString()); if (wearableCache[idx].TextureAsset != null) { - wearableCache[idx].CacheId = cacheItems[i].CacheId; + if ( wearableCache[idx].TextureID != face.TextureID || + wearableCache[idx].CacheId != cacheItems[i].CacheId) + validDirtyBakes++; + wearableCache[idx].TextureID = face.TextureID; - validDirtyBakes++; + wearableCache[idx].CacheId = cacheItems[i].CacheId; hits++; } else @@ -444,11 +446,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } sp.Appearance.WearableCacheItems = wearableCache; - - // if we got a full set of baked textures save all in BakedTextureModule - - if (validDirtyBakes > 0 && hits == cacheItems.Length) + + if (missing.Count > 0) { + foreach (UUID id in missing) + sp.ControllingClient.SendRebakeAvatarTextures(id); + } + else if (validDirtyBakes > 0 && hits == cacheItems.Length) + { + // if we got a full set of baked textures save all in BakedTextureModule if (m_BakedTextureModule != null) { m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); @@ -466,11 +472,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } - if(missing.Count > 0) - { - foreach(UUID id in missing) - sp.ControllingClient.SendRebakeAvatarTextures(id); - } // debug m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString() + " rebakes " + missing.Count); -- cgit v1.1 From d0dfa721f2b906771ee9dacfe834909cd27e96fc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 29 Oct 2014 06:56:54 +0000 Subject: change last commit, need to send to Xbakes or changes will not be detected --- OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 97b540a..1d2fd4e 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -452,7 +452,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory foreach (UUID id in missing) sp.ControllingClient.SendRebakeAvatarTextures(id); } - else if (validDirtyBakes > 0 && hits == cacheItems.Length) + + if (validDirtyBakes > 0 && hits == cacheItems.Length) { // if we got a full set of baked textures save all in BakedTextureModule if (m_BakedTextureModule != null) -- cgit v1.1 From 36ecad98a1c04e09ceff17ce6850a45d38f9c95f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2014 04:48:19 +0100 Subject: Only send the actual bakes to the bakes module --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 1d2fd4e..1eb7d2d 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -462,14 +462,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory WearableCacheItem[] toBakedModule = new WearableCacheItem[AvatarAppearance.BAKE_INDICES.Length]; - for (int i = 0; i < cacheItems.Length; i++) + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { - int idx = (int)cacheItems[i].TextureIndex; - cacheItems[i].CacheId = wearableCache[idx].CacheId; - cacheItems[i].TextureID = wearableCache[idx].TextureID; - cacheItems[i].TextureAsset = wearableCache[idx].TextureAsset; + int idx = (int)AvatarAppearance.BAKE_INDICES[i]; + toBakedModule[i] = new WearableCacheItem(); + toBakedModule[i].TextureIndex = (uint)idx; + toBakedModule[i].CacheId = wearableCache[idx].CacheId; + toBakedModule[i].TextureID = wearableCache[idx].TextureID; + toBakedModule[i].TextureAsset = wearableCache[idx].TextureAsset; } - m_BakedTextureModule.Store(sp.UUID, cacheItems); + m_BakedTextureModule.Store(sp.UUID, toBakedModule); } } -- cgit v1.1 From bec456c2a529ca0b9ca7fd59e8110e5d5b27c126 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 11 Nov 2014 07:09:30 +0100 Subject: Remove the Invisible stuff and add more baked caching. Refactor selection of textures to save to Bakes module. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 1eb7d2d..22f0366 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -460,18 +460,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); - WearableCacheItem[] toBakedModule = new WearableCacheItem[AvatarAppearance.BAKE_INDICES.Length]; - - for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) - { - int idx = (int)AvatarAppearance.BAKE_INDICES[i]; - toBakedModule[i] = new WearableCacheItem(); - toBakedModule[i].TextureIndex = (uint)idx; - toBakedModule[i].CacheId = wearableCache[idx].CacheId; - toBakedModule[i].TextureID = wearableCache[idx].TextureID; - toBakedModule[i].TextureAsset = wearableCache[idx].TextureAsset; - } - m_BakedTextureModule.Store(sp.UUID, toBakedModule); + m_BakedTextureModule.Store(sp.UUID); } } @@ -610,8 +599,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { bakedModuleCache = bakedModule.Get(sp.UUID); } - catch (Exception) + catch (Exception e) { + m_log.ErrorFormat(e.ToString()); bakedModuleCache = null; } -- cgit v1.1 From 80118ac0575ad6816f65ed7436ec4e0b384f231d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 21 Nov 2014 04:00:52 +0100 Subject: Remove braindead "fix" that messed up intersim scripted giving. --- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 03aaaac..3815c71 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -471,17 +471,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer /// private void OnGridInstantMessage(GridInstantMessage im) { - // Check if it's a type of message that we should handle - if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) - || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) - || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) - || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined))) - return; - - m_log.DebugFormat( - "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}", - (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID); - // Check if this is ours to handle // Scene scene = FindClientScene(new UUID(im.toAgentID)); -- cgit v1.1 From a2676388f4f5976bf27f2d9ec5fc1170db9e7c62 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 23 Mar 2015 22:17:51 +0100 Subject: Make the scripted dialogs and restart message appear in the top right corner again. Viewers have been busy making these notifications all into toasts but we believe there are message that are important enough to make the user acknowledge them. --- OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 0e7ab7e..4fdcd01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -203,8 +203,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { m_scene.ForEachRootClient(delegate(IClientAPI client) { - client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, - message); + client.SendAgentAlertMessage( + message, false); }); } -- cgit v1.1 From 07dead7dcb8b0f2a27a50748e4a460d9669903fc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 29 Mar 2015 14:25:12 -0700 Subject: varregion: any conversions of use of Constants.RegionSize converted into Util.cs routines to convert region coords to and from world coords or handles. --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 6 ++---- OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index dcfc630..9d70063 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -213,8 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat IScene scene = c.Scene; UUID destination = c.Destination; Vector3 fromPos = c.Position; - Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, - scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); + Vector3 regionPos = new Vector3(scene.RegionInfo.WorldLocX, scene.RegionInfo.WorldLocY, 0); bool checkParcelHide = false; UUID sourceParcelID = UUID.Zero; @@ -424,8 +423,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat { Vector3 fromRegionPos = fromPos + regionPos; Vector3 toRegionPos = presence.AbsolutePosition + - new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize, - presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); + new Vector3(presence.Scene.RegionInfo.WorldLocX, presence.Scene.RegionInfo.WorldLocY, 0); int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index db8405b..7177d9b 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -663,8 +663,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles Vector3 avaPos = p.AbsolutePosition; // Getting the global position for the Avatar - Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX*Constants.RegionSize + avaPos.X, - remoteClient.Scene.RegionInfo.RegionLocY*Constants.RegionSize + avaPos.Y, + Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.WorldLocX + avaPos.X, + remoteClient.Scene.RegionInfo.WorldLocY + avaPos.Y, avaPos.Z); string landOwnerName = string.Empty; @@ -1353,4 +1353,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles } #endregion Web Util } -} \ No newline at end of file +} -- cgit v1.1