diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs | 2034 |
1 files changed, 1017 insertions, 1017 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs index 343bd6d..eff76cf 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs | |||
@@ -1,1017 +1,1017 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | 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; | 32 | //using System.Text; |
33 | 33 | ||
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | 35 | ||
36 | using log4net; | 36 | using log4net; |
37 | // using Nini.Config; | 37 | // using Nini.Config; |
38 | 38 | ||
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
41 | 41 | ||
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | //using OpenSim.Region.Framework.Interfaces; | 43 | //using OpenSim.Region.Framework.Interfaces; |
44 | 44 | ||
45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
46 | { | 46 | { |
47 | 47 | ||
48 | public class XmlRpcGroupDataProvider : IGroupDataProvider | 48 | public class XmlRpcGroupDataProvider : IGroupDataProvider |
49 | { | 49 | { |
50 | private static readonly ILog m_log = | 50 | private static readonly ILog m_log = |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private string m_serviceURL = "http://osflotsam.org/xmlrpc.php"; | 53 | private string m_serviceURL = "http://osflotsam.org/xmlrpc.php"; |
54 | 54 | ||
55 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | GroupPowers.JoinChat | GroupPowers.AllowVoiceChat | GroupPowers.ReceiveNotices | GroupPowers.StartProposal | GroupPowers.VoteOnProposal; | 55 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | GroupPowers.JoinChat | GroupPowers.AllowVoiceChat | GroupPowers.ReceiveNotices | GroupPowers.StartProposal | GroupPowers.VoteOnProposal; |
56 | 56 | ||
57 | public XmlRpcGroupDataProvider(string serviceURL) | 57 | public XmlRpcGroupDataProvider(string serviceURL) |
58 | { | 58 | { |
59 | m_serviceURL = serviceURL; | 59 | m_serviceURL = serviceURL; |
60 | } | 60 | } |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// 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. | 63 | /// 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. |
64 | /// </summary> | 64 | /// </summary> |
65 | public UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID) | 65 | public UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID) |
66 | { | 66 | { |
67 | UUID GroupID = UUID.Random(); | 67 | UUID GroupID = UUID.Random(); |
68 | UUID OwnerRoleID = UUID.Random(); | 68 | UUID OwnerRoleID = UUID.Random(); |
69 | 69 | ||
70 | Hashtable param = new Hashtable(); | 70 | Hashtable param = new Hashtable(); |
71 | param["GroupID"] = GroupID.ToString(); | 71 | param["GroupID"] = GroupID.ToString(); |
72 | param["Name"] = name; | 72 | param["Name"] = name; |
73 | param["Charter"] = charter; | 73 | param["Charter"] = charter; |
74 | param["ShowInList"] = showInList == true ? 1 : 0; | 74 | param["ShowInList"] = showInList == true ? 1 : 0; |
75 | param["InsigniaID"] = insigniaID.ToString(); | 75 | param["InsigniaID"] = insigniaID.ToString(); |
76 | param["MembershipFee"] = 0; | 76 | param["MembershipFee"] = 0; |
77 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; | 77 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; |
78 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 78 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
79 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 79 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
80 | param["FounderID"] = founderID.ToString(); | 80 | param["FounderID"] = founderID.ToString(); |
81 | param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString(); | 81 | param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString(); |
82 | param["OwnerRoleID"] = OwnerRoleID.ToString(); | 82 | param["OwnerRoleID"] = OwnerRoleID.ToString(); |
83 | 83 | ||
84 | // Would this be cleaner as (GroupPowers)ulong.MaxValue; | 84 | // Would this be cleaner as (GroupPowers)ulong.MaxValue; |
85 | GroupPowers OwnerPowers = GroupPowers.Accountable | 85 | GroupPowers OwnerPowers = GroupPowers.Accountable |
86 | | GroupPowers.AllowEditLand | 86 | | GroupPowers.AllowEditLand |
87 | | GroupPowers.AllowFly | 87 | | GroupPowers.AllowFly |
88 | | GroupPowers.AllowLandmark | 88 | | GroupPowers.AllowLandmark |
89 | | GroupPowers.AllowRez | 89 | | GroupPowers.AllowRez |
90 | | GroupPowers.AllowSetHome | 90 | | GroupPowers.AllowSetHome |
91 | | GroupPowers.AllowVoiceChat | 91 | | GroupPowers.AllowVoiceChat |
92 | | GroupPowers.AssignMember | 92 | | GroupPowers.AssignMember |
93 | | GroupPowers.AssignMemberLimited | 93 | | GroupPowers.AssignMemberLimited |
94 | | GroupPowers.ChangeActions | 94 | | GroupPowers.ChangeActions |
95 | | GroupPowers.ChangeIdentity | 95 | | GroupPowers.ChangeIdentity |
96 | | GroupPowers.ChangeMedia | 96 | | GroupPowers.ChangeMedia |
97 | | GroupPowers.ChangeOptions | 97 | | GroupPowers.ChangeOptions |
98 | | GroupPowers.CreateRole | 98 | | GroupPowers.CreateRole |
99 | | GroupPowers.DeedObject | 99 | | GroupPowers.DeedObject |
100 | | GroupPowers.DeleteRole | 100 | | GroupPowers.DeleteRole |
101 | | GroupPowers.Eject | 101 | | GroupPowers.Eject |
102 | | GroupPowers.FindPlaces | 102 | | GroupPowers.FindPlaces |
103 | | GroupPowers.Invite | 103 | | GroupPowers.Invite |
104 | | GroupPowers.JoinChat | 104 | | GroupPowers.JoinChat |
105 | | GroupPowers.LandChangeIdentity | 105 | | GroupPowers.LandChangeIdentity |
106 | | GroupPowers.LandDeed | 106 | | GroupPowers.LandDeed |
107 | | GroupPowers.LandDivideJoin | 107 | | GroupPowers.LandDivideJoin |
108 | | GroupPowers.LandEdit | 108 | | GroupPowers.LandEdit |
109 | | GroupPowers.LandEjectAndFreeze | 109 | | GroupPowers.LandEjectAndFreeze |
110 | | GroupPowers.LandGardening | 110 | | GroupPowers.LandGardening |
111 | | GroupPowers.LandManageAllowed | 111 | | GroupPowers.LandManageAllowed |
112 | | GroupPowers.LandManageBanned | 112 | | GroupPowers.LandManageBanned |
113 | | GroupPowers.LandManagePasses | 113 | | GroupPowers.LandManagePasses |
114 | | GroupPowers.LandOptions | 114 | | GroupPowers.LandOptions |
115 | | GroupPowers.LandRelease | 115 | | GroupPowers.LandRelease |
116 | | GroupPowers.LandSetSale | 116 | | GroupPowers.LandSetSale |
117 | | GroupPowers.ModerateChat | 117 | | GroupPowers.ModerateChat |
118 | | GroupPowers.ObjectManipulate | 118 | | GroupPowers.ObjectManipulate |
119 | | GroupPowers.ObjectSetForSale | 119 | | GroupPowers.ObjectSetForSale |
120 | | GroupPowers.ReceiveNotices | 120 | | GroupPowers.ReceiveNotices |
121 | | GroupPowers.RemoveMember | 121 | | GroupPowers.RemoveMember |
122 | | GroupPowers.ReturnGroupOwned | 122 | | GroupPowers.ReturnGroupOwned |
123 | | GroupPowers.ReturnGroupSet | 123 | | GroupPowers.ReturnGroupSet |
124 | | GroupPowers.ReturnNonGroup | 124 | | GroupPowers.ReturnNonGroup |
125 | | GroupPowers.RoleProperties | 125 | | GroupPowers.RoleProperties |
126 | | GroupPowers.SendNotices | 126 | | GroupPowers.SendNotices |
127 | | GroupPowers.SetLandingPoint | 127 | | GroupPowers.SetLandingPoint |
128 | | GroupPowers.StartProposal | 128 | | GroupPowers.StartProposal |
129 | | GroupPowers.VoteOnProposal; | 129 | | GroupPowers.VoteOnProposal; |
130 | param["OwnersPowers"] = ((ulong)OwnerPowers).ToString(); | 130 | param["OwnersPowers"] = ((ulong)OwnerPowers).ToString(); |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | IList parameters = new ArrayList(); | 134 | IList parameters = new ArrayList(); |
135 | parameters.Add(param); | 135 | parameters.Add(param); |
136 | XmlRpcRequest req = new XmlRpcRequest("groups.createGroup", parameters); | 136 | XmlRpcRequest req = new XmlRpcRequest("groups.createGroup", parameters); |
137 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 137 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
138 | Hashtable respData = (Hashtable)resp.Value; | 138 | Hashtable respData = (Hashtable)resp.Value; |
139 | 139 | ||
140 | if (respData.Contains("error")) | 140 | if (respData.Contains("error")) |
141 | { | 141 | { |
142 | LogRespDataToConsoleError(respData); | 142 | LogRespDataToConsoleError(respData); |
143 | } | 143 | } |
144 | 144 | ||
145 | return UUID.Parse((string)respData["GroupID"]); | 145 | return UUID.Parse((string)respData["GroupID"]); |
146 | } | 146 | } |
147 | 147 | ||
148 | public void UpdateGroup(UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) | 148 | public void UpdateGroup(UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) |
149 | { | 149 | { |
150 | Hashtable param = new Hashtable(); | 150 | Hashtable param = new Hashtable(); |
151 | param["GroupID"] = groupID.ToString(); | 151 | param["GroupID"] = groupID.ToString(); |
152 | param["Charter"] = charter; | 152 | param["Charter"] = charter; |
153 | param["ShowInList"] = showInList == true ? 1 : 0; | 153 | param["ShowInList"] = showInList == true ? 1 : 0; |
154 | param["InsigniaID"] = insigniaID.ToString(); | 154 | param["InsigniaID"] = insigniaID.ToString(); |
155 | param["MembershipFee"] = membershipFee; | 155 | param["MembershipFee"] = membershipFee; |
156 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; | 156 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; |
157 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 157 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
158 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 158 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
159 | 159 | ||
160 | IList parameters = new ArrayList(); | 160 | IList parameters = new ArrayList(); |
161 | parameters.Add(param); | 161 | parameters.Add(param); |
162 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroup", parameters); | 162 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroup", parameters); |
163 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 163 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
164 | Hashtable respData = (Hashtable)resp.Value; | 164 | Hashtable respData = (Hashtable)resp.Value; |
165 | 165 | ||
166 | if (respData.Contains("error")) | 166 | if (respData.Contains("error")) |
167 | { | 167 | { |
168 | LogRespDataToConsoleError(respData); | 168 | LogRespDataToConsoleError(respData); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | public void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) | 172 | public void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) |
173 | { | 173 | { |
174 | Hashtable param = new Hashtable(); | 174 | Hashtable param = new Hashtable(); |
175 | param["GroupID"] = groupID.ToString(); | 175 | param["GroupID"] = groupID.ToString(); |
176 | param["RoleID"] = roleID.ToString(); | 176 | param["RoleID"] = roleID.ToString(); |
177 | param["Name"] = name; | 177 | param["Name"] = name; |
178 | param["Description"] = description; | 178 | param["Description"] = description; |
179 | param["Title"] = title; | 179 | param["Title"] = title; |
180 | param["Powers"] = powers.ToString(); | 180 | param["Powers"] = powers.ToString(); |
181 | 181 | ||
182 | IList parameters = new ArrayList(); | 182 | IList parameters = new ArrayList(); |
183 | parameters.Add(param); | 183 | parameters.Add(param); |
184 | XmlRpcRequest req = new XmlRpcRequest("groups.addRoleToGroup", parameters); | 184 | XmlRpcRequest req = new XmlRpcRequest("groups.addRoleToGroup", parameters); |
185 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 185 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
186 | Hashtable respData = (Hashtable)resp.Value; | 186 | Hashtable respData = (Hashtable)resp.Value; |
187 | 187 | ||
188 | if (respData.Contains("error")) | 188 | if (respData.Contains("error")) |
189 | { | 189 | { |
190 | LogRespDataToConsoleError(respData); | 190 | LogRespDataToConsoleError(respData); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | public void RemoveGroupRole(UUID groupID, UUID roleID) | 194 | public void RemoveGroupRole(UUID groupID, UUID roleID) |
195 | { | 195 | { |
196 | Hashtable param = new Hashtable(); | 196 | Hashtable param = new Hashtable(); |
197 | param["GroupID"] = groupID.ToString(); | 197 | param["GroupID"] = groupID.ToString(); |
198 | param["RoleID"] = roleID.ToString(); | 198 | param["RoleID"] = roleID.ToString(); |
199 | 199 | ||
200 | IList parameters = new ArrayList(); | 200 | IList parameters = new ArrayList(); |
201 | parameters.Add(param); | 201 | parameters.Add(param); |
202 | XmlRpcRequest req = new XmlRpcRequest("groups.removeRoleFromGroup", parameters); | 202 | XmlRpcRequest req = new XmlRpcRequest("groups.removeRoleFromGroup", parameters); |
203 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 203 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
204 | Hashtable respData = (Hashtable)resp.Value; | 204 | Hashtable respData = (Hashtable)resp.Value; |
205 | 205 | ||
206 | if (respData.Contains("error")) | 206 | if (respData.Contains("error")) |
207 | { | 207 | { |
208 | LogRespDataToConsoleError(respData); | 208 | LogRespDataToConsoleError(respData); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | public void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) | 212 | public void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) |
213 | { | 213 | { |
214 | Hashtable param = new Hashtable(); | 214 | Hashtable param = new Hashtable(); |
215 | param["GroupID"] = groupID.ToString(); | 215 | param["GroupID"] = groupID.ToString(); |
216 | param["RoleID"] = roleID.ToString(); | 216 | param["RoleID"] = roleID.ToString(); |
217 | if (name != null) | 217 | if (name != null) |
218 | { | 218 | { |
219 | param["Name"] = name; | 219 | param["Name"] = name; |
220 | } | 220 | } |
221 | if (description != null) | 221 | if (description != null) |
222 | { | 222 | { |
223 | param["Description"] = description; | 223 | param["Description"] = description; |
224 | } | 224 | } |
225 | if (title != null) | 225 | if (title != null) |
226 | { | 226 | { |
227 | param["Title"] = title; | 227 | param["Title"] = title; |
228 | } | 228 | } |
229 | param["Powers"] = powers.ToString(); | 229 | param["Powers"] = powers.ToString(); |
230 | 230 | ||
231 | IList parameters = new ArrayList(); | 231 | IList parameters = new ArrayList(); |
232 | parameters.Add(param); | 232 | parameters.Add(param); |
233 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroupRole", parameters); | 233 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroupRole", parameters); |
234 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 234 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
235 | Hashtable respData = (Hashtable)resp.Value; | 235 | Hashtable respData = (Hashtable)resp.Value; |
236 | 236 | ||
237 | if (respData.Contains("error")) | 237 | if (respData.Contains("error")) |
238 | { | 238 | { |
239 | LogRespDataToConsoleError(respData); | 239 | LogRespDataToConsoleError(respData); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | public GroupRecord GetGroupRecord(UUID GroupID, string GroupName) | 243 | public GroupRecord GetGroupRecord(UUID GroupID, string GroupName) |
244 | { | 244 | { |
245 | Hashtable param = new Hashtable(); | 245 | Hashtable param = new Hashtable(); |
246 | if ((GroupID != null) && (GroupID != UUID.Zero)) | 246 | if ((GroupID != null) && (GroupID != UUID.Zero)) |
247 | { | 247 | { |
248 | param["GroupID"] = GroupID.ToString(); | 248 | param["GroupID"] = GroupID.ToString(); |
249 | } | 249 | } |
250 | if ((GroupName != null) && (GroupName != string.Empty)) | 250 | if ((GroupName != null) && (GroupName != string.Empty)) |
251 | { | 251 | { |
252 | param["Name"] = GroupName.ToString(); | 252 | param["Name"] = GroupName.ToString(); |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | IList parameters = new ArrayList(); | 256 | IList parameters = new ArrayList(); |
257 | parameters.Add(param); | 257 | parameters.Add(param); |
258 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); | 258 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); |
259 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 259 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
260 | Hashtable respData = (Hashtable)resp.Value; | 260 | Hashtable respData = (Hashtable)resp.Value; |
261 | 261 | ||
262 | if (respData.Contains("error")) | 262 | if (respData.Contains("error")) |
263 | { | 263 | { |
264 | if ((string)respData["error"] != "Group Not Found") | 264 | if ((string)respData["error"] != "Group Not Found") |
265 | { | 265 | { |
266 | LogRespDataToConsoleError(respData); | 266 | LogRespDataToConsoleError(respData); |
267 | } | 267 | } |
268 | return null; | 268 | return null; |
269 | } | 269 | } |
270 | 270 | ||
271 | return GroupProfileHashtableToGroupRecord(respData); | 271 | return GroupProfileHashtableToGroupRecord(respData); |
272 | 272 | ||
273 | } | 273 | } |
274 | 274 | ||
275 | public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID) | 275 | public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID) |
276 | { | 276 | { |
277 | Hashtable param = new Hashtable(); | 277 | Hashtable param = new Hashtable(); |
278 | param["GroupID"] = GroupID.ToString(); | 278 | param["GroupID"] = GroupID.ToString(); |
279 | 279 | ||
280 | 280 | ||
281 | IList parameters = new ArrayList(); | 281 | IList parameters = new ArrayList(); |
282 | parameters.Add(param); | 282 | parameters.Add(param); |
283 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); | 283 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); |
284 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 284 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
285 | Hashtable respData = (Hashtable)resp.Value; | 285 | Hashtable respData = (Hashtable)resp.Value; |
286 | 286 | ||
287 | if (respData.Contains("error")) | 287 | if (respData.Contains("error")) |
288 | { | 288 | { |
289 | if ((string)respData["error"] != "Group Not Found") | 289 | if ((string)respData["error"] != "Group Not Found") |
290 | { | 290 | { |
291 | LogRespDataToConsoleError(respData); | 291 | LogRespDataToConsoleError(respData); |
292 | } | 292 | } |
293 | return new GroupProfileData(); | 293 | return new GroupProfileData(); |
294 | } | 294 | } |
295 | 295 | ||
296 | GroupMembershipData MemberInfo = GetAgentGroupMembership(AgentID, GroupID); | 296 | GroupMembershipData MemberInfo = GetAgentGroupMembership(AgentID, GroupID); |
297 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 297 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
298 | 298 | ||
299 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 299 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
300 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 300 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; |
301 | 301 | ||
302 | return MemberGroupProfile; | 302 | return MemberGroupProfile; |
303 | 303 | ||
304 | } | 304 | } |
305 | 305 | ||
306 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) | 306 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) |
307 | { | 307 | { |
308 | GroupProfileData group = new GroupProfileData(); | 308 | GroupProfileData group = new GroupProfileData(); |
309 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 309 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
310 | group.Name = (string)groupProfile["Name"]; | 310 | group.Name = (string)groupProfile["Name"]; |
311 | 311 | ||
312 | if (groupProfile["Charter"] != null) | 312 | if (groupProfile["Charter"] != null) |
313 | { | 313 | { |
314 | group.Charter = (string)groupProfile["Charter"]; | 314 | group.Charter = (string)groupProfile["Charter"]; |
315 | } | 315 | } |
316 | 316 | ||
317 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | 317 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; |
318 | group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); | 318 | group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); |
319 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | 319 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); |
320 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | 320 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; |
321 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | 321 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; |
322 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | 322 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; |
323 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | 323 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); |
324 | group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); | 324 | group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); |
325 | 325 | ||
326 | group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); | 326 | group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); |
327 | group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); | 327 | group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); |
328 | 328 | ||
329 | return group; | 329 | return group; |
330 | } | 330 | } |
331 | 331 | ||
332 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | 332 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) |
333 | { | 333 | { |
334 | 334 | ||
335 | GroupRecord group = new GroupRecord(); | 335 | GroupRecord group = new GroupRecord(); |
336 | m_log.Debug("GroupID"); | 336 | m_log.Debug("GroupID"); |
337 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 337 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
338 | 338 | ||
339 | m_log.Debug("Name"); | 339 | m_log.Debug("Name"); |
340 | group.GroupName = groupProfile["Name"].ToString(); | 340 | group.GroupName = groupProfile["Name"].ToString(); |
341 | 341 | ||
342 | m_log.Debug("Charter"); | 342 | m_log.Debug("Charter"); |
343 | if (groupProfile["Charter"] != null) | 343 | if (groupProfile["Charter"] != null) |
344 | { | 344 | { |
345 | group.Charter = (string)groupProfile["Charter"]; | 345 | group.Charter = (string)groupProfile["Charter"]; |
346 | } | 346 | } |
347 | 347 | ||
348 | m_log.Debug("ShowInList"); | 348 | m_log.Debug("ShowInList"); |
349 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | 349 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; |
350 | 350 | ||
351 | m_log.Debug("InsigniaID"); | 351 | m_log.Debug("InsigniaID"); |
352 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); | 352 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); |
353 | 353 | ||
354 | m_log.Debug("MembershipFee"); | 354 | m_log.Debug("MembershipFee"); |
355 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | 355 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); |
356 | 356 | ||
357 | m_log.Debug("OpenEnrollment"); | 357 | m_log.Debug("OpenEnrollment"); |
358 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | 358 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; |
359 | 359 | ||
360 | m_log.Debug("AllowPublish"); | 360 | m_log.Debug("AllowPublish"); |
361 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | 361 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; |
362 | 362 | ||
363 | m_log.Debug("MaturePublish"); | 363 | m_log.Debug("MaturePublish"); |
364 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | 364 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; |
365 | 365 | ||
366 | m_log.Debug("FounderID"); | 366 | m_log.Debug("FounderID"); |
367 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | 367 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); |
368 | 368 | ||
369 | m_log.Debug("OwnerRoleID"); | 369 | m_log.Debug("OwnerRoleID"); |
370 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); | 370 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); |
371 | 371 | ||
372 | return group; | 372 | return group; |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
376 | public void SetAgentActiveGroup(UUID AgentID, UUID GroupID) | 376 | public void SetAgentActiveGroup(UUID AgentID, UUID GroupID) |
377 | { | 377 | { |
378 | Hashtable param = new Hashtable(); | 378 | Hashtable param = new Hashtable(); |
379 | param["AgentID"] = AgentID.ToString(); | 379 | param["AgentID"] = AgentID.ToString(); |
380 | param["GroupID"] = GroupID.ToString(); | 380 | param["GroupID"] = GroupID.ToString(); |
381 | 381 | ||
382 | IList parameters = new ArrayList(); | 382 | IList parameters = new ArrayList(); |
383 | parameters.Add(param); | 383 | parameters.Add(param); |
384 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentActiveGroup", parameters); | 384 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentActiveGroup", parameters); |
385 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 385 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
386 | Hashtable respData = (Hashtable)resp.Value; | 386 | Hashtable respData = (Hashtable)resp.Value; |
387 | 387 | ||
388 | if (respData.Contains("error")) | 388 | if (respData.Contains("error")) |
389 | { | 389 | { |
390 | LogRespDataToConsoleError(respData); | 390 | LogRespDataToConsoleError(respData); |
391 | } | 391 | } |
392 | 392 | ||
393 | } | 393 | } |
394 | 394 | ||
395 | public void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 395 | public void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
396 | { | 396 | { |
397 | Hashtable param = new Hashtable(); | 397 | Hashtable param = new Hashtable(); |
398 | param["AgentID"] = AgentID.ToString(); | 398 | param["AgentID"] = AgentID.ToString(); |
399 | param["GroupID"] = GroupID.ToString(); | 399 | param["GroupID"] = GroupID.ToString(); |
400 | param["SelectedRoleID"] = RoleID.ToString(); | 400 | param["SelectedRoleID"] = RoleID.ToString(); |
401 | 401 | ||
402 | IList parameters = new ArrayList(); | 402 | IList parameters = new ArrayList(); |
403 | parameters.Add(param); | 403 | parameters.Add(param); |
404 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); | 404 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); |
405 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 405 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
406 | Hashtable respData = (Hashtable)resp.Value; | 406 | Hashtable respData = (Hashtable)resp.Value; |
407 | 407 | ||
408 | if (respData.Contains("error")) | 408 | if (respData.Contains("error")) |
409 | { | 409 | { |
410 | LogRespDataToConsoleError(respData); | 410 | LogRespDataToConsoleError(respData); |
411 | } | 411 | } |
412 | 412 | ||
413 | } | 413 | } |
414 | 414 | ||
415 | public void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 415 | public void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
416 | { | 416 | { |
417 | Hashtable param = new Hashtable(); | 417 | Hashtable param = new Hashtable(); |
418 | param["AgentID"] = AgentID.ToString(); | 418 | param["AgentID"] = AgentID.ToString(); |
419 | param["GroupID"] = GroupID.ToString(); | 419 | param["GroupID"] = GroupID.ToString(); |
420 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 420 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
421 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 421 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
422 | 422 | ||
423 | IList parameters = new ArrayList(); | 423 | IList parameters = new ArrayList(); |
424 | parameters.Add(param); | 424 | parameters.Add(param); |
425 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); | 425 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); |
426 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 426 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
427 | Hashtable respData = (Hashtable)resp.Value; | 427 | Hashtable respData = (Hashtable)resp.Value; |
428 | 428 | ||
429 | if (respData.Contains("error")) | 429 | if (respData.Contains("error")) |
430 | { | 430 | { |
431 | LogRespDataToConsoleError(respData); | 431 | LogRespDataToConsoleError(respData); |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 435 | public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
436 | { | 436 | { |
437 | Hashtable param = new Hashtable(); | 437 | Hashtable param = new Hashtable(); |
438 | param["InviteID"] = inviteID.ToString(); | 438 | param["InviteID"] = inviteID.ToString(); |
439 | param["AgentID"] = agentID.ToString(); | 439 | param["AgentID"] = agentID.ToString(); |
440 | param["RoleID"] = roleID.ToString(); | 440 | param["RoleID"] = roleID.ToString(); |
441 | param["GroupID"] = groupID.ToString(); | 441 | param["GroupID"] = groupID.ToString(); |
442 | 442 | ||
443 | IList parameters = new ArrayList(); | 443 | IList parameters = new ArrayList(); |
444 | parameters.Add(param); | 444 | parameters.Add(param); |
445 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupInvite", parameters); | 445 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupInvite", parameters); |
446 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 446 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
447 | Hashtable respData = (Hashtable)resp.Value; | 447 | Hashtable respData = (Hashtable)resp.Value; |
448 | 448 | ||
449 | if (respData.Contains("error")) | 449 | if (respData.Contains("error")) |
450 | { | 450 | { |
451 | if (respData["error"] != "Duplicate group invite requested") | 451 | if (respData["error"] != "Duplicate group invite requested") |
452 | { | 452 | { |
453 | LogRespDataToConsoleError(respData); | 453 | LogRespDataToConsoleError(respData); |
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | } | 458 | } |
459 | 459 | ||
460 | public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID) | 460 | public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID) |
461 | { | 461 | { |
462 | Hashtable param = new Hashtable(); | 462 | Hashtable param = new Hashtable(); |
463 | param["InviteID"] = inviteID.ToString(); | 463 | param["InviteID"] = inviteID.ToString(); |
464 | 464 | ||
465 | IList parameters = new ArrayList(); | 465 | IList parameters = new ArrayList(); |
466 | parameters.Add(param); | 466 | parameters.Add(param); |
467 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentToGroupInvite", parameters); | 467 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentToGroupInvite", parameters); |
468 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 468 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
469 | Hashtable respData = (Hashtable)resp.Value; | 469 | Hashtable respData = (Hashtable)resp.Value; |
470 | 470 | ||
471 | 471 | ||
472 | if (respData.Contains("error")) | 472 | if (respData.Contains("error")) |
473 | { | 473 | { |
474 | LogRespDataToConsoleError(respData); | 474 | LogRespDataToConsoleError(respData); |
475 | 475 | ||
476 | return null; | 476 | return null; |
477 | } | 477 | } |
478 | 478 | ||
479 | GroupInviteInfo inviteInfo = new GroupInviteInfo(); | 479 | GroupInviteInfo inviteInfo = new GroupInviteInfo(); |
480 | inviteInfo.InviteID = inviteID; | 480 | inviteInfo.InviteID = inviteID; |
481 | inviteInfo.GroupID = UUID.Parse((string)respData["GroupID"]); | 481 | inviteInfo.GroupID = UUID.Parse((string)respData["GroupID"]); |
482 | inviteInfo.RoleID = UUID.Parse((string)respData["RoleID"]); | 482 | inviteInfo.RoleID = UUID.Parse((string)respData["RoleID"]); |
483 | inviteInfo.AgentID = UUID.Parse((string)respData["AgentID"]); | 483 | inviteInfo.AgentID = UUID.Parse((string)respData["AgentID"]); |
484 | 484 | ||
485 | return inviteInfo; | 485 | return inviteInfo; |
486 | } | 486 | } |
487 | 487 | ||
488 | public void RemoveAgentToGroupInvite(UUID inviteID) | 488 | public void RemoveAgentToGroupInvite(UUID inviteID) |
489 | { | 489 | { |
490 | Hashtable param = new Hashtable(); | 490 | Hashtable param = new Hashtable(); |
491 | param["InviteID"] = inviteID.ToString(); | 491 | param["InviteID"] = inviteID.ToString(); |
492 | 492 | ||
493 | IList parameters = new ArrayList(); | 493 | IList parameters = new ArrayList(); |
494 | parameters.Add(param); | 494 | parameters.Add(param); |
495 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentToGroupInvite", parameters); | 495 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentToGroupInvite", parameters); |
496 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 496 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
497 | Hashtable respData = (Hashtable)resp.Value; | 497 | Hashtable respData = (Hashtable)resp.Value; |
498 | 498 | ||
499 | if (respData.Contains("error")) | 499 | if (respData.Contains("error")) |
500 | { | 500 | { |
501 | LogRespDataToConsoleError(respData); | 501 | LogRespDataToConsoleError(respData); |
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
505 | public void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID) | 505 | public void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID) |
506 | { | 506 | { |
507 | Hashtable param = new Hashtable(); | 507 | Hashtable param = new Hashtable(); |
508 | param["AgentID"] = AgentID.ToString(); | 508 | param["AgentID"] = AgentID.ToString(); |
509 | param["GroupID"] = GroupID.ToString(); | 509 | param["GroupID"] = GroupID.ToString(); |
510 | param["RoleID"] = RoleID.ToString(); | 510 | param["RoleID"] = RoleID.ToString(); |
511 | 511 | ||
512 | IList parameters = new ArrayList(); | 512 | IList parameters = new ArrayList(); |
513 | parameters.Add(param); | 513 | parameters.Add(param); |
514 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroup", parameters); | 514 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroup", parameters); |
515 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 515 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
516 | Hashtable respData = (Hashtable)resp.Value; | 516 | Hashtable respData = (Hashtable)resp.Value; |
517 | 517 | ||
518 | if (respData.Contains("error")) | 518 | if (respData.Contains("error")) |
519 | { | 519 | { |
520 | LogRespDataToConsoleError(respData); | 520 | LogRespDataToConsoleError(respData); |
521 | } | 521 | } |
522 | } | 522 | } |
523 | 523 | ||
524 | public void RemoveAgentFromGroup(UUID AgentID, UUID GroupID) | 524 | public void RemoveAgentFromGroup(UUID AgentID, UUID GroupID) |
525 | { | 525 | { |
526 | Hashtable param = new Hashtable(); | 526 | Hashtable param = new Hashtable(); |
527 | param["AgentID"] = AgentID.ToString(); | 527 | param["AgentID"] = AgentID.ToString(); |
528 | param["GroupID"] = GroupID.ToString(); | 528 | param["GroupID"] = GroupID.ToString(); |
529 | 529 | ||
530 | IList parameters = new ArrayList(); | 530 | IList parameters = new ArrayList(); |
531 | parameters.Add(param); | 531 | parameters.Add(param); |
532 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroup", parameters); | 532 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroup", parameters); |
533 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 533 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
534 | Hashtable respData = (Hashtable)resp.Value; | 534 | Hashtable respData = (Hashtable)resp.Value; |
535 | 535 | ||
536 | if (respData.Contains("error")) | 536 | if (respData.Contains("error")) |
537 | { | 537 | { |
538 | LogRespDataToConsoleError(respData); | 538 | LogRespDataToConsoleError(respData); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | 541 | ||
542 | public void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 542 | public void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
543 | { | 543 | { |
544 | Hashtable param = new Hashtable(); | 544 | Hashtable param = new Hashtable(); |
545 | param["AgentID"] = AgentID.ToString(); | 545 | param["AgentID"] = AgentID.ToString(); |
546 | param["GroupID"] = GroupID.ToString(); | 546 | param["GroupID"] = GroupID.ToString(); |
547 | param["RoleID"] = RoleID.ToString(); | 547 | param["RoleID"] = RoleID.ToString(); |
548 | 548 | ||
549 | IList parameters = new ArrayList(); | 549 | IList parameters = new ArrayList(); |
550 | parameters.Add(param); | 550 | parameters.Add(param); |
551 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupRole", parameters); | 551 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupRole", parameters); |
552 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 552 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
553 | Hashtable respData = (Hashtable)resp.Value; | 553 | Hashtable respData = (Hashtable)resp.Value; |
554 | 554 | ||
555 | if (respData.Contains("error")) | 555 | if (respData.Contains("error")) |
556 | { | 556 | { |
557 | LogRespDataToConsoleError(respData); | 557 | LogRespDataToConsoleError(respData); |
558 | } | 558 | } |
559 | } | 559 | } |
560 | 560 | ||
561 | public void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 561 | public void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
562 | { | 562 | { |
563 | Hashtable param = new Hashtable(); | 563 | Hashtable param = new Hashtable(); |
564 | param["AgentID"] = AgentID.ToString(); | 564 | param["AgentID"] = AgentID.ToString(); |
565 | param["GroupID"] = GroupID.ToString(); | 565 | param["GroupID"] = GroupID.ToString(); |
566 | param["RoleID"] = RoleID.ToString(); | 566 | param["RoleID"] = RoleID.ToString(); |
567 | 567 | ||
568 | IList parameters = new ArrayList(); | 568 | IList parameters = new ArrayList(); |
569 | parameters.Add(param); | 569 | parameters.Add(param); |
570 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroupRole", parameters); | 570 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroupRole", parameters); |
571 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 571 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
572 | Hashtable respData = (Hashtable)resp.Value; | 572 | Hashtable respData = (Hashtable)resp.Value; |
573 | 573 | ||
574 | if (respData.Contains("error")) | 574 | if (respData.Contains("error")) |
575 | { | 575 | { |
576 | LogRespDataToConsoleError(respData); | 576 | LogRespDataToConsoleError(respData); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | 580 | ||
581 | public List<DirGroupsReplyData> FindGroups(string search) | 581 | public List<DirGroupsReplyData> FindGroups(string search) |
582 | { | 582 | { |
583 | Hashtable param = new Hashtable(); | 583 | Hashtable param = new Hashtable(); |
584 | param["Search"] = search; | 584 | param["Search"] = search; |
585 | 585 | ||
586 | IList parameters = new ArrayList(); | 586 | IList parameters = new ArrayList(); |
587 | parameters.Add(param); | 587 | parameters.Add(param); |
588 | XmlRpcRequest req = new XmlRpcRequest("groups.findGroups", parameters); | 588 | XmlRpcRequest req = new XmlRpcRequest("groups.findGroups", parameters); |
589 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 589 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
590 | Hashtable respData = (Hashtable)resp.Value; | 590 | Hashtable respData = (Hashtable)resp.Value; |
591 | 591 | ||
592 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 592 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
593 | 593 | ||
594 | if (respData.Contains("error")) | 594 | if (respData.Contains("error")) |
595 | { | 595 | { |
596 | if (respData["error"].ToString() != "No groups found.") | 596 | if (respData["error"].ToString() != "No groups found.") |
597 | { | 597 | { |
598 | LogRespDataToConsoleError(respData); | 598 | LogRespDataToConsoleError(respData); |
599 | } | 599 | } |
600 | } | 600 | } |
601 | else | 601 | else |
602 | { | 602 | { |
603 | Hashtable results = (Hashtable)respData["results"]; | 603 | Hashtable results = (Hashtable)respData["results"]; |
604 | foreach (Hashtable groupFind in results.Values) | 604 | foreach (Hashtable groupFind in results.Values) |
605 | { | 605 | { |
606 | DirGroupsReplyData data = new DirGroupsReplyData(); | 606 | DirGroupsReplyData data = new DirGroupsReplyData(); |
607 | data.groupID = new UUID((string)groupFind["GroupID"]); ; | 607 | data.groupID = new UUID((string)groupFind["GroupID"]); ; |
608 | data.groupName = (string)groupFind["Name"]; | 608 | data.groupName = (string)groupFind["Name"]; |
609 | data.members = int.Parse((string)groupFind["Members"]); | 609 | data.members = int.Parse((string)groupFind["Members"]); |
610 | // data.searchOrder = order; | 610 | // data.searchOrder = order; |
611 | 611 | ||
612 | findings.Add(data); | 612 | findings.Add(data); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | return findings; | 616 | return findings; |
617 | } | 617 | } |
618 | 618 | ||
619 | public GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID) | 619 | public GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID) |
620 | { | 620 | { |
621 | Hashtable param = new Hashtable(); | 621 | Hashtable param = new Hashtable(); |
622 | param["AgentID"] = AgentID.ToString(); | 622 | param["AgentID"] = AgentID.ToString(); |
623 | param["GroupID"] = GroupID.ToString(); | 623 | param["GroupID"] = GroupID.ToString(); |
624 | 624 | ||
625 | IList parameters = new ArrayList(); | 625 | IList parameters = new ArrayList(); |
626 | parameters.Add(param); | 626 | parameters.Add(param); |
627 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMembership", parameters); | 627 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMembership", parameters); |
628 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 628 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
629 | Hashtable respData = (Hashtable)resp.Value; | 629 | Hashtable respData = (Hashtable)resp.Value; |
630 | 630 | ||
631 | if (respData.Contains("error")) | 631 | if (respData.Contains("error")) |
632 | { | 632 | { |
633 | if ((string)respData["error"] != "None Found") | 633 | if ((string)respData["error"] != "None Found") |
634 | { | 634 | { |
635 | LogRespDataToConsoleError(respData); | 635 | LogRespDataToConsoleError(respData); |
636 | } | 636 | } |
637 | return null; | 637 | return null; |
638 | } | 638 | } |
639 | 639 | ||
640 | GroupMembershipData data = HashTableToGroupMembershipData(respData); | 640 | GroupMembershipData data = HashTableToGroupMembershipData(respData); |
641 | 641 | ||
642 | return data; | 642 | return data; |
643 | } | 643 | } |
644 | 644 | ||
645 | public GroupMembershipData GetAgentActiveMembership(UUID AgentID) | 645 | public GroupMembershipData GetAgentActiveMembership(UUID AgentID) |
646 | { | 646 | { |
647 | Hashtable param = new Hashtable(); | 647 | Hashtable param = new Hashtable(); |
648 | param["AgentID"] = AgentID.ToString(); | 648 | param["AgentID"] = AgentID.ToString(); |
649 | 649 | ||
650 | IList parameters = new ArrayList(); | 650 | IList parameters = new ArrayList(); |
651 | parameters.Add(param); | 651 | parameters.Add(param); |
652 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentActiveMembership", parameters); | 652 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentActiveMembership", parameters); |
653 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 653 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
654 | Hashtable respData = (Hashtable)resp.Value; | 654 | Hashtable respData = (Hashtable)resp.Value; |
655 | 655 | ||
656 | if (respData.Contains("error")) | 656 | if (respData.Contains("error")) |
657 | { | 657 | { |
658 | if (respData["error"].ToString() == "No Active Group Specified") | 658 | if (respData["error"].ToString() == "No Active Group Specified") |
659 | { | 659 | { |
660 | return null; | 660 | return null; |
661 | } | 661 | } |
662 | LogRespDataToConsoleError(respData); | 662 | LogRespDataToConsoleError(respData); |
663 | return null; | 663 | return null; |
664 | } | 664 | } |
665 | 665 | ||
666 | try | 666 | try |
667 | { | 667 | { |
668 | GroupMembershipData data = HashTableToGroupMembershipData(respData); | 668 | GroupMembershipData data = HashTableToGroupMembershipData(respData); |
669 | return data; | 669 | return data; |
670 | } | 670 | } |
671 | catch (System.Exception e) | 671 | catch (System.Exception e) |
672 | { | 672 | { |
673 | LogRespDataToConsoleError(respData); | 673 | LogRespDataToConsoleError(respData); |
674 | throw e; | 674 | throw e; |
675 | } | 675 | } |
676 | } | 676 | } |
677 | 677 | ||
678 | private void LogRespDataToConsoleError(Hashtable respData) | 678 | private void LogRespDataToConsoleError(Hashtable respData) |
679 | { | 679 | { |
680 | m_log.Error("[GROUPDATA] Error:"); | 680 | m_log.Error("[GROUPDATA] Error:"); |
681 | 681 | ||
682 | foreach (string key in respData.Keys) | 682 | foreach (string key in respData.Keys) |
683 | { | 683 | { |
684 | m_log.ErrorFormat("[GROUPDATA] Key: {0}", key); | 684 | m_log.ErrorFormat("[GROUPDATA] Key: {0}", key); |
685 | 685 | ||
686 | object o = respData[key]; | 686 | object o = respData[key]; |
687 | 687 | ||
688 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); | 688 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); |
689 | foreach (string line in lines) | 689 | foreach (string line in lines) |
690 | { | 690 | { |
691 | m_log.ErrorFormat("[GROUPDATA] {0}", line); | 691 | m_log.ErrorFormat("[GROUPDATA] {0}", line); |
692 | } | 692 | } |
693 | 693 | ||
694 | } | 694 | } |
695 | } | 695 | } |
696 | 696 | ||
697 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID) | 697 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID) |
698 | { | 698 | { |
699 | Hashtable param = new Hashtable(); | 699 | Hashtable param = new Hashtable(); |
700 | param["AgentID"] = AgentID.ToString(); | 700 | param["AgentID"] = AgentID.ToString(); |
701 | 701 | ||
702 | IList parameters = new ArrayList(); | 702 | IList parameters = new ArrayList(); |
703 | parameters.Add(param); | 703 | parameters.Add(param); |
704 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMemberships", parameters); | 704 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMemberships", parameters); |
705 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 705 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
706 | Hashtable respData = (Hashtable)resp.Value; | 706 | Hashtable respData = (Hashtable)resp.Value; |
707 | 707 | ||
708 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 708 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
709 | 709 | ||
710 | if (respData.Contains("error")) | 710 | if (respData.Contains("error")) |
711 | { | 711 | { |
712 | if (respData["error"].ToString() != "No Memberships") | 712 | if (respData["error"].ToString() != "No Memberships") |
713 | { | 713 | { |
714 | LogRespDataToConsoleError(respData); | 714 | LogRespDataToConsoleError(respData); |
715 | } | 715 | } |
716 | } | 716 | } |
717 | else | 717 | else |
718 | { | 718 | { |
719 | foreach (object membership in respData.Values) | 719 | foreach (object membership in respData.Values) |
720 | { | 720 | { |
721 | memberships.Add(HashTableToGroupMembershipData((Hashtable)membership)); | 721 | memberships.Add(HashTableToGroupMembershipData((Hashtable)membership)); |
722 | } | 722 | } |
723 | } | 723 | } |
724 | return memberships; | 724 | return memberships; |
725 | } | 725 | } |
726 | 726 | ||
727 | public List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID) | 727 | public List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID) |
728 | { | 728 | { |
729 | Hashtable param = new Hashtable(); | 729 | Hashtable param = new Hashtable(); |
730 | param["AgentID"] = AgentID.ToString(); | 730 | param["AgentID"] = AgentID.ToString(); |
731 | param["GroupID"] = GroupID.ToString(); | 731 | param["GroupID"] = GroupID.ToString(); |
732 | 732 | ||
733 | IList parameters = new ArrayList(); | 733 | IList parameters = new ArrayList(); |
734 | parameters.Add(param); | 734 | parameters.Add(param); |
735 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentRoles", parameters); | 735 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentRoles", parameters); |
736 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 736 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
737 | Hashtable respData = (Hashtable)resp.Value; | 737 | Hashtable respData = (Hashtable)resp.Value; |
738 | 738 | ||
739 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 739 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
740 | 740 | ||
741 | if (respData.Contains("error")) | 741 | if (respData.Contains("error")) |
742 | { | 742 | { |
743 | if ((string)respData["error"] != "None found") | 743 | if ((string)respData["error"] != "None found") |
744 | { | 744 | { |
745 | LogRespDataToConsoleError(respData); | 745 | LogRespDataToConsoleError(respData); |
746 | } | 746 | } |
747 | return Roles; | 747 | return Roles; |
748 | } | 748 | } |
749 | 749 | ||
750 | foreach (Hashtable role in respData.Values) | 750 | foreach (Hashtable role in respData.Values) |
751 | { | 751 | { |
752 | GroupRolesData data = new GroupRolesData(); | 752 | GroupRolesData data = new GroupRolesData(); |
753 | data.RoleID = new UUID((string)role["RoleID"]); | 753 | data.RoleID = new UUID((string)role["RoleID"]); |
754 | data.Name = (string)role["Name"]; | 754 | data.Name = (string)role["Name"]; |
755 | data.Description = (string)role["Description"]; | 755 | data.Description = (string)role["Description"]; |
756 | data.Powers = ulong.Parse((string)role["Powers"]); | 756 | data.Powers = ulong.Parse((string)role["Powers"]); |
757 | data.Title = (string)role["Title"]; | 757 | data.Title = (string)role["Title"]; |
758 | 758 | ||
759 | Roles.Add(data); | 759 | Roles.Add(data); |
760 | } | 760 | } |
761 | 761 | ||
762 | return Roles; | 762 | return Roles; |
763 | 763 | ||
764 | 764 | ||
765 | } | 765 | } |
766 | 766 | ||
767 | public List<GroupRolesData> GetGroupRoles(UUID GroupID) | 767 | public List<GroupRolesData> GetGroupRoles(UUID GroupID) |
768 | { | 768 | { |
769 | Hashtable param = new Hashtable(); | 769 | Hashtable param = new Hashtable(); |
770 | param["GroupID"] = GroupID.ToString(); | 770 | param["GroupID"] = GroupID.ToString(); |
771 | 771 | ||
772 | IList parameters = new ArrayList(); | 772 | IList parameters = new ArrayList(); |
773 | parameters.Add(param); | 773 | parameters.Add(param); |
774 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoles", parameters); | 774 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoles", parameters); |
775 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 775 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
776 | Hashtable respData = (Hashtable)resp.Value; | 776 | Hashtable respData = (Hashtable)resp.Value; |
777 | 777 | ||
778 | if (respData.Contains("error")) | 778 | if (respData.Contains("error")) |
779 | { | 779 | { |
780 | LogRespDataToConsoleError(respData); | 780 | LogRespDataToConsoleError(respData); |
781 | return null; | 781 | return null; |
782 | } | 782 | } |
783 | 783 | ||
784 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 784 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
785 | foreach (Hashtable role in respData.Values) | 785 | foreach (Hashtable role in respData.Values) |
786 | { | 786 | { |
787 | GroupRolesData data = new GroupRolesData(); | 787 | GroupRolesData data = new GroupRolesData(); |
788 | data.Description = (string)role["Description"]; | 788 | data.Description = (string)role["Description"]; |
789 | data.Members = int.Parse((string)role["Members"]); | 789 | data.Members = int.Parse((string)role["Members"]); |
790 | data.Name = (string)role["Name"]; | 790 | data.Name = (string)role["Name"]; |
791 | data.Powers = ulong.Parse((string)role["Powers"]); | 791 | data.Powers = ulong.Parse((string)role["Powers"]); |
792 | data.RoleID = new UUID((string)role["RoleID"]); | 792 | data.RoleID = new UUID((string)role["RoleID"]); |
793 | data.Title = (string)role["Title"]; | 793 | data.Title = (string)role["Title"]; |
794 | 794 | ||
795 | Roles.Add(data); | 795 | Roles.Add(data); |
796 | } | 796 | } |
797 | 797 | ||
798 | return Roles; | 798 | return Roles; |
799 | 799 | ||
800 | } | 800 | } |
801 | 801 | ||
802 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | 802 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) |
803 | { | 803 | { |
804 | GroupMembershipData data = new GroupMembershipData(); | 804 | GroupMembershipData data = new GroupMembershipData(); |
805 | data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); | 805 | data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); |
806 | data.Contribution = int.Parse((string)respData["Contribution"]); | 806 | data.Contribution = int.Parse((string)respData["Contribution"]); |
807 | data.ListInProfile = ((string)respData["ListInProfile"] == "1"); | 807 | data.ListInProfile = ((string)respData["ListInProfile"] == "1"); |
808 | 808 | ||
809 | data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); | 809 | data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); |
810 | data.GroupTitle = (string)respData["Title"]; | 810 | data.GroupTitle = (string)respData["Title"]; |
811 | 811 | ||
812 | data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); | 812 | data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); |
813 | 813 | ||
814 | // Is this group the agent's active group | 814 | // Is this group the agent's active group |
815 | 815 | ||
816 | data.GroupID = new UUID((string)respData["GroupID"]); | 816 | data.GroupID = new UUID((string)respData["GroupID"]); |
817 | 817 | ||
818 | UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); | 818 | UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); |
819 | data.Active = data.GroupID.Equals(ActiveGroup); | 819 | data.Active = data.GroupID.Equals(ActiveGroup); |
820 | 820 | ||
821 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); | 821 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); |
822 | data.Charter = (string)respData["Charter"]; | 822 | data.Charter = (string)respData["Charter"]; |
823 | data.FounderID = new UUID((string)respData["FounderID"]); | 823 | data.FounderID = new UUID((string)respData["FounderID"]); |
824 | data.GroupID = new UUID((string)respData["GroupID"]); | 824 | data.GroupID = new UUID((string)respData["GroupID"]); |
825 | data.GroupName = (string)respData["GroupName"]; | 825 | data.GroupName = (string)respData["GroupName"]; |
826 | data.GroupPicture = new UUID((string)respData["InsigniaID"]); | 826 | data.GroupPicture = new UUID((string)respData["InsigniaID"]); |
827 | data.MaturePublish = ((string)respData["MaturePublish"] == "1"); | 827 | data.MaturePublish = ((string)respData["MaturePublish"] == "1"); |
828 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | 828 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); |
829 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | 829 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); |
830 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | 830 | data.ShowInList = ((string)respData["ShowInList"] == "1"); |
831 | return data; | 831 | return data; |
832 | } | 832 | } |
833 | 833 | ||
834 | public List<GroupMembersData> GetGroupMembers(UUID GroupID) | 834 | public List<GroupMembersData> GetGroupMembers(UUID GroupID) |
835 | { | 835 | { |
836 | Hashtable param = new Hashtable(); | 836 | Hashtable param = new Hashtable(); |
837 | param["GroupID"] = GroupID.ToString(); | 837 | param["GroupID"] = GroupID.ToString(); |
838 | 838 | ||
839 | IList parameters = new ArrayList(); | 839 | IList parameters = new ArrayList(); |
840 | parameters.Add(param); | 840 | parameters.Add(param); |
841 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupMembers", parameters); | 841 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupMembers", parameters); |
842 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 842 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
843 | Hashtable respData = (Hashtable)resp.Value; | 843 | Hashtable respData = (Hashtable)resp.Value; |
844 | 844 | ||
845 | if (respData.Contains("error")) | 845 | if (respData.Contains("error")) |
846 | { | 846 | { |
847 | LogRespDataToConsoleError(respData); | 847 | LogRespDataToConsoleError(respData); |
848 | return null; | 848 | return null; |
849 | } | 849 | } |
850 | 850 | ||
851 | List<GroupMembersData> members = new List<GroupMembersData>(); | 851 | List<GroupMembersData> members = new List<GroupMembersData>(); |
852 | foreach (Hashtable membership in respData.Values) | 852 | foreach (Hashtable membership in respData.Values) |
853 | { | 853 | { |
854 | GroupMembersData data = new GroupMembersData(); | 854 | GroupMembersData data = new GroupMembersData(); |
855 | 855 | ||
856 | data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1"; | 856 | data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1"; |
857 | data.AgentID = new UUID((string)membership["AgentID"]); | 857 | data.AgentID = new UUID((string)membership["AgentID"]); |
858 | data.Contribution = int.Parse((string)membership["Contribution"]); | 858 | data.Contribution = int.Parse((string)membership["Contribution"]); |
859 | data.IsOwner = ((string)membership["IsOwner"]) == "1"; | 859 | data.IsOwner = ((string)membership["IsOwner"]) == "1"; |
860 | data.ListInProfile = ((string)membership["ListInProfile"]) == "1"; | 860 | data.ListInProfile = ((string)membership["ListInProfile"]) == "1"; |
861 | data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]); | 861 | data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]); |
862 | data.Title = (string)membership["Title"]; | 862 | data.Title = (string)membership["Title"]; |
863 | 863 | ||
864 | members.Add(data); | 864 | members.Add(data); |
865 | } | 865 | } |
866 | 866 | ||
867 | return members; | 867 | return members; |
868 | 868 | ||
869 | } | 869 | } |
870 | 870 | ||
871 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID) | 871 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID) |
872 | { | 872 | { |
873 | Hashtable param = new Hashtable(); | 873 | Hashtable param = new Hashtable(); |
874 | param["GroupID"] = GroupID.ToString(); | 874 | param["GroupID"] = GroupID.ToString(); |
875 | 875 | ||
876 | IList parameters = new ArrayList(); | 876 | IList parameters = new ArrayList(); |
877 | parameters.Add(param); | 877 | parameters.Add(param); |
878 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoleMembers", parameters); | 878 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoleMembers", parameters); |
879 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 879 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
880 | Hashtable respData = (Hashtable)resp.Value; | 880 | Hashtable respData = (Hashtable)resp.Value; |
881 | 881 | ||
882 | if (respData.Contains("error")) | 882 | if (respData.Contains("error")) |
883 | { | 883 | { |
884 | LogRespDataToConsoleError(respData); | 884 | LogRespDataToConsoleError(respData); |
885 | return null; | 885 | return null; |
886 | } | 886 | } |
887 | 887 | ||
888 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 888 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
889 | foreach (Hashtable membership in respData.Values) | 889 | foreach (Hashtable membership in respData.Values) |
890 | { | 890 | { |
891 | GroupRoleMembersData data = new GroupRoleMembersData(); | 891 | GroupRoleMembersData data = new GroupRoleMembersData(); |
892 | 892 | ||
893 | data.MemberID = new UUID((string)membership["AgentID"]); | 893 | data.MemberID = new UUID((string)membership["AgentID"]); |
894 | data.RoleID = new UUID((string)membership["RoleID"]); | 894 | data.RoleID = new UUID((string)membership["RoleID"]); |
895 | 895 | ||
896 | members.Add(data); | 896 | members.Add(data); |
897 | } | 897 | } |
898 | 898 | ||
899 | return members; | 899 | return members; |
900 | } | 900 | } |
901 | 901 | ||
902 | public List<GroupNoticeData> GetGroupNotices(UUID GroupID) | 902 | public List<GroupNoticeData> GetGroupNotices(UUID GroupID) |
903 | { | 903 | { |
904 | Hashtable param = new Hashtable(); | 904 | Hashtable param = new Hashtable(); |
905 | param["GroupID"] = GroupID.ToString(); | 905 | param["GroupID"] = GroupID.ToString(); |
906 | 906 | ||
907 | IList parameters = new ArrayList(); | 907 | IList parameters = new ArrayList(); |
908 | parameters.Add(param); | 908 | parameters.Add(param); |
909 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotices", parameters); | 909 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotices", parameters); |
910 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 910 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
911 | Hashtable respData = (Hashtable)resp.Value; | 911 | Hashtable respData = (Hashtable)resp.Value; |
912 | 912 | ||
913 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 913 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
914 | 914 | ||
915 | if (respData.Contains("error")) | 915 | if (respData.Contains("error")) |
916 | { | 916 | { |
917 | if ((string)respData["error"] != "No Notices") | 917 | if ((string)respData["error"] != "No Notices") |
918 | { | 918 | { |
919 | LogRespDataToConsoleError(respData); | 919 | LogRespDataToConsoleError(respData); |
920 | } | 920 | } |
921 | } | 921 | } |
922 | else | 922 | else |
923 | { | 923 | { |
924 | foreach (Hashtable value in respData.Values) | 924 | foreach (Hashtable value in respData.Values) |
925 | { | 925 | { |
926 | GroupNoticeData data = new GroupNoticeData(); | 926 | GroupNoticeData data = new GroupNoticeData(); |
927 | data.NoticeID = UUID.Parse((string)value["NoticeID"]); | 927 | data.NoticeID = UUID.Parse((string)value["NoticeID"]); |
928 | data.Timestamp = uint.Parse((string)value["Timestamp"]); | 928 | data.Timestamp = uint.Parse((string)value["Timestamp"]); |
929 | data.FromName = (string)value["FromName"]; | 929 | data.FromName = (string)value["FromName"]; |
930 | data.Subject = (string)value["Subject"]; | 930 | data.Subject = (string)value["Subject"]; |
931 | data.HasAttachment = false; | 931 | data.HasAttachment = false; |
932 | data.AssetType = 0; | 932 | data.AssetType = 0; |
933 | 933 | ||
934 | values.Add(data); | 934 | values.Add(data); |
935 | } | 935 | } |
936 | } | 936 | } |
937 | return values; | 937 | return values; |
938 | 938 | ||
939 | } | 939 | } |
940 | public GroupNoticeInfo GetGroupNotice(UUID noticeID) | 940 | public GroupNoticeInfo GetGroupNotice(UUID noticeID) |
941 | { | 941 | { |
942 | Hashtable param = new Hashtable(); | 942 | Hashtable param = new Hashtable(); |
943 | param["NoticeID"] = noticeID.ToString(); | 943 | param["NoticeID"] = noticeID.ToString(); |
944 | 944 | ||
945 | IList parameters = new ArrayList(); | 945 | IList parameters = new ArrayList(); |
946 | parameters.Add(param); | 946 | parameters.Add(param); |
947 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotice", parameters); | 947 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotice", parameters); |
948 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 948 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
949 | Hashtable respData = (Hashtable)resp.Value; | 949 | Hashtable respData = (Hashtable)resp.Value; |
950 | 950 | ||
951 | 951 | ||
952 | 952 | ||
953 | if (respData.Contains("error")) | 953 | if (respData.Contains("error")) |
954 | { | 954 | { |
955 | if ((string)respData["error"] != "Group Notice Not Found") | 955 | if ((string)respData["error"] != "Group Notice Not Found") |
956 | { | 956 | { |
957 | LogRespDataToConsoleError(respData); | 957 | LogRespDataToConsoleError(respData); |
958 | return null; | 958 | return null; |
959 | } | 959 | } |
960 | } | 960 | } |
961 | 961 | ||
962 | GroupNoticeInfo data = new GroupNoticeInfo(); | 962 | GroupNoticeInfo data = new GroupNoticeInfo(); |
963 | data.GroupID = UUID.Parse((string)respData["GroupID"]); | 963 | data.GroupID = UUID.Parse((string)respData["GroupID"]); |
964 | data.Message = (string)respData["Message"]; | 964 | data.Message = (string)respData["Message"]; |
965 | data.BinaryBucket = Utils.HexStringToBytes((string)respData["BinaryBucket"], true); | 965 | data.BinaryBucket = Utils.HexStringToBytes((string)respData["BinaryBucket"], true); |
966 | data.noticeData.NoticeID = UUID.Parse((string)respData["NoticeID"]); | 966 | data.noticeData.NoticeID = UUID.Parse((string)respData["NoticeID"]); |
967 | data.noticeData.Timestamp = uint.Parse((string)respData["Timestamp"]); | 967 | data.noticeData.Timestamp = uint.Parse((string)respData["Timestamp"]); |
968 | data.noticeData.FromName = (string)respData["FromName"]; | 968 | data.noticeData.FromName = (string)respData["FromName"]; |
969 | data.noticeData.Subject = (string)respData["Subject"]; | 969 | data.noticeData.Subject = (string)respData["Subject"]; |
970 | data.noticeData.HasAttachment = false; | 970 | data.noticeData.HasAttachment = false; |
971 | data.noticeData.AssetType = 0; | 971 | data.noticeData.AssetType = 0; |
972 | 972 | ||
973 | if (data.Message == null) | 973 | if (data.Message == null) |
974 | { | 974 | { |
975 | data.Message = string.Empty; | 975 | data.Message = string.Empty; |
976 | } | 976 | } |
977 | 977 | ||
978 | return data; | 978 | return data; |
979 | } | 979 | } |
980 | public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 980 | public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
981 | { | 981 | { |
982 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 982 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
983 | 983 | ||
984 | Hashtable param = new Hashtable(); | 984 | Hashtable param = new Hashtable(); |
985 | param["GroupID"] = groupID.ToString(); | 985 | param["GroupID"] = groupID.ToString(); |
986 | param["NoticeID"] = noticeID.ToString(); | 986 | param["NoticeID"] = noticeID.ToString(); |
987 | param["FromName"] = fromName; | 987 | param["FromName"] = fromName; |
988 | param["Subject"] = subject; | 988 | param["Subject"] = subject; |
989 | param["Message"] = message; | 989 | param["Message"] = message; |
990 | param["BinaryBucket"] = binBucket; | 990 | param["BinaryBucket"] = binBucket; |
991 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 991 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
992 | 992 | ||
993 | IList parameters = new ArrayList(); | 993 | IList parameters = new ArrayList(); |
994 | parameters.Add(param); | 994 | parameters.Add(param); |
995 | XmlRpcRequest req = new XmlRpcRequest("groups.addGroupNotice", parameters); | 995 | XmlRpcRequest req = new XmlRpcRequest("groups.addGroupNotice", parameters); |
996 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 996 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
997 | Hashtable respData = (Hashtable)resp.Value; | 997 | Hashtable respData = (Hashtable)resp.Value; |
998 | 998 | ||
999 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 999 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
1000 | 1000 | ||
1001 | if (respData.Contains("error")) | 1001 | if (respData.Contains("error")) |
1002 | { | 1002 | { |
1003 | LogRespDataToConsoleError(respData); | 1003 | LogRespDataToConsoleError(respData); |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | 1007 | ||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | public class GroupNoticeInfo | 1010 | public class GroupNoticeInfo |
1011 | { | 1011 | { |
1012 | public GroupNoticeData noticeData = new GroupNoticeData(); | 1012 | public GroupNoticeData noticeData = new GroupNoticeData(); |
1013 | public UUID GroupID = UUID.Zero; | 1013 | public UUID GroupID = UUID.Zero; |
1014 | public string Message = string.Empty; | 1014 | public string Message = string.Empty; |
1015 | public byte[] BinaryBucket = new byte[0]; | 1015 | public byte[] BinaryBucket = new byte[0]; |
1016 | } | 1016 | } |
1017 | } | 1017 | } |