diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index fd179ba178..bf2e775ebd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -153,6 +153,45 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Handle the update of an object's user group. + /// + /// + /// + /// + /// + private void HandleObjectGroupUpdate( + IClientAPI remoteClient, UUID groupID, uint objectLocalID, UUID Garbage) + { + if (m_groupsModule == null) + return; + + // XXX: Might be better to get rid of this special casing and have GetMembershipData return something + // reasonable for a UUID.Zero group. + if (groupID != UUID.Zero) + { + GroupMembershipData gmd = m_groupsModule.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); + } + } + } + /// /// Handle the deselection of a prim from the client. /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f8487e7c85..c2ba893a0f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -142,6 +142,7 @@ namespace OpenSim.Region.Framework.Scenes protected IDialogModule m_dialogModule; protected IEntityTransferModule m_teleportModule; protected ICapabilitiesModule m_capsModule; + protected IGroupsModule m_groupsModule; /// /// Current scene frame number @@ -1206,6 +1207,7 @@ namespace OpenSim.Region.Framework.Scenes m_dialogModule = RequestModuleInterface(); m_capsModule = RequestModuleInterface(); m_teleportModule = RequestModuleInterface(); + m_groupsModule = RequestModuleInterface(); } #endregion @@ -2856,6 +2858,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnObjectDescription += m_sceneGraph.PrimDescription; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner += ObjectOwner; + client.OnObjectGroupRequest += HandleObjectGroupUpdate; } public virtual void SubscribeToClientPrimRezEvents(IClientAPI client) @@ -3675,15 +3678,11 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!"); } - IGroupsModule groupsModule = - RequestModuleInterface(); - List agentGroups = new List(); - if (groupsModule != null) + if (m_groupsModule != null) { - GroupMembershipData[] GroupMembership = - groupsModule.GetMembershipData(agent.AgentID); + GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); if (GroupMembership != null) { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 8002cb6599..4e214d9b72 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -218,7 +218,6 @@ 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; @@ -329,35 +328,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups remoteClient.SendGroupNameReply(GroupID, GroupName); } - private void HandleObjectGroupUpdate( - IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage) - { - // XXX: Might be better to get rid of this special casing and have GetMembershipData return something - // reasonable for a UUID.Zero group. - if (GroupID != UUID.Zero) - { - 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);