aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments
diff options
context:
space:
mode:
authorMelanie2010-07-31 00:57:50 +0100
committerMelanie2010-07-31 00:57:50 +0100
commit3302e8ddc4b7a99fc664d3fcc69cb61f9ee60116 (patch)
tree87bbf9ba4bf4e4e3b31e00d276dda98f1ecd156e /OpenSim/Region/CoreModules/Avatar/Attachments
parentBannination fixes. Objects in nonpublic parcels were muted by default. Gods (diff)
parentSlight improvement on previous commit. (diff)
downloadopensim-SC_OLD-3302e8ddc4b7a99fc664d3fcc69cb61f9ee60116.zip
opensim-SC_OLD-3302e8ddc4b7a99fc664d3fcc69cb61f9ee60116.tar.gz
opensim-SC_OLD-3302e8ddc4b7a99fc664d3fcc69cb61f9ee60116.tar.bz2
opensim-SC_OLD-3302e8ddc4b7a99fc664d3fcc69cb61f9ee60116.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs59
1 files changed, 43 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 34198d2..e557d2c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Xml; 31using System.Xml;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.Packets; 36using OpenMetaverse.Packets;
@@ -41,38 +42,64 @@ using OpenSim.Region.Framework.Scenes.Serialization;
41 42
42namespace OpenSim.Region.CoreModules.Avatar.Attachments 43namespace OpenSim.Region.CoreModules.Avatar.Attachments
43{ 44{
44 public class AttachmentsModule : IAttachmentsModule, IRegionModule 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AttachmentsModule")]
46 public class AttachmentsModule : IAttachmentsModule, INonSharedRegionModule
45 { 47 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 49
48 protected Scene m_scene = null; 50 protected Scene m_scene = null;
51
52 public string Name { get { return "Attachments Module"; } }
53 public Type ReplaceableInterface { get { return null; } }
49 54
50 public void Initialise(Scene scene, IConfigSource source) 55 public void Initialise(IConfigSource source) {}
56
57 public void AddRegion(Scene scene)
51 { 58 {
52 scene.RegisterModuleInterface<IAttachmentsModule>(this);
53 m_scene = scene; 59 m_scene = scene;
60 m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
61 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
62 // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
54 } 63 }
55 64
56 public void PostInitialise() 65 public void RemoveRegion(Scene scene)
57 { 66 {
67 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
68 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
58 } 69 }
59 70
60 public void Close() 71 public void RegionLoaded(Scene scene) {}
72
73 public void Close()
61 { 74 {
75 RemoveRegion(m_scene);
62 } 76 }
63 77
64 public string Name 78 public void SubscribeToClientEvents(IClientAPI client)
65 { 79 {
66 get { return "Attachments Module"; } 80 client.OnRezSingleAttachmentFromInv += RezSingleAttachmentFromInventory;
81 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
82 client.OnObjectAttach += AttachObject;
83 client.OnObjectDetach += DetachObject;
84 client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
67 } 85 }
68 86
69 public bool IsSharedModule 87 public void UnsubscribeFromClientEvents(IClientAPI client)
70 { 88 {
71 get { return false; } 89 client.OnRezSingleAttachmentFromInv -= RezSingleAttachmentFromInventory;
90 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
91 client.OnObjectAttach -= AttachObject;
92 client.OnObjectDetach -= DetachObject;
93 client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
72 } 94 }
73 95
74 // Called by client 96 /// <summary>
75 // 97 /// Called by client
98 /// </summary>
99 /// <param name="remoteClient"></param>
100 /// <param name="objectLocalID"></param>
101 /// <param name="AttachmentPt"></param>
102 /// <param name="silent"></param>
76 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) 103 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
77 { 104 {
78 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); 105 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");