Change the permissions module to use the friend list cache already in the
friends module instead of requesting the entire friends list over the network each time a prim is touched.0.6.8-post-fixes
parent
b098572525
commit
ec0d5b408a
|
@ -1114,6 +1114,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
{
|
{
|
||||||
((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights);
|
((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FriendListItem> GetUserFriends(UUID agentID)
|
||||||
|
{
|
||||||
|
List<FriendListItem> fl;
|
||||||
|
lock (m_friendLists)
|
||||||
|
{
|
||||||
|
fl = (List<FriendListItem>)m_friendLists.Get(agentID.ToString(),
|
||||||
|
m_initialScene.GetFriendList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
|
private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
|
||||||
private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
|
private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
|
||||||
private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
|
private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
|
||||||
|
private IFriendsModule m_friendsModule = null;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
@ -363,6 +365,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
|
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||||
|
|
||||||
|
if (m_friendsModule == null)
|
||||||
|
m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
|
||||||
|
else
|
||||||
|
m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -479,9 +487,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
|
protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (user == UUID.Zero) return false;
|
if (user == UUID.Zero)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_friendsModule == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
List<FriendListItem> profile = m_friendsModule.GetUserFriends(user);
|
||||||
|
|
||||||
List<FriendListItem> profile = m_scene.CommsManager.GetUserFriendList(user);
|
|
||||||
foreach (FriendListItem item in profile)
|
foreach (FriendListItem item in profile)
|
||||||
{
|
{
|
||||||
if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0)
|
if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0)
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
|
@ -45,5 +46,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="offerMessage"></param>
|
/// <param name="offerMessage"></param>
|
||||||
void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
|
void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
|
||||||
|
List<FriendListItem> GetUserFriends(UUID agentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue