aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-07-11 17:47:25 +0000
committerMW2007-07-11 17:47:25 +0000
commit2ceff87a02d9862497d1d8fa965851ae2d9c9b1b (patch)
tree47cbd7a3fe7678c9ac2d56ace21ea4ebf8f628ef /OpenSim
parentupdated libsecondlife.dll to a 1.18 version (from the libsecondlife aditi bra... (diff)
downloadopensim-SC_OLD-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.zip
opensim-SC_OLD-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.gz
opensim-SC_OLD-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.bz2
opensim-SC_OLD-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.xz
More work on UserProfile and inventory cache (still currently not enabled).
Asset uploading over CAPS now works, and although inventory isn't really working yet, this should now at least enables texturing of prims.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs4
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs17
-rw-r--r--OpenSim/Framework/Communications/caches/CachedUserInfo.cs77
-rw-r--r--OpenSim/Framework/Communications/caches/InventoryFolder.cs (renamed from OpenSim/Region/Caches/InventoryFolder.cs)2
-rw-r--r--OpenSim/Framework/Communications/caches/UserProfileCache.cs (renamed from OpenSim/Region/Caches/UserProfileCache.cs)42
-rw-r--r--OpenSim/Framework/Data/InventoryData.cs6
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/Servers/BinaryStreamHandler.cs44
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs1
-rw-r--r--OpenSim/Region/Caches/CachedUserInfo.cs20
-rw-r--r--OpenSim/Region/Capabilities/Caps.cs20
-rw-r--r--OpenSim/Region/Capabilities/LLSDCapsDetails.cs2
-rw-r--r--OpenSim/Region/ClientStack/Assets/InventoryCache.cs1
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs122
14 files changed, 301 insertions, 61 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 109d027..ebc9632 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -32,6 +32,7 @@ using OpenSim.Framework.Data;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
35using OpenSim.Framework.Communications.Caches;
35 36
36namespace OpenSim.Framework.Communications 37namespace OpenSim.Framework.Communications
37{ 38{
@@ -40,12 +41,15 @@ namespace OpenSim.Framework.Communications
40 { 41 {
41 public IUserServices UserServer; 42 public IUserServices UserServer;
42 public IGridServices GridServer; 43 public IGridServices GridServer;
44 public IInventoryServices InventoryServer;
43 public IInterRegionCommunications InterRegion; 45 public IInterRegionCommunications InterRegion;
46 public UserProfileCache UserProfilesCache;
44 47
45 public NetworkServersInfo ServersInfo; 48 public NetworkServersInfo ServersInfo;
46 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer) 49 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer)
47 { 50 {
48 ServersInfo = serversInfo; 51 ServersInfo = serversInfo;
52 UserProfilesCache = new UserProfileCache(this);
49 } 53 }
50 54
51 #region Packet Handlers 55 #region Packet Handlers
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
new file mode 100644
index 0000000..0b05834
--- /dev/null
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -0,0 +1,17 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Data;
5using libsecondlife;
6using OpenSim.Framework.Communications.Caches;
7
8namespace OpenSim.Framework.Communications
9{
10 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo);
11 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
12
13 public interface IInventoryServices
14 {
15 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
16 }
17}
diff --git a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
new file mode 100644
index 0000000..1c779e9
--- /dev/null
+++ b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
@@ -0,0 +1,77 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Data;
5using libsecondlife;
6
7namespace OpenSim.Framework.Communications.Caches
8{
9 public class CachedUserInfo
10 {
11 public UserProfileData UserProfile;
12 //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>();
13 public InventoryFolder RootFolder;
14
15 public CachedUserInfo()
16 {
17
18 }
19
20 /// <summary>
21 ///
22 /// </summary>
23 /// <param name="userID"></param>
24 /// <param name="folderInfo"></param>
25 public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
26 {
27 if (userID == UserProfile.UUID)
28 {
29 if (this.RootFolder == null)
30 {
31 if (folderInfo.parentID == LLUUID.Zero)
32 {
33 this.RootFolder = folderInfo;
34 }
35 }
36 else
37 {
38 if (this.RootFolder.folderID == folderInfo.parentID)
39 {
40 this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
41 }
42 else
43 {
44 InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID);
45 if (pFolder != null)
46 {
47 pFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
48 }
49 }
50 }
51 }
52 }
53
54 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
55 {
56 if (userID == UserProfile.UUID)
57 {
58 if (this.RootFolder != null)
59 {
60 if (itemInfo.parentFolderID == this.RootFolder.folderID)
61 {
62 this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo);
63 }
64 else
65 {
66 InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID);
67 if (pFolder != null)
68 {
69 pFolder.Items.Add(itemInfo.inventoryID, itemInfo);
70 }
71 }
72 }
73
74 }
75 }
76 }
77}
diff --git a/OpenSim/Region/Caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs
index 364a184..eaddf19 100644
--- a/OpenSim/Region/Caches/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/caches/InventoryFolder.cs
@@ -4,7 +4,7 @@ using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Data; 5using OpenSim.Framework.Data;
6 6
7namespace OpenSim.Region.Caches 7namespace OpenSim.Framework.Communications.Caches
8{ 8{
9 public class InventoryFolder : InventoryFolderBase 9 public class InventoryFolder : InventoryFolderBase
10 { 10 {
diff --git a/OpenSim/Region/Caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs
index 0717e55..0ee63ba 100644
--- a/OpenSim/Region/Caches/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/caches/UserProfileCache.cs
@@ -3,16 +3,19 @@ using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Data; 5using OpenSim.Framework.Data;
6using OpenSim.Framework.Communications;
6 7
7namespace OpenSim.Region.Caches 8namespace OpenSim.Framework.Communications.Caches
8{ 9{
9 public class UserProfileCache 10 public class UserProfileCache
10 { 11 {
11 public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>(); 12 public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>();
12 13
13 public UserProfileCache() 14 private CommunicationsManager m_parent;
14 {
15 15
16 public UserProfileCache(CommunicationsManager parent)
17 {
18 m_parent = parent;
16 } 19 }
17 20
18 /// <summary> 21 /// <summary>
@@ -22,7 +25,36 @@ namespace OpenSim.Region.Caches
22 /// <param name="userID"></param> 25 /// <param name="userID"></param>
23 public void AddNewUser(LLUUID userID) 26 public void AddNewUser(LLUUID userID)
24 { 27 {
28 if (!this.UserProfiles.ContainsKey(userID))
29 {
30 CachedUserInfo userInfo = new CachedUserInfo();
31 userInfo.UserProfile = this.RequestUserProfileForUser(userID);
32 this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
33 if (userInfo.UserProfile != null)
34 {
35 this.UserProfiles.Add(userID, userInfo);
36 }
37 else
38 {
39 //no profile for this user, what do we do now?
40 }
41 }
42 else
43 {
44 //already have a cached profile for this user
45 //we should make sure its upto date with the user server version
46 }
47 }
25 48
49 /// <summary>
50 /// A new user has moved into a region in this instance
51 /// so get info from servers
52 /// </summary>
53 /// <param name="firstName"></param>
54 /// <param name="lastName"></param>
55 public void AddNewUser(string firstName, string lastName)
56 {
57
26 } 58 }
27 59
28 /// <summary> 60 /// <summary>
@@ -40,9 +72,9 @@ namespace OpenSim.Region.Caches
40 /// Request the user profile from User server 72 /// Request the user profile from User server
41 /// </summary> 73 /// </summary>
42 /// <param name="userID"></param> 74 /// <param name="userID"></param>
43 private void RequestUserProfileForUser(LLUUID userID) 75 private UserProfileData RequestUserProfileForUser(LLUUID userID)
44 { 76 {
45 77 return this.m_parent.UserServer.GetUserProfile(userID);
46 } 78 }
47 79
48 /// <summary> 80 /// <summary>
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index fe2e25c..7253cc7 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Data
48 /// </summary> 48 /// </summary>
49 public int type; 49 public int type;
50 /// <summary> 50 /// <summary>
51 /// The folder this item is contained in (NULL_KEY = Inventory Root) 51 /// The folder this item is contained in
52 /// </summary> 52 /// </summary>
53 public LLUUID parentFolderID; 53 public LLUUID parentFolderID;
54 /// <summary> 54 /// <summary>
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data
56 /// </summary> 56 /// </summary>
57 public LLUUID avatarID; 57 public LLUUID avatarID;
58 /// <summary> 58 /// <summary>
59 /// The creator of this folder 59 /// The creator of this item
60 /// </summary> 60 /// </summary>
61 public LLUUID creatorsID; 61 public LLUUID creatorsID;
62 /// <summary> 62 /// <summary>
@@ -91,7 +91,7 @@ namespace OpenSim.Framework.Data
91 /// </summary> 91 /// </summary>
92 public LLUUID agentID; 92 public LLUUID agentID;
93 /// <summary> 93 /// <summary>
94 /// The folder this folder is contained in (NULL_KEY for root) 94 /// The folder this folder is contained in
95 /// </summary> 95 /// </summary>
96 public LLUUID parentID; 96 public LLUUID parentID;
97 /// <summary> 97 /// <summary>
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 1b0c682..fe1e9dc 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -30,6 +30,7 @@ using System.Net;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33using OpenSim.Framework.Data;
33 34
34namespace OpenSim.Framework.Interfaces 35namespace OpenSim.Framework.Interfaces
35{ 36{
@@ -176,5 +177,8 @@ namespace OpenSim.Framework.Interfaces
176 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); 177 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
177 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); 178 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
178 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); 179 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation);
180
181 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
182 void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
179 } 183 }
180} 184}
diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
new file mode 100644
index 0000000..302dbff
--- /dev/null
+++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
@@ -0,0 +1,44 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5
6namespace OpenSim.Framework.Servers
7{
8
9 public class BinaryStreamHandler : BaseStreamHandler
10 {
11 BinaryMethod m_restMethod;
12
13 override public byte[] Handle(string path, Stream request)
14 {
15 byte[] data = ReadFully(request);
16 string param = GetParam(path);
17 string responseString = m_restMethod(data, path, param);
18
19 return Encoding.UTF8.GetBytes(responseString);
20 }
21
22 public BinaryStreamHandler(string httpMethod, string path, BinaryMethod restMethod)
23 : base(httpMethod, path)
24 {
25 m_restMethod = restMethod;
26 }
27
28 public byte[] ReadFully(Stream stream)
29 {
30 byte[] buffer = new byte[32768];
31 using (MemoryStream ms = new MemoryStream())
32 {
33 while (true)
34 {
35 int read = stream.Read(buffer, 0, buffer.Length);
36 if (read <= 0)
37 return ms.ToArray();
38 ms.Write(buffer, 0, read);
39 }
40 }
41 }
42 }
43
44}
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
index c6cb230..2a92fc1 100644
--- a/OpenSim/Framework/Servers/RestMethod.cs
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -28,4 +28,5 @@
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod( string request, string path, string param ); 30 public delegate string RestMethod( string request, string path, string param );
31 public delegate string BinaryMethod(byte[] data, string path, string param);
31} 32}
diff --git a/OpenSim/Region/Caches/CachedUserInfo.cs b/OpenSim/Region/Caches/CachedUserInfo.cs
deleted file mode 100644
index 08a7848..0000000
--- a/OpenSim/Region/Caches/CachedUserInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Data;
5using libsecondlife;
6
7namespace OpenSim.Region.Caches
8{
9 public class CachedUserInfo
10 {
11 public UserProfileData UserProfile;
12 //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>();
13 public InventoryFolder RootFolder;
14
15 public CachedUserInfo()
16 {
17
18 }
19 }
20}
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs
index 6068076..db8df9b 100644
--- a/OpenSim/Region/Capabilities/Caps.cs
+++ b/OpenSim/Region/Capabilities/Caps.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using System.IO;
32using libsecondlife; 33using libsecondlife;
33using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
34using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
@@ -118,7 +119,7 @@ namespace OpenSim.Region.Capabilities
118 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; 119 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath;
119 120
120 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 121 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
121 // caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 122 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
122 123
123 return caps; 124 return caps;
124 } 125 }
@@ -253,10 +254,12 @@ namespace OpenSim.Region.Capabilities
253 LLUUID newInvItem = LLUUID.Random(); 254 LLUUID newInvItem = LLUUID.Random();
254 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 255 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
255 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); 256 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener);
257
258 string capsBase = "/CAPS/" + m_capsObjectPath;
259 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
256 260
257 AddLegacyCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); 261
258 262 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath +uploaderPath;
259 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath;
260 //Console.WriteLine("uploader url is " + uploaderURL); 263 //Console.WriteLine("uploader url is " + uploaderURL);
261 res += "<llsd><map>"; 264 res += "<llsd><map>";
262 res += "<key>uploader</key><string>" + uploaderURL + "</string>"; 265 res += "<key>uploader</key><string>" + uploaderURL + "</string>";
@@ -303,10 +306,10 @@ namespace OpenSim.Region.Capabilities
303 306
304 } 307 }
305 308
306 public string uploaderCaps(string request, string path, string param) 309 public string uploaderCaps(byte[] data, string path, string param)
307 { 310 {
308 Encoding _enc = Encoding.UTF8; 311 //Encoding _enc = Encoding.UTF8;
309 byte[] data = _enc.GetBytes(request); 312 //byte[] data = _enc.GetBytes(request);
310 //Console.WriteLine("recieved upload " + Util.FieldToString(data)); 313 //Console.WriteLine("recieved upload " + Util.FieldToString(data));
311 LLUUID inv = this.inventoryItemID; 314 LLUUID inv = this.inventoryItemID;
312 string res = ""; 315 string res = "";
@@ -324,7 +327,8 @@ namespace OpenSim.Region.Capabilities
324 OnUpLoad(newAssetID, inv, data); 327 OnUpLoad(newAssetID, inv, data);
325 } 328 }
326 329
327 /*FileStream fs = File.Create("upload.jp2"); 330 /*
331 FileStream fs = File.Create("upload.jp2");
328 BinaryWriter bw = new BinaryWriter(fs); 332 BinaryWriter bw = new BinaryWriter(fs);
329 bw.Write(data); 333 bw.Write(data);
330 bw.Close(); 334 bw.Close();
diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
index 1f8b242..1522559 100644
--- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
+++ b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
@@ -4,7 +4,7 @@ namespace OpenSim.Region.Capabilities
4 public class LLSDCapsDetails 4 public class LLSDCapsDetails
5 { 5 {
6 public string MapLayer = ""; 6 public string MapLayer = "";
7 //public string NewFileAgentInventory = ""; 7 public string NewFileAgentInventory = "";
8 //public string EventQueueGet = ""; 8 //public string EventQueueGet = "";
9 9
10 public LLSDCapsDetails() 10 public LLSDCapsDetails()
diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
index 082c0d0..e2cfa46 100644
--- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
+++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
@@ -196,6 +196,7 @@ namespace OpenSim.Assets
196 196
197 public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend) 197 public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend)
198 { 198 {
199
199 if (this._agentsInventory.ContainsKey(userInfo.AgentID)) 200 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
200 { 201 {
201 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; 202 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 225e906..d5b6b52 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -35,6 +35,7 @@ using libsecondlife.Packets;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types; 37using OpenSim.Framework.Types;
38using OpenSim.Framework.Data;
38 39
39namespace OpenSim.Region.ClientStack 40namespace OpenSim.Region.ClientStack
40{ 41{
@@ -76,7 +77,7 @@ namespace OpenSim.Region.ClientStack
76 public event GenericCall6 OnRemoveAvatar; 77 public event GenericCall6 OnRemoveAvatar;
77 public event RequestMapBlocks OnRequestMapBlocks; 78 public event RequestMapBlocks OnRequestMapBlocks;
78 public event TeleportLocationRequest OnTeleportLocationRequest; 79 public event TeleportLocationRequest OnTeleportLocationRequest;
79 80
80 public event UUIDNameRequest OnNameFromUUIDRequest; 81 public event UUIDNameRequest OnNameFromUUIDRequest;
81 82
82 public event ParcelPropertiesRequest OnParcelPropertiesRequest; 83 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
@@ -188,7 +189,7 @@ namespace OpenSim.Region.ClientStack
188 mov.Data.RegionHandle = regInfo.RegionHandle; 189 mov.Data.RegionHandle = regInfo.RegionHandle;
189 mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this 190 mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this
190 191
191 if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) 192 if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0))
192 { 193 {
193 mov.Data.Position = this.startpos; 194 mov.Data.Position = this.startpos;
194 } 195 }
@@ -325,11 +326,11 @@ namespace OpenSim.Region.ClientStack
325 /// <param name="neighbourHandle"></param> 326 /// <param name="neighbourHandle"></param>
326 /// <param name="neighbourIP"></param> 327 /// <param name="neighbourIP"></param>
327 /// <param name="neighbourPort"></param> 328 /// <param name="neighbourPort"></param>
328 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint ) 329 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint)
329 { 330 {
330 IPAddress neighbourIP = neighbourEndPoint.Address; 331 IPAddress neighbourIP = neighbourEndPoint.Address;
331 ushort neighbourPort = (ushort) neighbourEndPoint.Port; 332 ushort neighbourPort = (ushort)neighbourEndPoint.Port;
332 333
333 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); 334 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
334 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 335 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
335 enablesimpacket.SimulatorInfo.Handle = neighbourHandle; 336 enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
@@ -405,7 +406,7 @@ namespace OpenSim.Region.ClientStack
405 mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name); 406 mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name);
406 mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags; 407 mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags;
407 mapReply.Data[i].Access = mapBlocks[i].Access; 408 mapReply.Data[i].Access = mapBlocks[i].Access;
408 mapReply.Data[i].Agents = mapBlocks[i].Agents; 409 mapReply.Data[i].Agents = mapBlocks[i].Agents;
409 } 410 }
410 this.OutPacket(mapReply); 411 this.OutPacket(mapReply);
411 } 412 }
@@ -421,7 +422,7 @@ namespace OpenSim.Region.ClientStack
421 OutPacket(tpLocal); 422 OutPacket(tpLocal);
422 } 423 }
423 424
424 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags) 425 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags)
425 { 426 {
426 TeleportFinishPacket teleport = new TeleportFinishPacket(); 427 TeleportFinishPacket teleport = new TeleportFinishPacket();
427 teleport.Info.AgentID = this.AgentID; 428 teleport.Info.AgentID = this.AgentID;
@@ -439,7 +440,7 @@ namespace OpenSim.Region.ClientStack
439 teleport.Info.SimIP = ip; 440 teleport.Info.SimIP = ip;
440 teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; 441 teleport.Info.SimPort = (ushort)newRegionEndPoint.Port;
441 teleport.Info.LocationID = 4; 442 teleport.Info.LocationID = 4;
442 teleport.Info.TeleportFlags = 1 << 4; 443 teleport.Info.TeleportFlags = 1 << 4;
443 OutPacket(teleport); 444 OutPacket(teleport);
444 } 445 }
445 446
@@ -492,6 +493,81 @@ namespace OpenSim.Region.ClientStack
492 OutPacket(kill); 493 OutPacket(kill);
493 } 494 }
494 495
496 public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items)
497 {
498 Encoding enc = Encoding.ASCII;
499 uint FULL_MASK_PERMISSIONS = 2147483647;
500 InventoryDescendentsPacket descend = new InventoryDescendentsPacket();
501 descend.AgentData.AgentID = this.AgentId;
502 descend.AgentData.OwnerID = ownerID;
503 descend.AgentData.FolderID = folderID;
504 descend.AgentData.Descendents = items.Count;
505 descend.AgentData.Version = 0;
506 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
507 int i = 0;
508 foreach (InventoryItemBase item in items)
509 {
510 descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
511 descend.ItemData[i].ItemID = item.inventoryID;
512 descend.ItemData[i].AssetID = item.assetID;
513 descend.ItemData[i].CreatorID = item.creatorsID;
514 descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
515 descend.ItemData[i].CreationDate = 1000;
516 descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription+ "\0");
517 descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
518 descend.ItemData[i].Flags = 1;
519 descend.ItemData[i].FolderID = item.parentFolderID;
520 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
521 descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
522 descend.ItemData[i].InvType = (sbyte)item.type;
523 descend.ItemData[i].Name = enc.GetBytes(item.inventoryName+ "\0");
524 descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
525 descend.ItemData[i].OwnerID = item.avatarID;
526 descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
527 descend.ItemData[i].SalePrice = 0;
528 descend.ItemData[i].SaleType = 0;
529 descend.ItemData[i].Type = (sbyte)item.type;
530 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);
531
532 i++;
533 }
534
535 this.OutPacket(descend);
536
537 }
538
539 public void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item)
540 {
541 Encoding enc = Encoding.ASCII;
542 uint FULL_MASK_PERMISSIONS = 2147483647;
543 FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket();
544 inventoryReply.AgentData.AgentID = this.AgentId;
545 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
546 inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
547 inventoryReply.InventoryData[0].ItemID = item.inventoryID;
548 inventoryReply.InventoryData[0].AssetID = item.assetID;
549 inventoryReply.InventoryData[0].CreatorID = item.creatorsID;
550 inventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
551 inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
552 inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0");
553 inventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
554 inventoryReply.InventoryData[0].Flags = 0;
555 inventoryReply.InventoryData[0].FolderID = item.parentFolderID;
556 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
557 inventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
558 inventoryReply.InventoryData[0].InvType = (sbyte)item.type;
559 inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0");
560 inventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
561 inventoryReply.InventoryData[0].OwnerID = item.avatarID;
562 inventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
563 inventoryReply.InventoryData[0].SalePrice = 0;
564 inventoryReply.InventoryData[0].SaleType = 0;
565 inventoryReply.InventoryData[0].Type = (sbyte)item.type;
566 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);
567
568 this.OutPacket(inventoryReply);
569 }
570
495 571
496 #region Appearance/ Wearables Methods 572 #region Appearance/ Wearables Methods
497 573
@@ -545,20 +621,20 @@ namespace OpenSim.Region.ClientStack
545 OutPacket(avp); 621 OutPacket(avp);
546 } 622 }
547 623
548 public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) 624 public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId)
549 { 625 {
550 AvatarAnimationPacket ani = new AvatarAnimationPacket(); 626 AvatarAnimationPacket ani = new AvatarAnimationPacket();
551 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; 627 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
552 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); 628 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
553 ani.AnimationSourceList[0].ObjectID = sourceAgentId; 629 ani.AnimationSourceList[0].ObjectID = sourceAgentId;
554 ani.Sender = new AvatarAnimationPacket.SenderBlock(); 630 ani.Sender = new AvatarAnimationPacket.SenderBlock();
555 ani.Sender.ID = sourceAgentId; 631 ani.Sender.ID = sourceAgentId;
556 ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; 632 ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1];
557 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); 633 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
558 ani.AnimationList[0].AnimID = animID; 634 ani.AnimationList[0].AnimID = animID;
559 ani.AnimationList[0].AnimSequenceID = seq; 635 ani.AnimationList[0].AnimSequenceID = seq;
560 this.OutPacket(ani); 636 this.OutPacket(ani);
561 } 637 }
562 638
563 #endregion 639 #endregion
564 640
@@ -674,7 +750,7 @@ namespace OpenSim.Region.ClientStack
674 /// </summary> 750 /// </summary>
675 /// <param name="primData"></param> 751 /// <param name="primData"></param>
676 /// <param name="pos"></param> 752 /// <param name="pos"></param>
677 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID , uint flags) 753 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags)
678 { 754 {
679 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 755 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
680 outPacket.RegionData.RegionHandle = regionHandle; 756 outPacket.RegionData.RegionHandle = regionHandle;