Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

LIBOMV-529 Adds new UpdateAgentInformation Message + Test

LIBOMV-477 Adds PlacesReplyMessage + Test to Message system

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2736 52acb1d6-8a22-11de-b505-999d5b087335
  • Loading branch information...
commit 7155dfa2acb9d3073bd375af40af1ed87dec40ee 1 parent 4af13d7
@jimradford jimradford authored
View
95 OpenMetaverse.Tests/MessageTests.cs
@@ -1000,6 +1000,101 @@ public void TelportFailedMessage()
Assert.AreEqual(s.Reason, t.Reason);
}
+
+ [Test]
+ public void UpdateAgentInformationMessage()
+ {
+ UpdateAgentInformationMessage s = new UpdateAgentInformationMessage();
+ s.MaxAccess = "PG";
+ OSDMap map = s.Serialize();
+
+ UpdateAgentInformationMessage t = new UpdateAgentInformationMessage();
+ t.Deserialize(map);
+
+ Assert.AreEqual(s.MaxAccess, t.MaxAccess);
+ }
+
+ [Test]
+ public void PlacesReplyMessage()
+ {
+ PlacesReplyMessage s = new PlacesReplyMessage();
+ s.TransactionID = UUID.Random();
+ s.AgentID = UUID.Random();
+ s.QueryID = UUID.Random();
+ s.QueryDataBlocks = new PlacesReplyMessage.QueryData[2];
+
+ PlacesReplyMessage.QueryData q1 = new PlacesReplyMessage.QueryData();
+ q1.ActualArea = 1024;
+ q1.BillableArea = 768;
+ q1.Description = "Test Description Q1";
+ q1.Dwell = 1435.4f;
+ q1.Flags = 1 << 6;
+ q1.GlobalX = 1;
+ q1.GlobalY = 2;
+ q1.GlobalZ = 3;
+ q1.Name = "Test Name Q1";
+ q1.OwnerID = UUID.Random();
+ q1.Price = 1;
+ q1.ProductSku = "021";
+ q1.SimName = "Hooper";
+ q1.SnapShotID = UUID.Random();
+
+ s.QueryDataBlocks[0] = q1;
+
+ PlacesReplyMessage.QueryData q2 = new PlacesReplyMessage.QueryData();
+ q2.ActualArea = 512;
+ q2.BillableArea = 384;
+ q2.Description = "Test Description Q2";
+ q2.Dwell = 1;
+ q2.Flags = 1 << 4;
+ q2.GlobalX = 4;
+ q2.GlobalY = 5;
+ q2.GlobalZ = 6;
+ q2.Name = "Test Name Q2";
+ q2.OwnerID = UUID.Random();
+ q2.Price = 2;
+ q2.ProductSku = "022";
+ q2.SimName = "Tethys";
+ q2.SnapShotID = UUID.Random();
+
+ s.QueryDataBlocks[1] = q2;
+
+ OSDMap map = s.Serialize();
+
+ PlacesReplyMessage t = new PlacesReplyMessage();
+ t.Deserialize(map);
+
+ Assert.AreEqual(s.AgentID, t.AgentID);
+ Assert.AreEqual(s.TransactionID, t.TransactionID);
+ Assert.AreEqual(s.QueryID, t.QueryID);
+
+ for(int i = 0; i < s.QueryDataBlocks.Length; i++)
+ {
+ Assert.AreEqual(s.QueryDataBlocks[i].ActualArea, t.QueryDataBlocks[i].ActualArea);
+ Assert.AreEqual(s.QueryDataBlocks[i].BillableArea, t.QueryDataBlocks[i].BillableArea);
+ Assert.AreEqual(s.QueryDataBlocks[i].Description, t.QueryDataBlocks[i].Description);
+ Assert.AreEqual(s.QueryDataBlocks[i].Dwell, t.QueryDataBlocks[i].Dwell);
+ Assert.AreEqual(s.QueryDataBlocks[i].Flags, t.QueryDataBlocks[i].Flags);
+ Assert.AreEqual(s.QueryDataBlocks[i].GlobalX, t.QueryDataBlocks[i].GlobalX);
+ Assert.AreEqual(s.QueryDataBlocks[i].GlobalY, t.QueryDataBlocks[i].GlobalY);
+ Assert.AreEqual(s.QueryDataBlocks[i].GlobalZ, t.QueryDataBlocks[i].GlobalZ);
+ Assert.AreEqual(s.QueryDataBlocks[i].Name, t.QueryDataBlocks[i].Name);
+ Assert.AreEqual(s.QueryDataBlocks[i].OwnerID, t.QueryDataBlocks[i].OwnerID);
+ Assert.AreEqual(s.QueryDataBlocks[i].Price, t.QueryDataBlocks[i].Price);
+ Assert.AreEqual(s.QueryDataBlocks[i].ProductSku, t.QueryDataBlocks[i].ProductSku);
+ Assert.AreEqual(s.QueryDataBlocks[i].SimName, t.QueryDataBlocks[i].SimName);
+ Assert.AreEqual(s.QueryDataBlocks[i].SnapShotID, t.QueryDataBlocks[i].SnapShotID);
+ }
+
+
+
+
+
+
+
+ }
+
+
}
}
View
42 OpenMetaverse/Messages/LindenMessages.cs
@@ -2285,23 +2285,20 @@ public OSDMap Serialize()
OSDMap map = new OSDMap(3);
// add the AgentData map
- OSDMap agentIDmap = new OSDMap(1);
+ OSDMap agentIDmap = new OSDMap(2);
agentIDmap["AgentID"] = OSD.FromUUID(AgentID);
+ agentIDmap["QueryID"] = OSD.FromUUID(QueryID);
- OSDMap queryIDMap = new OSDMap(1);
- queryIDMap["QueryID"] = OSD.FromUUID(QueryID);
-
- OSDArray agentDataArray = new OSDArray(2);
+ OSDArray agentDataArray = new OSDArray();
agentDataArray.Add(agentIDmap);
- agentDataArray.Add(queryIDMap);
-
+
map["AgentData"] = agentDataArray;
// add the QueryData map
OSDArray dataBlocksArray = new OSDArray(QueryDataBlocks.Length);
for(int i = 0; i < QueryDataBlocks.Length; i++)
{
- OSDMap queryDataMap = new OSDMap(10);
+ OSDMap queryDataMap = new OSDMap(14);
queryDataMap["ActualArea"] = OSD.FromInteger(QueryDataBlocks[i].ActualArea);
queryDataMap["BillableArea"] = OSD.FromInteger(QueryDataBlocks[i].BillableArea);
queryDataMap["Desc"] = OSD.FromString(QueryDataBlocks[i].Description);
@@ -2334,6 +2331,7 @@ public OSDMap Serialize()
public void Deserialize(OSDMap map)
{
OSDArray agentDataArray = (OSDArray) map["AgentData"];
+
OSDMap agentDataMap = (OSDMap)agentDataArray[0];
AgentID = agentDataMap["AgentID"].AsUUID();
QueryID = agentDataMap["QueryID"].AsUUID();
@@ -2343,16 +2341,16 @@ public void Deserialize(OSDMap map)
QueryDataBlocks = new QueryData[dataBlocksArray.Count];
for(int i = 0; i < dataBlocksArray.Count; i++)
{
+ OSDMap dataMap = (OSDMap)dataBlocksArray[i];
QueryData data = new QueryData();
- OSDMap dataMap = (OSDMap) dataBlocksArray[i];
data.ActualArea = dataMap["ActualArea"].AsInteger();
data.BillableArea = dataMap["BillableArea"].AsInteger();
data.Description = dataMap["Desc"].AsString();
data.Dwell = (float)dataMap["Dwell"].AsReal();
data.Flags = dataMap["Flags"].AsInteger();
- data.GlobalX = dataMap["GlobalX"].AsInteger();
- data.GlobalY = dataMap["GlobalY"].AsInteger();
- data.GlobalZ = dataMap["GlobalX"].AsInteger();
+ data.GlobalX = (float)dataMap["GlobalX"].AsReal();
+ data.GlobalY = (float)dataMap["GlobalY"].AsReal();
+ data.GlobalZ = (float)dataMap["GlobalZ"].AsReal();
data.Name = dataMap["Name"].AsString();
data.OwnerID = dataMap["OwnerID"].AsUUID();
data.Price = dataMap["Price"].AsInteger();
@@ -2368,5 +2366,25 @@ public void Deserialize(OSDMap map)
}
}
+ public class UpdateAgentInformationMessage : IMessage
+ {
+ public string MaxAccess; // PG, A, or M
+
+ public OSDMap Serialize()
+ {
+ OSDMap map = new OSDMap(1);
+ OSDMap prefsMap = new OSDMap(1);
+ prefsMap["max"] = OSD.FromString(MaxAccess);
+ map["access_prefs"] = prefsMap;
+ return map;
+ }
+
+ public void Deserialize(OSDMap map)
+ {
+ OSDMap prefsMap = (OSDMap)map["access_prefs"];
+ MaxAccess = prefsMap["max"].AsString();
+ }
+ }
+
#endregion
}
View
1  OpenMetaverse/Messages/MessageEventDecoder.cs
@@ -77,6 +77,7 @@ public static IMessage DecodeEvent(string eventName, OSDMap map)
case "CrossedRegion": message = new CrossedRegionMessage(); break;
case "TeleportFailed": message = new TeleportFailedMessage(); break;
case "PlacesReply": message = new PlacesReplyMessage(); break;
+ case "UpdateAgentInformation": message = new UpdateAgentInformationMessage(); break;
//case "ProductInfoRequest": message = new ProductInfoRequestMessage(); break;
// Capabilities TODO:
Please sign in to comment.
Something went wrong with that request. Please try again.