From f9137c923bcdc952efe37c7dd328c2d0d8323317 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 17 Dec 2011 02:23:24 +0000
Subject: 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
---
OpenSim/Framework/ISceneEntity.cs | 1 +
OpenSim/Framework/ISceneObject.cs | 6 +++++
.../World/Permissions/PermissionsModule.cs | 12 +++++++---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 14 -----------
.../Region/Framework/Scenes/SceneObjectGroup.cs | 2 ++
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++
.../Avatar/XmlRpcGroups/GroupsModule.cs | 27 +++++++++++++++++++++-
8 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/OpenSim/Framework/ISceneEntity.cs b/OpenSim/Framework/ISceneEntity.cs
index c0ea302..a9f21d2 100644
--- a/OpenSim/Framework/ISceneEntity.cs
+++ b/OpenSim/Framework/ISceneEntity.cs
@@ -34,6 +34,7 @@ namespace OpenSim.Framework
string Name { get; set; }
UUID UUID { get; }
uint LocalId { get; }
+
Vector3 AbsolutePosition { get; }
}
}
diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs
index 18631f1..afac9b8 100644
--- a/OpenSim/Framework/ISceneObject.cs
+++ b/OpenSim/Framework/ISceneObject.cs
@@ -33,6 +33,12 @@ namespace OpenSim.Framework
public interface ISceneObject
{
UUID UUID { get; }
+
+ ///
+ /// The owner of this object.
+ ///
+ UUID OwnerID { get; set; }
+
ISceneObject CloneForNewScene();
string ToXml2();
string ExtraToXmlString();
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 7760382..cdecd2f 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -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)
+
+ ///
+ /// 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)
+ ///
+ ///
+ ///
+ ///
+ ///
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
{
if (null == m_groupsModule)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b43b227..4914d65 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2776,7 +2776,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;
@@ -2903,7 +2902,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;
@@ -4287,7 +4285,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Get a scene object group that contains the prim with the given local id
///
///
- /// null if no scene object group containing that prim is found
+ /// null if no scene object group containing that prim is found
public SceneObjectGroup GetGroupByPrim(uint localID)
{
return m_sceneGraph.GetGroupByPrim(localID);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index af95c28..a3e4b46 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -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)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 7bf8c34..abea788 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3211,6 +3211,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();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 598b310..b29ecc6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3344,6 +3344,11 @@ namespace OpenSim.Region.Framework.Scenes
public void SetGroup(UUID groupID, IClientAPI client)
{
+ // 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);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 8baeaa4..9969a15 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -218,6 +218,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;
@@ -225,7 +226,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);
}
@@ -328,6 +329,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);
--
cgit v1.1