diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 209 |
1 files changed, 83 insertions, 126 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index ab343c8..964d0bb 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -40,16 +40,16 @@ using OpenMetaverse; | |||
40 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
41 | 41 | ||
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Communications; | ||
44 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
45 | using OpenSim.Services.Interfaces; | ||
46 | 44 | ||
47 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
48 | { | 46 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
50 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector | 48 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector |
51 | { | 49 | { |
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | 53 | ||
54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | |
55 | GroupPowers.Accountable | | 55 | GroupPowers.Accountable | |
@@ -68,8 +68,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
68 | private string m_groupReadKey = string.Empty; | 68 | private string m_groupReadKey = string.Empty; |
69 | private string m_groupWriteKey = string.Empty; | 69 | private string m_groupWriteKey = string.Empty; |
70 | 70 | ||
71 | private IUserAccountService m_accountService = null; | ||
72 | |||
73 | 71 | ||
74 | #region IRegionModuleBase Members | 72 | #region IRegionModuleBase Members |
75 | 73 | ||
@@ -120,9 +118,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
120 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 118 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
121 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 119 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
122 | 120 | ||
123 | |||
124 | |||
125 | |||
126 | // If we got all the config options we need, lets start'er'up | 121 | // If we got all the config options we need, lets start'er'up |
127 | m_connectorEnabled = true; | 122 | m_connectorEnabled = true; |
128 | } | 123 | } |
@@ -136,24 +131,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
136 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 131 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
137 | { | 132 | { |
138 | if (m_connectorEnabled) | 133 | if (m_connectorEnabled) |
139 | { | ||
140 | |||
141 | if (m_accountService == null) | ||
142 | { | ||
143 | m_accountService = scene.UserAccountService; | ||
144 | } | ||
145 | |||
146 | |||
147 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | 134 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); |
148 | } | ||
149 | } | 135 | } |
150 | 136 | ||
151 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 137 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
152 | { | 138 | { |
153 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | 139 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) |
154 | { | ||
155 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | 140 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); |
156 | } | ||
157 | } | 141 | } |
158 | 142 | ||
159 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | 143 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -173,12 +157,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
173 | 157 | ||
174 | #endregion | 158 | #endregion |
175 | 159 | ||
160 | |||
161 | |||
176 | #region IGroupsServicesConnector Members | 162 | #region IGroupsServicesConnector Members |
177 | 163 | ||
178 | /// <summary> | 164 | /// <summary> |
179 | /// 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. |
180 | /// </summary> | 166 | /// </summary> |
181 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, | 167 | public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, |
182 | int membershipFee, bool openEnrollment, bool allowPublish, | 168 | int membershipFee, bool openEnrollment, bool allowPublish, |
183 | bool maturePublish, UUID founderID) | 169 | bool maturePublish, UUID founderID) |
184 | { | 170 | { |
@@ -250,7 +236,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
250 | 236 | ||
251 | 237 | ||
252 | 238 | ||
253 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); | 239 | Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param); |
254 | 240 | ||
255 | if (respData.Contains("error")) | 241 | if (respData.Contains("error")) |
256 | { | 242 | { |
@@ -262,7 +248,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
262 | return UUID.Parse((string)respData["GroupID"]); | 248 | return UUID.Parse((string)respData["GroupID"]); |
263 | } | 249 | } |
264 | 250 | ||
265 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, | 251 | public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, |
266 | UUID insigniaID, int membershipFee, bool openEnrollment, | 252 | UUID insigniaID, int membershipFee, bool openEnrollment, |
267 | bool allowPublish, bool maturePublish) | 253 | bool allowPublish, bool maturePublish) |
268 | { | 254 | { |
@@ -276,10 +262,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
276 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 262 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
277 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 263 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
278 | 264 | ||
279 | XmlRpcCall(requestingAgentID, "groups.updateGroup", param); | 265 | XmlRpcCall(requestID, "groups.updateGroup", param); |
280 | } | 266 | } |
281 | 267 | ||
282 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, | 268 | public void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, |
283 | string title, ulong powers) | 269 | string title, ulong powers) |
284 | { | 270 | { |
285 | Hashtable param = new Hashtable(); | 271 | Hashtable param = new Hashtable(); |
@@ -290,19 +276,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
290 | param["Title"] = title; | 276 | param["Title"] = title; |
291 | param["Powers"] = powers.ToString(); | 277 | param["Powers"] = powers.ToString(); |
292 | 278 | ||
293 | XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param); | 279 | XmlRpcCall(requestID, "groups.addRoleToGroup", param); |
294 | } | 280 | } |
295 | 281 | ||
296 | public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) | 282 | public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID) |
297 | { | 283 | { |
298 | Hashtable param = new Hashtable(); | 284 | Hashtable param = new Hashtable(); |
299 | param["GroupID"] = groupID.ToString(); | 285 | param["GroupID"] = groupID.ToString(); |
300 | param["RoleID"] = roleID.ToString(); | 286 | param["RoleID"] = roleID.ToString(); |
301 | 287 | ||
302 | XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); | 288 | XmlRpcCall(requestID, "groups.removeRoleFromGroup", param); |
303 | } | 289 | } |
304 | 290 | ||
305 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, | 291 | public void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, |
306 | string title, ulong powers) | 292 | string title, ulong powers) |
307 | { | 293 | { |
308 | Hashtable param = new Hashtable(); | 294 | Hashtable param = new Hashtable(); |
@@ -322,10 +308,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
322 | } | 308 | } |
323 | param["Powers"] = powers.ToString(); | 309 | param["Powers"] = powers.ToString(); |
324 | 310 | ||
325 | XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param); | 311 | XmlRpcCall(requestID, "groups.updateGroupRole", param); |
326 | } | 312 | } |
327 | 313 | ||
328 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) | 314 | public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName) |
329 | { | 315 | { |
330 | Hashtable param = new Hashtable(); | 316 | Hashtable param = new Hashtable(); |
331 | if (GroupID != UUID.Zero) | 317 | if (GroupID != UUID.Zero) |
@@ -337,7 +323,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
337 | param["Name"] = GroupName.ToString(); | 323 | param["Name"] = GroupName.ToString(); |
338 | } | 324 | } |
339 | 325 | ||
340 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); | 326 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); |
341 | 327 | ||
342 | if (respData.Contains("error")) | 328 | if (respData.Contains("error")) |
343 | { | 329 | { |
@@ -348,12 +334,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
348 | 334 | ||
349 | } | 335 | } |
350 | 336 | ||
351 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) | 337 | public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID) |
352 | { | 338 | { |
353 | Hashtable param = new Hashtable(); | 339 | Hashtable param = new Hashtable(); |
354 | param["GroupID"] = GroupID.ToString(); | 340 | param["GroupID"] = GroupID.ToString(); |
355 | 341 | ||
356 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); | 342 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); |
357 | 343 | ||
358 | if (respData.Contains("error")) | 344 | if (respData.Contains("error")) |
359 | { | 345 | { |
@@ -361,35 +347,38 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
361 | return new GroupProfileData(); | 347 | return new GroupProfileData(); |
362 | } | 348 | } |
363 | 349 | ||
364 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); | 350 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID); |
365 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 351 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
366 | 352 | ||
367 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 353 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
368 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 354 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; |
369 | 355 | ||
370 | return MemberGroupProfile; | 356 | return MemberGroupProfile; |
357 | |||
371 | } | 358 | } |
372 | 359 | ||
373 | public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) | 360 | |
361 | |||
362 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | ||
374 | { | 363 | { |
375 | Hashtable param = new Hashtable(); | 364 | Hashtable param = new Hashtable(); |
376 | param["AgentID"] = AgentID.ToString(); | 365 | param["AgentID"] = AgentID.ToString(); |
377 | param["GroupID"] = GroupID.ToString(); | 366 | param["GroupID"] = GroupID.ToString(); |
378 | 367 | ||
379 | XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param); | 368 | XmlRpcCall(requestID, "groups.setAgentActiveGroup", param); |
380 | } | 369 | } |
381 | 370 | ||
382 | public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) | 371 | public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) |
383 | { | 372 | { |
384 | Hashtable param = new Hashtable(); | 373 | Hashtable param = new Hashtable(); |
385 | param["AgentID"] = AgentID.ToString(); | 374 | param["AgentID"] = AgentID.ToString(); |
386 | param["GroupID"] = GroupID.ToString(); | 375 | param["GroupID"] = GroupID.ToString(); |
387 | param["SelectedRoleID"] = RoleID.ToString(); | 376 | param["SelectedRoleID"] = RoleID.ToString(); |
388 | 377 | ||
389 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); | 378 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); |
390 | } | 379 | } |
391 | 380 | ||
392 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 381 | public void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
393 | { | 382 | { |
394 | Hashtable param = new Hashtable(); | 383 | Hashtable param = new Hashtable(); |
395 | param["AgentID"] = AgentID.ToString(); | 384 | param["AgentID"] = AgentID.ToString(); |
@@ -397,11 +386,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
397 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 386 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
398 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 387 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
399 | 388 | ||
400 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); | 389 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); |
401 | 390 | ||
402 | } | 391 | } |
403 | 392 | ||
404 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 393 | public void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
405 | { | 394 | { |
406 | Hashtable param = new Hashtable(); | 395 | Hashtable param = new Hashtable(); |
407 | param["InviteID"] = inviteID.ToString(); | 396 | param["InviteID"] = inviteID.ToString(); |
@@ -409,16 +398,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
409 | param["RoleID"] = roleID.ToString(); | 398 | param["RoleID"] = roleID.ToString(); |
410 | param["GroupID"] = groupID.ToString(); | 399 | param["GroupID"] = groupID.ToString(); |
411 | 400 | ||
412 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param); | 401 | XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param); |
413 | 402 | ||
414 | } | 403 | } |
415 | 404 | ||
416 | public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) | 405 | public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) |
417 | { | 406 | { |
418 | Hashtable param = new Hashtable(); | 407 | Hashtable param = new Hashtable(); |
419 | param["InviteID"] = inviteID.ToString(); | 408 | param["InviteID"] = inviteID.ToString(); |
420 | 409 | ||
421 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param); | 410 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param); |
422 | 411 | ||
423 | if (respData.Contains("error")) | 412 | if (respData.Contains("error")) |
424 | { | 413 | { |
@@ -434,59 +423,60 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
434 | return inviteInfo; | 423 | return inviteInfo; |
435 | } | 424 | } |
436 | 425 | ||
437 | public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) | 426 | public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) |
438 | { | 427 | { |
439 | Hashtable param = new Hashtable(); | 428 | Hashtable param = new Hashtable(); |
440 | param["InviteID"] = inviteID.ToString(); | 429 | param["InviteID"] = inviteID.ToString(); |
441 | 430 | ||
442 | XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param); | 431 | XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param); |
443 | } | 432 | } |
444 | 433 | ||
445 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) | 434 | public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) |
446 | { | 435 | { |
447 | Hashtable param = new Hashtable(); | 436 | Hashtable param = new Hashtable(); |
448 | param["AgentID"] = AgentID.ToString(); | 437 | param["AgentID"] = AgentID.ToString(); |
449 | param["GroupID"] = GroupID.ToString(); | 438 | param["GroupID"] = GroupID.ToString(); |
450 | param["RoleID"] = RoleID.ToString(); | 439 | param["RoleID"] = RoleID.ToString(); |
451 | 440 | ||
452 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param); | 441 | XmlRpcCall(requestID, "groups.addAgentToGroup", param); |
453 | } | 442 | } |
454 | 443 | ||
455 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) | 444 | public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) |
456 | { | 445 | { |
457 | Hashtable param = new Hashtable(); | 446 | Hashtable param = new Hashtable(); |
458 | param["AgentID"] = AgentID.ToString(); | 447 | param["AgentID"] = AgentID.ToString(); |
459 | param["GroupID"] = GroupID.ToString(); | 448 | param["GroupID"] = GroupID.ToString(); |
460 | 449 | ||
461 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param); | 450 | XmlRpcCall(requestID, "groups.removeAgentFromGroup", param); |
462 | } | 451 | } |
463 | 452 | ||
464 | public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) | 453 | public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) |
465 | { | 454 | { |
466 | Hashtable param = new Hashtable(); | 455 | Hashtable param = new Hashtable(); |
467 | param["AgentID"] = AgentID.ToString(); | 456 | param["AgentID"] = AgentID.ToString(); |
468 | param["GroupID"] = GroupID.ToString(); | 457 | param["GroupID"] = GroupID.ToString(); |
469 | param["RoleID"] = RoleID.ToString(); | 458 | param["RoleID"] = RoleID.ToString(); |
470 | 459 | ||
471 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param); | 460 | XmlRpcCall(requestID, "groups.addAgentToGroupRole", param); |
472 | } | 461 | } |
473 | 462 | ||
474 | public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) | 463 | public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) |
475 | { | 464 | { |
476 | Hashtable param = new Hashtable(); | 465 | Hashtable param = new Hashtable(); |
477 | param["AgentID"] = AgentID.ToString(); | 466 | param["AgentID"] = AgentID.ToString(); |
478 | param["GroupID"] = GroupID.ToString(); | 467 | param["GroupID"] = GroupID.ToString(); |
479 | param["RoleID"] = RoleID.ToString(); | 468 | param["RoleID"] = RoleID.ToString(); |
480 | 469 | ||
481 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param); | 470 | XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); |
482 | } | 471 | } |
483 | 472 | ||
484 | public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search) | 473 | |
474 | public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) | ||
485 | { | 475 | { |
486 | Hashtable param = new Hashtable(); | 476 | Hashtable param = new Hashtable(); |
487 | param["Search"] = search; | 477 | param["Search"] = search; |
488 | 478 | ||
489 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); | 479 | Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param); |
490 | 480 | ||
491 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 481 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
492 | 482 | ||
@@ -508,13 +498,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
508 | return findings; | 498 | return findings; |
509 | } | 499 | } |
510 | 500 | ||
511 | public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) | 501 | public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID) |
512 | { | 502 | { |
513 | Hashtable param = new Hashtable(); | 503 | Hashtable param = new Hashtable(); |
514 | param["AgentID"] = AgentID.ToString(); | 504 | param["AgentID"] = AgentID.ToString(); |
515 | param["GroupID"] = GroupID.ToString(); | 505 | param["GroupID"] = GroupID.ToString(); |
516 | 506 | ||
517 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param); | 507 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param); |
518 | 508 | ||
519 | if (respData.Contains("error")) | 509 | if (respData.Contains("error")) |
520 | { | 510 | { |
@@ -526,12 +516,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
526 | return data; | 516 | return data; |
527 | } | 517 | } |
528 | 518 | ||
529 | public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) | 519 | public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID) |
530 | { | 520 | { |
531 | Hashtable param = new Hashtable(); | 521 | Hashtable param = new Hashtable(); |
532 | param["AgentID"] = AgentID.ToString(); | 522 | param["AgentID"] = AgentID.ToString(); |
533 | 523 | ||
534 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param); | 524 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param); |
535 | 525 | ||
536 | if (respData.Contains("error")) | 526 | if (respData.Contains("error")) |
537 | { | 527 | { |
@@ -541,12 +531,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
541 | return HashTableToGroupMembershipData(respData); | 531 | return HashTableToGroupMembershipData(respData); |
542 | } | 532 | } |
543 | 533 | ||
544 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) | 534 | |
535 | public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) | ||
545 | { | 536 | { |
546 | Hashtable param = new Hashtable(); | 537 | Hashtable param = new Hashtable(); |
547 | param["AgentID"] = AgentID.ToString(); | 538 | param["AgentID"] = AgentID.ToString(); |
548 | 539 | ||
549 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param); | 540 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param); |
550 | 541 | ||
551 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 542 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
552 | 543 | ||
@@ -561,13 +552,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
561 | return memberships; | 552 | return memberships; |
562 | } | 553 | } |
563 | 554 | ||
564 | public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) | 555 | public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID) |
565 | { | 556 | { |
566 | Hashtable param = new Hashtable(); | 557 | Hashtable param = new Hashtable(); |
567 | param["AgentID"] = AgentID.ToString(); | 558 | param["AgentID"] = AgentID.ToString(); |
568 | param["GroupID"] = GroupID.ToString(); | 559 | param["GroupID"] = GroupID.ToString(); |
569 | 560 | ||
570 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param); | 561 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param); |
571 | 562 | ||
572 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 563 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
573 | 564 | ||
@@ -593,12 +584,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
593 | 584 | ||
594 | } | 585 | } |
595 | 586 | ||
596 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) | 587 | public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID) |
597 | { | 588 | { |
598 | Hashtable param = new Hashtable(); | 589 | Hashtable param = new Hashtable(); |
599 | param["GroupID"] = GroupID.ToString(); | 590 | param["GroupID"] = GroupID.ToString(); |
600 | 591 | ||
601 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); | 592 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param); |
602 | 593 | ||
603 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 594 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
604 | 595 | ||
@@ -626,12 +617,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
626 | 617 | ||
627 | 618 | ||
628 | 619 | ||
629 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) | 620 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) |
630 | { | 621 | { |
631 | Hashtable param = new Hashtable(); | 622 | Hashtable param = new Hashtable(); |
632 | param["GroupID"] = GroupID.ToString(); | 623 | param["GroupID"] = GroupID.ToString(); |
633 | 624 | ||
634 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param); | 625 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param); |
635 | 626 | ||
636 | List<GroupMembersData> members = new List<GroupMembersData>(); | 627 | List<GroupMembersData> members = new List<GroupMembersData>(); |
637 | 628 | ||
@@ -659,12 +650,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
659 | 650 | ||
660 | } | 651 | } |
661 | 652 | ||
662 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) | 653 | public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID) |
663 | { | 654 | { |
664 | Hashtable param = new Hashtable(); | 655 | Hashtable param = new Hashtable(); |
665 | param["GroupID"] = GroupID.ToString(); | 656 | param["GroupID"] = GroupID.ToString(); |
666 | 657 | ||
667 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param); | 658 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param); |
668 | 659 | ||
669 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 660 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
670 | 661 | ||
@@ -683,12 +674,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
683 | return members; | 674 | return members; |
684 | } | 675 | } |
685 | 676 | ||
686 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) | 677 | public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID) |
687 | { | 678 | { |
688 | Hashtable param = new Hashtable(); | 679 | Hashtable param = new Hashtable(); |
689 | param["GroupID"] = GroupID.ToString(); | 680 | param["GroupID"] = GroupID.ToString(); |
690 | 681 | ||
691 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param); | 682 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param); |
692 | 683 | ||
693 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 684 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
694 | 685 | ||
@@ -710,12 +701,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
710 | return values; | 701 | return values; |
711 | 702 | ||
712 | } | 703 | } |
713 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) | 704 | public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID) |
714 | { | 705 | { |
715 | Hashtable param = new Hashtable(); | 706 | Hashtable param = new Hashtable(); |
716 | param["NoticeID"] = noticeID.ToString(); | 707 | param["NoticeID"] = noticeID.ToString(); |
717 | 708 | ||
718 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); | 709 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param); |
719 | 710 | ||
720 | 711 | ||
721 | if (respData.Contains("error")) | 712 | if (respData.Contains("error")) |
@@ -741,7 +732,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
741 | 732 | ||
742 | return data; | 733 | return data; |
743 | } | 734 | } |
744 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 735 | public void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
745 | { | 736 | { |
746 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 737 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
747 | 738 | ||
@@ -754,7 +745,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
754 | param["BinaryBucket"] = binBucket; | 745 | param["BinaryBucket"] = binBucket; |
755 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 746 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
756 | 747 | ||
757 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); | 748 | XmlRpcCall(requestID, "groups.addGroupNotice", param); |
758 | } | 749 | } |
759 | #endregion | 750 | #endregion |
760 | 751 | ||
@@ -787,6 +778,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
787 | 778 | ||
788 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | 779 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) |
789 | { | 780 | { |
781 | |||
790 | GroupRecord group = new GroupRecord(); | 782 | GroupRecord group = new GroupRecord(); |
791 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 783 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
792 | group.GroupName = groupProfile["Name"].ToString(); | 784 | group.GroupName = groupProfile["Name"].ToString(); |
@@ -805,7 +797,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
805 | 797 | ||
806 | return group; | 798 | return group; |
807 | } | 799 | } |
808 | |||
809 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | 800 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) |
810 | { | 801 | { |
811 | GroupMembershipData data = new GroupMembershipData(); | 802 | GroupMembershipData data = new GroupMembershipData(); |
@@ -838,7 +829,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
838 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | 829 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); |
839 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | 830 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); |
840 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | 831 | data.ShowInList = ((string)respData["ShowInList"] == "1"); |
841 | |||
842 | return data; | 832 | return data; |
843 | } | 833 | } |
844 | 834 | ||
@@ -847,14 +837,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
847 | /// <summary> | 837 | /// <summary> |
848 | /// Encapsulate the XmlRpc call to standardize security and error handling. | 838 | /// Encapsulate the XmlRpc call to standardize security and error handling. |
849 | /// </summary> | 839 | /// </summary> |
850 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) | 840 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) |
851 | { | 841 | { |
852 | string UserService; | 842 | if (requestID == null) |
853 | UUID SessionID; | 843 | { |
854 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); | 844 | requestID = new GroupRequestID(); |
855 | param.Add("requestingAgentID", requestingAgentID.ToString()); | 845 | } |
856 | param.Add("RequestingAgentUserService", UserService); | 846 | param.Add("RequestingAgentID", requestID.AgentID.ToString()); |
857 | param.Add("RequestingSessionID", SessionID.ToString()); | 847 | param.Add("RequestingAgentUserService", requestID.UserServiceURL); |
848 | param.Add("RequestingSessionID", requestID.SessionID.ToString()); | ||
858 | 849 | ||
859 | 850 | ||
860 | param.Add("ReadKey", m_groupReadKey); | 851 | param.Add("ReadKey", m_groupReadKey); |
@@ -945,49 +936,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
945 | } | 936 | } |
946 | } | 937 | } |
947 | 938 | ||
948 | |||
949 | /// <summary> | ||
950 | /// Group Request Tokens are an attempt to allow the groups service to authenticate | ||
951 | /// requests. Currently uses UserService, AgentID, and SessionID | ||
952 | /// TODO: Find a better way to do this. | ||
953 | /// </summary> | ||
954 | /// <param name="client"></param> | ||
955 | /// <returns></returns> | ||
956 | private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID) | ||
957 | { | ||
958 | UserServiceURL = ""; | ||
959 | SessionID = UUID.Zero; | ||
960 | |||
961 | |||
962 | // Need to rework this based on changes to User Services | ||
963 | /* | ||
964 | UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); | ||
965 | if (userAccount == null) | ||
966 | { | ||
967 | // This should be impossible. If I've been passed a reference to a client | ||
968 | // that client should be registered with the UserService. So something | ||
969 | // is horribly wrong somewhere. | ||
970 | |||
971 | m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID); | ||
972 | 939 | ||
973 | } | 940 | } |
974 | else if (userProfile is ForeignUserProfileData) | ||
975 | { | ||
976 | // They aren't from around here | ||
977 | ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; | ||
978 | UserServiceURL = fupd.UserServerURI; | ||
979 | SessionID = fupd.CurrentAgent.SessionID; | ||
980 | 941 | ||
981 | } | 942 | public class GroupNoticeInfo |
982 | else | 943 | { |
983 | { | 944 | public GroupNoticeData noticeData = new GroupNoticeData(); |
984 | // They're a local user, use this: | 945 | public UUID GroupID = UUID.Zero; |
985 | UserServiceURL = m_commManager.NetworkServersInfo.UserURL; | 946 | public string Message = string.Empty; |
986 | SessionID = userProfile.CurrentAgent.SessionID; | 947 | public byte[] BinaryBucket = new byte[0]; |
987 | } | ||
988 | */ | ||
989 | } | ||
990 | |||
991 | } | 948 | } |
992 | } | 949 | } |
993 | 950 | ||