aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer')
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs10
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs94
2 files changed, 101 insertions, 3 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 1a03216..ca473e3 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -491,7 +491,7 @@ namespace OpenSim
491 /// <param name="avatarID"></param> 491 /// <param name="avatarID"></param>
492 /// <param name="avatarLocalID"></param> 492 /// <param name="avatarLocalID"></param>
493 /// <param name="Pos"></param> 493 /// <param name="Pos"></param>
494 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos) 494 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry)
495 { 495 {
496 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 496 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
497 //send a objectupdate packet with information about the clients avatar 497 //send a objectupdate packet with information about the clients avatar
@@ -500,7 +500,7 @@ namespace OpenSim
500 objupdate.RegionData.RegionHandle = regionHandle; 500 objupdate.RegionData.RegionHandle = regionHandle;
501 objupdate.RegionData.TimeDilation = 64096; 501 objupdate.RegionData.TimeDilation = 64096;
502 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 502 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
503 objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(); 503 objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry);
504 //give this avatar object a local id and assign the user a name 504 //give this avatar object a local id and assign the user a name
505 505
506 objupdate.ObjectData[0].ID = avatarLocalID; 506 objupdate.ObjectData[0].ID = avatarLocalID;
@@ -859,7 +859,7 @@ namespace OpenSim
859 /// 859 ///
860 /// </summary> 860 /// </summary>
861 /// <returns></returns> 861 /// <returns></returns>
862 protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket() 862 protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry)
863 { 863 {
864 libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); 864 libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
865 865
@@ -873,6 +873,10 @@ namespace OpenSim
873 objdata.OwnerID = LLUUID.Zero; 873 objdata.OwnerID = LLUUID.Zero;
874 objdata.Scale = new LLVector3(1, 1, 1); 874 objdata.Scale = new LLVector3(1, 1, 1);
875 objdata.PCode = 47; 875 objdata.PCode = 47;
876 if (textureEntry != null)
877 {
878 objdata.TextureEntry = textureEntry;
879 }
876 System.Text.Encoding enc = System.Text.Encoding.ASCII; 880 System.Text.Encoding enc = System.Text.Encoding.ASCII;
877 libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); 881 libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
878 pos.X = 100f; 882 pos.X = 100f;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs b/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
index 31749d8..1b01f24 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Assets; 31using OpenSim.Assets;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Utilities; 34using OpenSim.Framework.Utilities;
34using OpenSim.Caches; 35using OpenSim.Caches;
35using libsecondlife; 36using libsecondlife;
@@ -258,6 +259,99 @@ namespace OpenSim
258 259
259 } 260 }
260 } 261 }
262
263 //new class , not currently used.
264 public class AssetXferUploader
265 {
266 private IClientAPI ourClient;
267
268 public bool UploadComplete = false;
269
270 public bool AddToInventory;
271 public LLUUID InventFolder = LLUUID.Zero;
272
273 public uint XferID;
274 public AssetBase Asset;
275 public LLUUID TransactionID = LLUUID.Zero;
276
277
278 public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data)
279 {
280 ourClient = remoteClient;
281 Asset = new AssetBase();
282 Asset.FullID = assetID;
283 Asset.InvType = type;
284 Asset.Type = type;
285 Asset.Data = data;
286 Asset.Name = "blank";
287 Asset.Description = "empty";
288 TransactionID = transaction;
289
290 if (Asset.Data.Length > 2)
291 {
292 this.SendCompleteMessage();
293 }
294 else
295 {
296 this.ReqestStartXfer();
297 }
298 }
299
300 protected void SendCompleteMessage()
301 {
302 UploadComplete = true;
303 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
304 response.AssetBlock.Type = Asset.Type;
305 response.AssetBlock.Success = true;
306 response.AssetBlock.UUID = Asset.FullID;
307 this.ourClient.OutPacket(response);
308
309 //TODO trigger event
310 }
311
312 protected void ReqestStartXfer()
313 {
314 UploadComplete = false;
315 XferID = Util.GetNextXferID();
316 RequestXferPacket xfer = new RequestXferPacket();
317 xfer.XferID.ID = XferID;
318 xfer.XferID.VFileType = Asset.Type;
319 xfer.XferID.VFileID = Asset.FullID;
320 xfer.XferID.FilePath = 0;
321 xfer.XferID.Filename = new byte[0];
322 this.ourClient.OutPacket(xfer);
323 }
324
325 public void HandleXferPacket(uint xferID, uint packetID, byte[] data)
326 {
327 if (XferID == xferID)
328 {
329 if (Asset.Data.Length > 1)
330 {
331 byte[] newArray = new byte[Asset.Data.Length + data.Length];
332 Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length);
333 Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length);
334 Asset.Data = newArray;
335 }
336 else
337 {
338 byte[] newArray = new byte[data.Length - 4];
339 Array.Copy(data, 4, newArray, 0, data.Length - 4);
340 Asset.Data = newArray;
341 }
342
343 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
344 confirmXfer.XferID.ID = xferID;
345 confirmXfer.XferID.Packet = packetID;
346 this.ourClient.OutPacket(confirmXfer);
347
348 if ((packetID & 2147483648) != 0)
349 {
350 this.SendCompleteMessage();
351 }
352 }
353 }
354 }
261 } 355 }
262 } 356 }
263} 357}