diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1187e91..d895bb1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -56,11 +56,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
56 | { | 56 | { |
57 | m_scene = scene; | 57 | m_scene = scene; |
58 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 58 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
59 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
60 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI | ||
59 | } | 61 | } |
60 | 62 | ||
61 | public void RemoveRegion(Scene scene) | 63 | public void RemoveRegion(Scene scene) |
62 | { | 64 | { |
63 | m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); | 65 | m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); |
66 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
64 | } | 67 | } |
65 | 68 | ||
66 | public void RegionLoaded(Scene scene) {} | 69 | public void RegionLoaded(Scene scene) {} |
@@ -69,7 +72,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
69 | { | 72 | { |
70 | RemoveRegion(m_scene); | 73 | RemoveRegion(m_scene); |
71 | } | 74 | } |
72 | 75 | ||
76 | public void SubscribeToClientEvents(IClientAPI client) | ||
77 | { | ||
78 | client.OnRezSingleAttachmentFromInv += RezSingleAttachmentFromInventory; | ||
79 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; | ||
80 | client.OnObjectAttach += AttachObject; | ||
81 | client.OnObjectDetach += DetachObject; | ||
82 | client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; | ||
83 | } | ||
84 | |||
85 | public void UnsubscribeFromClientEvents(IClientAPI client) | ||
86 | { | ||
87 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachmentFromInventory; | ||
88 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; | ||
89 | client.OnObjectAttach -= AttachObject; | ||
90 | client.OnObjectDetach -= DetachObject; | ||
91 | client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; | ||
92 | } | ||
93 | |||
73 | /// <summary> | 94 | /// <summary> |
74 | /// Called by client | 95 | /// Called by client |
75 | /// </summary> | 96 | /// </summary> |