More work on GrantRights. Still not right.
parent
b8d89ac6da
commit
cfaf087b89
|
@ -186,40 +186,40 @@ namespace OpenSim.Framework
|
||||||
PCode = (byte)PCodeEnum.Primitive;
|
PCode = (byte)PCodeEnum.Primitive;
|
||||||
ExtraParams = new byte[1];
|
ExtraParams = new byte[1];
|
||||||
m_textureEntry = DEFAULT_TEXTURE;
|
m_textureEntry = DEFAULT_TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimitiveBaseShape(Primitive prim)
|
public PrimitiveBaseShape(Primitive prim)
|
||||||
{
|
{
|
||||||
PCode = (byte)prim.PrimData.PCode;
|
PCode = (byte)prim.PrimData.PCode;
|
||||||
ExtraParams = new byte[1];
|
ExtraParams = new byte[1];
|
||||||
|
|
||||||
State = prim.PrimData.State;
|
State = prim.PrimData.State;
|
||||||
PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin);
|
PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin);
|
||||||
PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd);
|
PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd);
|
||||||
PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX);
|
PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX);
|
||||||
PathScaleY = Primitive.PackPathScale(prim.PrimData.PathScaleY);
|
PathScaleY = Primitive.PackPathScale(prim.PrimData.PathScaleY);
|
||||||
PathShearX = (byte)Primitive.PackPathShear(prim.PrimData.PathShearX);
|
PathShearX = (byte)Primitive.PackPathShear(prim.PrimData.PathShearX);
|
||||||
PathShearY = (byte)Primitive.PackPathShear(prim.PrimData.PathShearY);
|
PathShearY = (byte)Primitive.PackPathShear(prim.PrimData.PathShearY);
|
||||||
PathSkew = Primitive.PackPathTwist(prim.PrimData.PathSkew);
|
PathSkew = Primitive.PackPathTwist(prim.PrimData.PathSkew);
|
||||||
ProfileBegin = Primitive.PackBeginCut(prim.PrimData.ProfileBegin);
|
ProfileBegin = Primitive.PackBeginCut(prim.PrimData.ProfileBegin);
|
||||||
ProfileEnd = Primitive.PackEndCut(prim.PrimData.ProfileEnd);
|
ProfileEnd = Primitive.PackEndCut(prim.PrimData.ProfileEnd);
|
||||||
Scale = prim.Scale;
|
Scale = prim.Scale;
|
||||||
PathCurve = (byte)prim.PrimData.PathCurve;
|
PathCurve = (byte)prim.PrimData.PathCurve;
|
||||||
ProfileCurve = (byte)prim.PrimData.ProfileCurve;
|
ProfileCurve = (byte)prim.PrimData.ProfileCurve;
|
||||||
ProfileHollow = Primitive.PackProfileHollow(prim.PrimData.ProfileHollow);
|
ProfileHollow = Primitive.PackProfileHollow(prim.PrimData.ProfileHollow);
|
||||||
PathRadiusOffset = Primitive.PackPathTwist(prim.PrimData.PathRadiusOffset);
|
PathRadiusOffset = Primitive.PackPathTwist(prim.PrimData.PathRadiusOffset);
|
||||||
PathRevolutions = Primitive.PackPathRevolutions(prim.PrimData.PathRevolutions);
|
PathRevolutions = Primitive.PackPathRevolutions(prim.PrimData.PathRevolutions);
|
||||||
PathTaperX = Primitive.PackPathTaper(prim.PrimData.PathTaperX);
|
PathTaperX = Primitive.PackPathTaper(prim.PrimData.PathTaperX);
|
||||||
PathTaperY = Primitive.PackPathTaper(prim.PrimData.PathTaperY);
|
PathTaperY = Primitive.PackPathTaper(prim.PrimData.PathTaperY);
|
||||||
PathTwist = Primitive.PackPathTwist(prim.PrimData.PathTwist);
|
PathTwist = Primitive.PackPathTwist(prim.PrimData.PathTwist);
|
||||||
PathTwistBegin = Primitive.PackPathTwist(prim.PrimData.PathTwistBegin);
|
PathTwistBegin = Primitive.PackPathTwist(prim.PrimData.PathTwistBegin);
|
||||||
|
|
||||||
m_textureEntry = prim.Textures.GetBytes();
|
m_textureEntry = prim.Textures.GetBytes();
|
||||||
|
|
||||||
SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None);
|
SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None);
|
||||||
SculptData = prim.Sculpt.GetBytes();
|
SculptData = prim.Sculpt.GetBytes();
|
||||||
SculptTexture = prim.Sculpt.SculptTexture;
|
SculptTexture = prim.Sculpt.SculptTexture;
|
||||||
SculptType = (byte)prim.Sculpt.Type;
|
SculptType = (byte)prim.Sculpt.Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
|
|
|
@ -566,52 +566,64 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
if (!m_Friends.ContainsKey(remoteClient.AgentId))
|
if (!m_Friends.ContainsKey(remoteClient.AgentId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
|
||||||
|
// Let's find the friend in this user's friend list
|
||||||
UserFriendData fd = m_Friends[remoteClient.AgentId];
|
UserFriendData fd = m_Friends[remoteClient.AgentId];
|
||||||
|
FriendInfo friend = new FriendInfo();
|
||||||
FriendsService.StoreFriend(requester, target.ToString(), rights);
|
|
||||||
|
|
||||||
foreach (FriendInfo fi in fd.Friends)
|
foreach (FriendInfo fi in fd.Friends)
|
||||||
{
|
|
||||||
if (fi.Friend == target.ToString())
|
if (fi.Friend == target.ToString())
|
||||||
{
|
friend = fi;
|
||||||
IClientAPI friendClient = LocateClientObject(target);
|
|
||||||
|
|
||||||
int delta = rights ^ fi.MyFlags;
|
if (!friend.PrincipalID.Equals(UUID.Zero)) // Found it
|
||||||
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 friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
|
||||||
if (friendSession != null)
|
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
FriendsService.StoreFriend(requester, target.ToString(), rights);
|
||||||
// TODO: You might want to send the delta to save the lookup
|
|
||||||
// on the other end!!
|
bool onlineBitChanged = ((rights ^ friend.MyFlags) & (int)FriendRights.CanSeeOnline) == 0;
|
||||||
m_FriendsSimConnector.GrantRights(region, requester, target);
|
if (!onlineBitChanged)
|
||||||
|
{
|
||||||
|
remoteClient.SendChangeUserRights(requester, target, rights);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try local
|
||||||
|
if (LocalGrantRights(requester, target, friend.MyFlags, rights))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
//int delta = rights ^ friend.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 friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
||||||
|
if (friendSession != null)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,10 +693,53 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LocalGrantRights()
|
public bool LocalGrantRights(UUID userID, UUID friendID, int myFlags, int rights)
|
||||||
{
|
{
|
||||||
// TODO
|
m_log.DebugFormat("XXX Trying to locate {0}", friendID);
|
||||||
return true;
|
IClientAPI friendClient = LocateClientObject(friendID);
|
||||||
|
if (friendClient != null)
|
||||||
|
{
|
||||||
|
bool onlineBitChanged = ((rights ^ myFlags) & (int)FriendRights.CanSeeOnline) == 0;
|
||||||
|
if (!onlineBitChanged)
|
||||||
|
friendClient.SendChangeUserRights(userID, friendID, rights);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((rights & (int)FriendRights.CanSeeOnline) == 1)
|
||||||
|
friendClient.SendAgentOnline(new UUID[] { new UUID(userID) });
|
||||||
|
else
|
||||||
|
friendClient.SendAgentOffline(new UUID[] { new UUID(userID) });
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//int delta = rights ^ friend.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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
|
public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
|
||||||
|
|
|
@ -34,6 +34,7 @@ using System.Xml;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -205,7 +206,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
if (!UUID.TryParse(request["ToID"].ToString(), out toID))
|
if (!UUID.TryParse(request["ToID"].ToString(), out toID))
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
if (m_FriendsModule.LocalGrantRights(/* ??? */))
|
// !!!
|
||||||
|
if (m_FriendsModule.LocalGrantRights(UUID.Zero, UUID.Zero, 0, 0))
|
||||||
return SuccessResult();
|
return SuccessResult();
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
Loading…
Reference in New Issue