Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.csavinationmerge
commit
afca742392
|
@ -56,13 +56,21 @@ namespace OpenSim.Data.Null
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public FriendsData[] GetFriends(string userID)
|
public FriendsData[] GetFriends(string userID)
|
||||||
{
|
{
|
||||||
List<FriendsData> lst = m_Data.FindAll(delegate (FriendsData fdata)
|
List<FriendsData> lst = m_Data.FindAll(fdata =>
|
||||||
{
|
{
|
||||||
return fdata.PrincipalID == userID.ToString();
|
return fdata.PrincipalID == userID.ToString();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (lst != null)
|
if (lst != null)
|
||||||
|
{
|
||||||
|
lst.ForEach(f =>
|
||||||
|
{
|
||||||
|
FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID);
|
||||||
|
if (f2 != null) { f.Data["TheirFlags"] = f2.Data["Flags"]; }
|
||||||
|
});
|
||||||
|
|
||||||
return lst.ToArray();
|
return lst.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
return new FriendsData[0];
|
return new FriendsData[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -11197,6 +11197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
|
Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HandleGrantUserRights(IClientAPI sender, Packet Pack)
|
private bool HandleGrantUserRights(IClientAPI sender, Packet Pack)
|
||||||
{
|
{
|
||||||
GrantUserRightsPacket GrantUserRights =
|
GrantUserRightsPacket GrantUserRights =
|
||||||
|
@ -11217,6 +11218,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
GrantUserRights.Rights[0].RelatedRights);
|
GrantUserRights.Rights[0].RelatedRights);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HandlePlacesQuery(IClientAPI sender, Packet Pack)
|
private bool HandlePlacesQuery(IClientAPI sender, Packet Pack)
|
||||||
{
|
{
|
||||||
PlacesQueryPacket placesQueryPacket =
|
PlacesQueryPacket placesQueryPacket =
|
||||||
|
|
|
@ -46,7 +46,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
// Fields
|
// Fields
|
||||||
private bool m_dumpAssetsToFile;
|
private bool m_dumpAssetsToFile;
|
||||||
private Scene m_Scene;
|
private Scene m_Scene;
|
||||||
private UUID UserID;
|
|
||||||
private Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>();
|
private Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -54,7 +53,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
bool dumpAssetsToFile)
|
bool dumpAssetsToFile)
|
||||||
{
|
{
|
||||||
m_Scene = scene;
|
m_Scene = scene;
|
||||||
UserID = agentID;
|
|
||||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
// Instantiate the request handler
|
// Instantiate the request handler
|
||||||
IHttpServer server = MainServer.GetHttpServer((uint)mPort);
|
IHttpServer server = MainServer.GetHttpServer((uint)mPort);
|
||||||
|
|
||||||
|
if (server != null)
|
||||||
server.AddStreamHandler(new FriendsRequestHandler(this));
|
server.AddStreamHandler(new FriendsRequestHandler(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,20 +354,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PresenceInfo presence = null;
|
|
||||||
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
|
|
||||||
if (presences != null && presences.Length > 0)
|
|
||||||
presence = presences[0];
|
|
||||||
if (presence != null)
|
|
||||||
im.offline = 0;
|
im.offline = 0;
|
||||||
|
|
||||||
im.fromAgentID = fromAgentID.Guid;
|
im.fromAgentID = fromAgentID.Guid;
|
||||||
im.fromAgentName = firstname + " " + lastname;
|
im.fromAgentName = firstname + " " + lastname;
|
||||||
im.offline = (byte)((presence == null) ? 1 : 0);
|
im.offline = (byte)((presence == null) ? 1 : 0);
|
||||||
im.imSessionID = im.fromAgentID;
|
im.imSessionID = im.fromAgentID;
|
||||||
im.message = FriendshipMessage(fid);
|
im.message = FriendshipMessage(fid);
|
||||||
|
|
||||||
// Finally
|
|
||||||
LocalFriendshipOffered(agentID, im);
|
LocalFriendshipOffered(agentID, im);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,9 +571,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
|
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
|
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID);
|
||||||
|
|
||||||
StoreFriendships(agentID, friendID);
|
AddFriend(client, friendID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddFriend(IClientAPI client, UUID friendID)
|
||||||
|
{
|
||||||
|
StoreFriendships(client.AgentId, friendID);
|
||||||
|
|
||||||
ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>();
|
ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>();
|
||||||
if (ccm != null)
|
if (ccm != null)
|
||||||
|
@ -594,7 +594,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
//
|
//
|
||||||
|
|
||||||
// Try Local
|
// Try Local
|
||||||
if (LocalFriendshipApproved(agentID, client.Name, friendID))
|
if (LocalFriendshipApproved(client.AgentId, client.Name, friendID))
|
||||||
{
|
{
|
||||||
client.SendAgentOnline(new UUID[] { friendID });
|
client.SendAgentOnline(new UUID[] { friendID });
|
||||||
return;
|
return;
|
||||||
|
@ -608,7 +608,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
if (friendSession != null)
|
if (friendSession != null)
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||||
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
|
m_FriendsSimConnector.FriendshipApproved(region, client.AgentId, client.Name, friendID);
|
||||||
client.SendAgentOnline(new UUID[] { friendID });
|
client.SendAgentOnline(new UUID[] { friendID });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -882,7 +882,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update loca cache only
|
/// Update local cache only
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
/// <param name="friendID"></param>
|
/// <param name="friendID"></param>
|
||||||
|
|
|
@ -141,7 +141,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
{
|
{
|
||||||
List<string> fList = new List<string>();
|
List<string> fList = new List<string>();
|
||||||
foreach (string s in friendList)
|
foreach (string s in friendList)
|
||||||
|
{
|
||||||
|
if (s.Length < 36)
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[HGFRIENDS MODULE]: Ignoring friend {0} ({1} chars) for {2} since identifier too short",
|
||||||
|
s, s.Length, userID);
|
||||||
|
else
|
||||||
fList.Add(s.Substring(0, 36));
|
fList.Add(s.Substring(0, 36));
|
||||||
|
}
|
||||||
|
|
||||||
PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
|
PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
|
||||||
foreach (PresenceInfo pi in presence)
|
foreach (PresenceInfo pi in presence)
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Nini.Config;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.CoreModules.Avatar.Friends;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class FriendsModuleTests
|
||||||
|
{
|
||||||
|
private FriendsModule m_fm;
|
||||||
|
private TestScene m_scene;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
IConfigSource config = new IniConfigSource();
|
||||||
|
config.AddConfig("Modules");
|
||||||
|
// Not strictly necessary since FriendsModule assumes it is the default (!)
|
||||||
|
config.Configs["Modules"].Set("FriendsModule", "FriendsModule");
|
||||||
|
config.AddConfig("Friends");
|
||||||
|
config.Configs["Friends"].Set("Connector", "OpenSim.Services.FriendsService.dll");
|
||||||
|
config.AddConfig("FriendsService");
|
||||||
|
config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||||
|
|
||||||
|
m_scene = SceneHelpers.SetupScene();
|
||||||
|
m_fm = new FriendsModule();
|
||||||
|
SceneHelpers.SetupSceneModules(m_scene, config, m_fm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNoFriends()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
UUID userId = TestHelpers.ParseTail(0x1);
|
||||||
|
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||||
|
|
||||||
|
Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
|
||||||
|
Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAddFriendWhileOnline()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
UUID userId = TestHelpers.ParseTail(0x1);
|
||||||
|
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||||
|
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||||
|
SceneHelpers.AddScenePresence(m_scene, user2Id);
|
||||||
|
|
||||||
|
// This friendship is currently only one-way, which might be pathalogical in Second Life.
|
||||||
|
m_fm.AddFriend(sp.ControllingClient, user2Id);
|
||||||
|
|
||||||
|
Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
|
||||||
|
Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -225,12 +225,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
foreach (Scene scene in m_Scenes)
|
foreach (Scene scene in m_Scenes)
|
||||||
{
|
{
|
||||||
ScenePresence sp = scene.GetScenePresence(toAgentID);
|
ScenePresence sp = scene.GetScenePresence(toAgentID);
|
||||||
if(!sp.IsChildAgent)
|
if(sp != null && !sp.IsChildAgent)
|
||||||
{
|
{
|
||||||
scene.EventManager.TriggerIncomingInstantMessage(gim);
|
scene.EventManager.TriggerIncomingInstantMessage(gim);
|
||||||
successful = true;
|
successful = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!successful)
|
if (!successful)
|
||||||
{
|
{
|
||||||
// If the message can't be delivered to an agent, it
|
// If the message can't be delivered to an agent, it
|
||||||
|
|
|
@ -50,8 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Scene Scene { get; set; }
|
public Scene Scene { get; set; }
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled;
|
||||||
private Scene m_Scene;
|
|
||||||
private XInventoryServicesConnector m_RemoteConnector;
|
private XInventoryServicesConnector m_RemoteConnector;
|
||||||
|
|
||||||
private IUserManagement m_UserManager;
|
private IUserManagement m_UserManager;
|
||||||
|
|
|
@ -33,6 +33,20 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
public interface IFriendsModule
|
public interface IFriendsModule
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Add a friend for the given user.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is a one-way friendship. To make a two way friendship you will need to call this again with the
|
||||||
|
/// client and friend reversed.
|
||||||
|
///
|
||||||
|
/// Ultimately, it would be more useful to take in a user account here rather than having to have a user
|
||||||
|
/// present in the scene.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="friendID"></param>
|
||||||
|
void AddFriend(IClientAPI client, UUID friendID);
|
||||||
|
|
||||||
uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
|
uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
|
||||||
bool SendFriendsOnlineIfNeeded(IClientAPI client);
|
bool SendFriendsOnlineIfNeeded(IClientAPI client);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2862,6 +2862,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
|
||||||
|
|
||||||
AddToPhysicalScene(isFlying);
|
AddToPhysicalScene(isFlying);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,10 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
private IScene m_scene;
|
private IScene m_scene;
|
||||||
|
|
||||||
|
// Properties so that we can get at received data for test purposes
|
||||||
|
public List<UUID> OfflineNotificationsReceived { get; private set; }
|
||||||
|
public List<UUID> OnlineNotificationsReceived { get; private set; }
|
||||||
|
|
||||||
// disable warning: public events, part of the public API
|
// disable warning: public events, part of the public API
|
||||||
#pragma warning disable 67
|
#pragma warning disable 67
|
||||||
|
|
||||||
|
@ -440,6 +444,9 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
m_circuitCode = agentData.circuitcode;
|
m_circuitCode = agentData.circuitcode;
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
CapsSeedUrl = agentData.CapsPath;
|
CapsSeedUrl = agentData.CapsPath;
|
||||||
|
|
||||||
|
OfflineNotificationsReceived = new List<UUID>();
|
||||||
|
OnlineNotificationsReceived = new List<UUID>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -827,12 +834,12 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
public void SendAgentOffline(UUID[] agentIDs)
|
public void SendAgentOffline(UUID[] agentIDs)
|
||||||
{
|
{
|
||||||
|
OfflineNotificationsReceived.AddRange(agentIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAgentOnline(UUID[] agentIDs)
|
public void SendAgentOnline(UUID[] agentIDs)
|
||||||
{
|
{
|
||||||
|
OnlineNotificationsReceived.AddRange(agentIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot,
|
public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot,
|
||||||
|
|
|
@ -2947,6 +2947,7 @@
|
||||||
<Match path="Asset/Tests" pattern="*.cs" recurse="true"/>
|
<Match path="Asset/Tests" pattern="*.cs" recurse="true"/>
|
||||||
<Match path="Avatar/Attachments/Tests" pattern="*.cs" recurse="true"/>
|
<Match path="Avatar/Attachments/Tests" pattern="*.cs" recurse="true"/>
|
||||||
<Match path="Avatar/AvatarFactory/Tests" pattern="*.cs" recurse="true"/>
|
<Match path="Avatar/AvatarFactory/Tests" pattern="*.cs" recurse="true"/>
|
||||||
|
<Match path="Avatar/Friends/Tests" pattern="*.cs" recurse="true"/>
|
||||||
<Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/>
|
<Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/>
|
||||||
<Match path="Framework/InventoryAccess/Tests" pattern="*.cs" recurse="true"/>
|
<Match path="Framework/InventoryAccess/Tests" pattern="*.cs" recurse="true"/>
|
||||||
<Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/>
|
<Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/>
|
||||||
|
|
Loading…
Reference in New Issue