aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs98
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IFriendsModule.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
9 files changed, 137 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 626ebb5..133da0f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11088,6 +11088,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11088 Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText)); 11088 Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
11089 return true; 11089 return true;
11090 } 11090 }
11091
11091 private bool HandleGrantUserRights(IClientAPI sender, Packet Pack) 11092 private bool HandleGrantUserRights(IClientAPI sender, Packet Pack)
11092 { 11093 {
11093 GrantUserRightsPacket GrantUserRights = 11094 GrantUserRightsPacket GrantUserRights =
@@ -11108,6 +11109,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11108 GrantUserRights.Rights[0].RelatedRights); 11109 GrantUserRights.Rights[0].RelatedRights);
11109 return true; 11110 return true;
11110 } 11111 }
11112
11111 private bool HandlePlacesQuery(IClientAPI sender, Packet Pack) 11113 private bool HandlePlacesQuery(IClientAPI sender, Packet Pack)
11112 { 11114 {
11113 PlacesQueryPacket placesQueryPacket = 11115 PlacesQueryPacket placesQueryPacket =
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index eed7cd5..b557ffe 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -46,7 +46,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
46 // Fields 46 // Fields
47 private bool m_dumpAssetsToFile; 47 private bool m_dumpAssetsToFile;
48 private Scene m_Scene; 48 private Scene m_Scene;
49 private UUID UserID;
50 private Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>(); 49 private Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>();
51 50
52 // Methods 51 // Methods
@@ -54,7 +53,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
54 bool dumpAssetsToFile) 53 bool dumpAssetsToFile)
55 { 54 {
56 m_Scene = scene; 55 m_Scene = scene;
57 UserID = agentID;
58 m_dumpAssetsToFile = dumpAssetsToFile; 56 m_dumpAssetsToFile = dumpAssetsToFile;
59 } 57 }
60 58
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index c952ebf..7a2a46e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -165,7 +165,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
165 165
166 // Instantiate the request handler 166 // Instantiate the request handler
167 IHttpServer server = MainServer.GetHttpServer((uint)mPort); 167 IHttpServer server = MainServer.GetHttpServer((uint)mPort);
168 server.AddStreamHandler(new FriendsRequestHandler(this)); 168
169 if (server != null)
170 server.AddStreamHandler(new FriendsRequestHandler(this));
169 } 171 }
170 172
171 if (m_FriendsService == null) 173 if (m_FriendsService == null)
@@ -352,18 +354,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
352 continue; 354 continue;
353 } 355 }
354 356
355 PresenceInfo presence = null;
356 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
357 if (presences != null && presences.Length > 0)
358 presence = presences[0];
359 im.offline = 0; 357 im.offline = 0;
360
361 im.fromAgentID = fromAgentID.Guid; 358 im.fromAgentID = fromAgentID.Guid;
362 im.fromAgentName = firstname + " " + lastname; 359 im.fromAgentName = firstname + " " + lastname;
363 im.imSessionID = im.fromAgentID; 360 im.imSessionID = im.fromAgentID;
364 im.message = FriendshipMessage(fid); 361 im.message = FriendshipMessage(fid);
365 362
366 // Finally
367 LocalFriendshipOffered(agentID, im); 363 LocalFriendshipOffered(agentID, im);
368 } 364 }
369 365
@@ -574,9 +570,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
574 570
575 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 571 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
576 { 572 {
577 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); 573 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID);
578 574
579 StoreFriendships(agentID, friendID); 575 AddFriendship(client, friendID);
576 }
577
578 public void AddFriendship(IClientAPI client, UUID friendID)
579 {
580 StoreFriendships(client.AgentId, friendID);
580 581
581 // Update the local cache 582 // Update the local cache
582 RefetchFriends(client); 583 RefetchFriends(client);
@@ -586,7 +587,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
586 // 587 //
587 588
588 // Try Local 589 // Try Local
589 if (LocalFriendshipApproved(agentID, client.Name, friendID)) 590 if (LocalFriendshipApproved(client.AgentId, client.Name, friendID))
590 { 591 {
591 client.SendAgentOnline(new UUID[] { friendID }); 592 client.SendAgentOnline(new UUID[] { friendID });
592 return; 593 return;
@@ -600,7 +601,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
600 if (friendSession != null) 601 if (friendSession != null)
601 { 602 {
602 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 603 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
603 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 604 m_FriendsSimConnector.FriendshipApproved(region, client.AgentId, client.Name, friendID);
604 client.SendAgentOnline(new UUID[] { friendID }); 605 client.SendAgentOnline(new UUID[] { friendID });
605 } 606 }
606 } 607 }
@@ -867,7 +868,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
867 } 868 }
868 869
869 /// <summary> 870 /// <summary>
870 /// Update loca cache only 871 /// Update local cache only
871 /// </summary> 872 /// </summary>
872 /// <param name="userID"></param> 873 /// <param name="userID"></param>
873 /// <param name="friendID"></param> 874 /// <param name="friendID"></param>
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index dda67f9..02b417f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -141,7 +141,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
141 { 141 {
142 List<string> fList = new List<string>(); 142 List<string> fList = new List<string>();
143 foreach (string s in friendList) 143 foreach (string s in friendList)
144 fList.Add(s.Substring(0, 36)); 144 {
145 if (s.Length < 36)
146 m_log.WarnFormat(
147 "[HGFRIENDS MODULE]: Ignoring friend {0} ({1} chars) for {2} since identifier too short",
148 s, s.Length, userID);
149 else
150 fList.Add(s.Substring(0, 36));
151 }
145 152
146 PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray()); 153 PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
147 foreach (PresenceInfo pi in presence) 154 foreach (PresenceInfo pi in presence)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
new file mode 100644
index 0000000..c945dcf
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
@@ -0,0 +1,98 @@
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.Collections.Generic;
30using Nini.Config;
31using NUnit.Framework;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Region.CoreModules.Avatar.Friends;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38
39namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
40{
41 [TestFixture]
42 public class FriendsModuleTests
43 {
44 private FriendsModule m_fm;
45 private TestScene m_scene;
46
47 [SetUp]
48 public void Init()
49 {
50 IConfigSource config = new IniConfigSource();
51 config.AddConfig("Modules");
52 // Not strictly necessary since FriendsModule assumes it is the default (!)
53 config.Configs["Modules"].Set("FriendsModule", "FriendsModule");
54 config.AddConfig("Friends");
55 config.Configs["Friends"].Set("Connector", "OpenSim.Services.FriendsService.dll");
56 config.AddConfig("FriendsService");
57 config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
58
59 m_scene = SceneHelpers.SetupScene();
60 m_fm = new FriendsModule();
61 SceneHelpers.SetupSceneModules(m_scene, config, m_fm);
62 }
63
64 [Test]
65 public void TestNoFriends()
66 {
67 TestHelpers.InMethod();
68// log4net.Config.XmlConfigurator.Configure();
69
70 UUID userId = TestHelpers.ParseTail(0x1);
71
72 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
73
74 Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
75 Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(0));
76 }
77
78 [Test]
79 public void TestAddFriendWhileOnline()
80 {
81 TestHelpers.InMethod();
82// log4net.Config.XmlConfigurator.Configure();
83
84 UUID userId = TestHelpers.ParseTail(0x1);
85 UUID user2Id = TestHelpers.ParseTail(0x2);
86
87 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
88 SceneHelpers.AddScenePresence(m_scene, user2Id);
89
90 // This fiendship is two-way but without a connector, only the first user will receive the online
91 // notification.
92 m_fm.AddFriendship(sp.ControllingClient, user2Id);
93
94 Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
95 Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(1));
96 }
97 }
98} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 321a705..560d913 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -225,12 +225,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
225 foreach (Scene scene in m_Scenes) 225 foreach (Scene scene in m_Scenes)
226 { 226 {
227 ScenePresence sp = scene.GetScenePresence(toAgentID); 227 ScenePresence sp = scene.GetScenePresence(toAgentID);
228 if(!sp.IsChildAgent) 228 if(sp != null && !sp.IsChildAgent)
229 { 229 {
230 scene.EventManager.TriggerIncomingInstantMessage(gim); 230 scene.EventManager.TriggerIncomingInstantMessage(gim);
231 successful = true; 231 successful = true;
232 } 232 }
233 } 233 }
234
234 if (!successful) 235 if (!successful)
235 { 236 {
236 // If the message can't be delivered to an agent, it 237 // If the message can't be delivered to an agent, it
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 73ab4e3..10ab6d0 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -50,8 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
50 /// </summary> 50 /// </summary>
51 public Scene Scene { get; set; } 51 public Scene Scene { get; set; }
52 52
53 private bool m_Enabled = false; 53 private bool m_Enabled;
54 private Scene m_Scene;
55 private XInventoryServicesConnector m_RemoteConnector; 54 private XInventoryServicesConnector m_RemoteConnector;
56 55
57 private IUserManagement m_UserManager; 56 private IUserManagement m_UserManager;
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index d4a6857..fdede34 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -33,6 +33,17 @@ namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 public interface IFriendsModule 34 public interface IFriendsModule
35 { 35 {
36 /// <summary>
37 /// Add a friendship between two users.
38 /// </summary>
39 /// <remarks>
40 /// Ultimately, it would be more useful to take in a user account here rather than having to have a user
41 /// present in the scene.
42 /// </remarks>
43 /// <param name="client"></param>
44 /// <param name="friendID"></param>
45 void AddFriendship(IClientAPI client, UUID friendID);
46
36 uint GetFriendPerms(UUID PrincipalID, UUID FriendID); 47 uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
37 bool SendFriendsOnlineIfNeeded(IClientAPI client); 48 bool SendFriendsOnlineIfNeeded(IClientAPI client);
38 } 49 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a4cb7cf..098437a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2828,6 +2828,8 @@ namespace OpenSim.Region.Framework.Scenes
2828 Velocity = Vector3.Zero; 2828 Velocity = Vector3.Zero;
2829 AbsolutePosition = pos; 2829 AbsolutePosition = pos;
2830 2830
2831// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
2832
2831 AddToPhysicalScene(isFlying); 2833 AddToPhysicalScene(isFlying);
2832 } 2834 }
2833 } 2835 }