Browse Source

replace recent IModule.GetGroup() with better GetGroupRecord(string name)

Justin Clark-Casey (justincc) 14 years ago
parent
commit
87fe96ae2c

+ 2 - 2
OpenSim/Data/Null/NullRegionData.cs

@@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
     {
         private static NullRegionData Instance = null;
 
-        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+//        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
         Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>();
 
@@ -192,4 +192,4 @@ namespace OpenSim.Data.Null
             return ret;
         }
     }
-}
+}

+ 0 - 2
OpenSim/Framework/GroupData.cs

@@ -48,7 +48,6 @@ namespace OpenSim.Framework
     public class GroupMembershipData
     {
         // Group base data
-        //
         public UUID GroupID;
         public string GroupName;
         public bool AllowPublish = true;
@@ -61,7 +60,6 @@ namespace OpenSim.Framework
         public bool ShowInList = true;
 
         // Per user data
-        //
         public bool AcceptNotices = true;
         public int Contribution = 0;
         public ulong GroupPowers = 0;

+ 10 - 4
OpenSim/Region/Framework/Interfaces/IGroupsModule.cs

@@ -55,11 +55,18 @@ namespace OpenSim.Region.Framework.Interfaces
             bool openEnrollment, bool allowPublish, bool maturePublish);
 
         /// <summary>
-        /// Get a group given its name
+        /// Get a group
         /// </summary>
-        /// <param name="name"></param>
+        /// <param name="name">Name of the group</param>
         /// <returns>The group's data.  Null if there is no such group.</returns>
-        DirGroupsReplyData? GetGroup(string name);
+        GroupRecord GetGroupRecord(string name);
+
+        /// <summary>
+        /// Get a group
+        /// </summary>
+        /// <param name="GroupID">ID of the group</param>
+        /// <returns>The group's data.  Null if there is no such group.</returns>        
+        GroupRecord GetGroupRecord(UUID GroupID);
         
         void ActivateGroup(IClientAPI remoteClient, UUID groupID);
         List<GroupTitlesData> GroupTitlesRequest(IClientAPI remoteClient, UUID groupID);
@@ -87,7 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces
         void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID);
         void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID);
         void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID);
-        GroupRecord GetGroupRecord(UUID GroupID);
         void NotifyChange(UUID GroupID);
     }
 }

+ 26 - 20
OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs

@@ -365,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             SendScenePresenceUpdate(dataForAgentID, activeGroupTitle);
         }
 
-        private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remoteClient)
+        private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
         {
             if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
 
@@ -595,6 +595,31 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             return m_groupData.GetGroupRecord(null, GroupID, null);
         }
 
+        public GroupRecord GetGroupRecord(string name)
+        {
+            if (m_debugEnabled) 
+                m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
+
+            // XXX: Two call implementation.  This could be done in a single call if the server itself were to
+            // implement the code below.
+
+            List<DirGroupsReplyData> groups = m_groupData.FindGroups(null, name);
+
+            DirGroupsReplyData? foundGroup = null;
+            
+            foreach (DirGroupsReplyData group in groups)
+            {
+                // We must have an exact match - I believe FindGroups will return partial matches
+                if (group.groupName == name)
+                    foundGroup = group;
+            }            
+
+            if (null == foundGroup)
+                return null;
+
+            return GetGroupRecord(((DirGroupsReplyData)foundGroup).groupID);
+        }
+        
         public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
         {
             if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -768,25 +793,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             return groupID;
         }
 
-        public DirGroupsReplyData? GetGroup(string name)
-        {
-            if (m_debugEnabled) 
-                m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
-
-            List<DirGroupsReplyData> groups = m_groupData.FindGroups(null, name);
-
-            DirGroupsReplyData? foundGroup = null;
-            
-            foreach (DirGroupsReplyData group in groups)
-            {
-                // We must have an exact match - I believe FindGroups will return partial matches
-                if (group.groupName == name)
-                    foundGroup = group;
-            }            
-
-            return foundGroup;
-        }
-
         public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID groupID)
         {
             if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

+ 0 - 3
OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs

@@ -352,11 +352,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
 
             return MemberGroupProfile;
-
         }
 
-
-
         public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID)
         {
             Hashtable param = new Hashtable();