aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-09-30 01:19:22 +0100
committerJustin Clark-Casey (justincc)2011-09-30 01:19:22 +0100
commite742cffe15d3e50841908d7babc2e4c4a7630635 (patch)
tree9284d6ba2f750b29c965b15f215f77abb34414b1 /OpenSim
parentllAvatarOnLinkSitTarget Implementation (diff)
downloadopensim-SC_OLD-e742cffe15d3e50841908d7babc2e4c4a7630635.zip
opensim-SC_OLD-e742cffe15d3e50841908d7babc2e4c4a7630635.tar.gz
opensim-SC_OLD-e742cffe15d3e50841908d7babc2e4c4a7630635.tar.bz2
opensim-SC_OLD-e742cffe15d3e50841908d7babc2e4c4a7630635.tar.xz
Add Enabled switch in new [Attachments] section in OpenSimDefaults.ini to allow attachments to be temporarily turned off.
This is for debugging purposes. Defaults to Attachments Enabled
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs56
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs1
3 files changed, 54 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index af9b62f..fefa242 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -442,7 +442,7 @@ namespace OpenSim.Framework.Servers.HttpServer
442 string path = request.RawUrl; 442 string path = request.RawUrl;
443 string handlerKey = GetHandlerKey(request.HttpMethod, path); 443 string handlerKey = GetHandlerKey(request.HttpMethod, path);
444 444
445 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 445// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
446 446
447 if (TryGetStreamHandler(handlerKey, out requestHandler)) 447 if (TryGetStreamHandler(handlerKey, out requestHandler))
448 { 448 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index b965d75..8757251 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -48,25 +48,42 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
48 48
49 private Scene m_scene; 49 private Scene m_scene;
50 private IDialogModule m_dialogModule; 50 private IDialogModule m_dialogModule;
51
52 /// <summary>
53 /// Are attachments enabled?
54 /// </summary>
55 public bool Enabled { get; private set; }
51 56
52 public string Name { get { return "Attachments Module"; } } 57 public string Name { get { return "Attachments Module"; } }
53 public Type ReplaceableInterface { get { return null; } } 58 public Type ReplaceableInterface { get { return null; } }
54 59
55 public void Initialise(IConfigSource source) {} 60 public void Initialise(IConfigSource source)
61 {
62 IConfig config = source.Configs["Attachments"];
63 if (config != null)
64 Enabled = config.GetBoolean("Enabled", true);
65 else
66 Enabled = true;
67 }
56 68
57 public void AddRegion(Scene scene) 69 public void AddRegion(Scene scene)
58 { 70 {
59 m_scene = scene; 71 m_scene = scene;
60 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); 72 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
61 m_scene.RegisterModuleInterface<IAttachmentsModule>(this); 73 m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
62 m_scene.EventManager.OnNewClient += SubscribeToClientEvents; 74
75 if (Enabled)
76 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
77
63 // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI 78 // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
64 } 79 }
65 80
66 public void RemoveRegion(Scene scene) 81 public void RemoveRegion(Scene scene)
67 { 82 {
68 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); 83 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
69 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; 84
85 if (Enabled)
86 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
70 } 87 }
71 88
72 public void RegionLoaded(Scene scene) {} 89 public void RegionLoaded(Scene scene) {}
@@ -102,6 +119,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
102 /// </summary> 119 /// </summary>
103 public void RezAttachments(IScenePresence sp) 120 public void RezAttachments(IScenePresence sp)
104 { 121 {
122 if (!Enabled)
123 return;
124
105 if (null == sp.Appearance) 125 if (null == sp.Appearance)
106 { 126 {
107 m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID); 127 m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID);
@@ -145,6 +165,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
145 { 165 {
146// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); 166// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
147 167
168 if (!Enabled)
169 return;
170
148 foreach (SceneObjectGroup grp in sp.GetAttachments()) 171 foreach (SceneObjectGroup grp in sp.GetAttachments())
149 { 172 {
150// if (grp.HasGroupChanged) // Resizer scripts? 173// if (grp.HasGroupChanged) // Resizer scripts?
@@ -163,6 +186,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
163// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", 186// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
164// m_scene.RegionInfo.RegionName, sp.Name, silent); 187// m_scene.RegionInfo.RegionName, sp.Name, silent);
165 188
189 if (!Enabled)
190 return;
191
166 foreach (SceneObjectGroup sop in sp.GetAttachments()) 192 foreach (SceneObjectGroup sop in sp.GetAttachments())
167 { 193 {
168 sop.Scene.DeleteSceneObject(sop, silent); 194 sop.Scene.DeleteSceneObject(sop, silent);
@@ -184,6 +210,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
184// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", 210// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
185// objectLocalID, remoteClient.Name, AttachmentPt, silent); 211// objectLocalID, remoteClient.Name, AttachmentPt, silent);
186 212
213 if (!Enabled)
214 return;
215
187 try 216 try
188 { 217 {
189 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 218 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
@@ -232,6 +261,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
232 261
233 public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) 262 public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
234 { 263 {
264 if (!Enabled)
265 return false;
266
235 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 267 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
236 268
237 if (sp == null) 269 if (sp == null)
@@ -331,6 +363,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
331 RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, 363 RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
332 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) 364 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
333 { 365 {
366 if (!Enabled)
367 return;
368
334 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 369 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
335 370
336 if (sp == null) 371 if (sp == null)
@@ -354,6 +389,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
354 389
355 public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 390 public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
356 { 391 {
392 if (!Enabled)
393 return null;
394
357// m_log.DebugFormat( 395// m_log.DebugFormat(
358// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", 396// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}",
359// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); 397// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name);
@@ -373,6 +411,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
373 411
374 public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt) 412 public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt)
375 { 413 {
414 if (!Enabled)
415 return null;
416
376// m_log.DebugFormat( 417// m_log.DebugFormat(
377// "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}", 418// "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}",
378// (AttachmentPoint)AttachmentPt, itemID, sp.Name); 419// (AttachmentPoint)AttachmentPt, itemID, sp.Name);
@@ -535,6 +576,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
535 576
536 public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) 577 public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
537 { 578 {
579 if (!Enabled)
580 return;
581
538 ScenePresence presence; 582 ScenePresence presence;
539 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 583 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
540 { 584 {
@@ -554,6 +598,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
554 598
555 public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient) 599 public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient)
556 { 600 {
601 if (!Enabled)
602 return;
603
557// m_log.DebugFormat( 604// m_log.DebugFormat(
558// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", 605// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
559// remoteClient.Name, soLocalId); 606// remoteClient.Name, soLocalId);
@@ -669,6 +716,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
669 716
670 public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) 717 public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos)
671 { 718 {
719 if (!Enabled)
720 return;
721
672 // First we save the 722 // First we save the
673 // attachment point information, then we update the relative 723 // attachment point information, then we update the relative
674 // positioning. Then we have to mark the object as NOT an 724 // positioning. Then we have to mark the object as NOT an
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 03238d9..54b422b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
150 { 150 {
151 if (!m_Enabled) 151 if (!m_Enabled)
152 return; 152 return;
153
154 } 153 }
155 154
156 #endregion 155 #endregion