From 989517725d02d8a2d216e599856eb2625b454e25 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 5 Aug 2009 11:15:53 -0700 Subject: [PATCH 1/4] Begin refactoring XmlRpcGroups to a more generic Groups module that allows for replaceable Groups Service Connectors. --- ...sMessaging.cs => GroupsMessagingModule.cs} | 2 +- ...{XmlRpcGroupsModule.cs => GroupsModule.cs} | 28 +- ...rovider.cs => IGroupsServicesConnector.cs} | 2 +- ...=> XmlRpcGroupsServicesConnectorModule.cs} | 283 ++++++++++++------ 4 files changed, 205 insertions(+), 110 deletions(-) rename OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/{XmlRpcGroupsMessaging.cs => GroupsMessagingModule.cs} (99%) rename OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/{XmlRpcGroupsModule.cs => GroupsModule.cs} (98%) rename OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/{IGroupDataProvider.cs => IGroupsServicesConnector.cs} (99%) rename OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/{XmlRpcGroupData.cs => XmlRpcGroupsServicesConnectorModule.cs} (91%) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs similarity index 99% rename from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs rename to OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 4095041d13..8fbda28b94 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -46,7 +46,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - public class XmlRpcGroupsMessaging : ISharedRegionModule + public class GroupsMessagingModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs similarity index 98% rename from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs rename to OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 2cbc571aed..f0e386b7e4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -49,7 +49,7 @@ using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - public class XmlRpcGroupsModule : ISharedRegionModule, IGroupsModule + public class GroupsModule : ISharedRegionModule, IGroupsModule { /// /// ; To use this module, you must specify the following in your OpenSim.ini @@ -78,7 +78,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private IMessageTransferModule m_msgTransferModule = null; - private IGroupDataProvider m_groupData = null; + private IGroupsServicesConnector m_groupData = null; class GroupRequestIDInfo { @@ -91,7 +91,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Configuration settings - private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php"; private bool m_groupsEnabled = false; private bool m_groupNoticesEnabled = true; private bool m_debugEnabled = true; @@ -124,15 +123,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name); - string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); - bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); - - string ServiceReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); - string ServiceWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); - - m_groupData = new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive, ServiceReadKey, ServiceWriteKey); - m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL); - m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); @@ -172,6 +162,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + if (m_groupData == null) + { + m_groupData = scene.RequestModuleInterface(); + + // No Groups Service Connector, then nothing works... + if (m_groupData == null) + { + m_groupsEnabled = false; + m_log.Error("[GROUPS]: Could not get IGroupsServicesConnector"); + Close(); + return; + } + } + if (m_msgTransferModule == null) { m_msgTransferModule = scene.RequestModuleInterface(); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs similarity index 99% rename from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs rename to OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 302be4a213..9e0fa2de4a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs @@ -34,7 +34,7 @@ using OpenSim.Framework; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - interface IGroupDataProvider + interface IGroupsServicesConnector { UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs similarity index 91% rename from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs rename to OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 1d4cde5ca3..03fe109c30 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -29,27 +29,25 @@ using System; using System.Collections; using System.Collections.Generic; using System.Reflection; -//using System.Text; using Nwc.XmlRpc; using log4net; -// using Nini.Config; +using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -//using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - public class XmlRpcGroupDataProvider : IGroupDataProvider + public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private string m_serviceURL = string.Empty; public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | @@ -59,26 +57,108 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups GroupPowers.StartProposal | GroupPowers.VoteOnProposal; + private bool m_connectorEnabled = false; + + private string m_serviceURL = string.Empty; + private bool m_disableKeepAlive = false; private string m_groupReadKey = string.Empty; private string m_groupWriteKey = string.Empty; - public XmlRpcGroupDataProvider(string serviceURL, bool disableKeepAlive, string groupReadKey, string groupWriteKey) + + #region IRegionModuleBase Members + + public string Name { - m_serviceURL = serviceURL.Trim(); - m_disableKeepAlive = disableKeepAlive; - - if ((serviceURL == null) || - (serviceURL == string.Empty)) - { - throw new Exception("Please specify a valid ServiceURL for XmlRpcGroupDataProvider in OpenSim.ini, [Groups], XmlRpcServiceURL"); - } - - m_groupReadKey = groupReadKey; - m_groupWriteKey = groupWriteKey; + get { return "XmlRpcGroupsServicesConnector"; } } + // this module is not intended to be replaced, but there should only be 1 of them. + public Type ReplacableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource config) + { + IConfig groupsConfig = config.Configs["Groups"]; + + if (groupsConfig == null) + { + // Do not run this module by default. + return; + } + else + { + // if groups aren't enabled, we're not needed. + // if we're not specified as the connector to use, then we're not wanted + if ( (groupsConfig.GetBoolean("Enabled", false) == false) + || (groupsConfig.GetString("GroupsServicesConnectorModule", "Default") != Name)) + { + m_connectorEnabled = false; + return; + } + + m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); + + m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); + if ((m_serviceURL == null) || + (m_serviceURL == string.Empty)) + { + m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); + m_connectorEnabled = false; + return; + } + + m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); + + m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); + m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); + + // If we got all the config options we need, lets start'er'up + m_connectorEnabled = true; + } + } + + public void Close() + { + m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name); + } + + public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) + { + if (m_connectorEnabled) + scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) + { + if (scene.RequestModuleInterface() == this) + scene.UnregisterModuleInterface(this); + } + + public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) + { + // TODO: May want to consider listenning for Agent Connections so we can pre-cache group info + // scene.EventManager.OnNewClient += OnNewClient; + } + + #endregion + + #region ISharedRegionModule Members + + public void PostInitialise() + { + // NoOp + } + + #endregion + + + + #region IGroupsServicesConnector Members + /// /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. /// @@ -275,53 +355,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } - private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) - { - GroupProfileData group = new GroupProfileData(); - group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); - group.Name = (string)groupProfile["Name"]; - if (groupProfile["Charter"] != null) - { - group.Charter = (string)groupProfile["Charter"]; - } - - group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; - group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); - group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); - group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; - group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; - group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; - group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); - group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); - - group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); - group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); - - return group; - } - - private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) - { - - GroupRecord group = new GroupRecord(); - group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); - group.GroupName = groupProfile["Name"].ToString(); - if (groupProfile["Charter"] != null) - { - group.Charter = (string)groupProfile["Charter"]; - } - group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; - group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); - group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); - group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; - group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; - group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; - group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); - group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); - - return group; - } public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) { @@ -579,40 +613,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } - private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) - { - GroupMembershipData data = new GroupMembershipData(); - data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); - data.Contribution = int.Parse((string)respData["Contribution"]); - data.ListInProfile = ((string)respData["ListInProfile"] == "1"); - data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); - data.GroupTitle = (string)respData["Title"]; - - data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); - - // Is this group the agent's active group - - data.GroupID = new UUID((string)respData["GroupID"]); - - UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); - data.Active = data.GroupID.Equals(ActiveGroup); - - data.AllowPublish = ((string)respData["AllowPublish"] == "1"); - if (respData["Charter"] != null) - { - data.Charter = (string)respData["Charter"]; - } - data.FounderID = new UUID((string)respData["FounderID"]); - data.GroupID = new UUID((string)respData["GroupID"]); - data.GroupName = (string)respData["GroupName"]; - data.GroupPicture = new UUID((string)respData["InsigniaID"]); - data.MaturePublish = ((string)respData["MaturePublish"] == "1"); - data.MembershipFee = int.Parse((string)respData["MembershipFee"]); - data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); - data.ShowInList = ((string)respData["ShowInList"] == "1"); - return data; - } public List GetGroupMembers(GroupRequestID requestID, UUID GroupID) { @@ -744,7 +745,96 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups XmlRpcCall(requestID, "groups.addGroupNotice", param); } + #endregion + #region XmlRpcHashtableMarshalling + private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) + { + GroupProfileData group = new GroupProfileData(); + group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); + group.Name = (string)groupProfile["Name"]; + + if (groupProfile["Charter"] != null) + { + group.Charter = (string)groupProfile["Charter"]; + } + + group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; + group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); + group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); + group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; + group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; + group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; + group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); + group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); + + group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); + group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); + + return group; + } + + private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) + { + + GroupRecord group = new GroupRecord(); + group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); + group.GroupName = groupProfile["Name"].ToString(); + if (groupProfile["Charter"] != null) + { + group.Charter = (string)groupProfile["Charter"]; + } + group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; + group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); + group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); + group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; + group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; + group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; + group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); + group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); + + return group; + } + private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) + { + GroupMembershipData data = new GroupMembershipData(); + data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); + data.Contribution = int.Parse((string)respData["Contribution"]); + data.ListInProfile = ((string)respData["ListInProfile"] == "1"); + + data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); + data.GroupTitle = (string)respData["Title"]; + + data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); + + // Is this group the agent's active group + + data.GroupID = new UUID((string)respData["GroupID"]); + + UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); + data.Active = data.GroupID.Equals(ActiveGroup); + + data.AllowPublish = ((string)respData["AllowPublish"] == "1"); + if (respData["Charter"] != null) + { + data.Charter = (string)respData["Charter"]; + } + data.FounderID = new UUID((string)respData["FounderID"]); + data.GroupID = new UUID((string)respData["GroupID"]); + data.GroupName = (string)respData["GroupName"]; + data.GroupPicture = new UUID((string)respData["InsigniaID"]); + data.MaturePublish = ((string)respData["MaturePublish"] == "1"); + data.MembershipFee = int.Parse((string)respData["MembershipFee"]); + data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); + data.ShowInList = ((string)respData["ShowInList"] == "1"); + return data; + } + + #endregion + + /// + /// Encapsulate the XmlRpc call to standardize security and error handling. + /// private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) { if (requestID == null) @@ -846,6 +936,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } } + } public class GroupNoticeInfo From 6c65b990a2b0a7766841e1776fe533a1f1e98203 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 5 Aug 2009 13:20:46 -0700 Subject: [PATCH 2/4] Fixes mono Add-In references for the OptionalModules add-in so that groups doesn't throw errors, and so that the add-in is correctly reported as "OptionalModules" rather then as "SampleMoney" --- .../Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 2 ++ .../Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 2 ++ .../Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 2 ++ .../Region/OptionalModules/Resources/OptionalModules.addin.xml | 2 -- .../OptionalModules/World/MoneyModule/SampleMoneyModule.cs | 3 --- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 8fbda28b94..f7883daa6e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -46,6 +47,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class GroupsMessagingModule : ISharedRegionModule { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index f0e386b7e4..3fd2a85ff4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using System.Timers; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -49,6 +50,7 @@ using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class GroupsModule : ISharedRegionModule, IGroupsModule { /// diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 03fe109c30..80adb9e42a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -33,6 +33,7 @@ using System.Reflection; using Nwc.XmlRpc; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -43,6 +44,7 @@ using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector { private static readonly ILog m_log = diff --git a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml b/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml index 4b7b39d44b..389044e775 100644 --- a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml +++ b/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml @@ -10,8 +10,6 @@ - - diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 5471f9eebe..696f915092 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -41,9 +41,6 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -[assembly: Addin("SampleMoneyModule", "0.1")] -[assembly: AddinDependency("OpenSim", "0.5")] - namespace OpenSim.Region.OptionalModules.World.MoneyModule { /// From c73a6ab7e01efd07f68798de8b402343bef12de4 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 5 Aug 2009 14:56:48 -0700 Subject: [PATCH 3/4] Continue with renaming of Groups module components --- .../XmlRpcGroups/GroupsMessagingModule.cs | 27 ++++++++--------- .../Avatar/XmlRpcGroups/GroupsModule.cs | 27 ++++++++++------- .../XmlRpcGroupsServicesConnectorModule.cs | 2 +- bin/OpenSim.ini.example | 29 ++++++++++++------- 4 files changed, 47 insertions(+), 38 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index f7883daa6e..0bfb8e7a61 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private IGroupsModule m_groupsModule = null; - // TODO: Move this off to the xmlrpc server + // TODO: Move this off to the Groups Server public Dictionary> m_agentsInGroupSession = new Dictionary>(); public Dictionary> m_agentsDroppedSession = new Dictionary>(); @@ -81,31 +81,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } else { - if (!groupsConfig.GetBoolean("Enabled", false)) - { - return; - } - - if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") + // if groups aren't enabled, we're not needed. + // if we're not specified as the connector to use, then we're not wanted + if ((groupsConfig.GetBoolean("Enabled", false) == false) + || (groupsConfig.GetString("MessagingModule", "Default") != Name)) { m_groupMessagingEnabled = false; - return; } - m_groupMessagingEnabled = groupsConfig.GetBoolean("XmlRpcMessagingEnabled", true); + m_groupMessagingEnabled = groupsConfig.GetBoolean("MessagingEnabled", true); if (!m_groupMessagingEnabled) { return; } - m_log.Info("[GROUPS-MESSAGING]: Initializing XmlRpcGroupsMessaging"); + m_log.Info("[GROUPS-MESSAGING]: Initializing GroupsMessagingModule"); - m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); + m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); } - m_log.Info("[GROUPS-MESSAGING]: XmlRpcGroupsMessaging starting up"); + m_log.Info("[GROUPS-MESSAGING]: GroupsMessagingModule starting up"); } @@ -125,7 +122,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // No groups module, no groups messaging if (m_groupsModule == null) { - m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, XmlRpcGroupsMessaging is now disabled."); + m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, GroupsMessagingModule is now disabled."); Close(); m_groupMessagingEnabled = false; return; @@ -165,7 +162,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (!m_groupMessagingEnabled) return; - if (m_debugEnabled) m_log.Debug("[GROUPS-MESSAGING]: Shutting down XmlRpcGroupsMessaging module."); + if (m_debugEnabled) m_log.Debug("[GROUPS-MESSAGING]: Shutting down GroupsMessagingModule module."); foreach (Scene scene in m_sceneList) { @@ -186,7 +183,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public string Name { - get { return "XmlRpcGroupsMessaging"; } + get { return "GroupsMessagingModule"; } } #endregion diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 3fd2a85ff4..5ec8de8fea 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -57,14 +57,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// ; To use this module, you must specify the following in your OpenSim.ini /// [GROUPS] /// Enabled = true - /// Module = XmlRpcGroups - /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php - /// XmlRpcMessagingEnabled = true - /// XmlRpcNoticesEnabled = true - /// XmlRpcDebugEnabled = true - /// XmlRpcServiceReadKey = 1234 + /// + /// GroupsModule = GroupsModule + /// NoticesEnabled = true + /// DebugEnabled = true + /// + /// GroupsServicesConnectorModule = XmlRpcGroupsServicesConnector + /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php + /// XmlRpcServiceReadKey = 1234 /// XmlRpcServiceWriteKey = 1234 /// + /// GroupsMessagingModule = GroupsMessagingModule + /// GroupsMessagingEnabled = true + /// /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for /// ; a problem discovered on some Windows based region servers. Only disable /// ; if you see a large number (dozens) of the following Exceptions: @@ -116,7 +121,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return; } - if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") + if (groupsConfig.GetString("Module", "Default") != Name) { m_groupsEnabled = false; @@ -125,8 +130,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name); - m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); - m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); + m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); + m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut; m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache; @@ -224,7 +229,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (!m_groupsEnabled) return; - if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module."); + if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); m_clientRequestIDFlushTimer.Stop(); } @@ -236,7 +241,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public string Name { - get { return "XmlRpcGroupsModule"; } + get { return "GroupsModule"; } } #endregion diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 80adb9e42a..d77fe5bb76 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // if groups aren't enabled, we're not needed. // if we're not specified as the connector to use, then we're not wanted if ( (groupsConfig.GetBoolean("Enabled", false) == false) - || (groupsConfig.GetString("GroupsServicesConnectorModule", "Default") != Name)) + || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) { m_connectorEnabled = false; return; diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 6ae6a95c50..643b0aff83 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -1271,21 +1271,28 @@ ; The PHP code for the server is available from the Flotsam project for you to deploy ; to your own server. The Flotsam project is located at http://code.google.com/p/flotsam/ ; - ;Module = XmlRpcGroups + ;Module = GroupsModule + + ; Enable Group Notices + ;NoticesEnabled = true - ;XmlRpcServiceURL = http://yourxmlrpcserver.com/xmlrpc.php - ;XmlRpcServiceReadKey = 1234 - ;XmlRpcServiceWriteKey = 1234 + ; This makes the Groups modules very chatty on the console. + ;DebugEnabled = true - ;XmlRpcMessagingEnabled = true - ;XmlRpcNoticesEnabled = true + ; Specify which messaging module to use for groups messaging and if it's enabled + ;MessagingModule = GroupsMessagingModule + ;MessagingEnabled = true - ; This makes the XmlRpcGroups modules very chatty on the console. - ;XmlRpcDebugEnabled = true + ; Service connector to Groups Service [Select One] + ; XmlRpc Service Connector to the Flotsam XmlRpc Groups Service Implementation + ;ServicesConnectorModule = XmlRpcGroupsServicesConnector + ;XmlRpcServiceURL = http://yourxmlrpcserver.com/xmlrpc.php + ;XmlRpcServiceReadKey = 1234 + ;XmlRpcServiceWriteKey = 1234 - ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for - ; a problem discovered on some Windows based region servers. Only disable - ; if you see a large number (dozens) of the following Exceptions: + ; Disables HTTP Keep-Alive for XmlRpcGroupsServicesConnector HTTP Requests, + ; this is a work around fora problem discovered on some Windows based region servers. + ; Only disable keep alive if you see a large number (dozens) of the following Exceptions: ; System.Net.WebException: The request was aborted: The request was canceled. ; ; XmlRpcDisableKeepAlive = false From 6244b8c384790fbd846d6a9014d14096a1223c7b Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Thu, 6 Aug 2009 09:34:30 -0700 Subject: [PATCH 4/4] Fixing comments re: INI file. --- .../OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 5ec8de8fea..725c303edf 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// [GROUPS] /// Enabled = true /// - /// GroupsModule = GroupsModule + /// Module = GroupsModule /// NoticesEnabled = true /// DebugEnabled = true /// @@ -67,8 +67,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// XmlRpcServiceReadKey = 1234 /// XmlRpcServiceWriteKey = 1234 /// - /// GroupsMessagingModule = GroupsMessagingModule - /// GroupsMessagingEnabled = true + /// MessagingModule = GroupsMessagingModule + /// MessagingEnabled = true /// /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for /// ; a problem discovered on some Windows based region servers. Only disable