From 87a2d8d51b66db12a487014deb8447fb2432e2a3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 23:03:45 +0000 Subject: Move HandleObjectGroupUpdate() from GroupsModule to Scene.PacketHandlers.cs as this is updating SOG/SOP.GroupID, which is arguably generic. --- .../Framework/Scenes/Scene.PacketHandlers.cs | 39 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 11 +++--- .../Avatar/XmlRpcGroups/GroupsModule.cs | 30 ----------------- 3 files changed, 44 insertions(+), 36 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index f9d0e0a..3355ebe 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -154,6 +154,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 4914d65..6666328 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -139,6 +139,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 @@ -1164,6 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes m_dialogModule = RequestModuleInterface(); m_capsModule = RequestModuleInterface(); m_teleportModule = RequestModuleInterface(); + m_groupsModule = RequestModuleInterface(); } #endregion @@ -2733,6 +2735,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) @@ -3520,15 +3523,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 e959821..740dbdd 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); -- cgit v1.1