diff options
author | Melanie | 2012-10-03 00:24:33 +0100 |
---|---|---|
committer | Melanie | 2012-10-03 00:24:33 +0100 |
commit | 23d5bafa7f5e7b23ea36300de8096c7dc84e51b0 (patch) | |
tree | 044eb97d800f1ce82bfb0367488eb8752b3e6aa6 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-23d5bafa7f5e7b23ea36300de8096c7dc84e51b0.zip opensim-SC-23d5bafa7f5e7b23ea36300de8096c7dc84e51b0.tar.gz opensim-SC-23d5bafa7f5e7b23ea36300de8096c7dc84e51b0.tar.bz2 opensim-SC-23d5bafa7f5e7b23ea36300de8096c7dc84e51b0.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 219 insertions, 162 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8e886d4..e711afb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -475,6 +475,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
475 | 475 | ||
476 | public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId) | 476 | public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId) |
477 | { | 477 | { |
478 | DetachSingleAttachmentToGround(sp, soLocalId, sp.AbsolutePosition, Quaternion.Identity); | ||
479 | } | ||
480 | |||
481 | public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId, Vector3 absolutePos, Quaternion absoluteRot) | ||
482 | { | ||
478 | if (!Enabled) | 483 | if (!Enabled) |
479 | return; | 484 | return; |
480 | 485 | ||
@@ -516,7 +521,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
516 | so.FromItemID = UUID.Zero; | 521 | so.FromItemID = UUID.Zero; |
517 | 522 | ||
518 | SceneObjectPart rootPart = so.RootPart; | 523 | SceneObjectPart rootPart = so.RootPart; |
519 | so.AbsolutePosition = sp.AbsolutePosition; | 524 | so.AbsolutePosition = absolutePos; |
525 | if (absoluteRot != Quaternion.Identity) | ||
526 | { | ||
527 | so.UpdateGroupRotationR(absoluteRot); | ||
528 | } | ||
520 | so.AttachedAvatar = UUID.Zero; | 529 | so.AttachedAvatar = UUID.Zero; |
521 | rootPart.SetParentLocalId(0); | 530 | rootPart.SetParentLocalId(0); |
522 | so.ClearPartAttachmentData(); | 531 | so.ClearPartAttachmentData(); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 81de29c..c14cb17 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -313,6 +313,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
313 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); | 313 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | ||
317 | { | ||
318 | UUID destinationFolderID = UUID.Zero; | ||
319 | |||
320 | if (im.binaryBucket != null && im.binaryBucket.Length >= 16) | ||
321 | { | ||
322 | destinationFolderID = new UUID(im.binaryBucket, 0); | ||
323 | } | ||
324 | |||
325 | if (destinationFolderID != UUID.Zero) | ||
326 | { | ||
327 | IInventoryService invService = scene.InventoryService; | ||
328 | |||
329 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | ||
330 | |||
331 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | ||
332 | item = invService.GetItem(item); | ||
333 | InventoryFolderBase folder = null; | ||
334 | |||
335 | if (item != null) // It's an item | ||
336 | { | ||
337 | item.Folder = destinationFolderID; | ||
338 | |||
339 | invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); | ||
340 | scene.AddInventoryItem(client, item); | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | folder = new InventoryFolderBase(inventoryID, client.AgentId); | ||
345 | folder = invService.GetFolder(folder); | ||
346 | |||
347 | if (folder != null) // It's a folder | ||
348 | { | ||
349 | folder.ParentID = destinationFolderID; | ||
350 | invService.MoveFolder(folder); | ||
351 | } | ||
352 | } | ||
353 | } | ||
354 | } | ||
316 | else if ( | 355 | else if ( |
317 | im.dialog == (byte)InstantMessageDialog.InventoryDeclined | 356 | im.dialog == (byte)InstantMessageDialog.InventoryDeclined |
318 | || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) | 357 | || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) |
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs index 65e4c90..fd8d5e3 100755 --- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs +++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs | |||
@@ -1,161 +1,170 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Text; | 30 | using System.Text; |
31 | using log4net; | 31 | using log4net; |
32 | 32 | ||
33 | namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging | 33 | namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// Class for writing a high performance, high volume log file. | 36 | /// Class for writing a high performance, high volume log file. |
37 | /// Sometimes, to debug, one has a high volume logging to do and the regular | 37 | /// Sometimes, to debug, one has a high volume logging to do and the regular |
38 | /// log file output is not appropriate. | 38 | /// log file output is not appropriate. |
39 | /// Create a new instance with the parameters needed and | 39 | /// Create a new instance with the parameters needed and |
40 | /// call Write() to output a line. Call Close() when finished. | 40 | /// call Write() to output a line. Call Close() when finished. |
41 | /// If created with no parameters, it will not log anything. | 41 | /// If created with no parameters, it will not log anything. |
42 | /// </summary> | 42 | /// </summary> |
43 | public class LogWriter : IDisposable | 43 | public class LogWriter : IDisposable |
44 | { | 44 | { |
45 | public bool Enabled { get; private set; } | 45 | public bool Enabled { get; private set; } |
46 | 46 | ||
47 | private string m_logDirectory = "."; | 47 | private string m_logDirectory = "."; |
48 | private int m_logMaxFileTimeMin = 5; // 5 minutes | 48 | private int m_logMaxFileTimeMin = 5; // 5 minutes |
49 | public String LogFileHeader { get; set; } | 49 | public String LogFileHeader { get; set; } |
50 | 50 | ||
51 | private StreamWriter m_logFile = null; | 51 | private StreamWriter m_logFile = null; |
52 | private TimeSpan m_logFileLife; | 52 | private TimeSpan m_logFileLife; |
53 | private DateTime m_logFileEndTime; | 53 | private DateTime m_logFileEndTime; |
54 | private Object m_logFileWriteLock = new Object(); | 54 | private Object m_logFileWriteLock = new Object(); |
55 | 55 | ||
56 | // set externally when debugging. If let 'null', this does not write any error messages. | 56 | // set externally when debugging. If let 'null', this does not write any error messages. |
57 | public ILog ErrorLogger = null; | 57 | public ILog ErrorLogger = null; |
58 | private string LogHeader = "[LOG WRITER]"; | 58 | private string LogHeader = "[LOG WRITER]"; |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Create a log writer that will not write anything. Good for when not enabled | 61 | /// Create a log writer that will not write anything. Good for when not enabled |
62 | /// but the write statements are still in the code. | 62 | /// but the write statements are still in the code. |
63 | /// </summary> | 63 | /// </summary> |
64 | public LogWriter() | 64 | public LogWriter() |
65 | { | 65 | { |
66 | Enabled = false; | 66 | Enabled = false; |
67 | m_logFile = null; | 67 | m_logFile = null; |
68 | } | 68 | } |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Create a log writer instance. | 71 | /// Create a log writer instance. |
72 | /// </summary> | 72 | /// </summary> |
73 | /// <param name="dir">The directory to create the log file in. May be 'null' for default.</param> | 73 | /// <param name="dir">The directory to create the log file in. May be 'null' for default.</param> |
74 | /// <param name="headr">The characters that begin the log file name. May be 'null' for default.</param> | 74 | /// <param name="headr">The characters that begin the log file name. May be 'null' for default.</param> |
75 | /// <param name="maxFileTime">Maximum age of a log file in minutes. If zero, will set default.</param> | 75 | /// <param name="maxFileTime">Maximum age of a log file in minutes. If zero, will set default.</param> |
76 | public LogWriter(string dir, string headr, int maxFileTime) | 76 | public LogWriter(string dir, string headr, int maxFileTime) |
77 | { | 77 | { |
78 | m_logDirectory = dir == null ? "." : dir; | 78 | m_logDirectory = dir == null ? "." : dir; |
79 | 79 | ||
80 | LogFileHeader = headr == null ? "log-" : headr; | 80 | LogFileHeader = headr == null ? "log-" : headr; |
81 | 81 | ||
82 | m_logMaxFileTimeMin = maxFileTime; | 82 | m_logMaxFileTimeMin = maxFileTime; |
83 | if (m_logMaxFileTimeMin < 1) | 83 | if (m_logMaxFileTimeMin < 1) |
84 | m_logMaxFileTimeMin = 5; | 84 | m_logMaxFileTimeMin = 5; |
85 | 85 | ||
86 | m_logFileLife = new TimeSpan(0, m_logMaxFileTimeMin, 0); | 86 | m_logFileLife = new TimeSpan(0, m_logMaxFileTimeMin, 0); |
87 | m_logFileEndTime = DateTime.Now + m_logFileLife; | 87 | m_logFileEndTime = DateTime.Now + m_logFileLife; |
88 | 88 | ||
89 | Enabled = true; | 89 | Enabled = true; |
90 | } | 90 | } |
91 | 91 | ||
92 | public void Dispose() | 92 | public void Dispose() |
93 | { | 93 | { |
94 | this.Close(); | 94 | this.Close(); |
95 | } | 95 | } |
96 | 96 | ||
97 | public void Close() | 97 | public void Close() |
98 | { | 98 | { |
99 | Enabled = false; | 99 | Enabled = false; |
100 | if (m_logFile != null) | 100 | if (m_logFile != null) |
101 | { | 101 | { |
102 | m_logFile.Close(); | 102 | m_logFile.Close(); |
103 | m_logFile.Dispose(); | 103 | m_logFile.Dispose(); |
104 | m_logFile = null; | 104 | m_logFile = null; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | public void Write(string line, params object[] args) | 108 | public void Write(string line, params object[] args) |
109 | { | 109 | { |
110 | if (!Enabled) return; | 110 | if (!Enabled) return; |
111 | Write(String.Format(line, args)); | 111 | Write(String.Format(line, args)); |
112 | } | 112 | } |
113 | 113 | ||
114 | public void Write(string line) | 114 | public void Flush() |
115 | { | 115 | { |
116 | if (!Enabled) return; | 116 | if (!Enabled) return; |
117 | try | 117 | if (m_logFile != null) |
118 | { | 118 | { |
119 | lock (m_logFileWriteLock) | 119 | m_logFile.Flush(); |
120 | { | 120 | } |
121 | DateTime now = DateTime.Now; | 121 | } |
122 | if (m_logFile == null || now > m_logFileEndTime) | 122 | |
123 | { | 123 | public void Write(string line) |
124 | if (m_logFile != null) | 124 | { |
125 | { | 125 | if (!Enabled) return; |
126 | m_logFile.Close(); | 126 | try |
127 | m_logFile.Dispose(); | 127 | { |
128 | m_logFile = null; | 128 | lock (m_logFileWriteLock) |
129 | } | 129 | { |
130 | 130 | DateTime now = DateTime.Now; | |
131 | // First log file or time has expired, start writing to a new log file | 131 | if (m_logFile == null || now > m_logFileEndTime) |
132 | m_logFileEndTime = now + m_logFileLife; | 132 | { |
133 | string path = (m_logDirectory.Length > 0 ? m_logDirectory | 133 | if (m_logFile != null) |
134 | + System.IO.Path.DirectorySeparatorChar.ToString() : "") | 134 | { |
135 | + String.Format("{0}{1}.log", LogFileHeader, now.ToString("yyyyMMddHHmmss")); | 135 | m_logFile.Close(); |
136 | m_logFile = new StreamWriter(File.Open(path, FileMode.Append, FileAccess.Write)); | 136 | m_logFile.Dispose(); |
137 | } | 137 | m_logFile = null; |
138 | if (m_logFile != null) | 138 | } |
139 | { | 139 | |
140 | StringBuilder buff = new StringBuilder(line.Length + 25); | 140 | // First log file or time has expired, start writing to a new log file |
141 | buff.Append(now.ToString("yyyyMMddHHmmssfff")); | 141 | m_logFileEndTime = now + m_logFileLife; |
142 | // buff.Append(now.ToString("yyyyMMddHHmmss")); | 142 | string path = (m_logDirectory.Length > 0 ? m_logDirectory |
143 | buff.Append(","); | 143 | + System.IO.Path.DirectorySeparatorChar.ToString() : "") |
144 | buff.Append(line); | 144 | + String.Format("{0}{1}.log", LogFileHeader, now.ToString("yyyyMMddHHmmss")); |
145 | buff.Append("\r\n"); | 145 | m_logFile = new StreamWriter(File.Open(path, FileMode.Append, FileAccess.Write)); |
146 | m_logFile.Write(buff.ToString()); | 146 | } |
147 | } | 147 | if (m_logFile != null) |
148 | } | 148 | { |
149 | } | 149 | StringBuilder buff = new StringBuilder(line.Length + 25); |
150 | catch (Exception e) | 150 | buff.Append(now.ToString("yyyyMMddHHmmssfff")); |
151 | { | 151 | // buff.Append(now.ToString("yyyyMMddHHmmss")); |
152 | if (ErrorLogger != null) | 152 | buff.Append(","); |
153 | { | 153 | buff.Append(line); |
154 | ErrorLogger.ErrorFormat("{0}: FAILURE WRITING TO LOGFILE: {1}", LogHeader, e); | 154 | buff.Append("\r\n"); |
155 | } | 155 | m_logFile.Write(buff.ToString()); |
156 | Enabled = false; | 156 | } |
157 | } | 157 | } |
158 | return; | 158 | } |
159 | } | 159 | catch (Exception e) |
160 | } | 160 | { |
161 | } \ No newline at end of file | 161 | if (ErrorLogger != null) |
162 | { | ||
163 | ErrorLogger.ErrorFormat("{0}: FAILURE WRITING TO LOGFILE: {1}", LogHeader, e); | ||
164 | } | ||
165 | Enabled = false; | ||
166 | } | ||
167 | return; | ||
168 | } | ||
169 | } | ||
170 | } | ||