diff options
author | UbitUmarov | 2018-10-23 12:27:08 +0100 |
---|---|---|
committer | UbitUmarov | 2018-10-23 12:27:08 +0100 |
commit | 601d965009c67ebaa78f511901659942505d227f (patch) | |
tree | 44ca8c7f6b49c89942673902568de06fad2ef92d | |
parent | recover the inword region console comand Set AutoGrantAttachPerms (diff) | |
download | opensim-SC-601d965009c67ebaa78f511901659942505d227f.zip opensim-SC-601d965009c67ebaa78f511901659942505d227f.tar.gz opensim-SC-601d965009c67ebaa78f511901659942505d227f.tar.bz2 opensim-SC-601d965009c67ebaa78f511901659942505d227f.tar.xz |
remove AttachmentsCommandModule
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 111 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs | 188 |
2 files changed, 92 insertions, 207 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 597f2eb..3b19ec8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Text; | ||
32 | using System.Threading; | 33 | using System.Threading; |
33 | using System.Xml; | 34 | using System.Xml; |
34 | using log4net; | 35 | using log4net; |
@@ -37,6 +38,7 @@ using Nini.Config; | |||
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
39 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Region.Framework; | 42 | using OpenSim.Region.Framework; |
41 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
@@ -92,23 +94,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
92 | m_scene.EventManager.OnStartScript += (localID, itemID) => OnScriptStateChange(localID, true); | 94 | m_scene.EventManager.OnStartScript += (localID, itemID) => OnScriptStateChange(localID, true); |
93 | m_scene.EventManager.OnStopScript += (localID, itemID) => OnScriptStateChange(localID, false); | 95 | m_scene.EventManager.OnStopScript += (localID, itemID) => OnScriptStateChange(localID, false); |
94 | 96 | ||
95 | MainConsole.Instance.Commands.AddCommand( | ||
96 | "Debug", | ||
97 | false, | ||
98 | "debug attachments log", | ||
99 | "debug attachments log [0|1]", | ||
100 | "Turn on attachments debug logging", | ||
101 | " <= 0 - turns off debug logging\n" | ||
102 | + " >= 1 - turns on attachment message debug logging", | ||
103 | HandleDebugAttachmentsLog); | ||
104 | |||
105 | MainConsole.Instance.Commands.AddCommand( | ||
106 | "Debug", | ||
107 | false, | ||
108 | "debug attachments status", | ||
109 | "debug attachments status", | ||
110 | "Show current attachments debug status", | ||
111 | HandleDebugAttachmentsStatus); | ||
112 | } | 97 | } |
113 | 98 | ||
114 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI | 99 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI |
@@ -133,6 +118,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
133 | { | 118 | { |
134 | m_regionConsole.AddCommand("AttachModule", false, "set auto_grant_attach_perms", "set auto_grant_attach_perms true|false", "Allow objects owned by the region owner or estate managers to obtain attach permissions without asking the user", HandleSetAutoGrantAttachPerms); | 119 | m_regionConsole.AddCommand("AttachModule", false, "set auto_grant_attach_perms", "set auto_grant_attach_perms true|false", "Allow objects owned by the region owner or estate managers to obtain attach permissions without asking the user", HandleSetAutoGrantAttachPerms); |
135 | } | 120 | } |
121 | |||
122 | scene.AddCommand( | ||
123 | "Debug", | ||
124 | this, | ||
125 | "debug attachments log", | ||
126 | "debug attachments log [0|1]", | ||
127 | "Turn on attachments debug logging", | ||
128 | " <= 0 - turns off debug logging\n" | ||
129 | + " >= 1 - turns on attachment message debug logging", | ||
130 | HandleDebugAttachmentsLog); | ||
131 | |||
132 | scene.AddCommand( | ||
133 | "Debug", | ||
134 | this, | ||
135 | "debug attachments status", | ||
136 | "debug attachments status", | ||
137 | "Show current attachments debug status", | ||
138 | HandleDebugAttachmentsStatus); | ||
139 | |||
140 | // next should work on console root also | ||
141 | MainConsole.Instance.Commands.AddCommand( | ||
142 | "Users", true, "attachments show", | ||
143 | "attachments show [<first-name> <last-name>]", | ||
144 | "Show attachment information for avatars in this simulator.", | ||
145 | "If no name is supplied then information for all avatars is shown.", | ||
146 | HandleShowAttachmentsCommand); | ||
136 | } | 147 | } |
137 | 148 | ||
138 | public void Close() | 149 | public void Close() |
@@ -164,6 +175,70 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
164 | MainConsole.Instance.OutputFormat("Debug logging level: {0}", DebugLevel); | 175 | MainConsole.Instance.OutputFormat("Debug logging level: {0}", DebugLevel); |
165 | } | 176 | } |
166 | 177 | ||
178 | protected void HandleShowAttachmentsCommand(string module, string[] cmd) | ||
179 | { | ||
180 | if (cmd.Length != 2 && cmd.Length < 4) | ||
181 | { | ||
182 | MainConsole.Instance.OutputFormat("Usage: attachments show [<first-name> <last-name>]"); | ||
183 | return; | ||
184 | } | ||
185 | |||
186 | SceneManager sm = SceneManager.Instance; | ||
187 | if(sm == null || sm.Scenes.Count == 0) | ||
188 | return; | ||
189 | |||
190 | bool targetNameSupplied = false; | ||
191 | string optionalTargetFirstName = null; | ||
192 | string optionalTargetLastName = null; | ||
193 | |||
194 | if (cmd.Length >= 4) | ||
195 | { | ||
196 | targetNameSupplied = true; | ||
197 | optionalTargetFirstName = cmd[2]; | ||
198 | optionalTargetLastName = cmd[3]; | ||
199 | } | ||
200 | |||
201 | StringBuilder sb = new StringBuilder(); | ||
202 | sm.ForEachSelectedScene( | ||
203 | scene => | ||
204 | { | ||
205 | if (targetNameSupplied) | ||
206 | { | ||
207 | ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); | ||
208 | if (sp != null && !sp.IsChildAgent) | ||
209 | GetAttachmentsReport(sp, sb); | ||
210 | } | ||
211 | else | ||
212 | { | ||
213 | sb.AppendFormat("--- All attachments for region {0}:\n", scene.Name); | ||
214 | scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb)); | ||
215 | } | ||
216 | }); | ||
217 | |||
218 | MainConsole.Instance.Output(sb.ToString()); | ||
219 | } | ||
220 | |||
221 | private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb) | ||
222 | { | ||
223 | sb.AppendFormat("Attachments for {0}\n\n", sp.Name); | ||
224 | |||
225 | ConsoleDisplayList ct = new ConsoleDisplayList(); | ||
226 | |||
227 | List<SceneObjectGroup> attachmentObjects = sp.GetAttachments(); | ||
228 | foreach (SceneObjectGroup attachmentObject in attachmentObjects) | ||
229 | { | ||
230 | ct.Indent = 2; | ||
231 | ct.AddRow("Attachment Name", attachmentObject.Name); | ||
232 | ct.AddRow("Local ID", attachmentObject.LocalId); | ||
233 | ct.AddRow("Item ID", attachmentObject.UUID); | ||
234 | ct.AddRow("From Item ID", attachmentObject.FromItemID); | ||
235 | ct.AddRow("Attach Point", ((AttachmentPoint)attachmentObject.AttachmentPoint)); | ||
236 | ct.AddRow("Position", attachmentObject.RootPart.AttachedPos + "\n\n"); | ||
237 | } | ||
238 | |||
239 | ct.AddToStringBuilder(sb); | ||
240 | } | ||
241 | |||
167 | private void SendConsoleOutput(UUID agentID, string text) | 242 | private void SendConsoleOutput(UUID agentID, string text) |
168 | { | 243 | { |
169 | if (m_regionConsole == null) | 244 | if (m_regionConsole == null) |
@@ -341,7 +416,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
341 | } | 416 | } |
342 | } | 417 | } |
343 | 418 | ||
344 | |||
345 | List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); | 419 | List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); |
346 | 420 | ||
347 | // Let's get all items at once, so they get cached | 421 | // Let's get all items at once, so they get cached |
@@ -410,7 +484,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
410 | 484 | ||
411 | Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); | 485 | Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); |
412 | 486 | ||
413 | |||
414 | if (sp.PresenceType != PresenceType.Npc) | 487 | if (sp.PresenceType != PresenceType.Npc) |
415 | { | 488 | { |
416 | foreach (SceneObjectGroup so in attachments) | 489 | foreach (SceneObjectGroup so in attachments) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs deleted file mode 100644 index 3685041..0000000 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using log4net; | ||
34 | using Mono.Addins; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | ||
39 | using OpenSim.Framework.Monitoring; | ||
40 | using OpenSim.Region.ClientStack.LindenUDP; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Region.OptionalModules.Avatar.Attachments | ||
45 | { | ||
46 | /// <summary> | ||
47 | /// A module that just holds commands for inspecting avatar appearance. | ||
48 | /// </summary> | ||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AttachmentsCommandModule")] | ||
50 | public class AttachmentsCommandModule : ISharedRegionModule | ||
51 | { | ||
52 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | private List<Scene> m_scenes = new List<Scene>(); | ||
55 | // private IAvatarFactoryModule m_avatarFactory; | ||
56 | |||
57 | public string Name { get { return "Attachments Command Module"; } } | ||
58 | |||
59 | public Type ReplaceableInterface { get { return null; } } | ||
60 | |||
61 | public void Initialise(IConfigSource source) | ||
62 | { | ||
63 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: INITIALIZED MODULE"); | ||
64 | } | ||
65 | |||
66 | public void PostInitialise() | ||
67 | { | ||
68 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: POST INITIALIZED MODULE"); | ||
69 | } | ||
70 | |||
71 | public void Close() | ||
72 | { | ||
73 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: CLOSED MODULE"); | ||
74 | } | ||
75 | |||
76 | public void AddRegion(Scene scene) | ||
77 | { | ||
78 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
79 | } | ||
80 | |||
81 | public void RemoveRegion(Scene scene) | ||
82 | { | ||
83 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
84 | |||
85 | lock (m_scenes) | ||
86 | m_scenes.Remove(scene); | ||
87 | } | ||
88 | |||
89 | public void RegionLoaded(Scene scene) | ||
90 | { | ||
91 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
92 | |||
93 | lock (m_scenes) | ||
94 | m_scenes.Add(scene); | ||
95 | |||
96 | scene.AddCommand( | ||
97 | "Users", this, "attachments show", | ||
98 | "attachments show [<first-name> <last-name>]", | ||
99 | "Show attachment information for avatars in this simulator.", | ||
100 | "If no name is supplied then information for all avatars is shown.", | ||
101 | HandleShowAttachmentsCommand); | ||
102 | } | ||
103 | |||
104 | protected void HandleShowAttachmentsCommand(string module, string[] cmd) | ||
105 | { | ||
106 | if (cmd.Length != 2 && cmd.Length < 4) | ||
107 | { | ||
108 | MainConsole.Instance.OutputFormat("Usage: attachments show [<first-name> <last-name>]"); | ||
109 | return; | ||
110 | } | ||
111 | |||
112 | bool targetNameSupplied = false; | ||
113 | string optionalTargetFirstName = null; | ||
114 | string optionalTargetLastName = null; | ||
115 | |||
116 | if (cmd.Length >= 4) | ||
117 | { | ||
118 | targetNameSupplied = true; | ||
119 | optionalTargetFirstName = cmd[2]; | ||
120 | optionalTargetLastName = cmd[3]; | ||
121 | } | ||
122 | |||
123 | StringBuilder sb = new StringBuilder(); | ||
124 | |||
125 | lock (m_scenes) | ||
126 | { | ||
127 | foreach (Scene scene in m_scenes) | ||
128 | { | ||
129 | if (targetNameSupplied) | ||
130 | { | ||
131 | ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); | ||
132 | if (sp != null && !sp.IsChildAgent) | ||
133 | GetAttachmentsReport(sp, sb); | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb)); | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | |||
142 | MainConsole.Instance.Output(sb.ToString()); | ||
143 | } | ||
144 | |||
145 | private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb) | ||
146 | { | ||
147 | sb.AppendFormat("Attachments for {0}\n\n", sp.Name); | ||
148 | |||
149 | ConsoleDisplayList ct = new ConsoleDisplayList(); | ||
150 | |||
151 | // sb.AppendFormat( | ||
152 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | ||
153 | // "Attachment Name", "Local ID", "Item ID", "Attach Point", "Position"); | ||
154 | |||
155 | List<SceneObjectGroup> attachmentObjects = sp.GetAttachments(); | ||
156 | foreach (SceneObjectGroup attachmentObject in attachmentObjects) | ||
157 | { | ||
158 | // InventoryItemBase attachmentItem | ||
159 | // = m_scenes[0].InventoryService.GetItem(new InventoryItemBase(attachmentObject.FromItemID)); | ||
160 | |||
161 | // if (attachmentItem == null) | ||
162 | // { | ||
163 | // sb.AppendFormat( | ||
164 | // "WARNING: Couldn't find attachment for item {0} at point {1}\n", | ||
165 | // attachmentData.ItemID, (AttachmentPoint)attachmentData.AttachPoint); | ||
166 | // continue; | ||
167 | // } | ||
168 | // else | ||
169 | // { | ||
170 | // sb.AppendFormat( | ||
171 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | ||
172 | // attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID, | ||
173 | // (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos); | ||
174 | |||
175 | ct.Indent = 2; | ||
176 | ct.AddRow("Attachment Name", attachmentObject.Name); | ||
177 | ct.AddRow("Local ID", attachmentObject.LocalId); | ||
178 | ct.AddRow("Item ID", attachmentObject.UUID); | ||
179 | ct.AddRow("From Item ID", attachmentObject.FromItemID); | ||
180 | ct.AddRow("Attach Point", ((AttachmentPoint)attachmentObject.AttachmentPoint)); | ||
181 | ct.AddRow("Position", attachmentObject.RootPart.AttachedPos + "\n\n"); | ||
182 | // } | ||
183 | } | ||
184 | |||
185 | ct.AddToStringBuilder(sb); | ||
186 | } | ||
187 | } | ||
188 | } \ No newline at end of file | ||