Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
authored May 10, 2009
95  OpenMetaverse.Tests/MessageTests.cs
@@ -1000,6 +1000,101 @@ public void TelportFailedMessage()
1000 1000
             Assert.AreEqual(s.Reason, t.Reason);
1001 1001
 
1002 1002
         }
  1003
+
  1004
+        [Test]
  1005
+        public void UpdateAgentInformationMessage()
  1006
+        {
  1007
+            UpdateAgentInformationMessage s = new UpdateAgentInformationMessage();
  1008
+            s.MaxAccess = "PG";
  1009
+            OSDMap map = s.Serialize();
  1010
+
  1011
+            UpdateAgentInformationMessage t = new UpdateAgentInformationMessage();
  1012
+            t.Deserialize(map);
  1013
+
  1014
+            Assert.AreEqual(s.MaxAccess, t.MaxAccess);
  1015
+        }
  1016
+
  1017
+        [Test]
  1018
+        public void PlacesReplyMessage()
  1019
+        {
  1020
+            PlacesReplyMessage s = new PlacesReplyMessage();
  1021
+            s.TransactionID = UUID.Random();
  1022
+            s.AgentID = UUID.Random();
  1023
+            s.QueryID = UUID.Random();
  1024
+            s.QueryDataBlocks = new PlacesReplyMessage.QueryData[2];
  1025
+
  1026
+            PlacesReplyMessage.QueryData q1 = new PlacesReplyMessage.QueryData();
  1027
+            q1.ActualArea = 1024;
  1028
+            q1.BillableArea = 768;
  1029
+            q1.Description = "Test Description Q1";
  1030
+            q1.Dwell = 1435.4f;
  1031
+            q1.Flags = 1 << 6;
  1032
+            q1.GlobalX = 1;
  1033
+            q1.GlobalY = 2;
  1034
+            q1.GlobalZ = 3;
  1035
+            q1.Name = "Test Name Q1";
  1036
+            q1.OwnerID = UUID.Random();
  1037
+            q1.Price = 1;
  1038
+            q1.ProductSku = "021";
  1039
+            q1.SimName = "Hooper";
  1040
+            q1.SnapShotID = UUID.Random();
  1041
+
  1042
+            s.QueryDataBlocks[0] = q1;
  1043
+
  1044
+            PlacesReplyMessage.QueryData q2 = new PlacesReplyMessage.QueryData();
  1045
+            q2.ActualArea = 512;
  1046
+            q2.BillableArea = 384;
  1047
+            q2.Description = "Test Description Q2";
  1048
+            q2.Dwell = 1;
  1049
+            q2.Flags = 1 << 4;
  1050
+            q2.GlobalX = 4;
  1051
+            q2.GlobalY = 5;
  1052
+            q2.GlobalZ = 6;
  1053
+            q2.Name = "Test Name Q2";
  1054
+            q2.OwnerID = UUID.Random();
  1055
+            q2.Price = 2;
  1056
+            q2.ProductSku = "022";
  1057
+            q2.SimName = "Tethys";
  1058
+            q2.SnapShotID = UUID.Random();
  1059
+
  1060
+            s.QueryDataBlocks[1] = q2;
  1061
+
  1062
+            OSDMap map = s.Serialize();
  1063
+
  1064
+            PlacesReplyMessage t = new PlacesReplyMessage();
  1065
+            t.Deserialize(map);
  1066
+
  1067
+            Assert.AreEqual(s.AgentID, t.AgentID);
  1068
+            Assert.AreEqual(s.TransactionID, t.TransactionID);
  1069
+            Assert.AreEqual(s.QueryID, t.QueryID);
  1070
+
  1071
+            for(int i = 0; i < s.QueryDataBlocks.Length; i++)
  1072
+            {
  1073
+                Assert.AreEqual(s.QueryDataBlocks[i].ActualArea, t.QueryDataBlocks[i].ActualArea);
  1074
+                Assert.AreEqual(s.QueryDataBlocks[i].BillableArea, t.QueryDataBlocks[i].BillableArea);
  1075
+                Assert.AreEqual(s.QueryDataBlocks[i].Description, t.QueryDataBlocks[i].Description);
  1076
+                Assert.AreEqual(s.QueryDataBlocks[i].Dwell, t.QueryDataBlocks[i].Dwell);
  1077
+                Assert.AreEqual(s.QueryDataBlocks[i].Flags, t.QueryDataBlocks[i].Flags);
  1078
+                Assert.AreEqual(s.QueryDataBlocks[i].GlobalX, t.QueryDataBlocks[i].GlobalX);
  1079
+                Assert.AreEqual(s.QueryDataBlocks[i].GlobalY, t.QueryDataBlocks[i].GlobalY);
  1080
+                Assert.AreEqual(s.QueryDataBlocks[i].GlobalZ, t.QueryDataBlocks[i].GlobalZ);
  1081
+                Assert.AreEqual(s.QueryDataBlocks[i].Name, t.QueryDataBlocks[i].Name);
  1082
+                Assert.AreEqual(s.QueryDataBlocks[i].OwnerID, t.QueryDataBlocks[i].OwnerID);
  1083
+                Assert.AreEqual(s.QueryDataBlocks[i].Price, t.QueryDataBlocks[i].Price);
  1084
+                Assert.AreEqual(s.QueryDataBlocks[i].ProductSku, t.QueryDataBlocks[i].ProductSku);
  1085
+                Assert.AreEqual(s.QueryDataBlocks[i].SimName, t.QueryDataBlocks[i].SimName);
  1086
+                Assert.AreEqual(s.QueryDataBlocks[i].SnapShotID, t.QueryDataBlocks[i].SnapShotID);
  1087
+            }
  1088
+
  1089
+
  1090
+
  1091
+
  1092
+
  1093
+
  1094
+
  1095
+        }
  1096
+
  1097
+
1003 1098
     }
1004 1099
 }
1005 1100
 
42  OpenMetaverse/Messages/LindenMessages.cs
@@ -2285,23 +2285,20 @@ public OSDMap Serialize()
2285 2285
             OSDMap map = new OSDMap(3);
2286 2286
 
2287 2287
             // add the AgentData map
2288  
-            OSDMap agentIDmap = new OSDMap(1);
  2288
+            OSDMap agentIDmap = new OSDMap(2);
2289 2289
             agentIDmap["AgentID"] = OSD.FromUUID(AgentID);
  2290
+            agentIDmap["QueryID"] = OSD.FromUUID(QueryID);
2290 2291
 
2291  
-            OSDMap queryIDMap = new OSDMap(1);
2292  
-            queryIDMap["QueryID"] = OSD.FromUUID(QueryID);
2293  
-
2294  
-            OSDArray agentDataArray = new OSDArray(2);
  2292
+            OSDArray agentDataArray = new OSDArray();
2295 2293
             agentDataArray.Add(agentIDmap);
2296  
-            agentDataArray.Add(queryIDMap);
2297  
-
  2294
+            
2298 2295
             map["AgentData"] = agentDataArray;
2299 2296
 
2300 2297
             // add the QueryData map
2301 2298
             OSDArray dataBlocksArray = new OSDArray(QueryDataBlocks.Length);
2302 2299
             for(int i = 0; i < QueryDataBlocks.Length; i++)
2303 2300
             {
2304  
-                OSDMap queryDataMap = new OSDMap(10);
  2301
+                OSDMap queryDataMap = new OSDMap(14);
2305 2302
                 queryDataMap["ActualArea"] = OSD.FromInteger(QueryDataBlocks[i].ActualArea);
2306 2303
                 queryDataMap["BillableArea"] = OSD.FromInteger(QueryDataBlocks[i].BillableArea);
2307 2304
                 queryDataMap["Desc"] = OSD.FromString(QueryDataBlocks[i].Description);
@@ -2334,6 +2331,7 @@ public OSDMap Serialize()
2334 2331
         public void Deserialize(OSDMap map)
2335 2332
         {
2336 2333
             OSDArray agentDataArray = (OSDArray) map["AgentData"];
  2334
+
2337 2335
             OSDMap agentDataMap = (OSDMap)agentDataArray[0];
2338 2336
             AgentID = agentDataMap["AgentID"].AsUUID();
2339 2337
             QueryID = agentDataMap["QueryID"].AsUUID();
@@ -2343,16 +2341,16 @@ public void Deserialize(OSDMap map)
2343 2341
             QueryDataBlocks = new QueryData[dataBlocksArray.Count];
2344 2342
             for(int i = 0; i < dataBlocksArray.Count; i++)
2345 2343
             {
  2344
+                OSDMap dataMap = (OSDMap)dataBlocksArray[i];
2346 2345
                 QueryData data = new QueryData();
2347  
-                OSDMap dataMap = (OSDMap) dataBlocksArray[i];
2348 2346
                 data.ActualArea = dataMap["ActualArea"].AsInteger();
2349 2347
                 data.BillableArea = dataMap["BillableArea"].AsInteger();
2350 2348
                 data.Description = dataMap["Desc"].AsString();
2351 2349
                 data.Dwell = (float)dataMap["Dwell"].AsReal();
2352 2350
                 data.Flags = dataMap["Flags"].AsInteger();
2353  
-                data.GlobalX = dataMap["GlobalX"].AsInteger();
2354  
-                data.GlobalY = dataMap["GlobalY"].AsInteger();
2355  
-                data.GlobalZ = dataMap["GlobalX"].AsInteger();
  2351
+                data.GlobalX = (float)dataMap["GlobalX"].AsReal();
  2352
+                data.GlobalY = (float)dataMap["GlobalY"].AsReal();
  2353
+                data.GlobalZ = (float)dataMap["GlobalZ"].AsReal();
2356 2354
                 data.Name = dataMap["Name"].AsString();
2357 2355
                 data.OwnerID = dataMap["OwnerID"].AsUUID();
2358 2356
                 data.Price = dataMap["Price"].AsInteger();
@@ -2368,5 +2366,25 @@ public void Deserialize(OSDMap map)
2368 2366
         }
2369 2367
     }
2370 2368
 
  2369
+    public class UpdateAgentInformationMessage : IMessage
  2370
+    {
  2371
+        public string MaxAccess; // PG, A, or M
  2372
+
  2373
+        public OSDMap Serialize()
  2374
+        {
  2375
+            OSDMap map = new OSDMap(1);
  2376
+            OSDMap prefsMap = new OSDMap(1);
  2377
+            prefsMap["max"] = OSD.FromString(MaxAccess);
  2378
+            map["access_prefs"] = prefsMap;
  2379
+            return map;
  2380
+        }
  2381
+
  2382
+        public void Deserialize(OSDMap map)
  2383
+        {
  2384
+            OSDMap prefsMap = (OSDMap)map["access_prefs"];
  2385
+            MaxAccess = prefsMap["max"].AsString();
  2386
+        }
  2387
+    }
  2388
+
2371 2389
     #endregion
2372 2390
 }
1  OpenMetaverse/Messages/MessageEventDecoder.cs
@@ -77,6 +77,7 @@ public static IMessage DecodeEvent(string eventName, OSDMap map)
77 77
                 case "CrossedRegion": message = new CrossedRegionMessage(); break;
78 78
                 case "TeleportFailed": message = new TeleportFailedMessage(); break;
79 79
                 case "PlacesReply": message = new PlacesReplyMessage(); break;
  80
+                case "UpdateAgentInformation": message = new UpdateAgentInformationMessage(); break;
80 81
                 //case "ProductInfoRequest": message = new ProductInfoRequestMessage(); break;
81 82
 
82 83
                 // Capabilities TODO:

0 notes on commit 7155dfa

Please sign in to comment.
Something went wrong with that request. Please try again.