diff --git a/OpenMetaverse/Messages/CableBeachAttributes.cs b/OpenMetaverse/Messages/CableBeachAttributes.cs
index 5d8782b0..a6ceba3b 100644
--- a/OpenMetaverse/Messages/CableBeachAttributes.cs
+++ b/OpenMetaverse/Messages/CableBeachAttributes.cs
@@ -28,6 +28,11 @@ using System;
namespace OpenMetaverse.Messages.CableBeach
{
+ public static class AvatarServices
+ {
+ public static readonly Uri INVENTORY_SERVER = new Uri("http://openmetaverse.org/services/inventoryServer");
+ }
+
public static class AvatarAttributes
{
public static readonly Uri EMAIL = new Uri("http://axschema.org/contact/email");
@@ -41,9 +46,6 @@ namespace OpenMetaverse.Messages.CableBeach
public static readonly Uri IMAGE = new Uri("http://axschema.org/media/image/default");
public static readonly Uri BIOGRAPHY = new Uri("http://axschema.org/media/biography");
- // Service attributes
- public static readonly Uri INVENTORY_SERVER = new Uri("http://openmetaverse.org/attributes/inventoryServer");
-
// OpenSim attributes
public static readonly Uri DEFAULT_INVENTORY = new Uri("http://opensimulator.org/attributes/defaultInventory");
public static readonly Uri IMAGE_ID = new Uri("http://opensimulator.org/attributes/imageID");
diff --git a/OpenMetaverse/Messages/CableBeachMessages.cs b/OpenMetaverse/Messages/CableBeachMessages.cs
index 39773f12..0d3542fd 100644
--- a/OpenMetaverse/Messages/CableBeachMessages.cs
+++ b/OpenMetaverse/Messages/CableBeachMessages.cs
@@ -32,12 +32,75 @@ using OpenMetaverse.Interfaces;
namespace OpenMetaverse.Messages.CableBeach
{
+ ///
+ /// Holds information about a grid region
+ ///
+ public struct RegionInfo
+ {
+ public string Name;
+ public UUID ID;
+ public ulong Handle;
+ public bool Online;
+ public IPEndPoint IPAndPort;
+ public Uri HttpServer;
+ public UUID MapTextureID;
+ public Uri Owner;
+ public RegionFlags Flags;
+ public int AgentCount;
+ public Dictionary Capabilities;
+ public float WaterHeight;
+ public Vector3 DefaultPosition;
+ public Vector3 DefaultLookAt;
+
+ public uint X
+ {
+ get
+ {
+ uint x, y;
+ OpenMetaverse.Utils.LongToUInts(Handle, out x, out y);
+ return x / 256;
+ }
+
+ set
+ {
+ uint x, y;
+ OpenMetaverse.Utils.LongToUInts(Handle, out x, out y);
+ Handle = OpenMetaverse.Utils.UIntsToLong(value, y);
+ }
+ }
+
+ public uint Y
+ {
+ get
+ {
+ uint x, y;
+ OpenMetaverse.Utils.LongToUInts(Handle, out x, out y);
+ return y / 256;
+ }
+
+ set
+ {
+ uint x, y;
+ OpenMetaverse.Utils.LongToUInts(Handle, out x, out y);
+ Handle = OpenMetaverse.Utils.UIntsToLong(x, value);
+ }
+ }
+
+ public override string ToString()
+ {
+ if (Online)
+ return Name + " [Online]";
+ else
+ return "[Offline]";
+ }
+ }
+
#region Identity Messages
public class RequestCapabilitiesMessage : IMessage
{
public Uri Identity;
- public Uri[] Capabilities;
+ public string[] Capabilities;
public OSDMap Serialize()
{
@@ -46,7 +109,7 @@ namespace OpenMetaverse.Messages.CableBeach
OSDArray array = new OSDArray(Capabilities.Length);
for (int i = 0; i < Capabilities.Length; i++)
- array.Add(OSD.FromUri(Capabilities[i]));
+ array.Add(OSD.FromString(Capabilities[i]));
map["capabilities"] = array;
return map;
@@ -57,22 +120,22 @@ namespace OpenMetaverse.Messages.CableBeach
Identity = map["identity"].AsUri();
OSDArray array = (OSDArray)map["capabilities"];
- Capabilities = new Uri[array.Count];
+ Capabilities = new string[array.Count];
for (int i = 0; i < array.Count; i++)
- Capabilities[i] = array[i].AsUri();
+ Capabilities[i] = array[i].AsString();
}
}
public class RequestCapabilitiesReplyMessage : IMessage
{
- public Dictionary Capabilities;
+ public Dictionary Capabilities;
public OSDMap Serialize()
{
OSDMap map = new OSDMap(1);
OSDMap caps = new OSDMap(Capabilities.Count);
- foreach (KeyValuePair entry in Capabilities)
- caps.Add(entry.Key.ToString(), OSD.FromUri(entry.Value));
+ foreach (KeyValuePair entry in Capabilities)
+ caps.Add(entry.Key, OSD.FromUri(entry.Value));
map["capabilities"] = caps;
return map;
}
@@ -80,9 +143,9 @@ namespace OpenMetaverse.Messages.CableBeach
public void Deserialize(OSDMap map)
{
OSDMap caps = (OSDMap)map["capabilities"];
- Capabilities = new Dictionary(caps.Count);
+ Capabilities = new Dictionary(caps.Count);
foreach (KeyValuePair entry in caps)
- Capabilities.Add(new Uri(entry.Key), entry.Value.AsUri());
+ Capabilities.Add(entry.Key, entry.Value.AsUri());
}
}
@@ -93,14 +156,12 @@ namespace OpenMetaverse.Messages.CableBeach
public class CreateInventoryMessage : IMessage
{
public Uri Identity;
- public UUID AccessToken;
public string Name;
public OSDMap Serialize()
{
- OSDMap map = new OSDMap(3);
+ OSDMap map = new OSDMap();
map["identity"] = OSD.FromUri(Identity);
- map["access_token"] = OSD.FromUUID(AccessToken);
map["name"] = OSD.FromString(Name);
return map;
}
@@ -108,7 +169,6 @@ namespace OpenMetaverse.Messages.CableBeach
public void Deserialize(OSDMap map)
{
Identity = map["identity"].AsUri();
- AccessToken = map["access_token"].AsUUID();
Name = map["name"].AsString();
}
}
@@ -130,19 +190,145 @@ namespace OpenMetaverse.Messages.CableBeach
}
}
+ public class GetInventorySkeletonMessage : IMessage
+ {
+ public Uri Identity;
+
+ public OSDMap Serialize()
+ {
+ OSDMap map = new OSDMap();
+ map["identity"] = OSD.FromUri(Identity);
+ return map;
+ }
+
+ public void Deserialize(OSDMap map)
+ {
+ Identity = map["identity"].AsUri();
+ }
+ }
+
+ public class GetInventorySkeletonReplyMessage : IMessage
+ {
+ public class Folder
+ {
+ public string Name;
+ public UUID ParentID;
+ public int Version;
+ public string PreferredContentType;
+ public UUID FolderID;
+ }
+
+ public Folder[] Folders;
+
+ public OSDMap Serialize()
+ {
+ OSDMap map = new OSDMap();
+
+ OSDArray folders = new OSDArray(Folders.Length);
+ for (int i = 0; i < Folders.Length; i++)
+ {
+ Folder folder = Folders[i];
+
+ OSDMap folderMap = new OSDMap();
+ folderMap["name"] = OSD.FromString(folder.Name);
+ folderMap["parent_id"] = OSD.FromUUID(folder.ParentID);
+ folderMap["version"] = OSD.FromInteger(folder.Version);
+ folderMap["preferred_content_type"] = OSD.FromString(folder.PreferredContentType);
+ folderMap["folder_id"] = OSD.FromUUID(folder.FolderID);
+
+ folders.Add(folderMap);
+ }
+
+ map["folders"] = folders;
+ return map;
+ }
+
+ public void Deserialize(OSDMap map)
+ {
+ OSDArray folders = (OSDArray)map["folders"];
+ Folders = new Folder[folders.Count];
+ for (int i = 0; i < folders.Count; i++)
+ {
+ OSDMap folderMap = (OSDMap)folders[i];
+
+ Folder folder = new Folder();
+ folder.Name = folderMap["name"].AsString();
+ folder.ParentID = folderMap["parent_id"].AsUUID();
+ folder.Version = folderMap["version"].AsInteger();
+ folder.PreferredContentType = folderMap["preferred_content_type"].AsString();
+ folder.FolderID = folderMap["folder_id"].AsUUID();
+
+ Folders[i] = folder;
+ }
+ }
+ }
+
+ public class GetActiveGesturesMessage : IMessage
+ {
+ public Uri Identity;
+
+ public OSDMap Serialize()
+ {
+ OSDMap map = new OSDMap();
+ map["identity"] = OSD.FromUri(Identity);
+ return map;
+ }
+
+ public void Deserialize(OSDMap map)
+ {
+ Identity = map["identity"].AsUri();
+ }
+ }
+
+ public class GetActiveGesturesReplyMessage : IMessage
+ {
+ public class Gesture
+ {
+ public UUID ItemID;
+ public UUID AssetID;
+ }
+
+ public Gesture[] Gestures;
+
+ public OSDMap Serialize()
+ {
+ OSDMap map = new OSDMap();
+
+ OSDArray gestures = new OSDArray();
+ for (int i = 0; i < Gestures.Length; i++)
+ {
+ Gesture gesture = Gestures[i];
+ OSDMap gestureMap = new OSDMap();
+ gestureMap["item_id"] = OSD.FromUUID(gesture.ItemID);
+ gestureMap["asset_id"] = OSD.FromUUID(gesture.AssetID);
+ gestures.Add(gestureMap);
+ }
+
+ map["gestures"] = gestures;
+ return map;
+ }
+
+ public void Deserialize(OSDMap map)
+ {
+ OSDArray gestures = (OSDArray)map["gestures"];
+ Gestures = new Gesture[gestures.Count];
+ for (int i = 0; i < gestures.Count; i++)
+ {
+ OSDMap gestureMap = (OSDMap)gestures[i];
+ Gesture gesture = new Gesture();
+ gesture.ItemID = gestureMap["item_id"].AsUUID();
+ gesture.AssetID = gestureMap["asset_id"].AsUUID();
+ Gestures[i] = gesture;
+ }
+ }
+ }
+
#endregion Inventory Messages
#region Region Messages
public class EnableClientMessage : IMessage
{
- public class Service
- {
- public Uri Type;
- public Uri Uri;
- public UUID AccessToken;
- }
-
public UUID AgentID;
public UUID SessionID;
public UUID SecureSessionID;
@@ -152,7 +338,7 @@ namespace OpenMetaverse.Messages.CableBeach
public IPAddress IP;
public string ClientVersion;
public Dictionary Attributes;
- public Dictionary Services;
+ public Dictionary> Services;
public Uri CallbackUri;
public OSDMap Serialize()
@@ -173,13 +359,12 @@ namespace OpenMetaverse.Messages.CableBeach
map["attributes"] = attributes;
OSDMap services = new OSDMap(Services.Count);
- foreach (KeyValuePair entry in Services)
+ foreach (KeyValuePair> serviceEntry in Services)
{
- OSDMap service = new OSDMap(3);
- service["type"] = OSD.FromUri(entry.Value.Type);
- service["uri"] = OSD.FromUri(entry.Value.Uri);
- service["access_token"] = OSD.FromUUID(entry.Value.AccessToken);
- services.Add(entry.Key.ToString(), service);
+ OSDMap service = new OSDMap();
+ foreach (KeyValuePair entry in serviceEntry.Value)
+ service.Add(entry.Key, OSD.FromUri(entry.Value));
+ services.Add(serviceEntry.Key.ToString(), service);
}
map["services"] = services;
@@ -204,15 +389,14 @@ namespace OpenMetaverse.Messages.CableBeach
Attributes.Add(new Uri(entry.Key), entry.Value);
OSDMap servicesMap = (OSDMap)map["services"];
- Services = new Dictionary(servicesMap.Count);
- foreach (KeyValuePair entry in servicesMap)
+ Services = new Dictionary>(servicesMap.Count);
+ foreach (KeyValuePair serviceEntry in servicesMap)
{
- OSDMap serviceMap = (OSDMap)entry.Value;
- Service service = new Service();
- service.Type = serviceMap["type"].AsUri();
- service.Uri = serviceMap["uri"].AsUri();
- service.AccessToken = serviceMap["access_token"].AsUUID();
- Services.Add(new Uri(entry.Key), service);
+ OSDMap serviceMap = (OSDMap)serviceEntry.Value;
+ Dictionary service = new Dictionary(serviceMap.Count);
+ foreach (KeyValuePair entry in serviceMap)
+ service.Add(entry.Key, entry.Value.AsUri());
+ Services.Add(new Uri(serviceEntry.Key), service);
}
CallbackUri = map["callback_uri"].AsUri();
diff --git a/OpenMetaverse/Messages/CableBeachUtils.cs b/OpenMetaverse/Messages/CableBeachUtils.cs
new file mode 100644
index 00000000..d3411e99
--- /dev/null
+++ b/OpenMetaverse/Messages/CableBeachUtils.cs
@@ -0,0 +1,185 @@
+using System;
+
+namespace OpenMetaverse.Messages.CableBeach
+{
+ public static class CableBeachUtils
+ {
+ #region SL / file extension / content-type conversions
+
+ public static string SLAssetTypeToContentType(int assetType)
+ {
+ switch (assetType)
+ {
+ case 0:
+ return "image/jp2";
+ case 1:
+ return "application/ogg";
+ case 2:
+ return "application/x-metaverse-callingcard";
+ case 3:
+ return "application/x-metaverse-landmark";
+ case 5:
+ return "application/x-metaverse-clothing";
+ case 6:
+ return "application/x-metaverse-primitive";
+ case 7:
+ return "application/x-metaverse-notecard";
+ case 8:
+ return "application/x-metaverse-folder";
+ case 10:
+ return "application/x-metaverse-lsl";
+ case 11:
+ return "application/x-metaverse-lso";
+ case 12:
+ return "image/tga";
+ case 13:
+ return "application/x-metaverse-bodypart";
+ case 17:
+ return "audio/x-wav";
+ case 19:
+ return "image/jpeg";
+ case 20:
+ return "application/x-metaverse-animation";
+ case 21:
+ return "application/x-metaverse-gesture";
+ case 22:
+ return "application/x-metaverse-simstate";
+ default:
+ return "application/octet-stream";
+ }
+ }
+
+ public static int ContentTypeToSLAssetType(string contentType)
+ {
+ switch (contentType)
+ {
+ case "image/jp2":
+ return 0;
+ case "application/ogg":
+ return 1;
+ case "application/x-metaverse-callingcard":
+ return 2;
+ case "application/x-metaverse-landmark":
+ return 3;
+ case "application/x-metaverse-clothing":
+ return 5;
+ case "application/x-metaverse-primitive":
+ return 6;
+ case "application/x-metaverse-notecard":
+ return 7;
+ case "application/x-metaverse-lsl":
+ return 10;
+ case "application/x-metaverse-lso":
+ return 11;
+ case "image/tga":
+ return 12;
+ case "application/x-metaverse-bodypart":
+ return 13;
+ case "audio/x-wav":
+ return 17;
+ case "image/jpeg":
+ return 19;
+ case "application/x-metaverse-animation":
+ return 20;
+ case "application/x-metaverse-gesture":
+ return 21;
+ case "application/x-metaverse-simstate":
+ return 22;
+ default:
+ return -1;
+ }
+ }
+
+ public static string ContentTypeToExtension(string contentType)
+ {
+ switch (contentType)
+ {
+ case "image/jp2":
+ return "texture";
+ case "application/ogg":
+ return "ogg";
+ case "application/x-metaverse-callingcard":
+ return "callingcard";
+ case "application/x-metaverse-landmark":
+ return "landmark";
+ case "application/x-metaverse-clothing":
+ return "clothing";
+ case "application/x-metaverse-primitive":
+ return "primitive";
+ case "application/x-metaverse-notecard":
+ return "notecard";
+ case "application/x-metaverse-lsl":
+ return "lsl";
+ case "application/x-metaverse-lso":
+ return "lso";
+ case "image/tga":
+ return "tga";
+ case "application/x-metaverse-bodypart":
+ return "bodypart";
+ case "audio/x-wav":
+ return "wav";
+ case "image/jpeg":
+ return "jpg";
+ case "application/x-metaverse-animation":
+ return "animation";
+ case "application/x-metaverse-gesture":
+ return "gesture";
+ case "application/x-metaverse-simstate":
+ return "simstate";
+ default:
+ return "bin";
+ }
+ }
+
+ public static string ExtensionToContentType(string extension)
+ {
+ switch (extension)
+ {
+ case "texture":
+ case "jp2":
+ case "j2c":
+ return "image/jp2";
+ case "sound":
+ case "ogg":
+ return "application/ogg";
+ case "callingcard":
+ return "application/x-metaverse-callingcard";
+ case "landmark":
+ return "application/x-metaverse-landmark";
+ case "clothing":
+ return "application/x-metaverse-clothing";
+ case "primitive":
+ return "application/x-metaverse-primitive";
+ case "notecard":
+ return "application/x-metaverse-notecard";
+ case "lsl":
+ return "application/x-metaverse-lsl";
+ case "lso":
+ return "application/x-metaverse-lso";
+ case "tga":
+ return "image/tga";
+ case "bodypart":
+ return "application/x-metaverse-bodypart";
+ case "wav":
+ return "audio/x-wav";
+ case "jpg":
+ case "jpeg":
+ return "image/jpeg";
+ case "animation":
+ return "application/x-metaverse-animation";
+ case "gesture":
+ return "application/x-metaverse-gesture";
+ case "simstate":
+ return "application/x-metaverse-simstate";
+ case "txt":
+ return "text/plain";
+ case "xml":
+ return "application/xml";
+ default:
+ return "application/octet-stream";
+ }
+ }
+
+ #endregion SL / file extension / content-type conversions
+ }
+}