diff options
author | Michael Cortez | 2009-08-05 11:15:53 -0700 |
---|---|---|
committer | Michael Cortez | 2009-08-05 11:15:53 -0700 |
commit | 989517725d02d8a2d216e599856eb2625b454e25 (patch) | |
tree | 74f31eac6e685361ff5d469cdc6992158964666f | |
parent | force back the Regions directory, which because it was empty in svn never made (diff) | |
download | opensim-SC_OLD-989517725d02d8a2d216e599856eb2625b454e25.zip opensim-SC_OLD-989517725d02d8a2d216e599856eb2625b454e25.tar.gz opensim-SC_OLD-989517725d02d8a2d216e599856eb2625b454e25.tar.bz2 opensim-SC_OLD-989517725d02d8a2d216e599856eb2625b454e25.tar.xz |
Begin refactoring XmlRpcGroups to a more generic Groups module that allows for replaceable Groups Service Connectors.
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs (renamed from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs (renamed from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs) | 28 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs (renamed from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs (renamed from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs) | 275 |
4 files changed, 201 insertions, 106 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 4095041..8fbda28 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; | |||
46 | 46 | ||
47 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 47 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
48 | { | 48 | { |
49 | public class XmlRpcGroupsMessaging : ISharedRegionModule | 49 | public class GroupsMessagingModule : ISharedRegionModule |
50 | { | 50 | { |
51 | 51 | ||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | 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 index 2cbc571..f0e386b 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; | |||
49 | 49 | ||
50 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 50 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
51 | { | 51 | { |
52 | public class XmlRpcGroupsModule : ISharedRegionModule, IGroupsModule | 52 | public class GroupsModule : ISharedRegionModule, IGroupsModule |
53 | { | 53 | { |
54 | /// <summary> | 54 | /// <summary> |
55 | /// ; To use this module, you must specify the following in your OpenSim.ini | 55 | /// ; To use this module, you must specify the following in your OpenSim.ini |
@@ -78,7 +78,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
78 | 78 | ||
79 | private IMessageTransferModule m_msgTransferModule = null; | 79 | private IMessageTransferModule m_msgTransferModule = null; |
80 | 80 | ||
81 | private IGroupDataProvider m_groupData = null; | 81 | private IGroupsServicesConnector m_groupData = null; |
82 | 82 | ||
83 | class GroupRequestIDInfo | 83 | class GroupRequestIDInfo |
84 | { | 84 | { |
@@ -91,7 +91,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
91 | 91 | ||
92 | 92 | ||
93 | // Configuration settings | 93 | // Configuration settings |
94 | private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php"; | ||
95 | private bool m_groupsEnabled = false; | 94 | private bool m_groupsEnabled = false; |
96 | private bool m_groupNoticesEnabled = true; | 95 | private bool m_groupNoticesEnabled = true; |
97 | private bool m_debugEnabled = true; | 96 | private bool m_debugEnabled = true; |
@@ -124,15 +123,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
124 | 123 | ||
125 | m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name); | 124 | m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name); |
126 | 125 | ||
127 | string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); | ||
128 | bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); | ||
129 | |||
130 | string ServiceReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | ||
131 | string ServiceWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | ||
132 | |||
133 | m_groupData = new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive, ServiceReadKey, ServiceWriteKey); | ||
134 | m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL); | ||
135 | |||
136 | m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); | 126 | m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); |
137 | m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); | 127 | m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); |
138 | 128 | ||
@@ -172,6 +162,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
172 | 162 | ||
173 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 163 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
174 | 164 | ||
165 | if (m_groupData == null) | ||
166 | { | ||
167 | m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>(); | ||
168 | |||
169 | // No Groups Service Connector, then nothing works... | ||
170 | if (m_groupData == null) | ||
171 | { | ||
172 | m_groupsEnabled = false; | ||
173 | m_log.Error("[GROUPS]: Could not get IGroupsServicesConnector"); | ||
174 | Close(); | ||
175 | return; | ||
176 | } | ||
177 | } | ||
178 | |||
175 | if (m_msgTransferModule == null) | 179 | if (m_msgTransferModule == null) |
176 | { | 180 | { |
177 | m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); | 181 | m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 302be4a..9e0fa2d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs | |||
@@ -34,7 +34,7 @@ using OpenSim.Framework; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 35 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
36 | { | 36 | { |
37 | interface IGroupDataProvider | 37 | interface IGroupsServicesConnector |
38 | { | 38 | { |
39 | UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); | 39 | UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); |
40 | void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); | 40 | 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 index 1d4cde5..03fe109 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -29,27 +29,25 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | //using System.Text; | ||
33 | 32 | ||
34 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
35 | 34 | ||
36 | using log4net; | 35 | using log4net; |
37 | // using Nini.Config; | 36 | using Nini.Config; |
38 | 37 | ||
39 | using OpenMetaverse; | 38 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | 39 | using OpenMetaverse.StructuredData; |
41 | 40 | ||
42 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
43 | //using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
44 | 43 | ||
45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 44 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
46 | { | 45 | { |
47 | public class XmlRpcGroupDataProvider : IGroupDataProvider | 46 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector |
48 | { | 47 | { |
49 | private static readonly ILog m_log = | 48 | private static readonly ILog m_log = |
50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 50 | ||
52 | private string m_serviceURL = string.Empty; | ||
53 | 51 | ||
54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 52 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | |
55 | GroupPowers.Accountable | | 53 | GroupPowers.Accountable | |
@@ -59,26 +57,108 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
59 | GroupPowers.StartProposal | | 57 | GroupPowers.StartProposal | |
60 | GroupPowers.VoteOnProposal; | 58 | GroupPowers.VoteOnProposal; |
61 | 59 | ||
60 | private bool m_connectorEnabled = false; | ||
61 | |||
62 | private string m_serviceURL = string.Empty; | ||
63 | |||
62 | private bool m_disableKeepAlive = false; | 64 | private bool m_disableKeepAlive = false; |
63 | 65 | ||
64 | private string m_groupReadKey = string.Empty; | 66 | private string m_groupReadKey = string.Empty; |
65 | private string m_groupWriteKey = string.Empty; | 67 | private string m_groupWriteKey = string.Empty; |
66 | 68 | ||
67 | public XmlRpcGroupDataProvider(string serviceURL, bool disableKeepAlive, string groupReadKey, string groupWriteKey) | 69 | |
70 | #region IRegionModuleBase Members | ||
71 | |||
72 | public string Name | ||
73 | { | ||
74 | get { return "XmlRpcGroupsServicesConnector"; } | ||
75 | } | ||
76 | |||
77 | // this module is not intended to be replaced, but there should only be 1 of them. | ||
78 | public Type ReplacableInterface | ||
68 | { | 79 | { |
69 | m_serviceURL = serviceURL.Trim(); | 80 | get { return null; } |
70 | m_disableKeepAlive = disableKeepAlive; | 81 | } |
71 | 82 | ||
72 | if ((serviceURL == null) || | 83 | public void Initialise(IConfigSource config) |
73 | (serviceURL == string.Empty)) | 84 | { |
85 | IConfig groupsConfig = config.Configs["Groups"]; | ||
86 | |||
87 | if (groupsConfig == null) | ||
74 | { | 88 | { |
75 | throw new Exception("Please specify a valid ServiceURL for XmlRpcGroupDataProvider in OpenSim.ini, [Groups], XmlRpcServiceURL"); | 89 | // Do not run this module by default. |
90 | return; | ||
76 | } | 91 | } |
92 | else | ||
93 | { | ||
94 | // if groups aren't enabled, we're not needed. | ||
95 | // if we're not specified as the connector to use, then we're not wanted | ||
96 | if ( (groupsConfig.GetBoolean("Enabled", false) == false) | ||
97 | || (groupsConfig.GetString("GroupsServicesConnectorModule", "Default") != Name)) | ||
98 | { | ||
99 | m_connectorEnabled = false; | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); | ||
104 | |||
105 | m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); | ||
106 | if ((m_serviceURL == null) || | ||
107 | (m_serviceURL == string.Empty)) | ||
108 | { | ||
109 | m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); | ||
110 | m_connectorEnabled = false; | ||
111 | return; | ||
112 | } | ||
113 | |||
114 | m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); | ||
77 | 115 | ||
78 | m_groupReadKey = groupReadKey; | 116 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
79 | m_groupWriteKey = groupWriteKey; | 117 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
118 | |||
119 | // If we got all the config options we need, lets start'er'up | ||
120 | m_connectorEnabled = true; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | public void Close() | ||
125 | { | ||
126 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name); | ||
80 | } | 127 | } |
81 | 128 | ||
129 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | ||
130 | { | ||
131 | if (m_connectorEnabled) | ||
132 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | ||
133 | } | ||
134 | |||
135 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | ||
136 | { | ||
137 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | ||
138 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | ||
139 | } | ||
140 | |||
141 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | ||
142 | { | ||
143 | // TODO: May want to consider listenning for Agent Connections so we can pre-cache group info | ||
144 | // scene.EventManager.OnNewClient += OnNewClient; | ||
145 | } | ||
146 | |||
147 | #endregion | ||
148 | |||
149 | #region ISharedRegionModule Members | ||
150 | |||
151 | public void PostInitialise() | ||
152 | { | ||
153 | // NoOp | ||
154 | } | ||
155 | |||
156 | #endregion | ||
157 | |||
158 | |||
159 | |||
160 | #region IGroupsServicesConnector Members | ||
161 | |||
82 | /// <summary> | 162 | /// <summary> |
83 | /// 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. | 163 | /// 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. |
84 | /// </summary> | 164 | /// </summary> |
@@ -275,53 +355,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
275 | 355 | ||
276 | } | 356 | } |
277 | 357 | ||
278 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) | ||
279 | { | ||
280 | GroupProfileData group = new GroupProfileData(); | ||
281 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | ||
282 | group.Name = (string)groupProfile["Name"]; | ||
283 | 358 | ||
284 | if (groupProfile["Charter"] != null) | ||
285 | { | ||
286 | group.Charter = (string)groupProfile["Charter"]; | ||
287 | } | ||
288 | |||
289 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | ||
290 | group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); | ||
291 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | ||
292 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | ||
293 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | ||
294 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | ||
295 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | ||
296 | group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); | ||
297 | |||
298 | group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); | ||
299 | group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); | ||
300 | |||
301 | return group; | ||
302 | } | ||
303 | |||
304 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | ||
305 | { | ||
306 | |||
307 | GroupRecord group = new GroupRecord(); | ||
308 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | ||
309 | group.GroupName = groupProfile["Name"].ToString(); | ||
310 | if (groupProfile["Charter"] != null) | ||
311 | { | ||
312 | group.Charter = (string)groupProfile["Charter"]; | ||
313 | } | ||
314 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | ||
315 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); | ||
316 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | ||
317 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | ||
318 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | ||
319 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | ||
320 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | ||
321 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); | ||
322 | |||
323 | return group; | ||
324 | } | ||
325 | 359 | ||
326 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 360 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) |
327 | { | 361 | { |
@@ -579,40 +613,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
579 | 613 | ||
580 | } | 614 | } |
581 | 615 | ||
582 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | ||
583 | { | ||
584 | GroupMembershipData data = new GroupMembershipData(); | ||
585 | data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); | ||
586 | data.Contribution = int.Parse((string)respData["Contribution"]); | ||
587 | data.ListInProfile = ((string)respData["ListInProfile"] == "1"); | ||
588 | |||
589 | data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); | ||
590 | data.GroupTitle = (string)respData["Title"]; | ||
591 | 616 | ||
592 | data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); | ||
593 | |||
594 | // Is this group the agent's active group | ||
595 | |||
596 | data.GroupID = new UUID((string)respData["GroupID"]); | ||
597 | |||
598 | UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); | ||
599 | data.Active = data.GroupID.Equals(ActiveGroup); | ||
600 | |||
601 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); | ||
602 | if (respData["Charter"] != null) | ||
603 | { | ||
604 | data.Charter = (string)respData["Charter"]; | ||
605 | } | ||
606 | data.FounderID = new UUID((string)respData["FounderID"]); | ||
607 | data.GroupID = new UUID((string)respData["GroupID"]); | ||
608 | data.GroupName = (string)respData["GroupName"]; | ||
609 | data.GroupPicture = new UUID((string)respData["InsigniaID"]); | ||
610 | data.MaturePublish = ((string)respData["MaturePublish"] == "1"); | ||
611 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | ||
612 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | ||
613 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | ||
614 | return data; | ||
615 | } | ||
616 | 617 | ||
617 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) | 618 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) |
618 | { | 619 | { |
@@ -744,7 +745,96 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
744 | 745 | ||
745 | XmlRpcCall(requestID, "groups.addGroupNotice", param); | 746 | XmlRpcCall(requestID, "groups.addGroupNotice", param); |
746 | } | 747 | } |
748 | #endregion | ||
749 | |||
750 | #region XmlRpcHashtableMarshalling | ||
751 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) | ||
752 | { | ||
753 | GroupProfileData group = new GroupProfileData(); | ||
754 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | ||
755 | group.Name = (string)groupProfile["Name"]; | ||
756 | |||
757 | if (groupProfile["Charter"] != null) | ||
758 | { | ||
759 | group.Charter = (string)groupProfile["Charter"]; | ||
760 | } | ||
761 | |||
762 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | ||
763 | group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); | ||
764 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | ||
765 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | ||
766 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | ||
767 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | ||
768 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | ||
769 | group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); | ||
770 | |||
771 | group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); | ||
772 | group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); | ||
773 | |||
774 | return group; | ||
775 | } | ||
776 | |||
777 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | ||
778 | { | ||
779 | |||
780 | GroupRecord group = new GroupRecord(); | ||
781 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | ||
782 | group.GroupName = groupProfile["Name"].ToString(); | ||
783 | if (groupProfile["Charter"] != null) | ||
784 | { | ||
785 | group.Charter = (string)groupProfile["Charter"]; | ||
786 | } | ||
787 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | ||
788 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); | ||
789 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | ||
790 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | ||
791 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | ||
792 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | ||
793 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | ||
794 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); | ||
795 | |||
796 | return group; | ||
797 | } | ||
798 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | ||
799 | { | ||
800 | GroupMembershipData data = new GroupMembershipData(); | ||
801 | data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); | ||
802 | data.Contribution = int.Parse((string)respData["Contribution"]); | ||
803 | data.ListInProfile = ((string)respData["ListInProfile"] == "1"); | ||
804 | |||
805 | data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); | ||
806 | data.GroupTitle = (string)respData["Title"]; | ||
807 | |||
808 | data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); | ||
809 | |||
810 | // Is this group the agent's active group | ||
811 | |||
812 | data.GroupID = new UUID((string)respData["GroupID"]); | ||
813 | |||
814 | UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); | ||
815 | data.Active = data.GroupID.Equals(ActiveGroup); | ||
816 | |||
817 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); | ||
818 | if (respData["Charter"] != null) | ||
819 | { | ||
820 | data.Charter = (string)respData["Charter"]; | ||
821 | } | ||
822 | data.FounderID = new UUID((string)respData["FounderID"]); | ||
823 | data.GroupID = new UUID((string)respData["GroupID"]); | ||
824 | data.GroupName = (string)respData["GroupName"]; | ||
825 | data.GroupPicture = new UUID((string)respData["InsigniaID"]); | ||
826 | data.MaturePublish = ((string)respData["MaturePublish"] == "1"); | ||
827 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | ||
828 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | ||
829 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | ||
830 | return data; | ||
831 | } | ||
832 | |||
833 | #endregion | ||
747 | 834 | ||
835 | /// <summary> | ||
836 | /// Encapsulate the XmlRpc call to standardize security and error handling. | ||
837 | /// </summary> | ||
748 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) | 838 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) |
749 | { | 839 | { |
750 | if (requestID == null) | 840 | if (requestID == null) |
@@ -846,6 +936,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
846 | } | 936 | } |
847 | } | 937 | } |
848 | 938 | ||
939 | |||
849 | } | 940 | } |
850 | 941 | ||
851 | public class GroupNoticeInfo | 942 | public class GroupNoticeInfo |