Fix bug where objects could not be set to a new group if the group had been created in that client session, or if no other action has been performed on the object.

There were two problems here:
1) On object group update, we looked for the group is the IClientAPI group cache rather than in the groups service.  This fails to groups created newly in that session
2) On object group update, we weren't setting the HasGroupChanged flag.  This meant that the change was not persisted unless some other action set this flag.
This commit fixes these issues and hopefully addresses http://opensimulator.org/mantis/view.php?id=5588
This commit also moves HandleObjectGroupUpdate() to the GroupsModule from the Scene.PacketHandlers.cs file
0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-12-17 02:23:24 +00:00
parent 7d426debd3
commit 67a2d6d855
8 changed files with 52 additions and 22 deletions

View File

@ -34,6 +34,7 @@ namespace OpenSim.Framework
string Name { get; set; }
UUID UUID { get; }
uint LocalId { get; }
Vector3 AbsolutePosition { get; }
}
}

View File

@ -33,6 +33,12 @@ namespace OpenSim.Framework
public interface ISceneObject
{
UUID UUID { get; }
/// <summary>
/// The owner of this object.
/// </summary>
UUID OwnerID { get; set; }
ISceneObject CloneForNewScene();
string ToXml2();
string ExtraToXmlString();

View File

@ -384,9 +384,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_debugPermissions)
m_log.Debug("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName);
}
// Checks if the given group is active and if the user is a group member
// with the powers requested (powers = 0 for no powers check)
/// <summary>
/// Checks if the given group is active and if the user is a group member
/// with the powers requested (powers = 0 for no powers check)
/// </summary>
/// <param name="groupID"></param>
/// <param name="userID"></param>
/// <param name="powers"></param>
/// <returns></returns>
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
{
if (null == m_groupsModule)

View File

@ -2757,7 +2757,6 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientParcelEvents(IClientAPI client)
{
client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate;
client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel;
client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime;
client.OnParcelBuy += ProcessParcelBuy;
@ -2884,7 +2883,6 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientParcelEvents(IClientAPI client)
{
client.OnObjectGroupRequest -= m_sceneGraph.HandleObjectGroupUpdate;
client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel;
client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime;
client.OnParcelBuy -= ProcessParcelBuy;
@ -4307,7 +4305,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Get a scene object group that contains the prim with the given local id
/// </summary>
/// <param name="localID"></param>
/// <returns>null if no scene object group containing that prim is found</returns>
/// <returns>null if no scene object group containing that prim is found</returns>
public SceneObjectGroup GetGroupByPrim(uint localID)
{
return m_sceneGraph.GetGroupByPrim(localID);

View File

@ -575,20 +575,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected internal void HandleObjectGroupUpdate(
IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
{
if (!remoteClient.IsGroupMember(GroupID))
return;
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
if (group != null)
{
if (group.OwnerID == remoteClient.AgentId)
group.SetGroup(GroupID, remoteClient);
}
}
protected internal ScenePresence CreateAndAddChildScenePresence(
IClientAPI client, AvatarAppearance appearance, PresenceType type)
{

View File

@ -3269,6 +3269,8 @@ namespace OpenSim.Region.Framework.Scenes
part.Inventory.ChangeInventoryGroup(GroupID);
}
HasGroupChanged = true;
// Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
// for the same object with very different properties. The caller must schedule the update.
//ScheduleGroupForFullUpdate();

View File

@ -3386,7 +3386,13 @@ namespace OpenSim.Region.Framework.Scenes
public void SetGroup(UUID groupID, IClientAPI client)
{
_groupID = groupID;
// Scene.AddNewPrims() calls with client == null so can't use this.
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Setting group for {0} to {1} for {2}",
// Name, groupID, OwnerID);
GroupID = groupID;
if (client != null)
SendPropertiesToClient(client);
m_updateFlag = 2;

View File

@ -225,6 +225,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
client.OnObjectGroupRequest += HandleObjectGroupUpdate;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnDirFindQuery += OnDirFindQuery;
client.OnRequestAvatarProperties += OnRequestAvatarProperties;
@ -232,7 +233,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Used for Notices and Group Invites/Accept/Reject
client.OnInstantMessage += OnInstantMessage;
// Send client thier groups information.
// Send client their groups information.
SendAgentGroupDataUpdate(client, client.AgentId);
}
@ -335,6 +336,30 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
remoteClient.SendGroupNameReply(GroupID, GroupName);
}
private void HandleObjectGroupUpdate(
IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
{
GroupMembershipData gmd = GetMembershipData(GroupID, remoteClient.AgentId);
if (gmd == null)
{
// m_log.WarnFormat(
// "[GROUPS]: User {0} is not a member of group {1} so they can't update {2} to this group",
// remoteClient.Name, GroupID, objectLocalID);
return;
}
SceneObjectGroup so = ((Scene)remoteClient.Scene).GetGroupByPrim(objectLocalID);
if (so != null)
{
if (so.OwnerID == remoteClient.AgentId)
{
so.SetGroup(GroupID, remoteClient);
}
}
}
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
{
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);