diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-19 14:43:18 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-19 14:43:18 -0400 |
commit | 289439c8329d992251769aa83e3d7809f651de26 (patch) | |
tree | 8a1e596190f197fa5f70f21a8c968d2c55004cde /OpenSim/Server | |
parent | Add Border (a virtual border management class) (diff) | |
parent | Added MoveItems, which is most useful upon viewer-delete inventory operation.... (diff) | |
download | opensim-SC-289439c8329d992251769aa83e3d7809f651de26.zip opensim-SC-289439c8329d992251769aa83e3d7809f651de26.tar.gz opensim-SC-289439c8329d992251769aa83e3d7809f651de26.tar.bz2 opensim-SC-289439c8329d992251769aa83e3d7809f651de26.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 28 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | 34 |
2 files changed, 56 insertions, 6 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 619c2d1..1d9eb0d 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -65,6 +65,10 @@ namespace OpenSim.Server.Base | |||
65 | // | 65 | // |
66 | private bool m_Running = true; | 66 | private bool m_Running = true; |
67 | 67 | ||
68 | // PID file | ||
69 | // | ||
70 | private string m_pidFile = String.Empty; | ||
71 | |||
68 | // Handle all the automagical stuff | 72 | // Handle all the automagical stuff |
69 | // | 73 | // |
70 | public ServicesServerBase(string prompt, string[] args) | 74 | public ServicesServerBase(string prompt, string[] args) |
@@ -211,6 +215,11 @@ namespace OpenSim.Server.Base | |||
211 | } | 215 | } |
212 | } | 216 | } |
213 | 217 | ||
218 | if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty) | ||
219 | { | ||
220 | CreatePIDFile(startupConfig.GetString("PIDFile")); | ||
221 | } | ||
222 | |||
214 | // Register the quit command | 223 | // Register the quit command |
215 | // | 224 | // |
216 | MainConsole.Instance.Commands.AddCommand("base", false, "quit", | 225 | MainConsole.Instance.Commands.AddCommand("base", false, "quit", |
@@ -230,6 +239,8 @@ namespace OpenSim.Server.Base | |||
230 | MainConsole.Instance.Prompt(); | 239 | MainConsole.Instance.Prompt(); |
231 | } | 240 | } |
232 | 241 | ||
242 | if (m_pidFile != String.Empty) | ||
243 | File.Delete(m_pidFile); | ||
233 | return 0; | 244 | return 0; |
234 | } | 245 | } |
235 | 246 | ||
@@ -246,5 +257,22 @@ namespace OpenSim.Server.Base | |||
246 | protected virtual void Initialise() | 257 | protected virtual void Initialise() |
247 | { | 258 | { |
248 | } | 259 | } |
260 | |||
261 | protected void CreatePIDFile(string path) | ||
262 | { | ||
263 | try | ||
264 | { | ||
265 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
266 | FileStream fs = File.Create(path); | ||
267 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
268 | Byte[] buf = enc.GetBytes(pidstring); | ||
269 | fs.Write(buf, 0, buf.Length); | ||
270 | fs.Close(); | ||
271 | m_pidFile = path; | ||
272 | } | ||
273 | catch (Exception) | ||
274 | { | ||
275 | } | ||
276 | } | ||
249 | } | 277 | } |
250 | } | 278 | } |
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 30b3cae..6ef1d9d 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | |||
@@ -105,8 +105,8 @@ namespace OpenSim.Server.Handlers.Inventory | |||
105 | "POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession)); | 105 | "POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession)); |
106 | 106 | ||
107 | m_httpServer.AddStreamHandler( | 107 | m_httpServer.AddStreamHandler( |
108 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 108 | new RestDeserialiseSecureHandler<List<Guid>, bool>( |
109 | "POST", "/DeleteItem/", m_InventoryService.DeleteItem, CheckAuthSession)); | 109 | "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); |
110 | 110 | ||
111 | m_httpServer.AddStreamHandler( | 111 | m_httpServer.AddStreamHandler( |
112 | new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | 112 | new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( |
@@ -125,8 +125,8 @@ namespace OpenSim.Server.Handlers.Inventory | |||
125 | "POST", "/NewFolder/", m_InventoryService.AddFolder, CheckAuthSession)); | 125 | "POST", "/NewFolder/", m_InventoryService.AddFolder, CheckAuthSession)); |
126 | 126 | ||
127 | m_httpServer.AddStreamHandler( | 127 | m_httpServer.AddStreamHandler( |
128 | new RestDeserialiseTrustedHandler<InventoryFolderBase, bool>( | 128 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
129 | "POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckTrustSource)); | 129 | "POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckAuthSession)); |
130 | 130 | ||
131 | m_httpServer.AddStreamHandler( | 131 | m_httpServer.AddStreamHandler( |
132 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 132 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( |
@@ -137,9 +137,13 @@ namespace OpenSim.Server.Handlers.Inventory | |||
137 | "POST", "/AddNewItem/", m_InventoryService.AddItem, CheckTrustSource)); | 137 | "POST", "/AddNewItem/", m_InventoryService.AddItem, CheckTrustSource)); |
138 | 138 | ||
139 | m_httpServer.AddStreamHandler( | 139 | m_httpServer.AddStreamHandler( |
140 | new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>( | 140 | new RestDeserialiseSecureHandler<Guid, List<InventoryItemBase>>( |
141 | "POST", "/GetItems/", GetFolderItems, CheckTrustSource)); | 141 | "POST", "/GetItems/", GetFolderItems, CheckAuthSession)); |
142 | 142 | ||
143 | m_httpServer.AddStreamHandler( | ||
144 | new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>( | ||
145 | "POST", "/MoveItems/", MoveItems, CheckAuthSession)); | ||
146 | |||
143 | // for persistent active gestures | 147 | // for persistent active gestures |
144 | m_httpServer.AddStreamHandler( | 148 | m_httpServer.AddStreamHandler( |
145 | new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> | 149 | new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> |
@@ -247,6 +251,24 @@ namespace OpenSim.Server.Handlers.Inventory | |||
247 | return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); | 251 | return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); |
248 | } | 252 | } |
249 | 253 | ||
254 | public bool DeleteItems(List<Guid> items) | ||
255 | { | ||
256 | List<UUID> uuids = new List<UUID>(); | ||
257 | foreach (Guid g in items) | ||
258 | uuids.Add(new UUID(g)); | ||
259 | // oops we lost the user info here. Bad bad handlers | ||
260 | return m_InventoryService.DeleteItems(UUID.Zero, uuids); | ||
261 | } | ||
262 | |||
263 | public bool MoveItems(List<InventoryItemBase> items) | ||
264 | { | ||
265 | // oops we lost the user info here. Bad bad handlers | ||
266 | // let's peek at one item | ||
267 | UUID ownerID = UUID.Zero; | ||
268 | if (items.Count > 0) | ||
269 | ownerID = items[0].Owner; | ||
270 | return m_InventoryService.MoveItems(ownerID, items); | ||
271 | } | ||
250 | #endregion | 272 | #endregion |
251 | 273 | ||
252 | /// <summary> | 274 | /// <summary> |