diff options
author | MW | 2007-08-19 13:35:20 +0000 |
---|---|---|
committer | MW | 2007-08-19 13:35:20 +0000 |
commit | c89db49f3cd3bbd60577eb5a1787ccf8dea930e3 (patch) | |
tree | 2b51b0d261724427933f543dd2f39ef8cd21127f | |
parent | Code comments on recent changes in EventQueueManager (diff) | |
download | opensim-SC-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.zip opensim-SC-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.tar.gz opensim-SC-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.tar.bz2 opensim-SC-c89db49f3cd3bbd60577eb5a1787ccf8dea930e3.tar.xz |
Sqlite datastore should now save the textures and extraparams data (used by sculpties) correctly. [Really need to add a ExtraParams field to the sqlite database though, but for now I have combined their data so that we don't lose backward compatibility, know a couple of people have been using the datastore already].
Now have a rough day/night cycle (the movement of the sun needs to be made smoother but for now it is better than we had I think).
Added dalien's patch (issue 294) for saving and loading prims to a xml file (think he will be modifying these to be import/export functions and maybe writing a xml datastore for backups).
Some preliminary work on task inventory (ie object's/prim's inventory).
Added place holder data for AvatarProperties (ie a avatar's profile). Should we store this sort of data on the user server or have another server for it (a normal webserver should work).
Added a few more method to IClientAPI.
Sure there is something I'm forgeting.
17 files changed, 537 insertions, 120 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs index 7f52739..addd20a 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
156 | } | 156 | } |
157 | if (this.OnUpLoad != null) | 157 | if (this.OnUpLoad != null) |
158 | { | 158 | { |
159 | this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data); | 159 | this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , ""); |
160 | } | 160 | } |
161 | return text; | 161 | return text; |
162 | } | 162 | } |
@@ -373,7 +373,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
373 | } | 373 | } |
374 | if (this.OnUpLoad != null) | 374 | if (this.OnUpLoad != null) |
375 | { | 375 | { |
376 | this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data); | 376 | this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , "" ); |
377 | } | 377 | } |
378 | return text; | 378 | return text; |
379 | } | 379 | } |
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 14f9c95..6afb35c 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Framework.Data; | |||
39 | 39 | ||
40 | namespace OpenSim.Region.Capabilities | 40 | namespace OpenSim.Region.Capabilities |
41 | { | 41 | { |
42 | public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data); | 42 | public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType); |
43 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); | 43 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); |
44 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); | 44 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); |
45 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); | 45 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); |
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Capabilities | |||
113 | /// <returns></returns> | 113 | /// <returns></returns> |
114 | public string CapsRequest(string request, string path, string param) | 114 | public string CapsRequest(string request, string path, string param) |
115 | { | 115 | { |
116 | //Console.WriteLine("caps request " + request); | 116 | // Console.WriteLine("caps request " + request); |
117 | string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); | 117 | string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); |
118 | return result; | 118 | return result; |
119 | } | 119 | } |
@@ -270,7 +270,7 @@ namespace OpenSim.Region.Capabilities | |||
270 | /// <returns></returns> | 270 | /// <returns></returns> |
271 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | 271 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) |
272 | { | 272 | { |
273 | // Console.WriteLine("asset upload request via CAPS"); | 273 | //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); |
274 | 274 | ||
275 | string assetName = llsdRequest.name; | 275 | string assetName = llsdRequest.name; |
276 | string assetDes = llsdRequest.description; | 276 | string assetDes = llsdRequest.description; |
@@ -280,7 +280,7 @@ namespace OpenSim.Region.Capabilities | |||
280 | LLUUID parentFolder = llsdRequest.folder_id; | 280 | LLUUID parentFolder = llsdRequest.folder_id; |
281 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 281 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
282 | 282 | ||
283 | AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, "" , "", capsBase + uploaderPath, this.httpListener); | 283 | AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener); |
284 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 284 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
285 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; | 285 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; |
286 | 286 | ||
@@ -297,13 +297,27 @@ namespace OpenSim.Region.Capabilities | |||
297 | /// <param name="assetID"></param> | 297 | /// <param name="assetID"></param> |
298 | /// <param name="inventoryItem"></param> | 298 | /// <param name="inventoryItem"></param> |
299 | /// <param name="data"></param> | 299 | /// <param name="data"></param> |
300 | public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data) | 300 | public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType) |
301 | { | 301 | { |
302 | sbyte assType = 0; | ||
303 | sbyte inType = 0; | ||
304 | |||
305 | if (inventoryType == "sound") | ||
306 | { | ||
307 | inType = 1; | ||
308 | assType = 1; | ||
309 | } | ||
310 | else if (inventoryType == "animation") | ||
311 | { | ||
312 | inType = 19; | ||
313 | assType = 19; | ||
314 | } | ||
315 | |||
302 | AssetBase asset; | 316 | AssetBase asset; |
303 | asset = new AssetBase(); | 317 | asset = new AssetBase(); |
304 | asset.FullID = assetID; | 318 | asset.FullID = assetID; |
305 | asset.Type = 0; | 319 | asset.Type = assType; |
306 | asset.InvType = 0; | 320 | asset.InvType = inType; |
307 | asset.Name = assetName; | 321 | asset.Name = assetName; |
308 | asset.Data = data; | 322 | asset.Data = data; |
309 | this.assetCache.AddAsset(asset); | 323 | this.assetCache.AddAsset(asset); |
@@ -315,8 +329,8 @@ namespace OpenSim.Region.Capabilities | |||
315 | item.assetID = asset.FullID; | 329 | item.assetID = asset.FullID; |
316 | item.inventoryDescription = assetDescription; | 330 | item.inventoryDescription = assetDescription; |
317 | item.inventoryName = assetName; | 331 | item.inventoryName = assetName; |
318 | item.assetType = 0; | 332 | item.assetType = assType; |
319 | item.invType = 0; | 333 | item.invType = inType; |
320 | item.parentFolderID = parentFolder; | 334 | item.parentFolderID = parentFolder; |
321 | item.inventoryCurrentPermissions = 2147483647; | 335 | item.inventoryCurrentPermissions = 2147483647; |
322 | item.inventoryNextPermissions = 2147483647; | 336 | item.inventoryNextPermissions = 2147483647; |
@@ -350,6 +364,9 @@ namespace OpenSim.Region.Capabilities | |||
350 | private string m_assetName = ""; | 364 | private string m_assetName = ""; |
351 | private string m_assetDes = ""; | 365 | private string m_assetDes = ""; |
352 | 366 | ||
367 | private string m_invType = ""; | ||
368 | private string m_assetType = ""; | ||
369 | |||
353 | /// <summary> | 370 | /// <summary> |
354 | /// | 371 | /// |
355 | /// </summary> | 372 | /// </summary> |
@@ -366,6 +383,9 @@ namespace OpenSim.Region.Capabilities | |||
366 | uploaderPath = path; | 383 | uploaderPath = path; |
367 | httpListener = httpServer; | 384 | httpListener = httpServer; |
368 | parentFolder = parentFolderID; | 385 | parentFolder = parentFolderID; |
386 | m_assetType = assetType; | ||
387 | m_invType = invType; | ||
388 | |||
369 | } | 389 | } |
370 | 390 | ||
371 | /// <summary> | 391 | /// <summary> |
@@ -393,7 +413,7 @@ namespace OpenSim.Region.Capabilities | |||
393 | 413 | ||
394 | if (OnUpLoad != null) | 414 | if (OnUpLoad != null) |
395 | { | 415 | { |
396 | OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data); | 416 | OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); |
397 | } | 417 | } |
398 | 418 | ||
399 | return res; | 419 | return res; |
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 8db1e15..2cedea0 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -89,6 +89,7 @@ namespace OpenSim.Framework.Interfaces | |||
89 | 89 | ||
90 | public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data); | 90 | public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data); |
91 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); | 91 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); |
92 | public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); | ||
92 | 93 | ||
93 | public interface IClientAPI | 94 | public interface IClientAPI |
94 | { | 95 | { |
@@ -140,6 +141,7 @@ namespace OpenSim.Framework.Interfaces | |||
140 | event RequestTaskInventory OnRequestTaskInventory; | 141 | event RequestTaskInventory OnRequestTaskInventory; |
141 | event UDPAssetUploadRequest OnAssetUploadRequest; | 142 | event UDPAssetUploadRequest OnAssetUploadRequest; |
142 | event XferReceive OnXferReceive; | 143 | event XferReceive OnXferReceive; |
144 | event RequestXfer OnRequestXfer; | ||
143 | 145 | ||
144 | event UUIDNameRequest OnNameFromUUIDRequest; | 146 | event UUIDNameRequest OnNameFromUUIDRequest; |
145 | 147 | ||
@@ -212,11 +214,17 @@ namespace OpenSim.Framework.Interfaces | |||
212 | void SendInventoryItemUpdate(InventoryItemBase Item); | 214 | void SendInventoryItemUpdate(InventoryItemBase Item); |
213 | void SendRemoveInventoryItem(LLUUID itemID); | 215 | void SendRemoveInventoryItem(LLUUID itemID); |
214 | void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); | 216 | void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); |
217 | void SendXferPacket(ulong xferID, uint packet, byte[] data); | ||
218 | |||
219 | void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID); | ||
220 | void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags); | ||
215 | 221 | ||
216 | void SendNameReply(LLUUID profileId, string firstname, string lastname); | 222 | void SendNameReply(LLUUID profileId, string firstname, string lastname); |
217 | void SendAlertMessage(string message); | 223 | void SendAlertMessage(string message); |
218 | void SendAgentAlertMessage(string message, bool modal); | 224 | void SendAgentAlertMessage(string message, bool modal); |
219 | void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); | 225 | void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); |
220 | bool AddMoney( int debit ); | 226 | bool AddMoney( int debit ); |
227 | |||
228 | void SendViewerTime(int phase); | ||
221 | } | 229 | } |
222 | } | 230 | } |
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index 6be2563..e001549 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs | |||
@@ -59,6 +59,7 @@ namespace OpenSim.Framework | |||
59 | public event RequestTaskInventory OnRequestTaskInventory; | 59 | public event RequestTaskInventory OnRequestTaskInventory; |
60 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 60 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
61 | public event XferReceive OnXferReceive; | 61 | public event XferReceive OnXferReceive; |
62 | public event RequestXfer OnRequestXfer; | ||
62 | 63 | ||
63 | public event UUIDNameRequest OnNameFromUUIDRequest; | 64 | public event UUIDNameRequest OnNameFromUUIDRequest; |
64 | 65 | ||
@@ -140,6 +141,10 @@ namespace OpenSim.Framework | |||
140 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } | 141 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } |
141 | public virtual void SendRemoveInventoryItem(LLUUID itemID) { } | 142 | public virtual void SendRemoveInventoryItem(LLUUID itemID) { } |
142 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | 143 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } |
144 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { } | ||
145 | |||
146 | public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { } | ||
147 | public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { } | ||
143 | 148 | ||
144 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} | 149 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} |
145 | public void SendAlertMessage(string message) { } | 150 | public void SendAlertMessage(string message) { } |
@@ -151,6 +156,8 @@ namespace OpenSim.Framework | |||
151 | { | 156 | { |
152 | return false; | 157 | return false; |
153 | } | 158 | } |
159 | |||
160 | public void SendViewerTime(int phase) { } | ||
154 | } | 161 | } |
155 | } | 162 | } |
156 | 163 | ||
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs index 87cf173..728767f 100644 --- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs | |||
@@ -12,12 +12,12 @@ namespace OpenSim.Framework.Types | |||
12 | RightTriangle = 4, | 12 | RightTriangle = 4, |
13 | HalfCircle = 5 | 13 | HalfCircle = 5 |
14 | } | 14 | } |
15 | 15 | ||
16 | public enum HollowShape : byte | 16 | public enum HollowShape : byte |
17 | { | 17 | { |
18 | Same = 0, | 18 | Same = 0, |
19 | Circle = 16, | 19 | Circle = 16, |
20 | Square =32, | 20 | Square = 32, |
21 | Triangle = 48 | 21 | Triangle = 48 |
22 | } | 22 | } |
23 | 23 | ||
@@ -26,7 +26,7 @@ namespace OpenSim.Framework.Types | |||
26 | Primitive = 9, | 26 | Primitive = 9, |
27 | Avatar = 47 | 27 | Avatar = 47 |
28 | } | 28 | } |
29 | 29 | ||
30 | public enum Extrusion : byte | 30 | public enum Extrusion : byte |
31 | { | 31 | { |
32 | Straight = 16, | 32 | Straight = 16, |
@@ -34,11 +34,11 @@ namespace OpenSim.Framework.Types | |||
34 | Curve2 = 48, | 34 | Curve2 = 48, |
35 | Flexible = 128 | 35 | Flexible = 128 |
36 | } | 36 | } |
37 | 37 | ||
38 | public class PrimitiveBaseShape | 38 | public class PrimitiveBaseShape |
39 | { | 39 | { |
40 | private static byte[] m_defaultTextureEntry; | 40 | private static byte[] m_defaultTextureEntry; |
41 | 41 | ||
42 | public byte PCode; | 42 | public byte PCode; |
43 | public ushort PathBegin; | 43 | public ushort PathBegin; |
44 | public ushort PathEnd; | 44 | public ushort PathEnd; |
@@ -100,14 +100,14 @@ namespace OpenSim.Framework.Types | |||
100 | { | 100 | { |
101 | m_defaultTextureEntry = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); | 101 | m_defaultTextureEntry = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); |
102 | } | 102 | } |
103 | 103 | ||
104 | public PrimitiveBaseShape() | 104 | public PrimitiveBaseShape() |
105 | { | 105 | { |
106 | PCode = (byte)PCodeEnum.Primitive; | 106 | PCode = (byte)PCodeEnum.Primitive; |
107 | ExtraParams = new byte[1]; | 107 | ExtraParams = new byte[1]; |
108 | TextureEntry = m_defaultTextureEntry; | 108 | TextureEntry = m_defaultTextureEntry; |
109 | } | 109 | } |
110 | 110 | ||
111 | //void returns need to change of course | 111 | //void returns need to change of course |
112 | public virtual void GetMesh() | 112 | public virtual void GetMesh() |
113 | { | 113 | { |
@@ -121,11 +121,12 @@ namespace OpenSim.Framework.Types | |||
121 | } | 121 | } |
122 | 122 | ||
123 | public class GenericShape : PrimitiveBaseShape | 123 | public class GenericShape : PrimitiveBaseShape |
124 | { | 124 | { |
125 | public GenericShape() : base() | 125 | public GenericShape() |
126 | : base() | ||
126 | { | 127 | { |
127 | 128 | ||
128 | } | 129 | } |
129 | } | 130 | } |
130 | 131 | ||
131 | public class BoxShape : PrimitiveBaseShape | 132 | public class BoxShape : PrimitiveBaseShape |
@@ -133,7 +134,7 @@ namespace OpenSim.Framework.Types | |||
133 | public BoxShape() | 134 | public BoxShape() |
134 | : base() | 135 | : base() |
135 | { | 136 | { |
136 | PathCurve = (byte) Extrusion.Straight; | 137 | PathCurve = (byte)Extrusion.Straight; |
137 | ProfileShape = ProfileShape.Square; | 138 | ProfileShape = ProfileShape.Square; |
138 | PathScaleX = 100; | 139 | PathScaleX = 100; |
139 | PathScaleY = 100; | 140 | PathScaleY = 100; |
@@ -156,8 +157,8 @@ namespace OpenSim.Framework.Types | |||
156 | { | 157 | { |
157 | BoxShape boxShape = new BoxShape(); | 158 | BoxShape boxShape = new BoxShape(); |
158 | 159 | ||
159 | boxShape.SetSide( 0.5f ); | 160 | boxShape.SetSide(0.5f); |
160 | 161 | ||
161 | return boxShape; | 162 | return boxShape; |
162 | } | 163 | } |
163 | } | 164 | } |
@@ -182,12 +183,12 @@ namespace OpenSim.Framework.Types | |||
182 | 183 | ||
183 | private void SetHeigth(float heigth) | 184 | private void SetHeigth(float heigth) |
184 | { | 185 | { |
185 | Scale.Z = heigth; | 186 | Scale.Z = heigth; |
186 | } | 187 | } |
187 | 188 | ||
188 | private void SetRadius(float radius) | 189 | private void SetRadius(float radius) |
189 | { | 190 | { |
190 | Scale.X = Scale.Y = radius*2f; | 191 | Scale.X = Scale.Y = radius * 2f; |
191 | } | 192 | } |
192 | } | 193 | } |
193 | } | 194 | } |
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index c68b260..3ca0f38 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -114,7 +114,7 @@ namespace OpenSim.Grid.UserServer | |||
114 | } | 114 | } |
115 | 115 | ||
116 | #region XMLRPC User Methods | 116 | #region XMLRPC User Methods |
117 | //should most likely move out of here and into the grid's userserver sub class | 117 | |
118 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 118 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
119 | { | 119 | { |
120 | XmlRpcResponse response = new XmlRpcResponse(); | 120 | XmlRpcResponse response = new XmlRpcResponse(); |
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index f16aca8..5da699b 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -62,10 +62,8 @@ namespace OpenSim | |||
62 | ArgvConfigSource configSource = new ArgvConfigSource(args); | 62 | ArgvConfigSource configSource = new ArgvConfigSource(args); |
63 | 63 | ||
64 | configSource.AddSwitch("Startup", "inifile"); | 64 | configSource.AddSwitch("Startup", "inifile"); |
65 | configSource.AddSwitch("Startup", "configfile"); | ||
66 | configSource.AddSwitch("Startup", "gridmode"); | 65 | configSource.AddSwitch("Startup", "gridmode"); |
67 | configSource.AddSwitch("Startup", "physics"); | 66 | configSource.AddSwitch("Startup", "physics"); |
68 | configSource.AddSwitch("Startup", "config"); | ||
69 | configSource.AddSwitch("Startup", "noverbose"); | 67 | configSource.AddSwitch("Startup", "noverbose"); |
70 | 68 | ||
71 | OpenSimMain sim = new OpenSimMain(configSource); | 69 | OpenSimMain sim = new OpenSimMain(configSource); |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 3fc6662..327a3c2 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -340,6 +340,28 @@ namespace OpenSim | |||
340 | } | 340 | } |
341 | break; | 341 | break; |
342 | 342 | ||
343 | case "save-xml": | ||
344 | if (cmdparams.Length > 0) | ||
345 | { | ||
346 | m_localScenes[0].SavePrimsToXml(cmdparams[0]); | ||
347 | } | ||
348 | else | ||
349 | { | ||
350 | m_localScenes[0].SavePrimsToXml("test.xml"); | ||
351 | } | ||
352 | break; | ||
353 | |||
354 | case "load-xml": | ||
355 | if (cmdparams.Length > 0) | ||
356 | { | ||
357 | m_localScenes[0].LoadPrimsFromXml(cmdparams[0]); | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | m_localScenes[0].LoadPrimsFromXml("test.xml"); | ||
362 | } | ||
363 | break; | ||
364 | |||
343 | case "terrain": | 365 | case "terrain": |
344 | string result = ""; | 366 | string result = ""; |
345 | foreach (Scene scene in m_localScenes) | 367 | foreach (Scene scene in m_localScenes) |
@@ -357,7 +379,7 @@ namespace OpenSim | |||
357 | if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower()) | 379 | if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower()) |
358 | { | 380 | { |
359 | string[] tmpCmdparams = new string[cmdparams.Length - 1]; | 381 | string[] tmpCmdparams = new string[cmdparams.Length - 1]; |
360 | cmdparams.CopyTo(tmpCmdparams,1); | 382 | cmdparams.CopyTo(tmpCmdparams, 1); |
361 | 383 | ||
362 | if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result2, scene.RegionInfo.RegionName)) | 384 | if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result2, scene.RegionInfo.RegionName)) |
363 | { | 385 | { |
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index f655674..c67ecb5 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -74,9 +74,9 @@ namespace OpenSim.Region.ClientStack | |||
74 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | 74 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; |
75 | public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; | 75 | public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; |
76 | public event UpdateVector OnUpdatePrimScale; | 76 | public event UpdateVector OnUpdatePrimScale; |
77 | public event StatusChange OnChildAgentStatus; | 77 | public event StatusChange OnChildAgentStatus; |
78 | public event GenericCall2 OnStopMovement; | 78 | public event GenericCall2 OnStopMovement; |
79 | public event GenericCall6 OnRemoveAvatar; | 79 | public event GenericCall6 OnRemoveAvatar; |
80 | public event RequestMapBlocks OnRequestMapBlocks; | 80 | public event RequestMapBlocks OnRequestMapBlocks; |
81 | public event TeleportLocationRequest OnTeleportLocationRequest; | 81 | public event TeleportLocationRequest OnTeleportLocationRequest; |
82 | public event DisconnectUser OnDisconnectUser; | 82 | public event DisconnectUser OnDisconnectUser; |
@@ -88,6 +88,7 @@ namespace OpenSim.Region.ClientStack | |||
88 | public event RequestTaskInventory OnRequestTaskInventory; | 88 | public event RequestTaskInventory OnRequestTaskInventory; |
89 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 89 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
90 | public event XferReceive OnXferReceive; | 90 | public event XferReceive OnXferReceive; |
91 | public event RequestXfer OnRequestXfer; | ||
91 | 92 | ||
92 | public event UUIDNameRequest OnNameFromUUIDRequest; | 93 | public event UUIDNameRequest OnNameFromUUIDRequest; |
93 | 94 | ||
@@ -410,7 +411,7 @@ namespace OpenSim.Region.ClientStack | |||
410 | newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; | 411 | newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; |
411 | //newSimPack.RegionData.SeedCapability = new byte[0]; | 412 | //newSimPack.RegionData.SeedCapability = new byte[0]; |
412 | newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); | 413 | newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); |
413 | 414 | ||
414 | this.OutPacket(newSimPack); | 415 | this.OutPacket(newSimPack); |
415 | } | 416 | } |
416 | 417 | ||
@@ -463,7 +464,7 @@ namespace OpenSim.Region.ClientStack | |||
463 | ip += (uint)byteIP[2] << 16; | 464 | ip += (uint)byteIP[2] << 16; |
464 | ip += (uint)byteIP[1] << 8; | 465 | ip += (uint)byteIP[1] << 8; |
465 | ip += (uint)byteIP[0]; | 466 | ip += (uint)byteIP[0]; |
466 | 467 | ||
467 | teleport.Info.SimIP = ip; | 468 | teleport.Info.SimIP = ip; |
468 | teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; | 469 | teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; |
469 | teleport.Info.LocationID = 4; | 470 | teleport.Info.LocationID = 4; |
@@ -510,9 +511,9 @@ namespace OpenSim.Region.ClientStack | |||
510 | pc.PingID.PingID = seq; | 511 | pc.PingID.PingID = seq; |
511 | pc.Header.Reliable = false; | 512 | pc.Header.Reliable = false; |
512 | OutPacket(pc); | 513 | OutPacket(pc); |
513 | 514 | ||
514 | } | 515 | } |
515 | 516 | ||
516 | public void SendKillObject(ulong regionHandle, uint localID) | 517 | public void SendKillObject(ulong regionHandle, uint localID) |
517 | { | 518 | { |
518 | KillObjectPacket kill = new KillObjectPacket(); | 519 | KillObjectPacket kill = new KillObjectPacket(); |
@@ -526,7 +527,7 @@ namespace OpenSim.Region.ClientStack | |||
526 | { | 527 | { |
527 | Encoding enc = Encoding.ASCII; | 528 | Encoding enc = Encoding.ASCII; |
528 | uint FULL_MASK_PERMISSIONS = 2147483647; | 529 | uint FULL_MASK_PERMISSIONS = 2147483647; |
529 | InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); | 530 | InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); |
530 | descend.AgentData.AgentID = this.AgentId; | 531 | descend.AgentData.AgentID = this.AgentId; |
531 | descend.AgentData.OwnerID = ownerID; | 532 | descend.AgentData.OwnerID = ownerID; |
532 | descend.AgentData.FolderID = folderID; | 533 | descend.AgentData.FolderID = folderID; |
@@ -542,22 +543,22 @@ namespace OpenSim.Region.ClientStack | |||
542 | descend.ItemData[i].CreatorID = item.creatorsID; | 543 | descend.ItemData[i].CreatorID = item.creatorsID; |
543 | descend.ItemData[i].BaseMask = item.inventoryBasePermissions; | 544 | descend.ItemData[i].BaseMask = item.inventoryBasePermissions; |
544 | descend.ItemData[i].CreationDate = 1000; | 545 | descend.ItemData[i].CreationDate = 1000; |
545 | descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription+ "\0"); | 546 | descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription + "\0"); |
546 | descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions; | 547 | descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions; |
547 | descend.ItemData[i].Flags = 1; | 548 | descend.ItemData[i].Flags = 1; |
548 | descend.ItemData[i].FolderID = item.parentFolderID; | 549 | descend.ItemData[i].FolderID = item.parentFolderID; |
549 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 550 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
550 | descend.ItemData[i].GroupMask = 0; | 551 | descend.ItemData[i].GroupMask = 0; |
551 | descend.ItemData[i].InvType = (sbyte)item.invType; | 552 | descend.ItemData[i].InvType = (sbyte)item.invType; |
552 | descend.ItemData[i].Name = enc.GetBytes(item.inventoryName+ "\0"); | 553 | descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0"); |
553 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; | 554 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; |
554 | descend.ItemData[i].OwnerID = item.avatarID; | 555 | descend.ItemData[i].OwnerID = item.avatarID; |
555 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; | 556 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; |
556 | descend.ItemData[i].SalePrice = 0; | 557 | descend.ItemData[i].SalePrice = 0; |
557 | descend.ItemData[i].SaleType = 0; | 558 | descend.ItemData[i].SaleType = 0; |
558 | descend.ItemData[i].Type = (sbyte)item.assetType; | 559 | descend.ItemData[i].Type = (sbyte)item.assetType; |
559 | descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100,descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 560 | descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100, descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); |
560 | 561 | ||
561 | i++; | 562 | i++; |
562 | } | 563 | } |
563 | 564 | ||
@@ -617,14 +618,14 @@ namespace OpenSim.Region.ClientStack | |||
617 | InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; | 618 | InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; |
618 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 619 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
619 | InventoryReply.InventoryData[0].GroupMask = 0; | 620 | InventoryReply.InventoryData[0].GroupMask = 0; |
620 | InventoryReply.InventoryData[0].InvType =(sbyte) Item.invType; | 621 | InventoryReply.InventoryData[0].InvType = (sbyte)Item.invType; |
621 | InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); | 622 | InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); |
622 | InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; | 623 | InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; |
623 | InventoryReply.InventoryData[0].OwnerID = Item.avatarID; | 624 | InventoryReply.InventoryData[0].OwnerID = Item.avatarID; |
624 | InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; | 625 | InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; |
625 | InventoryReply.InventoryData[0].SalePrice = 100; | 626 | InventoryReply.InventoryData[0].SalePrice = 100; |
626 | InventoryReply.InventoryData[0].SaleType = 0; | 627 | InventoryReply.InventoryData[0].SaleType = 0; |
627 | InventoryReply.InventoryData[0].Type =(sbyte) Item.assetType; | 628 | InventoryReply.InventoryData[0].Type = (sbyte)Item.assetType; |
628 | InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 629 | InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); |
629 | 630 | ||
630 | OutPacket(InventoryReply); | 631 | OutPacket(InventoryReply); |
@@ -651,6 +652,15 @@ namespace OpenSim.Region.ClientStack | |||
651 | OutPacket(replytask); | 652 | OutPacket(replytask); |
652 | } | 653 | } |
653 | 654 | ||
655 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | ||
656 | { | ||
657 | SendXferPacketPacket sendXfer = new SendXferPacketPacket(); | ||
658 | sendXfer.XferID.ID = xferID; | ||
659 | sendXfer.XferID.Packet = packet; | ||
660 | sendXfer.DataPacket.Data = data; | ||
661 | OutPacket(sendXfer); | ||
662 | } | ||
663 | |||
654 | /// <summary> | 664 | /// <summary> |
655 | /// | 665 | /// |
656 | /// </summary> | 666 | /// </summary> |
@@ -689,6 +699,66 @@ namespace OpenSim.Region.ClientStack | |||
689 | OutPacket(loadURL); | 699 | OutPacket(loadURL); |
690 | } | 700 | } |
691 | 701 | ||
702 | |||
703 | public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) | ||
704 | { | ||
705 | PreloadSoundPacket preSound = new PreloadSoundPacket(); | ||
706 | preSound.DataBlock = new PreloadSoundPacket.DataBlockBlock[1]; | ||
707 | preSound.DataBlock[0] = new PreloadSoundPacket.DataBlockBlock(); | ||
708 | preSound.DataBlock[0].ObjectID = objectID; | ||
709 | preSound.DataBlock[0].OwnerID = ownerID; | ||
710 | preSound.DataBlock[0].SoundID = soundID; | ||
711 | OutPacket(preSound); | ||
712 | } | ||
713 | |||
714 | public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) | ||
715 | { | ||
716 | AttachedSoundPacket sound = new AttachedSoundPacket(); | ||
717 | sound.DataBlock.SoundID = soundID; | ||
718 | sound.DataBlock.ObjectID = objectID; | ||
719 | sound.DataBlock.OwnerID = ownerID; | ||
720 | sound.DataBlock.Gain = gain; | ||
721 | sound.DataBlock.Flags = flags; | ||
722 | |||
723 | OutPacket(sound); | ||
724 | } | ||
725 | |||
726 | public void SendViewerTime(int phase) | ||
727 | { | ||
728 | |||
729 | SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); | ||
730 | //viewertime.TimeInfo.SecPerDay = 86400; | ||
731 | // viewertime.TimeInfo.SecPerYear = 31536000; | ||
732 | viewertime.TimeInfo.SecPerDay = 1000; | ||
733 | viewertime.TimeInfo.SecPerYear = 365000; | ||
734 | viewertime.TimeInfo.SunPhase = 1; | ||
735 | int sunPhase = (phase + 2) / 2; | ||
736 | if ((sunPhase < 12) || (sunPhase > 36)) | ||
737 | { | ||
738 | |||
739 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); | ||
740 | //Console.WriteLine("sending night"); | ||
741 | } | ||
742 | else | ||
743 | { | ||
744 | sunPhase = sunPhase - 12; | ||
745 | float yValue = 0.1f * (sunPhase); | ||
746 | if (yValue > 1.2f) { yValue = yValue - 1.2f; } | ||
747 | if (yValue > 1 ) { yValue = 1; } | ||
748 | if (yValue < 0) { yValue = 0; } | ||
749 | if (sunPhase < 14) | ||
750 | { | ||
751 | yValue = 1 - yValue; | ||
752 | } | ||
753 | if (sunPhase < 12) { yValue *= -1; } | ||
754 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f); | ||
755 | //Console.WriteLine("sending sun update " + yValue); | ||
756 | } | ||
757 | viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); | ||
758 | viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); | ||
759 | OutPacket(viewertime); | ||
760 | } | ||
761 | |||
692 | #endregion | 762 | #endregion |
693 | 763 | ||
694 | #region Appearance/ Wearables Methods | 764 | #region Appearance/ Wearables Methods |
@@ -782,7 +852,7 @@ namespace OpenSim.Region.ClientStack | |||
782 | //give this avatar object a local id and assign the user a name | 852 | //give this avatar object a local id and assign the user a name |
783 | objupdate.ObjectData[0].ID = avatarLocalID; | 853 | objupdate.ObjectData[0].ID = avatarLocalID; |
784 | objupdate.ObjectData[0].FullID = avatarID; | 854 | objupdate.ObjectData[0].FullID = avatarID; |
785 | objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName ); | 855 | objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); |
786 | LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); | 856 | LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); |
787 | byte[] pb = pos2.GetBytes(); | 857 | byte[] pb = pos2.GetBytes(); |
788 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 858 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
@@ -834,28 +904,28 @@ namespace OpenSim.Region.ClientStack | |||
834 | 904 | ||
835 | this.OutPacket(attach); | 905 | this.OutPacket(attach); |
836 | } | 906 | } |
837 | 907 | ||
838 | public void SendPrimitiveToClient( | 908 | public void SendPrimitiveToClient( |
839 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, | 909 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, |
840 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) | 910 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) |
841 | { | 911 | { |
842 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | 912 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); |
843 | outPacket.RegionData.RegionHandle = regionHandle; | 913 | outPacket.RegionData.RegionHandle = regionHandle; |
844 | outPacket.RegionData.TimeDilation = timeDilation; | 914 | outPacket.RegionData.TimeDilation = timeDilation; |
845 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 915 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
846 | 916 | ||
847 | outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags); | 917 | outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags); |
848 | 918 | ||
849 | outPacket.ObjectData[0].ID = localID; | 919 | outPacket.ObjectData[0].ID = localID; |
850 | outPacket.ObjectData[0].FullID = objectID; | 920 | outPacket.ObjectData[0].FullID = objectID; |
851 | outPacket.ObjectData[0].OwnerID = ownerID; | 921 | outPacket.ObjectData[0].OwnerID = ownerID; |
852 | outPacket.ObjectData[0].Text = Helpers.StringToField( text ); | 922 | outPacket.ObjectData[0].Text = Helpers.StringToField(text); |
853 | outPacket.ObjectData[0].ParentID = parentID; | 923 | outPacket.ObjectData[0].ParentID = parentID; |
854 | outPacket.ObjectData[0].PSBlock = particleSystem; | 924 | outPacket.ObjectData[0].PSBlock = particleSystem; |
855 | 925 | ||
856 | byte[] pb = pos.GetBytes(); | 926 | byte[] pb = pos.GetBytes(); |
857 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | 927 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); |
858 | 928 | ||
859 | byte[] rot = rotation.GetBytes(); | 929 | byte[] rot = rotation.GetBytes(); |
860 | Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length); | 930 | Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length); |
861 | 931 | ||
@@ -1050,7 +1120,7 @@ namespace OpenSim.Region.ClientStack | |||
1050 | 1120 | ||
1051 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) | 1121 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) |
1052 | { | 1122 | { |
1053 | 1123 | ||
1054 | objectData.TextureEntry = primData.TextureEntry; | 1124 | objectData.TextureEntry = primData.TextureEntry; |
1055 | objectData.PCode = primData.PCode; | 1125 | objectData.PCode = primData.PCode; |
1056 | objectData.PathBegin = primData.PathBegin; | 1126 | objectData.PathBegin = primData.PathBegin; |
@@ -1171,14 +1241,14 @@ namespace OpenSim.Region.ClientStack | |||
1171 | public void SendNameReply(LLUUID profileId, string firstname, string lastname) | 1241 | public void SendNameReply(LLUUID profileId, string firstname, string lastname) |
1172 | { | 1242 | { |
1173 | UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); | 1243 | UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); |
1174 | 1244 | ||
1175 | packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; | 1245 | packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; |
1176 | packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); | 1246 | packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); |
1177 | packet.UUIDNameBlock[0].ID = profileId; | 1247 | packet.UUIDNameBlock[0].ID = profileId; |
1178 | packet.UUIDNameBlock[0].FirstName = Helpers.StringToField( firstname ); | 1248 | packet.UUIDNameBlock[0].FirstName = Helpers.StringToField(firstname); |
1179 | packet.UUIDNameBlock[0].LastName = Helpers.StringToField( lastname ); | 1249 | packet.UUIDNameBlock[0].LastName = Helpers.StringToField(lastname); |
1180 | 1250 | ||
1181 | OutPacket( packet ); | 1251 | OutPacket(packet); |
1182 | } | 1252 | } |
1183 | 1253 | ||
1184 | #endregion | 1254 | #endregion |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 9ceb4cd..e73b2e2 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -95,6 +95,22 @@ namespace OpenSim.Region.ClientStack | |||
95 | break; | 95 | break; |
96 | 96 | ||
97 | #region Scene/Avatar | 97 | #region Scene/Avatar |
98 | case PacketType.AvatarPropertiesRequest: | ||
99 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | ||
100 | AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); | ||
101 | avatarReply.AgentData.AgentID = this.AgentID; | ||
102 | avatarReply.AgentData.AvatarID = avatarProperties.AgentData.AvatarID; | ||
103 | avatarReply.PropertiesData.AboutText = Helpers.StringToField( "OpenSim crash test dummy"); | ||
104 | avatarReply.PropertiesData.BornOn = Helpers.StringToField("Before now"); | ||
105 | avatarReply.PropertiesData.CharterMember = new byte[0]; | ||
106 | avatarReply.PropertiesData.FLAboutText = Helpers.StringToField("First life? What is one of those? OpenSim is my life!"); | ||
107 | avatarReply.PropertiesData.Flags = 0; | ||
108 | avatarReply.PropertiesData.FLImageID = LLUUID.Zero; | ||
109 | avatarReply.PropertiesData.ImageID = LLUUID.Zero; | ||
110 | avatarReply.PropertiesData.ProfileURL = new byte[0]; | ||
111 | avatarReply.PropertiesData.PartnerID = new LLUUID("11111111-1111-0000-0000-000100bba000"); | ||
112 | OutPacket(avatarReply); | ||
113 | break; | ||
98 | case PacketType.ChatFromViewer: | 114 | case PacketType.ChatFromViewer: |
99 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | 115 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; |
100 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") | 116 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") |
@@ -128,7 +144,7 @@ namespace OpenSim.Region.ClientStack | |||
128 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; | 144 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; |
129 | if (OnRezObject != null) | 145 | if (OnRezObject != null) |
130 | { | 146 | { |
131 | this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); | 147 | this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); |
132 | } | 148 | } |
133 | break; | 149 | break; |
134 | case PacketType.DeRezObject: | 150 | case PacketType.DeRezObject: |
@@ -366,7 +382,11 @@ namespace OpenSim.Region.ClientStack | |||
366 | } | 382 | } |
367 | break; | 383 | break; |
368 | case PacketType.RequestXfer: | 384 | case PacketType.RequestXfer: |
369 | //Console.WriteLine(Pack.ToString()); | 385 | RequestXferPacket xferReq = (RequestXferPacket)Pack; |
386 | if (OnRequestXfer != null) | ||
387 | { | ||
388 | OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); | ||
389 | } | ||
370 | break; | 390 | break; |
371 | case PacketType.SendXferPacket: | 391 | case PacketType.SendXferPacket: |
372 | SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; | 392 | SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index f0f73b0..6b8ddc6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
472 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); | 472 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
473 | if (hasPrim != false) | 473 | if (hasPrim != false) |
474 | { | 474 | { |
475 | ((SceneObjectGroup)ent).GetPartInventory(remoteClient, primLocalID); | 475 | ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); |
476 | break; | 476 | break; |
477 | } | 477 | } |
478 | } | 478 | } |
@@ -758,6 +758,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
758 | } | 758 | } |
759 | 759 | ||
760 | /// <summary> | 760 | /// <summary> |
761 | /// | ||
762 | /// </summary> | ||
763 | /// <param name="remoteClient"></param> | ||
764 | /// <param name="xferID"></param> | ||
765 | /// <param name="fileName"></param> | ||
766 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) | ||
767 | { | ||
768 | /* | ||
769 | foreach (EntityBase ent in Entities.Values) | ||
770 | { | ||
771 | if (ent is SceneObjectGroup) | ||
772 | { | ||
773 | ((SceneObjectGroup)ent).RequestInventoryFile(remoteClient, ((SceneObjectGroup)ent).LocalId, xferID); | ||
774 | break; | ||
775 | } | ||
776 | }*/ | ||
777 | } | ||
778 | |||
779 | /// <summary> | ||
761 | /// temporary method to test out creating new inventory items | 780 | /// temporary method to test out creating new inventory items |
762 | /// </summary> | 781 | /// </summary> |
763 | /// <param name="remoteClient"></param> | 782 | /// <param name="remoteClient"></param> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 01e58c7..85479a7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -29,6 +29,8 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Threading; | 30 | using System.Threading; |
31 | using System.Timers; | 31 | using System.Timers; |
32 | using System.IO; | ||
33 | using System.Xml; | ||
32 | using libsecondlife; | 34 | using libsecondlife; |
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
@@ -65,6 +67,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
65 | private int storageCount; | 67 | private int storageCount; |
66 | private int terrainCheckCount; | 68 | private int terrainCheckCount; |
67 | private int landPrimCheckCount; | 69 | private int landPrimCheckCount; |
70 | |||
71 | private int m_timePhase = 24; | ||
72 | private int m_timeUpdateCount; | ||
73 | |||
68 | private Mutex updateLock; | 74 | private Mutex updateLock; |
69 | 75 | ||
70 | protected StorageManager storageManager; | 76 | protected StorageManager storageManager; |
@@ -123,6 +129,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
123 | get { return Prims; } | 129 | get { return Prims; } |
124 | } | 130 | } |
125 | 131 | ||
132 | public int TimePhase | ||
133 | { | ||
134 | get { return this.m_timePhase; } | ||
135 | } | ||
136 | |||
126 | #endregion | 137 | #endregion |
127 | 138 | ||
128 | #region Constructors | 139 | #region Constructors |
@@ -301,6 +312,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
301 | landPrimCheckCount = 0; | 312 | landPrimCheckCount = 0; |
302 | } | 313 | } |
303 | } | 314 | } |
315 | |||
316 | m_timeUpdateCount++; | ||
317 | if (m_timeUpdateCount > 600) | ||
318 | { | ||
319 | List<ScenePresence> Avatars = this.RequestAvatarList(); | ||
320 | foreach (ScenePresence avatar in Avatars) | ||
321 | { | ||
322 | if (!avatar.childAgent) | ||
323 | { | ||
324 | //Console.WriteLine("sending time update " + timePhase + " from region " + m_regionHandle + " to avatar " + avatar.Firstname); | ||
325 | avatar.ControllingClient.SendViewerTime(m_timePhase); | ||
326 | } | ||
327 | } | ||
328 | m_timeUpdateCount = 0; | ||
329 | m_timePhase++; | ||
330 | if (m_timePhase > 94) | ||
331 | { | ||
332 | m_timePhase = 0; | ||
333 | } | ||
334 | } | ||
304 | } | 335 | } |
305 | catch (NotImplementedException) | 336 | catch (NotImplementedException) |
306 | { | 337 | { |
@@ -538,7 +569,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
538 | 569 | ||
539 | public void AddEntity(SceneObjectGroup sceneObject) | 570 | public void AddEntity(SceneObjectGroup sceneObject) |
540 | { | 571 | { |
541 | if(!Entities.ContainsKey(sceneObject.UUID)) | 572 | if (!Entities.ContainsKey(sceneObject.UUID)) |
542 | { | 573 | { |
543 | Entities.Add(sceneObject.UUID, sceneObject); | 574 | Entities.Add(sceneObject.UUID, sceneObject); |
544 | } | 575 | } |
@@ -563,6 +594,52 @@ namespace OpenSim.Region.Environment.Scenes | |||
563 | prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; | 594 | prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; |
564 | } | 595 | } |
565 | 596 | ||
597 | public void LoadPrimsFromXml(string fileName) | ||
598 | { | ||
599 | XmlDocument doc = new XmlDocument(); | ||
600 | XmlNode rootNode; | ||
601 | int primCount = 0; | ||
602 | if (File.Exists(fileName)) | ||
603 | { | ||
604 | XmlTextReader reader = new XmlTextReader(fileName); | ||
605 | reader.WhitespaceHandling = WhitespaceHandling.None; | ||
606 | doc.Load(reader); | ||
607 | reader.Close(); | ||
608 | rootNode = doc.FirstChild; | ||
609 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | ||
610 | { | ||
611 | SceneObjectGroup obj = new SceneObjectGroup(this, | ||
612 | this.m_regionHandle, aPrimNode.OuterXml); | ||
613 | AddEntity(obj); | ||
614 | primCount++; | ||
615 | } | ||
616 | } | ||
617 | else | ||
618 | { | ||
619 | throw new Exception("Could not open file " + fileName + " for reading"); | ||
620 | } | ||
621 | } | ||
622 | |||
623 | public void SavePrimsToXml(string fileName) | ||
624 | { | ||
625 | FileStream file = new FileStream(fileName, FileMode.Create); | ||
626 | StreamWriter stream = new StreamWriter(file); | ||
627 | int primCount = 0; | ||
628 | stream.WriteLine("<scene>\n"); | ||
629 | foreach (EntityBase ent in Entities.Values) | ||
630 | { | ||
631 | if (ent is SceneObjectGroup) | ||
632 | { | ||
633 | stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); | ||
634 | primCount++; | ||
635 | } | ||
636 | } | ||
637 | stream.WriteLine("</scene>\n"); | ||
638 | stream.Close(); | ||
639 | file.Close(); | ||
640 | } | ||
641 | |||
642 | |||
566 | #endregion | 643 | #endregion |
567 | 644 | ||
568 | #region Add/Remove Avatar Methods | 645 | #region Add/Remove Avatar Methods |
@@ -632,6 +709,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
632 | client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; | 709 | client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; |
633 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; | 710 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; |
634 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; | 711 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; |
712 | // client.OnRequestXfer += RequestXfer; | ||
635 | 713 | ||
636 | client.OnGrabObject += ProcessObjectGrab; | 714 | client.OnGrabObject += ProcessObjectGrab; |
637 | } | 715 | } |
@@ -950,7 +1028,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
950 | AgentCircuitData agent = remoteClient.RequestClientInfo(); | 1028 | AgentCircuitData agent = remoteClient.RequestClientInfo(); |
951 | agent.BaseFolder = LLUUID.Zero; | 1029 | agent.BaseFolder = LLUUID.Zero; |
952 | agent.InventoryFolder = LLUUID.Zero; | 1030 | agent.InventoryFolder = LLUUID.Zero; |
953 | // agent.startpos = new LLVector3(128, 128, 70); | 1031 | // agent.startpos = new LLVector3(128, 128, 70); |
954 | agent.startpos = position; | 1032 | agent.startpos = position; |
955 | agent.child = true; | 1033 | agent.child = true; |
956 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | 1034 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); |
@@ -1121,7 +1199,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1121 | item.assetID = asset.FullID; | 1199 | item.assetID = asset.FullID; |
1122 | userInfo.UpdateItem(remoteClient.AgentId, item); | 1200 | userInfo.UpdateItem(remoteClient.AgentId, item); |
1123 | 1201 | ||
1124 | // remoteClient.SendInventoryItemUpdate(item); | 1202 | // remoteClient.SendInventoryItemUpdate(item); |
1203 | if (item.invType == 7) | ||
1204 | { | ||
1205 | //do we want to know about updated note cards? | ||
1206 | } | ||
1207 | else if (item.invType == 10) | ||
1208 | { | ||
1209 | // do we want to know about updated scripts | ||
1210 | } | ||
1125 | 1211 | ||
1126 | return (asset.FullID); | 1212 | return (asset.FullID); |
1127 | } | 1213 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 421a981..1e6cd8f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -212,7 +212,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
212 | public string ToXmlString() | 212 | public string ToXmlString() |
213 | { | 213 | { |
214 | StringWriter sw = new StringWriter(); | 214 | StringWriter sw = new StringWriter(); |
215 | //StreamWriter st = new StreamWriter("testxml.txt"); | ||
216 | XmlTextWriter writer = new XmlTextWriter(sw); | 215 | XmlTextWriter writer = new XmlTextWriter(sw); |
217 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 216 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
218 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); | 217 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); |
@@ -231,11 +230,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
231 | writer.WriteEndElement(); | 230 | writer.WriteEndElement(); |
232 | writer.WriteEndElement(); | 231 | writer.WriteEndElement(); |
233 | writer.Close(); | 232 | writer.Close(); |
234 | // System.Console.WriteLine("prim: " + sw.ToString()); | ||
235 | return sw.ToString(); | 233 | return sw.ToString(); |
236 | // st.Close(); | ||
237 | // return ""; | ||
238 | |||
239 | } | 234 | } |
240 | 235 | ||
241 | #region Copying | 236 | #region Copying |
@@ -557,12 +552,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
557 | /// </summary> | 552 | /// </summary> |
558 | /// <param name="remoteClient"></param> | 553 | /// <param name="remoteClient"></param> |
559 | /// <param name="localID"></param> | 554 | /// <param name="localID"></param> |
560 | public void GetPartInventory(IClientAPI remoteClient, uint localID) | 555 | public void GetPartInventoryFileName(IClientAPI remoteClient, uint localID) |
561 | { | 556 | { |
562 | SceneObjectPart part = this.GetChildPrim(localID); | 557 | SceneObjectPart part = this.GetChildPrim(localID); |
563 | if (part != null) | 558 | if (part != null) |
564 | { | 559 | { |
565 | part.GetInventory(remoteClient, localID); | 560 | part.GetInventoryFileName(remoteClient, localID); |
561 | } | ||
562 | } | ||
563 | |||
564 | /// <summary> | ||
565 | /// | ||
566 | /// </summary> | ||
567 | /// <param name="remoteClient"></param> | ||
568 | /// <param name="partID"></param> | ||
569 | public void RequestInventoryFile(IClientAPI remoteClient, uint localID, ulong xferID) | ||
570 | { | ||
571 | SceneObjectPart part = this.GetChildPrim(localID); | ||
572 | if (part != null) | ||
573 | { | ||
574 | part.RequestInventoryFile(remoteClient, xferID); | ||
566 | } | 575 | } |
567 | } | 576 | } |
568 | 577 | ||
@@ -636,6 +645,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
636 | public void UpdateGroupPosition(LLVector3 pos) | 645 | public void UpdateGroupPosition(LLVector3 pos) |
637 | { | 646 | { |
638 | this.AbsolutePosition = pos; | 647 | this.AbsolutePosition = pos; |
648 | |||
639 | } | 649 | } |
640 | 650 | ||
641 | /// <summary> | 651 | /// <summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 1cfe9c8..c8a7515 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -31,7 +31,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
31 | public uint GroupMask = FULL_MASK_PERMISSIONS; | 31 | public uint GroupMask = FULL_MASK_PERMISSIONS; |
32 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | 32 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; |
33 | public uint BaseMask = FULL_MASK_PERMISSIONS; | 33 | public uint BaseMask = FULL_MASK_PERMISSIONS; |
34 | 34 | ||
35 | protected byte[] m_particleSystem = new byte[0]; | 35 | protected byte[] m_particleSystem = new byte[0]; |
36 | 36 | ||
37 | protected SceneObjectGroup m_parentGroup; | 37 | protected SceneObjectGroup m_parentGroup; |
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
47 | public LLUUID UUID | 47 | public LLUUID UUID |
48 | { | 48 | { |
49 | get { return m_uuid; } | 49 | get { return m_uuid; } |
50 | set { m_uuid = value ; } | 50 | set { m_uuid = value; } |
51 | } | 51 | } |
52 | 52 | ||
53 | protected uint m_localID; | 53 | protected uint m_localID; |
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
64 | set { m_name = value; } | 64 | set { m_name = value; } |
65 | } | 65 | } |
66 | 66 | ||
67 | protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; | 67 | protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 268435456 + 128; |
68 | public uint ObjectFlags | 68 | public uint ObjectFlags |
69 | { | 69 | { |
70 | get { return (uint)m_flags; } | 70 | get { return (uint)m_flags; } |
@@ -221,7 +221,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
221 | this.AngularVelocity = new LLVector3(0, 0, 0); | 221 | this.AngularVelocity = new LLVector3(0, 0, 0); |
222 | this.Acceleration = new LLVector3(0, 0, 0); | 222 | this.Acceleration = new LLVector3(0, 0, 0); |
223 | 223 | ||
224 | |||
225 | 224 | ||
226 | //temporary code just so the m_flags field doesn't give a compiler warning | 225 | //temporary code just so the m_flags field doesn't give a compiler warning |
227 | if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop) | 226 | if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop) |
@@ -233,6 +232,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
233 | 232 | ||
234 | /// <summary> | 233 | /// <summary> |
235 | /// Re/create a SceneObjectPart (prim) | 234 | /// Re/create a SceneObjectPart (prim) |
235 | /// currently not used, and maybe won't be | ||
236 | /// </summary> | 236 | /// </summary> |
237 | /// <param name="regionHandle"></param> | 237 | /// <param name="regionHandle"></param> |
238 | /// <param name="parent"></param> | 238 | /// <param name="parent"></param> |
@@ -396,13 +396,59 @@ namespace OpenSim.Region.Environment.Scenes | |||
396 | #endregion | 396 | #endregion |
397 | 397 | ||
398 | #region Inventory | 398 | #region Inventory |
399 | public void GetInventory(IClientAPI client, uint localID) | 399 | /// <summary> |
400 | /// | ||
401 | /// </summary> | ||
402 | /// <param name="client"></param> | ||
403 | /// <param name="localID"></param> | ||
404 | public void GetInventoryFileName(IClientAPI client, uint localID) | ||
400 | { | 405 | { |
401 | if (localID == this.m_localID) | 406 | if (localID == this.m_localID) |
402 | { | 407 | { |
408 | // client.SendTaskInventory(this.m_uuid, 0, Helpers.StringToField("primInventory")); | ||
403 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); | 409 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); |
404 | } | 410 | } |
405 | } | 411 | } |
412 | |||
413 | /// <summary> | ||
414 | /// | ||
415 | /// </summary> | ||
416 | /// <param name="client"></param> | ||
417 | /// <param name="xferID"></param> | ||
418 | public void RequestInventoryFile(IClientAPI client, ulong xferID) | ||
419 | { | ||
420 | // a test item | ||
421 | InventoryStringBuilder invString = new InventoryStringBuilder(); | ||
422 | invString.AddItemStart(); | ||
423 | invString.AddNameValueLine("item_id", LLUUID.Random().ToStringHyphenated()); | ||
424 | invString.AddNameValueLine("parent_id", this.UUID.ToStringHyphenated()); | ||
425 | |||
426 | invString.AddPermissionsStart(); | ||
427 | invString.AddNameValueLine("base_mask", "0x7FFFFFFF"); | ||
428 | invString.AddNameValueLine("owner_mask", "0x7FFFFFFF"); | ||
429 | invString.AddNameValueLine("group_mask", "0x7FFFFFFF"); | ||
430 | invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF"); | ||
431 | invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF"); | ||
432 | invString.AddNameValueLine("creator_id", client.AgentId.ToStringHyphenated()); | ||
433 | invString.AddNameValueLine("owner_id", client.AgentId.ToStringHyphenated()); | ||
434 | invString.AddNameValueLine("last_owner_id", LLUUID.Zero.ToStringHyphenated()); | ||
435 | invString.AddNameValueLine("group_id", LLUUID.Zero.ToStringHyphenated()); | ||
436 | invString.AddSectionEnd(); | ||
437 | |||
438 | invString.AddNameValueLine("asset_id", "00000000-0000-0000-9999-000000000002"); | ||
439 | invString.AddNameValueLine("type", "texture"); | ||
440 | invString.AddNameValueLine("inv_type" , "texture"); | ||
441 | invString.AddNameValueLine("flags", "0x00"); | ||
442 | invString.AddNameValueLine("name", "Test inventory" + "|"); | ||
443 | invString.AddNameValueLine("desc", "test description" + "|"); | ||
444 | invString.AddNameValueLine("creation_date", "10000"); | ||
445 | invString.AddSectionEnd(); | ||
446 | |||
447 | byte[] fileInv = Helpers.StringToField(invString.BuildString); | ||
448 | byte[] data = new byte[fileInv.Length + 4]; | ||
449 | Array.Copy(fileInv, 0,data , 4, fileInv.Length); | ||
450 | client.SendXferPacket(xferID, 0 + 0x80000000, data); | ||
451 | } | ||
406 | #endregion | 452 | #endregion |
407 | 453 | ||
408 | #region ExtraParams | 454 | #region ExtraParams |
@@ -422,7 +468,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
422 | Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); | 468 | Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); |
423 | 469 | ||
424 | this.ScheduleFullUpdate(); | 470 | this.ScheduleFullUpdate(); |
425 | 471 | ||
426 | } | 472 | } |
427 | #endregion | 473 | #endregion |
428 | 474 | ||
@@ -497,7 +543,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
497 | /// <param name="remoteClient"></param> | 543 | /// <param name="remoteClient"></param> |
498 | public void SendFullUpdate(IClientAPI remoteClient) | 544 | public void SendFullUpdate(IClientAPI remoteClient) |
499 | { | 545 | { |
500 | m_parentGroup.SendPartFullUpdate( remoteClient, this ); | 546 | m_parentGroup.SendPartFullUpdate(remoteClient, this); |
501 | } | 547 | } |
502 | 548 | ||
503 | /// <summary> | 549 | /// <summary> |
@@ -580,7 +626,46 @@ namespace OpenSim.Region.Environment.Scenes | |||
580 | 626 | ||
581 | public void SetText(string text, Vector3 color, double alpha) | 627 | public void SetText(string text, Vector3 color, double alpha) |
582 | { | 628 | { |
583 | Text = text; | 629 | Text = text; |
630 | } | ||
631 | |||
632 | public class InventoryStringBuilder | ||
633 | { | ||
634 | public string BuildString = ""; | ||
635 | |||
636 | public InventoryStringBuilder() | ||
637 | { | ||
638 | |||
639 | } | ||
640 | |||
641 | public void AddItemStart() | ||
642 | { | ||
643 | BuildString += "\tinv_item\t0\n"; | ||
644 | BuildString += "\t{\n"; | ||
645 | } | ||
646 | |||
647 | public void AddPermissionsStart() | ||
648 | { | ||
649 | BuildString += "\tpermissions 0\n"; | ||
650 | BuildString += "\t{\n"; | ||
651 | } | ||
652 | |||
653 | public void AddSectionEnd() | ||
654 | { | ||
655 | BuildString += "\t}\n"; | ||
656 | } | ||
657 | |||
658 | public void AddLine(string addLine) | ||
659 | { | ||
660 | BuildString += addLine; | ||
661 | } | ||
662 | |||
663 | public void AddNameValueLine(string name, string value) | ||
664 | { | ||
665 | BuildString += "\t\t"; | ||
666 | BuildString += name + "\t"; | ||
667 | BuildString += value + "\n"; | ||
668 | } | ||
584 | } | 669 | } |
585 | } | 670 | } |
586 | } | 671 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 7dcb760..0393a2a 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
59 | 59 | ||
60 | private ulong m_regionHandle; | 60 | private ulong m_regionHandle; |
61 | 61 | ||
62 | public bool childAgent = false; | 62 | public bool childAgent = true; |
63 | public bool IsRestrictedToRegion = false; | 63 | public bool IsRestrictedToRegion = false; |
64 | 64 | ||
65 | private bool newForce = false; | 65 | private bool newForce = false; |
@@ -495,6 +495,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
495 | this.SendArrearanceToAllOtherAgents(); | 495 | this.SendArrearanceToAllOtherAgents(); |
496 | 496 | ||
497 | this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); | 497 | this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); |
498 | this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); | ||
498 | } | 499 | } |
499 | 500 | ||
500 | /// <summary> | 501 | /// <summary> |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 25b62b8..ccb4d11 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -73,6 +73,7 @@ namespace SimpleApp | |||
73 | public event RequestTaskInventory OnRequestTaskInventory; | 73 | public event RequestTaskInventory OnRequestTaskInventory; |
74 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 74 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
75 | public event XferReceive OnXferReceive; | 75 | public event XferReceive OnXferReceive; |
76 | public event RequestXfer OnRequestXfer; | ||
76 | 77 | ||
77 | public event UUIDNameRequest OnNameFromUUIDRequest; | 78 | public event UUIDNameRequest OnNameFromUUIDRequest; |
78 | 79 | ||
@@ -155,8 +156,13 @@ namespace SimpleApp | |||
155 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } | 156 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } |
156 | public virtual void SendRemoveInventoryItem(LLUUID itemID) { } | 157 | public virtual void SendRemoveInventoryItem(LLUUID itemID) { } |
157 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | 158 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } |
159 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { } | ||
160 | |||
158 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } | 161 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } |
159 | 162 | ||
163 | public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { } | ||
164 | public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { } | ||
165 | |||
160 | public void SendAlertMessage(string message) { } | 166 | public void SendAlertMessage(string message) { } |
161 | public void SendAgentAlertMessage(string message, bool modal) { } | 167 | public void SendAgentAlertMessage(string message, bool modal) { } |
162 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } | 168 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } |
@@ -208,5 +214,7 @@ namespace SimpleApp | |||
208 | { | 214 | { |
209 | return false; | 215 | return false; |
210 | } | 216 | } |
217 | |||
218 | public void SendViewerTime(int phase) { } | ||
211 | } | 219 | } |
212 | } | 220 | } |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 6f12c47..391ac84 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -1,6 +1,9 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Xml; | ||
5 | using System.Xml.Serialization; | ||
6 | using System.IO; | ||
4 | 7 | ||
5 | using OpenSim.Region.Environment.Scenes; | 8 | using OpenSim.Region.Environment.Scenes; |
6 | using OpenSim.Region.Environment.LandManagement; | 9 | using OpenSim.Region.Environment.LandManagement; |
@@ -38,7 +41,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
38 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); | 41 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); |
39 | primDa = new SqliteDataAdapter(primSelectCmd); | 42 | primDa = new SqliteDataAdapter(primSelectCmd); |
40 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); | 43 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); |
41 | 44 | ||
42 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); | 45 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); |
43 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); | 46 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); |
44 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | 47 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); |
@@ -55,12 +58,12 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
55 | DataTable prims = ds.Tables["prims"]; | 58 | DataTable prims = ds.Tables["prims"]; |
56 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; | 59 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; |
57 | setupPrimCommands(primDa, conn); | 60 | setupPrimCommands(primDa, conn); |
58 | 61 | ||
59 | // shapeDa.FillSchema(ds, SchemaType.Source, "ShapeSchema"); | 62 | // shapeDa.FillSchema(ds, SchemaType.Source, "ShapeSchema"); |
60 | DataTable shapes = ds.Tables["primshapes"]; | 63 | DataTable shapes = ds.Tables["primshapes"]; |
61 | shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; | 64 | shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; |
62 | setupShapeCommands(shapeDa, conn); | 65 | setupShapeCommands(shapeDa, conn); |
63 | 66 | ||
64 | return; | 67 | return; |
65 | } | 68 | } |
66 | 69 | ||
@@ -158,7 +161,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
158 | return data; | 161 | return data; |
159 | } | 162 | } |
160 | 163 | ||
161 | private SqliteCommand createInsertCommand(string table, Dictionary<string, DbType> defs) | 164 | private SqliteCommand createInsertCommand(string table, Dictionary<string, DbType> defs) |
162 | { | 165 | { |
163 | /** | 166 | /** |
164 | * This is subtle enough to deserve some commentary. | 167 | * This is subtle enough to deserve some commentary. |
@@ -171,7 +174,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
171 | */ | 174 | */ |
172 | string[] cols = new string[defs.Keys.Count]; | 175 | string[] cols = new string[defs.Keys.Count]; |
173 | defs.Keys.CopyTo(cols, 0); | 176 | defs.Keys.CopyTo(cols, 0); |
174 | 177 | ||
175 | string sql = "insert into " + table + "("; | 178 | string sql = "insert into " + table + "("; |
176 | sql += String.Join(", ", cols); | 179 | sql += String.Join(", ", cols); |
177 | // important, the first ':' needs to be here, the rest get added in the join | 180 | // important, the first ':' needs to be here, the rest get added in the join |
@@ -179,21 +182,24 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
179 | sql += String.Join(", :", cols); | 182 | sql += String.Join(", :", cols); |
180 | sql += ")"; | 183 | sql += ")"; |
181 | SqliteCommand cmd = new SqliteCommand(sql); | 184 | SqliteCommand cmd = new SqliteCommand(sql); |
182 | 185 | ||
183 | // this provides the binding for all our parameters, so | 186 | // this provides the binding for all our parameters, so |
184 | // much less code than it used to be | 187 | // much less code than it used to be |
185 | foreach (KeyValuePair<string, DbType> kvp in defs) { | 188 | foreach (KeyValuePair<string, DbType> kvp in defs) |
189 | { | ||
186 | cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value)); | 190 | cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value)); |
187 | } | 191 | } |
188 | return cmd; | 192 | return cmd; |
189 | } | 193 | } |
190 | 194 | ||
191 | private SqliteCommand createUpdateCommand(string table, string pk, Dictionary<string, DbType> defs) | 195 | private SqliteCommand createUpdateCommand(string table, string pk, Dictionary<string, DbType> defs) |
192 | { | 196 | { |
193 | string sql = "update " + table + " set "; | 197 | string sql = "update " + table + " set "; |
194 | string subsql = ""; | 198 | string subsql = ""; |
195 | foreach (string key in defs.Keys) { | 199 | foreach (string key in defs.Keys) |
196 | if (subsql.Length > 0) { // a map function would rock so much here | 200 | { |
201 | if (subsql.Length > 0) | ||
202 | { // a map function would rock so much here | ||
197 | subsql += ", "; | 203 | subsql += ", "; |
198 | } | 204 | } |
199 | subsql += key + "= :" + key; | 205 | subsql += key + "= :" + key; |
@@ -204,7 +210,8 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
204 | 210 | ||
205 | // this provides the binding for all our parameters, so | 211 | // this provides the binding for all our parameters, so |
206 | // much less code than it used to be | 212 | // much less code than it used to be |
207 | foreach (KeyValuePair<string, DbType> kvp in defs) { | 213 | foreach (KeyValuePair<string, DbType> kvp in defs) |
214 | { | ||
208 | cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value)); | 215 | cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value)); |
209 | } | 216 | } |
210 | return cmd; | 217 | return cmd; |
@@ -213,13 +220,13 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
213 | private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) | 220 | private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) |
214 | { | 221 | { |
215 | Dictionary<string, DbType> primDataDefs = createPrimDataDefs(); | 222 | Dictionary<string, DbType> primDataDefs = createPrimDataDefs(); |
216 | 223 | ||
217 | da.InsertCommand = createInsertCommand("prims", primDataDefs); | 224 | da.InsertCommand = createInsertCommand("prims", primDataDefs); |
218 | da.InsertCommand.Connection = conn; | 225 | da.InsertCommand.Connection = conn; |
219 | 226 | ||
220 | da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", primDataDefs); | 227 | da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", primDataDefs); |
221 | da.UpdateCommand.Connection = conn; | 228 | da.UpdateCommand.Connection = conn; |
222 | 229 | ||
223 | SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); | 230 | SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); |
224 | delete.Parameters.Add(createSqliteParameter("UUID", DbType.String)); | 231 | delete.Parameters.Add(createSqliteParameter("UUID", DbType.String)); |
225 | delete.Connection = conn; | 232 | delete.Connection = conn; |
@@ -229,13 +236,13 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
229 | private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) | 236 | private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) |
230 | { | 237 | { |
231 | Dictionary<string, DbType> shapeDataDefs = createShapeDataDefs(); | 238 | Dictionary<string, DbType> shapeDataDefs = createShapeDataDefs(); |
232 | 239 | ||
233 | da.InsertCommand = createInsertCommand("primshapes", shapeDataDefs); | 240 | da.InsertCommand = createInsertCommand("primshapes", shapeDataDefs); |
234 | da.InsertCommand.Connection = conn; | 241 | da.InsertCommand.Connection = conn; |
235 | 242 | ||
236 | da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", shapeDataDefs); | 243 | da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", shapeDataDefs); |
237 | da.UpdateCommand.Connection = conn; | 244 | da.UpdateCommand.Connection = conn; |
238 | 245 | ||
239 | SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); | 246 | SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); |
240 | delete.Parameters.Add(createSqliteParameter("UUID", DbType.String)); | 247 | delete.Parameters.Add(createSqliteParameter("UUID", DbType.String)); |
241 | delete.Connection = conn; | 248 | delete.Connection = conn; |
@@ -271,8 +278,8 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
271 | prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); | 278 | prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); |
272 | // vectors | 279 | // vectors |
273 | prim.OffsetPosition = new LLVector3( | 280 | prim.OffsetPosition = new LLVector3( |
274 | Convert.ToSingle(row["PositionX"]), | 281 | Convert.ToSingle(row["PositionX"]), |
275 | Convert.ToSingle(row["PositionY"]), | 282 | Convert.ToSingle(row["PositionY"]), |
276 | Convert.ToSingle(row["PositionZ"]) | 283 | Convert.ToSingle(row["PositionZ"]) |
277 | ); | 284 | ); |
278 | prim.GroupPosition = new LLVector3( | 285 | prim.GroupPosition = new LLVector3( |
@@ -306,7 +313,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
306 | return prim; | 313 | return prim; |
307 | } | 314 | } |
308 | 315 | ||
309 | private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID) | 316 | private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID) |
310 | { | 317 | { |
311 | row["UUID"] = prim.UUID; | 318 | row["UUID"] = prim.UUID; |
312 | row["ParentID"] = prim.ParentID; | 319 | row["ParentID"] = prim.ParentID; |
@@ -383,11 +390,22 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
383 | // text TODO: this isn't right] = but I'm not sure the right | 390 | // text TODO: this isn't right] = but I'm not sure the right |
384 | // way to specify this as a blob atm | 391 | // way to specify this as a blob atm |
385 | // s.TextureEntry = (byte[])row["Texture"]; | 392 | // s.TextureEntry = (byte[])row["Texture"]; |
386 | 393 | ||
387 | //following hack will only save the default face texture, any other textures on other faces | 394 | string texture = (string)row["Texture"]; |
388 | //won't be saved or restored. | 395 | if (!texture.StartsWith("<")) |
389 | LLObject.TextureEntry texture = new LLObject.TextureEntry( new LLUUID((string)row["Texture"])); | 396 | { |
390 | s.TextureEntry = texture.ToBytes(); | 397 | //here so that we can still work with old format database files (ie from before I added xml serialization) |
398 | LLObject.TextureEntry textureEntry = null; | ||
399 | textureEntry = new LLObject.TextureEntry(new LLUUID(texture)); | ||
400 | s.TextureEntry = textureEntry.ToBytes(); | ||
401 | } | ||
402 | else | ||
403 | { | ||
404 | TextureBlock textureEntry = TextureBlock.FromXmlString(texture); | ||
405 | s.TextureEntry = textureEntry.TextureData; | ||
406 | s.ExtraParams = textureEntry.ExtraParams; | ||
407 | } | ||
408 | |||
391 | return s; | 409 | return s; |
392 | } | 410 | } |
393 | 411 | ||
@@ -428,34 +446,41 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
428 | // And I couldn't work out how to save binary data either | 446 | // And I couldn't work out how to save binary data either |
429 | // seems that the texture colum is being treated as a string in the Datarow | 447 | // seems that the texture colum is being treated as a string in the Datarow |
430 | // if you do a .getType() on it, it returns string, while the other columns return correct type | 448 | // if you do a .getType() on it, it returns string, while the other columns return correct type |
431 | //following hack will only save the default face texture, any other textures on other faces | ||
432 | //won't be saved or restored. | ||
433 | // MW[10-08-07] | 449 | // MW[10-08-07] |
434 | LLObject.TextureEntry text = new LLObject.TextureEntry(s.TextureEntry, 0, s.TextureEntry.Length); | 450 | // Added following xml hack but not really ideal , also ExtraParams isn't currently part of the database |
435 | row["Texture"] = text.DefaultTexture.TextureID.ToStringHyphenated(); | 451 | // am a bit worried about adding it now as some people will have old format databases, so for now including that data in this xml data |
436 | 452 | // MW[17-08-07] | |
453 | TextureBlock textureBlock = new TextureBlock(s.TextureEntry); | ||
454 | textureBlock.ExtraParams = s.ExtraParams; | ||
455 | row["Texture"] = textureBlock.ToXMLString(); | ||
437 | } | 456 | } |
438 | 457 | ||
439 | private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID) | 458 | private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID) |
440 | { | 459 | { |
441 | DataTable prims = ds.Tables["prims"]; | 460 | DataTable prims = ds.Tables["prims"]; |
442 | DataTable shapes = ds.Tables["primshapes"]; | 461 | DataTable shapes = ds.Tables["primshapes"]; |
443 | 462 | ||
444 | DataRow primRow = prims.Rows.Find(prim.UUID); | 463 | DataRow primRow = prims.Rows.Find(prim.UUID); |
445 | if (primRow == null) { | 464 | if (primRow == null) |
465 | { | ||
446 | primRow = prims.NewRow(); | 466 | primRow = prims.NewRow(); |
447 | fillPrimRow(primRow, prim, sceneGroupID); | 467 | fillPrimRow(primRow, prim, sceneGroupID); |
448 | prims.Rows.Add(primRow); | 468 | prims.Rows.Add(primRow); |
449 | } else { | 469 | } |
470 | else | ||
471 | { | ||
450 | fillPrimRow(primRow, prim, sceneGroupID); | 472 | fillPrimRow(primRow, prim, sceneGroupID); |
451 | } | 473 | } |
452 | 474 | ||
453 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); | 475 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); |
454 | if (shapeRow == null) { | 476 | if (shapeRow == null) |
477 | { | ||
455 | shapeRow = shapes.NewRow(); | 478 | shapeRow = shapes.NewRow(); |
456 | fillShapeRow(shapeRow, prim); | 479 | fillShapeRow(shapeRow, prim); |
457 | shapes.Rows.Add(shapeRow); | 480 | shapes.Rows.Add(shapeRow); |
458 | } else { | 481 | } |
482 | else | ||
483 | { | ||
459 | fillShapeRow(shapeRow, prim); | 484 | fillShapeRow(shapeRow, prim); |
460 | } | 485 | } |
461 | } | 486 | } |
@@ -466,11 +491,11 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
466 | { | 491 | { |
467 | addPrim(prim, obj.UUID); | 492 | addPrim(prim, obj.UUID); |
468 | } | 493 | } |
469 | 494 | ||
470 | // MainLog.Instance.Verbose("Attempting to do database update...."); | 495 | // MainLog.Instance.Verbose("Attempting to do database update...."); |
471 | primDa.Update(ds, "prims"); | 496 | primDa.Update(ds, "prims"); |
472 | shapeDa.Update(ds, "primshapes"); | 497 | shapeDa.Update(ds, "primshapes"); |
473 | // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); | 498 | // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); |
474 | } | 499 | } |
475 | 500 | ||
476 | public void RemoveObject(LLUUID obj) | 501 | public void RemoveObject(LLUUID obj) |
@@ -502,7 +527,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
502 | 527 | ||
503 | DataTable prims = ds.Tables["prims"]; | 528 | DataTable prims = ds.Tables["prims"]; |
504 | DataTable shapes = ds.Tables["primshapes"]; | 529 | DataTable shapes = ds.Tables["primshapes"]; |
505 | 530 | ||
506 | foreach (DataRow primRow in prims.Rows) | 531 | foreach (DataRow primRow in prims.Rows) |
507 | { | 532 | { |
508 | string uuid = (string)primRow["UUID"]; | 533 | string uuid = (string)primRow["UUID"]; |
@@ -548,7 +573,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
548 | 573 | ||
549 | return retvals; | 574 | return retvals; |
550 | } | 575 | } |
551 | 576 | ||
552 | public void StoreTerrain(double[,] ter) | 577 | public void StoreTerrain(double[,] ter) |
553 | { | 578 | { |
554 | 579 | ||
@@ -578,5 +603,42 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
578 | { | 603 | { |
579 | // TODO: DataSet commit | 604 | // TODO: DataSet commit |
580 | } | 605 | } |
606 | |||
607 | public class TextureBlock | ||
608 | { | ||
609 | public byte[] TextureData; | ||
610 | public byte[] ExtraParams = new byte[1]; | ||
611 | |||
612 | public TextureBlock(byte[] data) | ||
613 | { | ||
614 | TextureData = data; | ||
615 | } | ||
616 | |||
617 | public TextureBlock() | ||
618 | { | ||
619 | |||
620 | } | ||
621 | |||
622 | public string ToXMLString() | ||
623 | { | ||
624 | StringWriter sw = new StringWriter(); | ||
625 | XmlTextWriter writer = new XmlTextWriter(sw); | ||
626 | XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock)); | ||
627 | serializer.Serialize(writer, this); | ||
628 | return sw.ToString(); | ||
629 | } | ||
630 | |||
631 | public static TextureBlock FromXmlString(string xmlData) | ||
632 | { | ||
633 | TextureBlock textureEntry = null; | ||
634 | StringReader sr = new StringReader(xmlData); | ||
635 | XmlTextReader reader = new XmlTextReader(sr); | ||
636 | XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock)); | ||
637 | textureEntry = (TextureBlock)serializer.Deserialize(reader); | ||
638 | reader.Close(); | ||
639 | sr.Close(); | ||
640 | return textureEntry; | ||
641 | } | ||
642 | } | ||
581 | } | 643 | } |
582 | } | 644 | } |