Implement rights changes locall (UNTESTED)
parent
86c621fdc7
commit
adb9cc2af9
|
@ -567,19 +567,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
|
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
|
||||||
{
|
{
|
||||||
|
if (!m_Friends.ContainsKey(remoteClient.AgentId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
UserFriendData fd = m_Friends[remoteClient.AgentId];
|
||||||
|
|
||||||
FriendsService.StoreFriend(requester, target.ToString(), rights);
|
FriendsService.StoreFriend(requester, target.ToString(), rights);
|
||||||
|
|
||||||
//
|
foreach (FriendInfo fi in fd.Friends)
|
||||||
// Notify the friend
|
|
||||||
//
|
|
||||||
|
|
||||||
IClientAPI friendClient = LocateClientObject(target);
|
|
||||||
if (friendClient != null)
|
|
||||||
{
|
{
|
||||||
// the prospective friend in this sim as root agent
|
if (fi.Friend == target.ToString())
|
||||||
//friendClient.???;
|
{
|
||||||
// we're done
|
IClientAPI friendClient = LocateClientObject(target);
|
||||||
return;
|
|
||||||
|
int delta = rights ^ fi.MyFlags;
|
||||||
|
if ((delta & ~1) != 0)
|
||||||
|
{
|
||||||
|
remoteClient.SendChangeUserRights(remoteClient.AgentId, target, rights & ~1);
|
||||||
|
//
|
||||||
|
// Notify the friend
|
||||||
|
//
|
||||||
|
|
||||||
|
if (friendClient != null)
|
||||||
|
{
|
||||||
|
friendClient.SendChangeUserRights(target, remoteClient.AgentId, rights & ~1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((delta & 1) != 0)
|
||||||
|
{
|
||||||
|
if (friendClient != null)
|
||||||
|
{
|
||||||
|
if ((rights & 1) != 0)
|
||||||
|
friendClient.SendAgentOnline(new UUID[] { new UUID(remoteClient.AgentId) } );
|
||||||
|
else
|
||||||
|
friendClient.SendAgentOffline(new UUID[] { new UUID(remoteClient.AgentId) } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (friendClient != null) // Local, we're done
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
|
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
|
||||||
|
@ -587,6 +613,8 @@ 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);
|
||||||
|
// TODO: You might want to send the delta to save the lookup
|
||||||
|
// on the other end!!
|
||||||
m_FriendsSimConnector.GrantRights(region, requester, target);
|
m_FriendsSimConnector.GrantRights(region, requester, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue