Add simple login test with online friends. Add IFriendsModule.GrantRights() for granting rights via a module call.
Rename IFriendsModule.GetFriendPerms() -> GetRightsGrantedByFriend() to be more self-documenting and consistent with friends module terminology. Add some method doc.0.7.3-extended
parent
59911963ca
commit
67e66a2d34
|
@ -28,6 +28,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Data;
|
||||
|
@ -36,12 +38,25 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
public class NullFriendsData : IFriendsData
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static List<FriendsData> m_Data = new List<FriendsData>();
|
||||
|
||||
public NullFriendsData(string connectionString, string realm)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear all friends data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is required by unit tests to clear the static data between test runs.
|
||||
/// </remarks>
|
||||
public static void Clear()
|
||||
{
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(UUID principalID)
|
||||
{
|
||||
return GetFriends(principalID.ToString());
|
||||
|
@ -66,9 +81,16 @@ namespace OpenSim.Data.Null
|
|||
lst.ForEach(f =>
|
||||
{
|
||||
FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID);
|
||||
if (f2 != null) { f.Data["TheirFlags"] = f2.Data["Flags"]; }
|
||||
if (f2 != null)
|
||||
f.Data["TheirFlags"] = f2.Data["Flags"];
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL FRIENDS DATA]: Got {0} {1} {2} for {3}",
|
||||
// f.Friend, f.Data["Flags"], f2 != null ? f.Data["TheirFlags"] : "not found!", f.PrincipalID);
|
||||
});
|
||||
|
||||
// m_log.DebugFormat("[NULL FRIENDS DATA]: Got {0} friends for {1}", lst.Count, userID);
|
||||
|
||||
return lst.ToArray();
|
||||
}
|
||||
|
||||
|
@ -80,6 +102,9 @@ namespace OpenSim.Data.Null
|
|||
if (data == null)
|
||||
return false;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL FRIENDS DATA]: Storing {0} {1} {2}", data.PrincipalID, data.Friend, data.Data["Flags"]);
|
||||
|
||||
m_Data.Add(data);
|
||||
|
||||
return true;
|
||||
|
@ -98,6 +123,10 @@ namespace OpenSim.Data.Null
|
|||
FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; });
|
||||
if (friendID != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL FRIENDS DATA]: Deleting friend {0} {1} for {2}",
|
||||
// friend.Friend, friend.Data["Flags"], friend.PrincipalID);
|
||||
|
||||
m_Data.Remove(friend);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,6 @@ namespace OpenSim.Data.Null
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public PresenceData[] Get(string field, string data)
|
||||
{
|
||||
if (Instance != this)
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
{
|
||||
public class FriendsModule : ISharedRegionModule, IFriendsModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected bool m_Enabled = false;
|
||||
|
||||
protected class UserFriendData
|
||||
|
@ -72,7 +74,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
}
|
||||
|
||||
protected static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected List<Scene> m_Scenes = new List<Scene>();
|
||||
|
||||
|
@ -156,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
InitModule(config);
|
||||
|
||||
m_Enabled = true;
|
||||
m_log.InfoFormat("[FRIENDS MODULE]: {0} enabled.", Name);
|
||||
m_log.DebugFormat("[FRIENDS MODULE]: {0} enabled.", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_log.DebugFormat("[FRIENDS MODULE]: AddRegion on {0}", Name);
|
||||
// m_log.DebugFormat("[FRIENDS MODULE]: AddRegion on {0}", Name);
|
||||
|
||||
m_Scenes.Add(scene);
|
||||
scene.RegisterModuleInterface<IFriendsModule>(this);
|
||||
|
@ -241,13 +242,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
|
||||
#endregion
|
||||
|
||||
public virtual uint GetFriendPerms(UUID principalID, UUID friendID)
|
||||
public virtual int GetRightsGrantedByFriend(UUID principalID, UUID friendID)
|
||||
{
|
||||
FriendInfo[] friends = GetFriends(principalID);
|
||||
FriendInfo finfo = GetFriend(friends, friendID);
|
||||
if (finfo != null)
|
||||
{
|
||||
return (uint)finfo.TheirFlags;
|
||||
return finfo.TheirFlags;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -259,7 +260,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
client.OnApproveFriendRequest += OnApproveFriendRequest;
|
||||
client.OnDenyFriendRequest += OnDenyFriendRequest;
|
||||
client.OnTerminateFriendship += RemoveFriendship;
|
||||
client.OnGrantUserRights += OnGrantUserRights;
|
||||
client.OnGrantUserRights += GrantRights;
|
||||
|
||||
// We need to cache information for child agents as well as root agents so that friend edit/move/delete
|
||||
// permissions will work across borders where both regions are on different simulators.
|
||||
|
@ -356,10 +357,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
// Send the friends online
|
||||
List<UUID> online = GetOnlineFriends(agentID);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[FRIENDS MODULE]: User {0} in region {1} has {2} friends online",
|
||||
// client.Name, client.Scene.RegionInfo.RegionName, online.Count);
|
||||
|
||||
if (online.Count > 0)
|
||||
client.SendAgentOnline(online.ToArray());
|
||||
|
||||
|
@ -421,23 +418,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
List<UUID> GetOnlineFriends(UUID userID)
|
||||
{
|
||||
List<string> friendList = new List<string>();
|
||||
List<UUID> online = new List<UUID>();
|
||||
|
||||
FriendInfo[] friends = GetFriends(userID);
|
||||
foreach (FriendInfo fi in friends)
|
||||
{
|
||||
if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
|
||||
if (((fi.TheirFlags & (int)FriendRights.CanSeeOnline) != 0) && (fi.TheirFlags != -1))
|
||||
friendList.Add(fi.Friend);
|
||||
}
|
||||
|
||||
List<UUID> online = new List<UUID>();
|
||||
|
||||
if (friendList.Count > 0)
|
||||
GetOnlineFriends(userID, friendList, online);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[FRIENDS MODULE]: User {0} has {1} friends online", userID, online.Count);
|
||||
|
||||
return online;
|
||||
}
|
||||
|
||||
protected virtual void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[FRIENDS MODULE]: Looking for online presence of {0} users for {1}", friendList.Count, userID);
|
||||
|
||||
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
|
||||
foreach (PresenceInfo pi in presence)
|
||||
{
|
||||
|
@ -703,13 +707,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
}
|
||||
}
|
||||
|
||||
private void OnGrantUserRights(IClientAPI remoteClient, UUID target, int rights)
|
||||
public void GrantRights(IClientAPI remoteClient, UUID friendID, int rights)
|
||||
{
|
||||
UUID requester = remoteClient.AgentId;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}",
|
||||
requester, rights, target);
|
||||
requester, rights, friendID);
|
||||
|
||||
FriendInfo[] friends = GetFriends(requester);
|
||||
if (friends.Length == 0)
|
||||
|
@ -718,12 +722,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
}
|
||||
|
||||
// Let's find the friend in this user's friend list
|
||||
FriendInfo friend = GetFriend(friends, target);
|
||||
FriendInfo friend = GetFriend(friends, friendID);
|
||||
|
||||
if (friend != null) // Found it
|
||||
{
|
||||
// Store it on the DB
|
||||
if (!StoreRights(requester, target, rights))
|
||||
if (!StoreRights(requester, friendID, rights))
|
||||
{
|
||||
remoteClient.SendAlertMessage("Unable to grant rights.");
|
||||
return;
|
||||
|
@ -734,17 +738,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
friend.MyFlags = rights;
|
||||
|
||||
// Always send this back to the original client
|
||||
remoteClient.SendChangeUserRights(requester, target, rights);
|
||||
remoteClient.SendChangeUserRights(requester, friendID, rights);
|
||||
|
||||
//
|
||||
// Notify the friend
|
||||
//
|
||||
|
||||
// Try local
|
||||
if (LocalGrantRights(requester, target, myFlags, rights))
|
||||
if (LocalGrantRights(requester, friendID, myFlags, rights))
|
||||
return;
|
||||
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||
if (friendSessions != null && friendSessions.Length > 0)
|
||||
{
|
||||
PresenceInfo friendSession = friendSessions[0];
|
||||
|
@ -753,13 +757,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||
// TODO: You might want to send the delta to save the lookup
|
||||
// on the other end!!
|
||||
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
|
||||
m_FriendsSimConnector.GrantRights(region, requester, friendID, myFlags, rights);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", target, requester);
|
||||
m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", friendID, requester);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -976,8 +980,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
|
||||
protected virtual void StoreFriendships(UUID agentID, UUID friendID)
|
||||
{
|
||||
FriendsService.StoreFriend(agentID.ToString(), friendID.ToString(), 1);
|
||||
FriendsService.StoreFriend(friendID.ToString(), agentID.ToString(), 1);
|
||||
FriendsService.StoreFriend(agentID.ToString(), friendID.ToString(), (int)FriendRights.CanSeeOnline);
|
||||
FriendsService.StoreFriend(friendID.ToString(), agentID.ToString(), (int)FriendRights.CanSeeOnline);
|
||||
}
|
||||
|
||||
protected virtual bool DeleteFriendship(UUID agentID, UUID exfriendID)
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
|||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data.Null;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Avatar.Friends;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -63,6 +64,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
|
|||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
// We must clear friends data between tests since Data.Null holds it in static properties. This is necessary
|
||||
// so that different services and simulator can share the data in standalone mode. This is pretty horrible
|
||||
// effectively the statics are global variables.
|
||||
NullFriendsData.Clear();
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
// Not strictly necessary since FriendsModule assumes it is the default (!)
|
||||
|
@ -110,8 +116,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
|
|||
|
||||
m_fm.AddFriendship(sp1.ControllingClient, user2Id);
|
||||
|
||||
m_scene.RemoveClient(sp1.UUID, true);
|
||||
m_scene.RemoveClient(sp2.UUID, true);
|
||||
// Not necessary for this test. CanSeeOnline is automatically granted.
|
||||
// m_fm.GrantRights(sp1.ControllingClient, user2Id, (int)FriendRights.CanSeeOnline);
|
||||
|
||||
// We must logout from the client end so that the presence service is correctly updated by the presence
|
||||
// detector. This is listening to the OnConnectionClosed event on the client.
|
||||
((TestClient)sp1.ControllingClient).Logout();
|
||||
((TestClient)sp2.ControllingClient).Logout();
|
||||
// m_scene.RemoveClient(sp1.UUID, true);
|
||||
// m_scene.RemoveClient(sp2.UUID, true);
|
||||
|
||||
ScenePresence sp1Redux = SceneHelpers.AddScenePresence(m_scene, user1Id);
|
||||
|
||||
|
@ -120,33 +133,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
|
|||
Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
// [Test]
|
||||
// public void TestLoginWithOnlineFriends()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
[Test]
|
||||
public void TestLoginWithOnlineFriends()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
|
||||
// UserAccountHelpers.CreateUserWithInventory(m_scene, user1Id);
|
||||
// UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
|
||||
//
|
||||
// UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
// UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
//
|
||||
//// UserAccountHelpers.CreateUserWithInventory(m_scene, user1Id);
|
||||
//// UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
|
||||
////
|
||||
//// m_fm.AddFriendship(user1Id, user2Id);
|
||||
//
|
||||
// ScenePresence sp1 = SceneHelpers.AddScenePresence(m_scene, user1Id);
|
||||
// SceneHelpers.AddScenePresence(m_scene, user2Id);
|
||||
//
|
||||
// m_fm.AddFriendship(sp1.ControllingClient, user2Id);
|
||||
//// m_fm.LocalGrantRights
|
||||
//
|
||||
// m_scene.RemoveClient(sp1.UUID, true);
|
||||
//
|
||||
// ScenePresence sp1Redux = SceneHelpers.AddScenePresence(m_scene, user1Id);
|
||||
//
|
||||
// Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0));
|
||||
// Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(1));
|
||||
// }
|
||||
// m_fm.AddFriendship(user1Id, user2Id);
|
||||
|
||||
ScenePresence sp1 = SceneHelpers.AddScenePresence(m_scene, user1Id);
|
||||
ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, user2Id);
|
||||
|
||||
m_fm.AddFriendship(sp1.ControllingClient, user2Id);
|
||||
|
||||
// Not necessary for this test. CanSeeOnline is automatically granted.
|
||||
// m_fm.GrantRights(sp1.ControllingClient, user2Id, (int)FriendRights.CanSeeOnline);
|
||||
|
||||
// We must logout from the client end so that the presence service is correctly updated by the presence
|
||||
// detector. This is listening to the OnConnectionClosed event on the client.
|
||||
// ((TestClient)sp1.ControllingClient).Logout();
|
||||
((TestClient)sp2.ControllingClient).Logout();
|
||||
// m_scene.RemoveClient(user2Id, true);
|
||||
|
||||
ScenePresence sp2Redux = SceneHelpers.AddScenePresence(m_scene, user2Id);
|
||||
|
||||
Assert.That(((TestClient)sp2Redux.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0));
|
||||
Assert.That(((TestClient)sp2Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddFriendshipWhileOnline()
|
||||
|
|
|
@ -27,14 +27,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
{
|
||||
public class PresenceDetector
|
||||
|
@ -97,7 +95,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||
m_PresenceService.LogoutAgent(client.SessionId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -495,11 +495,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
if (m_friendsModule == null)
|
||||
return false;
|
||||
|
||||
uint friendPerms = m_friendsModule.GetFriendPerms(user, objectOwner);
|
||||
if ((friendPerms & (uint)FriendRights.CanModifyObjects) != 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
int friendPerms = m_friendsModule.GetRightsGrantedByFriend(user, objectOwner);
|
||||
return (friendPerms & (int)FriendRights.CanModifyObjects) != 0;
|
||||
}
|
||||
|
||||
protected bool IsEstateManager(UUID user)
|
||||
|
@ -508,6 +505,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
|
||||
return m_scene.RegionInfo.EstateSettings.IsEstateManager(user);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool PropagatePermissions()
|
||||
|
|
|
@ -55,7 +55,27 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="exFriendID"></param>
|
||||
void RemoveFriendship(IClientAPI client, UUID exFriendID);
|
||||
|
||||
uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
|
||||
/// <summary>
|
||||
/// Get permissions granted by a friend.
|
||||
/// </summary>
|
||||
/// <param name="PrincipalID">The user.</param>
|
||||
/// <param name="FriendID">The friend that granted.</param>
|
||||
/// <returns>The permissions. These come from the FriendRights enum.</returns>
|
||||
int GetRightsGrantedByFriend(UUID PrincipalID, UUID FriendID);
|
||||
|
||||
/// <summary>
|
||||
/// Grant permissions for a friend.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This includes giving them the ability to see when the user is online and permission to edit the user's
|
||||
/// objects.
|
||||
/// Granting lower permissions than the friend currently has will rescind the extra permissions.
|
||||
/// </remarks>
|
||||
/// <param name="remoteClient">The user granting the permissions.</param>
|
||||
/// <param name="friendID">The friend.</param>
|
||||
/// <param name="perms">These come from the FriendRights enum.</param>
|
||||
void GrantRights(IClientAPI remoteClient, UUID friendID, int perms);
|
||||
|
||||
bool SendFriendsOnlineIfNeeded(IClientAPI client);
|
||||
}
|
||||
}
|
|
@ -36,7 +36,15 @@ namespace OpenSim.Services.Interfaces
|
|||
{
|
||||
public UUID PrincipalID;
|
||||
public string Friend;
|
||||
|
||||
/// <summary>
|
||||
/// The permissions that this user has granted to the friend.
|
||||
/// </summary>
|
||||
public int MyFlags;
|
||||
|
||||
/// <summary>
|
||||
/// The permissions that the friend has granted to this user.
|
||||
/// </summary>
|
||||
public int TheirFlags;
|
||||
|
||||
public FriendInfo()
|
||||
|
|
|
@ -151,11 +151,12 @@ namespace OpenSim.Services.PresenceService
|
|||
|
||||
info.Add(ret);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[PRESENCE SERVICE]: GetAgents for {0} found {1} presences", userIDStr, data.Length);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[PRESENCE SERVICE]: GetAgents for {0} userIDs found {1} presences", userIDs.Length, info.Count);
|
||||
return info.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -369,8 +369,11 @@ namespace OpenSim.Tests.Common
|
|||
agentData.AgentID = agentId;
|
||||
agentData.firstname = firstName;
|
||||
agentData.lastname = "testlastname";
|
||||
agentData.SessionID = UUID.Zero;
|
||||
agentData.SecureSessionID = UUID.Zero;
|
||||
|
||||
// XXX: Sessions must be unique, otherwise one presence can overwrite another in NullPresenceData.
|
||||
agentData.SessionID = UUID.Random();
|
||||
agentData.SecureSessionID = UUID.Random();
|
||||
|
||||
agentData.circuitcode = 123;
|
||||
agentData.BaseFolder = UUID.Zero;
|
||||
agentData.InventoryFolder = UUID.Zero;
|
||||
|
@ -416,7 +419,10 @@ namespace OpenSim.Tests.Common
|
|||
// We emulate the proper login sequence here by doing things in four stages
|
||||
|
||||
// Stage 0: login
|
||||
scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
|
||||
// We need to punch through to the underlying service because scene will not, correctly, let us call it
|
||||
// through it's reference to the LPSC
|
||||
LocalPresenceServicesConnector lpsc = (LocalPresenceServicesConnector)scene.PresenceService;
|
||||
lpsc.m_PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
|
||||
|
||||
// Stages 1 & 2
|
||||
ScenePresence sp = IntroduceClientToScene(scene, agentData, TeleportFlags.ViaLogin);
|
||||
|
|
|
@ -347,15 +347,9 @@ namespace OpenSim.Tests.Common.Mock
|
|||
get { return m_agentId; }
|
||||
}
|
||||
|
||||
public UUID SessionId
|
||||
{
|
||||
get { return UUID.Zero; }
|
||||
}
|
||||
public UUID SessionId { get; set; }
|
||||
|
||||
public UUID SecureSessionId
|
||||
{
|
||||
get { return UUID.Zero; }
|
||||
}
|
||||
public UUID SecureSessionId { get; set; }
|
||||
|
||||
public virtual string FirstName
|
||||
{
|
||||
|
@ -379,11 +373,9 @@ namespace OpenSim.Tests.Common.Mock
|
|||
get { return true; }
|
||||
set { }
|
||||
}
|
||||
public bool IsLoggingOut
|
||||
{
|
||||
get { return false; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public bool IsLoggingOut { get; set; }
|
||||
|
||||
public UUID ActiveGroupId
|
||||
{
|
||||
get { return UUID.Zero; }
|
||||
|
@ -449,6 +441,8 @@ namespace OpenSim.Tests.Common.Mock
|
|||
m_lastName = agentData.lastname;
|
||||
m_circuitCode = agentData.circuitcode;
|
||||
m_scene = scene;
|
||||
SessionId = agentData.SessionID;
|
||||
SecureSessionId = agentData.SecureSessionID;
|
||||
CapsSeedUrl = agentData.CapsPath;
|
||||
|
||||
ReceivedOfflineNotifications = new List<UUID>();
|
||||
|
@ -905,8 +899,24 @@ namespace OpenSim.Tests.Common.Mock
|
|||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a TestClient only method to do shutdown tasks that are normally carried out by LLUDPServer.RemoveClient()
|
||||
/// </summary>
|
||||
public void Logout()
|
||||
{
|
||||
// We must set this here so that the presence is removed from the PresenceService by the PresenceDetector
|
||||
IsLoggingOut = true;
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
// Fire the callback for this connection closing
|
||||
// This is necesary to get the presence detector to notice that a client has logged out.
|
||||
if (OnConnectionClosed != null)
|
||||
OnConnectionClosed(this);
|
||||
|
||||
m_scene.RemoveClient(AgentId, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -2912,6 +2912,7 @@
|
|||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Data.Null"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Serialization"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
|
|
Loading…
Reference in New Issue