aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Tests/AnimationTests.cs96
-rw-r--r--OpenSim/Framework/tests/PrimeNumberHelperTests.cs146
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs103
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs26
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs4
7 files changed, 355 insertions, 37 deletions
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs
new file mode 100644
index 0000000..719ddce
--- /dev/null
+++ b/OpenSim/Framework/Tests/AnimationTests.cs
@@ -0,0 +1,96 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse;
33using OpenMetaverse.StructuredData;
34using OpenSim.Framework;
35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37using OpenSim.Tests.Common.Setup;
38using Animation = OpenSim.Framework.Animation;
39
40namespace OpenSim.Framework.Tests
41{
42 [TestFixture]
43 public class AnimationTests
44 {
45 private Animation anim1 = null;
46 private Animation anim2 = null;
47 private UUID animUUID1 = UUID.Zero;
48 private UUID objUUID1 = UUID.Zero;
49 private UUID animUUID2 = UUID.Zero;
50 private UUID objUUID2 = UUID.Zero;
51
52 [SetUp]
53 public void Setup()
54 {
55 animUUID1 = UUID.Random();
56 animUUID2 = UUID.Random();
57 objUUID1 = UUID.Random();
58 objUUID2 = UUID.Random();
59
60 anim1 = new Animation(animUUID1, 1, objUUID1);
61 anim2 = new Animation(animUUID2, 1, objUUID2);
62 }
63
64 [Test]
65 public void AnimationOSDTest()
66 {
67 Assert.That(anim1.AnimID==animUUID1 && anim1.ObjectID == objUUID1 && anim1.SequenceNum ==1, "The Animation Constructor didn't set the fields correctly");
68 OSD updateMessage = anim1.PackUpdateMessage();
69 Assert.That(updateMessage is OSDMap, "Packed UpdateMessage isn't an OSDMap");
70 OSDMap updateMap = (OSDMap) updateMessage;
71 Assert.That(updateMap.ContainsKey("animation"), "Packed Message doesn't contain an animation element");
72 Assert.That(updateMap.ContainsKey("object_id"), "Packed Message doesn't contain an object_id element");
73 Assert.That(updateMap.ContainsKey("seq_num"), "Packed Message doesn't contain a seq_num element");
74 Assert.That(updateMap["animation"].AsUUID() == animUUID1);
75 Assert.That(updateMap["object_id"].AsUUID() == objUUID1);
76 Assert.That(updateMap["seq_num"].AsInteger() == 1);
77
78 Animation anim3 = new Animation(updateMap);
79
80 Assert.That(anim3.ObjectID == anim1.ObjectID && anim3.AnimID == anim1.AnimID && anim3.SequenceNum == anim1.SequenceNum, "OSDMap Constructor failed to set the properties correctly.");
81
82 anim3.UnpackUpdateMessage(anim2.PackUpdateMessage());
83
84 Assert.That(anim3.ObjectID == objUUID2 && anim3.AnimID == animUUID2 && anim3.SequenceNum == 1, "Animation.UnpackUpdateMessage failed to set the properties correctly.");
85
86 Animation anim4 = new Animation();
87 anim4.AnimID = anim2.AnimID;
88 anim4.ObjectID = anim2.ObjectID;
89 anim4.SequenceNum = anim2.SequenceNum;
90
91 Assert.That(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly.");
92
93
94 }
95 }
96} \ No newline at end of file
diff --git a/OpenSim/Framework/tests/PrimeNumberHelperTests.cs b/OpenSim/Framework/tests/PrimeNumberHelperTests.cs
new file mode 100644
index 0000000..d741f91
--- /dev/null
+++ b/OpenSim/Framework/tests/PrimeNumberHelperTests.cs
@@ -0,0 +1,146 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse;
33using OpenMetaverse.StructuredData;
34using OpenSim.Framework;
35
36namespace OpenSim.Framework.Tests
37{
38 [TestFixture]
39 public class PrimeNumberHelperTests
40 {
41
42
43 [Test]
44 public void TestGetPrime()
45 {
46 int prime1 = PrimeNumberHelper.GetPrime(7919);
47 Assert.That(prime1 == 8419, "Prime Number Get Prime Failed, 7919 is prime");
48 Assert.That(PrimeNumberHelper.IsPrime(prime1),"Prime1 should be prime");
49 Assert.That(PrimeNumberHelper.IsPrime(7919), "7919 is prime but is falsely failing the prime test");
50 prime1 = PrimeNumberHelper.GetPrime(Int32.MaxValue - 1);
51 Assert.That(prime1 == -1, "prime1 should have been -1 since there are no primes between Int32.MaxValue-1 and Int32.MaxValue");
52
53 }
54
55 [Test]
56 public void Test1000SmallPrimeNumbers()
57 {
58 int[] primes = {
59 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89,
60 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191
61 , 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283,
62 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401,
63 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509,
64 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631,
65 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751,
66 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877,
67 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009,
68 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097,
69 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217,
70 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307,
71 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447,
72 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549,
73 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637,
74 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759,
75 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879,
76 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003,
77 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113,
78 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243,
79 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351,
80 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459,
81 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609,
82 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707,
83 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803,
84 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939,
85 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067,
86 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209,
87 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329,
88 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461,
89 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559,
90 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677,
91 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803,
92 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923,
93 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051,
94 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177,
95 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289,
96 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447,
97 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567,
98 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691,
99 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817,
100 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967,
101 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081,
102 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227,
103 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381,
104 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479,
105 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623,
106 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737,
107 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851,
108 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007,
109 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131,
110 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263,
111 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361,
112 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529,
113 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661,
114 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791,
115 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911,
116 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027,
117 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193,
118 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331,
119 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489,
120 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589,
121 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717,
122 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873,
123 7877, 7879, 7883, 7901, 7907, 7919
124 };
125 for (int i = 0; i < primes.Length; i++)
126 {
127 Assert.That(PrimeNumberHelper.IsPrime(primes[i]),primes[i] + " is prime but is erroniously failing the prime test");
128 }
129
130 int[] nonprimes = {
131 4, 6, 8, 10, 14, 16, 18, 22, 28, 30, 36, 40, 42, 46, 52, 58, 60, 66, 70, 72, 78, 82, 88,
132 96, 366, 372, 378, 382, 388, 396, 400, 408, 418, 420, 430, 432, 438, 442, 448, 456, 460, 462,
133 466, 478, 486, 490, 498, 502, 508, 856, 858, 862, 876, 880, 882, 886, 906, 910, 918, 928, 936,
134 940, 946, 952, 966, 970, 976, 982, 990, 996, 1008, 1740, 1746, 1752, 1758, 4650, 4656, 4662,
135 4672, 4678, 4690, 7740, 7752, 7756, 7758, 7788, 7792, 7816, 7822, 7828, 7840, 7852, 7866, 7872,
136 7876, 7878, 7882, 7900, 7906, 7918
137 };
138 for (int i = 0; i < nonprimes.Length; i++)
139 {
140 Assert.That(!PrimeNumberHelper.IsPrime(nonprimes[i]), nonprimes[i] + " is not prime but is erroniously passing the prime test");
141 }
142
143 Assert.That(PrimeNumberHelper.IsPrime(3));
144 }
145 }
146} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index cede050..48d5a12 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1531,6 +1531,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1531 OutPacket(kill, ThrottleOutPacketType.Task); 1531 OutPacket(kill, ThrottleOutPacketType.Task);
1532 } 1532 }
1533 } 1533 }
1534 else
1535 {
1536 OutPacket(kill, ThrottleOutPacketType.State);
1537 }
1534 } 1538 }
1535 1539
1536 /// <summary> 1540 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 4e4eee9..7a21d5e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -317,7 +317,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
317 continue; 317 continue;
318 318
319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); 319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
320 PresenceInfo presence = PresenceService.GetAgent(fromAgentID); 320
321 PresenceInfo presence = null;
322 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
323 if (presences != null && presences.Length > 0)
324 presence = presences[0];
325 if (presence != null)
326 im.offline = 0;
321 327
322 im.fromAgentID = fromAgentID.Guid; 328 im.fromAgentID = fromAgentID.Guid;
323 im.fromAgentName = account.FirstName + " " + account.LastName; 329 im.fromAgentName = account.FirstName + " " + account.LastName;
@@ -430,13 +436,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
430 return; 436 return;
431 437
432 // The friend is not here [as root]. Let's forward. 438 // The friend is not here [as root]. Let's forward.
433 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 439 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
434 if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check 440 if (friendSessions != null && friendSessions.Length > 0)
435 { 441 {
436 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 442 PresenceInfo friendSession = null;
437 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); 443 foreach (PresenceInfo pinfo in friendSessions)
438 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); 444 if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
445 {
446 friendSession = pinfo;
447 break;
448 }
449
450 if (friendSession != null)
451 {
452 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
453 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
454 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
455 }
439 } 456 }
457
458 // Friend is not online. Ignore.
440 } 459 }
441 else 460 else
442 { 461 {
@@ -477,11 +496,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
477 return; 496 return;
478 497
479 // The prospective friend is not here [as root]. Let's forward. 498 // The prospective friend is not here [as root]. Let's forward.
480 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 499 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
481 if (friendSession != null) 500 if (friendSessions != null && friendSessions.Length > 0)
482 { 501 {
483 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 502 PresenceInfo friendSession = friendSessions[0];
484 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); 503 if (friendSession != null)
504 {
505 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
506 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
507 }
485 } 508 }
486 // If the prospective friend is not online, he'll get the message upon login. 509 // If the prospective friend is not online, he'll get the message upon login.
487 } 510 }
@@ -508,12 +531,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
508 } 531 }
509 532
510 // The friend is not here 533 // The friend is not here
511 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 534 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
512 if (friendSession != null) 535 if (friendSessions != null && friendSessions.Length > 0)
513 { 536 {
514 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 537 PresenceInfo friendSession = friendSessions[0];
515 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 538 if (friendSession != null)
516 client.SendAgentOnline(new UUID[] { friendID }); 539 {
540 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
541 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
542 client.SendAgentOnline(new UUID[] { friendID });
543 }
517 } 544 }
518 } 545 }
519 546
@@ -532,14 +559,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
532 if (LocalFriendshipDenied(agentID, client.Name, friendID)) 559 if (LocalFriendshipDenied(agentID, client.Name, friendID))
533 return; 560 return;
534 561
535 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 562 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
536 if (friendSession != null) 563 if (friendSessions != null && friendSessions.Length > 0)
537 { 564 {
538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 565 PresenceInfo friendSession = friendSessions[0];
539 if (region != null) 566 if (friendSession != null)
540 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 567 {
541 else 568 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
542 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); 569 if (region != null)
570 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
571 else
572 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
573 }
543 } 574 }
544 } 575 }
545 576
@@ -561,11 +592,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
561 if (LocalFriendshipTerminated(exfriendID)) 592 if (LocalFriendshipTerminated(exfriendID))
562 return; 593 return;
563 594
564 PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); 595 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
565 if (friendSession != null) 596 if (friendSessions != null && friendSessions.Length > 0)
566 { 597 {
567 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 598 PresenceInfo friendSession = friendSessions[0];
568 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); 599 if (friendSession != null)
600 {
601 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
602 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
603 }
569 } 604 }
570 } 605 }
571 606
@@ -604,13 +639,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
604 if (LocalGrantRights(requester, target, myFlags, rights)) 639 if (LocalGrantRights(requester, target, myFlags, rights))
605 return; 640 return;
606 641
607 PresenceInfo friendSession = PresenceService.GetAgent(target); 642 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
608 if (friendSession != null) 643 if (friendSessions != null && friendSessions.Length > 0)
609 { 644 {
610 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 645 PresenceInfo friendSession = friendSessions[0];
611 // TODO: You might want to send the delta to save the lookup 646 if (friendSession != null)
612 // on the other end!! 647 {
613 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); 648 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
649 // TODO: You might want to send the delta to save the lookup
650 // on the other end!!
651 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
652 }
614 } 653 }
615 } 654 }
616 } 655 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 43bbf0d..9b1222b 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -498,7 +498,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
498 if (lookupAgent) 498 if (lookupAgent)
499 { 499 {
500 // Non-cached user agent lookup. 500 // Non-cached user agent lookup.
501 upd = PresenceService.GetAgent(toAgentID); 501 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
502 if (presences != null && presences.Length > 0)
503 {
504 foreach (PresenceInfo p in presences)
505 {
506 if (p.RegionID != UUID.Zero)
507 {
508 upd = p;
509 break;
510 }
511 }
512 }
502 513
503 if (upd != null) 514 if (upd != null)
504 { 515 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d59cafa..a6ca171 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3956,7 +3956,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3956 } 3956 }
3957 3957
3958 3958
3959 pinfo = World.PresenceService.GetAgent(uuid); 3959 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
3960 if (pinfos != null && pinfos.Length > 0)
3961 {
3962 foreach (PresenceInfo p in pinfos)
3963 {
3964 if (p.RegionID != UUID.Zero)
3965 {
3966 pinfo = p;
3967 }
3968 }
3969 }
3960 3970
3961 ce = new UserInfoCacheEntry(); 3971 ce = new UserInfoCacheEntry();
3962 ce.time = Util.EnvironmentTickCount(); 3972 ce.time = Util.EnvironmentTickCount();
@@ -3974,7 +3984,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3974 3984
3975 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) 3985 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
3976 { 3986 {
3977 pinfo = World.PresenceService.GetAgent(uuid); 3987 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
3988 if (pinfos != null && pinfos.Length > 0)
3989 {
3990 foreach (PresenceInfo p in pinfos)
3991 {
3992 if (p.RegionID != UUID.Zero)
3993 {
3994 pinfo = p;
3995 }
3996 }
3997 }
3998 else
3999 pinfo = null;
3978 4000
3979 ce.time = Util.EnvironmentTickCount(); 4001 ce.time = Util.EnvironmentTickCount();
3980 ce.pinfo = pinfo; 4002 ce.pinfo = pinfo;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index b7e8538..0ef4974 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
291 // Check if the user is online 291 // Check if the user is online
292 if (client.Scene is Scene) 292 if (client.Scene is Scene)
293 { 293 {
294 OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID); 294 OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() });
295 if (presence != null) 295 if (presences != null && presences.Length > 0)
296 flags |= ProfileFlags.Online; 296 flags |= ProfileFlags.Online;
297 } 297 }
298 298