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 +++---
2 files changed, 44 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
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)
{
--
cgit v1.1