aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs (renamed from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs)31
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs (renamed from OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs)57
-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)277
4 files changed, 235 insertions, 132 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 4095041..0bfb8e7 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31 31
32 32
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35 36
36using OpenMetaverse; 37using OpenMetaverse;
@@ -46,7 +47,8 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
46 47
47namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 48namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
48{ 49{
49 public class XmlRpcGroupsMessaging : ISharedRegionModule 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class GroupsMessagingModule : ISharedRegionModule
50 { 52 {
51 53
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -57,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
57 59
58 private IGroupsModule m_groupsModule = null; 60 private IGroupsModule m_groupsModule = null;
59 61
60 // TODO: Move this off to the xmlrpc server 62 // TODO: Move this off to the Groups Server
61 public Dictionary<Guid, List<Guid>> m_agentsInGroupSession = new Dictionary<Guid, List<Guid>>(); 63 public Dictionary<Guid, List<Guid>> m_agentsInGroupSession = new Dictionary<Guid, List<Guid>>();
62 public Dictionary<Guid, List<Guid>> m_agentsDroppedSession = new Dictionary<Guid, List<Guid>>(); 64 public Dictionary<Guid, List<Guid>> m_agentsDroppedSession = new Dictionary<Guid, List<Guid>>();
63 65
@@ -79,31 +81,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
79 } 81 }
80 else 82 else
81 { 83 {
82 if (!groupsConfig.GetBoolean("Enabled", false)) 84 // if groups aren't enabled, we're not needed.
83 { 85 // if we're not specified as the connector to use, then we're not wanted
84 return; 86 if ((groupsConfig.GetBoolean("Enabled", false) == false)
85 } 87 || (groupsConfig.GetString("MessagingModule", "Default") != Name))
86
87 if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups")
88 { 88 {
89 m_groupMessagingEnabled = false; 89 m_groupMessagingEnabled = false;
90
91 return; 90 return;
92 } 91 }
93 92
94 m_groupMessagingEnabled = groupsConfig.GetBoolean("XmlRpcMessagingEnabled", true); 93 m_groupMessagingEnabled = groupsConfig.GetBoolean("MessagingEnabled", true);
95 94
96 if (!m_groupMessagingEnabled) 95 if (!m_groupMessagingEnabled)
97 { 96 {
98 return; 97 return;
99 } 98 }
100 99
101 m_log.Info("[GROUPS-MESSAGING]: Initializing XmlRpcGroupsMessaging"); 100 m_log.Info("[GROUPS-MESSAGING]: Initializing GroupsMessagingModule");
102 101
103 m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); 102 m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
104 } 103 }
105 104
106 m_log.Info("[GROUPS-MESSAGING]: XmlRpcGroupsMessaging starting up"); 105 m_log.Info("[GROUPS-MESSAGING]: GroupsMessagingModule starting up");
107 106
108 } 107 }
109 108
@@ -123,7 +122,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
123 // No groups module, no groups messaging 122 // No groups module, no groups messaging
124 if (m_groupsModule == null) 123 if (m_groupsModule == null)
125 { 124 {
126 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, XmlRpcGroupsMessaging is now disabled."); 125 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, GroupsMessagingModule is now disabled.");
127 Close(); 126 Close();
128 m_groupMessagingEnabled = false; 127 m_groupMessagingEnabled = false;
129 return; 128 return;
@@ -163,7 +162,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
163 if (!m_groupMessagingEnabled) 162 if (!m_groupMessagingEnabled)
164 return; 163 return;
165 164
166 if (m_debugEnabled) m_log.Debug("[GROUPS-MESSAGING]: Shutting down XmlRpcGroupsMessaging module."); 165 if (m_debugEnabled) m_log.Debug("[GROUPS-MESSAGING]: Shutting down GroupsMessagingModule module.");
167 166
168 foreach (Scene scene in m_sceneList) 167 foreach (Scene scene in m_sceneList)
169 { 168 {
@@ -184,7 +183,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
184 183
185 public string Name 184 public string Name
186 { 185 {
187 get { return "XmlRpcGroupsMessaging"; } 186 get { return "GroupsMessagingModule"; }
188 } 187 }
189 188
190 #endregion 189 #endregion
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 2cbc571..725c303 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using System.Timers; 31using System.Timers;
32 32
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35 36
36using OpenMetaverse; 37using OpenMetaverse;
@@ -49,20 +50,26 @@ using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
49 50
50namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 51namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
51{ 52{
52 public class XmlRpcGroupsModule : ISharedRegionModule, IGroupsModule 53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
54 public class GroupsModule : ISharedRegionModule, IGroupsModule
53 { 55 {
54 /// <summary> 56 /// <summary>
55 /// ; To use this module, you must specify the following in your OpenSim.ini 57 /// ; To use this module, you must specify the following in your OpenSim.ini
56 /// [GROUPS] 58 /// [GROUPS]
57 /// Enabled = true 59 /// Enabled = true
58 /// Module = XmlRpcGroups 60 ///
59 /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php 61 /// Module = GroupsModule
60 /// XmlRpcMessagingEnabled = true 62 /// NoticesEnabled = true
61 /// XmlRpcNoticesEnabled = true 63 /// DebugEnabled = true
62 /// XmlRpcDebugEnabled = true 64 ///
63 /// XmlRpcServiceReadKey = 1234 65 /// GroupsServicesConnectorModule = XmlRpcGroupsServicesConnector
66 /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php
67 /// XmlRpcServiceReadKey = 1234
64 /// XmlRpcServiceWriteKey = 1234 68 /// XmlRpcServiceWriteKey = 1234
65 /// 69 ///
70 /// MessagingModule = GroupsMessagingModule
71 /// MessagingEnabled = true
72 ///
66 /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for 73 /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for
67 /// ; a problem discovered on some Windows based region servers. Only disable 74 /// ; a problem discovered on some Windows based region servers. Only disable
68 /// ; if you see a large number (dozens) of the following Exceptions: 75 /// ; if you see a large number (dozens) of the following Exceptions:
@@ -78,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
78 85
79 private IMessageTransferModule m_msgTransferModule = null; 86 private IMessageTransferModule m_msgTransferModule = null;
80 87
81 private IGroupDataProvider m_groupData = null; 88 private IGroupsServicesConnector m_groupData = null;
82 89
83 class GroupRequestIDInfo 90 class GroupRequestIDInfo
84 { 91 {
@@ -91,7 +98,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
91 98
92 99
93 // Configuration settings 100 // Configuration settings
94 private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php";
95 private bool m_groupsEnabled = false; 101 private bool m_groupsEnabled = false;
96 private bool m_groupNoticesEnabled = true; 102 private bool m_groupNoticesEnabled = true;
97 private bool m_debugEnabled = true; 103 private bool m_debugEnabled = true;
@@ -115,7 +121,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
115 return; 121 return;
116 } 122 }
117 123
118 if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") 124 if (groupsConfig.GetString("Module", "Default") != Name)
119 { 125 {
120 m_groupsEnabled = false; 126 m_groupsEnabled = false;
121 127
@@ -124,17 +130,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
124 130
125 m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name); 131 m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name);
126 132
127 string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); 133 m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true);
128 bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); 134 m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
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);
137 m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true);
138 135
139 m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut; 136 m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut;
140 m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache; 137 m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache;
@@ -172,6 +169,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
172 169
173 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 170 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
174 171
172 if (m_groupData == null)
173 {
174 m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();
175
176 // No Groups Service Connector, then nothing works...
177 if (m_groupData == null)
178 {
179 m_groupsEnabled = false;
180 m_log.Error("[GROUPS]: Could not get IGroupsServicesConnector");
181 Close();
182 return;
183 }
184 }
185
175 if (m_msgTransferModule == null) 186 if (m_msgTransferModule == null)
176 { 187 {
177 m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); 188 m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
@@ -218,7 +229,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
218 if (!m_groupsEnabled) 229 if (!m_groupsEnabled)
219 return; 230 return;
220 231
221 if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module."); 232 if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module.");
222 233
223 m_clientRequestIDFlushTimer.Stop(); 234 m_clientRequestIDFlushTimer.Stop();
224 } 235 }
@@ -230,7 +241,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
230 241
231 public string Name 242 public string Name
232 { 243 {
233 get { return "XmlRpcGroupsModule"; } 244 get { return "GroupsModule"; }
234 } 245 }
235 246
236 #endregion 247 #endregion
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
35namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 35namespace 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..d77fe5b 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -29,27 +29,27 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32//using System.Text;
33 32
34using Nwc.XmlRpc; 33using Nwc.XmlRpc;
35 34
36using log4net; 35using log4net;
37// using Nini.Config; 36using Mono.Addins;
37using Nini.Config;
38 38
39using OpenMetaverse; 39using OpenMetaverse;
40using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
41 41
42using OpenSim.Framework; 42using OpenSim.Framework;
43//using OpenSim.Region.Framework.Interfaces; 43using OpenSim.Region.Framework.Interfaces;
44 44
45namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 45namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
46{ 46{
47 public class XmlRpcGroupDataProvider : IGroupDataProvider 47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
48 public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector
48 { 49 {
49 private static readonly ILog m_log = 50 private static readonly ILog m_log =
50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 52
52 private string m_serviceURL = string.Empty;
53 53
54 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | 54 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome |
55 GroupPowers.Accountable | 55 GroupPowers.Accountable |
@@ -59,26 +59,108 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
59 GroupPowers.StartProposal | 59 GroupPowers.StartProposal |
60 GroupPowers.VoteOnProposal; 60 GroupPowers.VoteOnProposal;
61 61
62 private bool m_connectorEnabled = false;
63
64 private string m_serviceURL = string.Empty;
65
62 private bool m_disableKeepAlive = false; 66 private bool m_disableKeepAlive = false;
63 67
64 private string m_groupReadKey = string.Empty; 68 private string m_groupReadKey = string.Empty;
65 private string m_groupWriteKey = string.Empty; 69 private string m_groupWriteKey = string.Empty;
66 70
67 public XmlRpcGroupDataProvider(string serviceURL, bool disableKeepAlive, string groupReadKey, string groupWriteKey) 71
72 #region IRegionModuleBase Members
73
74 public string Name
75 {
76 get { return "XmlRpcGroupsServicesConnector"; }
77 }
78
79 // this module is not intended to be replaced, but there should only be 1 of them.
80 public Type ReplacableInterface
68 { 81 {
69 m_serviceURL = serviceURL.Trim(); 82 get { return null; }
70 m_disableKeepAlive = disableKeepAlive; 83 }
71 84
72 if ((serviceURL == null) || 85 public void Initialise(IConfigSource config)
73 (serviceURL == string.Empty)) 86 {
87 IConfig groupsConfig = config.Configs["Groups"];
88
89 if (groupsConfig == null)
74 { 90 {
75 throw new Exception("Please specify a valid ServiceURL for XmlRpcGroupDataProvider in OpenSim.ini, [Groups], XmlRpcServiceURL"); 91 // Do not run this module by default.
92 return;
76 } 93 }
94 else
95 {
96 // if groups aren't enabled, we're not needed.
97 // if we're not specified as the connector to use, then we're not wanted
98 if ( (groupsConfig.GetBoolean("Enabled", false) == false)
99 || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name))
100 {
101 m_connectorEnabled = false;
102 return;
103 }
104
105 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
106
107 m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty);
108 if ((m_serviceURL == null) ||
109 (m_serviceURL == string.Empty))
110 {
111 m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]");
112 m_connectorEnabled = false;
113 return;
114 }
115
116 m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);
77 117
78 m_groupReadKey = groupReadKey; 118 m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
79 m_groupWriteKey = groupWriteKey; 119 m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
120
121 // If we got all the config options we need, lets start'er'up
122 m_connectorEnabled = true;
123 }
124 }
125
126 public void Close()
127 {
128 m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name);
80 } 129 }
81 130
131 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
132 {
133 if (m_connectorEnabled)
134 scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
135 }
136
137 public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene)
138 {
139 if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this)
140 scene.UnregisterModuleInterface<IGroupsServicesConnector>(this);
141 }
142
143 public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene)
144 {
145 // TODO: May want to consider listenning for Agent Connections so we can pre-cache group info
146 // scene.EventManager.OnNewClient += OnNewClient;
147 }
148
149 #endregion
150
151 #region ISharedRegionModule Members
152
153 public void PostInitialise()
154 {
155 // NoOp
156 }
157
158 #endregion
159
160
161
162 #region IGroupsServicesConnector Members
163
82 /// <summary> 164 /// <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. 165 /// 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> 166 /// </summary>
@@ -275,53 +357,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
275 357
276 } 358 }
277 359
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 360
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 361
326 public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) 362 public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID)
327 { 363 {
@@ -579,40 +615,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
579 615
580 } 616 }
581 617
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 618
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 619
617 public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) 620 public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID)
618 { 621 {
@@ -744,7 +747,96 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
744 747
745 XmlRpcCall(requestID, "groups.addGroupNotice", param); 748 XmlRpcCall(requestID, "groups.addGroupNotice", param);
746 } 749 }
750 #endregion
751
752 #region XmlRpcHashtableMarshalling
753 private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
754 {
755 GroupProfileData group = new GroupProfileData();
756 group.GroupID = UUID.Parse((string)groupProfile["GroupID"]);
757 group.Name = (string)groupProfile["Name"];
758
759 if (groupProfile["Charter"] != null)
760 {
761 group.Charter = (string)groupProfile["Charter"];
762 }
763
764 group.ShowInList = ((string)groupProfile["ShowInList"]) == "1";
765 group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]);
766 group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]);
767 group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1";
768 group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1";
769 group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1";
770 group.FounderID = UUID.Parse((string)groupProfile["FounderID"]);
771 group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]);
772
773 group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]);
774 group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]);
775
776 return group;
777 }
778
779 private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile)
780 {
781
782 GroupRecord group = new GroupRecord();
783 group.GroupID = UUID.Parse((string)groupProfile["GroupID"]);
784 group.GroupName = groupProfile["Name"].ToString();
785 if (groupProfile["Charter"] != null)
786 {
787 group.Charter = (string)groupProfile["Charter"];
788 }
789 group.ShowInList = ((string)groupProfile["ShowInList"]) == "1";
790 group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]);
791 group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]);
792 group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1";
793 group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1";
794 group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1";
795 group.FounderID = UUID.Parse((string)groupProfile["FounderID"]);
796 group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]);
797
798 return group;
799 }
800 private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
801 {
802 GroupMembershipData data = new GroupMembershipData();
803 data.AcceptNotices = ((string)respData["AcceptNotices"] == "1");
804 data.Contribution = int.Parse((string)respData["Contribution"]);
805 data.ListInProfile = ((string)respData["ListInProfile"] == "1");
806
807 data.ActiveRole = new UUID((string)respData["SelectedRoleID"]);
808 data.GroupTitle = (string)respData["Title"];
809
810 data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]);
811
812 // Is this group the agent's active group
813
814 data.GroupID = new UUID((string)respData["GroupID"]);
815
816 UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]);
817 data.Active = data.GroupID.Equals(ActiveGroup);
818
819 data.AllowPublish = ((string)respData["AllowPublish"] == "1");
820 if (respData["Charter"] != null)
821 {
822 data.Charter = (string)respData["Charter"];
823 }
824 data.FounderID = new UUID((string)respData["FounderID"]);
825 data.GroupID = new UUID((string)respData["GroupID"]);
826 data.GroupName = (string)respData["GroupName"];
827 data.GroupPicture = new UUID((string)respData["InsigniaID"]);
828 data.MaturePublish = ((string)respData["MaturePublish"] == "1");
829 data.MembershipFee = int.Parse((string)respData["MembershipFee"]);
830 data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1");
831 data.ShowInList = ((string)respData["ShowInList"] == "1");
832 return data;
833 }
834
835 #endregion
747 836
837 /// <summary>
838 /// Encapsulate the XmlRpc call to standardize security and error handling.
839 /// </summary>
748 private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) 840 private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param)
749 { 841 {
750 if (requestID == null) 842 if (requestID == null)
@@ -846,6 +938,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
846 } 938 }
847 } 939 }
848 940
941
849 } 942 }
850 943
851 public class GroupNoticeInfo 944 public class GroupNoticeInfo