diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 59 |
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; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Xml; | 31 | using System.Xml; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenMetaverse.Packets; | 36 | using OpenMetaverse.Packets; |
@@ -41,38 +42,64 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 43 | namespace 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"); |