diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 281 |
1 files changed, 192 insertions, 89 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 964d0bb..2a60b00 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -47,9 +47,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
48 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector | 48 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector |
49 | { | 49 | { |
50 | private static readonly ILog m_log = | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | 51 | ||
54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 52 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | |
55 | GroupPowers.Accountable | | 53 | GroupPowers.Accountable | |
@@ -61,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
61 | 59 | ||
62 | private bool m_connectorEnabled = false; | 60 | private bool m_connectorEnabled = false; |
63 | 61 | ||
64 | private string m_serviceURL = string.Empty; | 62 | private string m_groupsServerURI = string.Empty; |
65 | 63 | ||
66 | private bool m_disableKeepAlive = false; | 64 | private bool m_disableKeepAlive = false; |
67 | 65 | ||
@@ -69,6 +67,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
69 | private string m_groupWriteKey = string.Empty; | 67 | private string m_groupWriteKey = string.Empty; |
70 | 68 | ||
71 | 69 | ||
70 | // Used to track which agents are have dropped from a group chat session | ||
71 | // Should be reset per agent, on logon | ||
72 | // TODO: move this to Flotsam XmlRpc Service | ||
73 | // SessionID, List<AgentID> | ||
74 | private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>(); | ||
75 | private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>(); | ||
76 | |||
77 | |||
72 | #region IRegionModuleBase Members | 78 | #region IRegionModuleBase Members |
73 | 79 | ||
74 | public string Name | 80 | public string Name |
@@ -104,11 +110,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
104 | 110 | ||
105 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); | 111 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); |
106 | 112 | ||
107 | m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); | 113 | m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); |
108 | if ((m_serviceURL == null) || | 114 | if ((m_groupsServerURI == null) || |
109 | (m_serviceURL == string.Empty)) | 115 | (m_groupsServerURI == string.Empty)) |
110 | { | 116 | { |
111 | m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); | 117 | m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); |
112 | m_connectorEnabled = false; | 118 | m_connectorEnabled = false; |
113 | return; | 119 | return; |
114 | } | 120 | } |
@@ -118,6 +124,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
118 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 124 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
119 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 125 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
120 | 126 | ||
127 | |||
128 | |||
129 | |||
121 | // If we got all the config options we need, lets start'er'up | 130 | // If we got all the config options we need, lets start'er'up |
122 | m_connectorEnabled = true; | 131 | m_connectorEnabled = true; |
123 | } | 132 | } |
@@ -131,13 +140,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
131 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 140 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
132 | { | 141 | { |
133 | if (m_connectorEnabled) | 142 | if (m_connectorEnabled) |
143 | { | ||
134 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | 144 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); |
145 | } | ||
135 | } | 146 | } |
136 | 147 | ||
137 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 148 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
138 | { | 149 | { |
139 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | 150 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) |
151 | { | ||
140 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | 152 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); |
153 | } | ||
141 | } | 154 | } |
142 | 155 | ||
143 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | 156 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -157,14 +170,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
157 | 170 | ||
158 | #endregion | 171 | #endregion |
159 | 172 | ||
160 | |||
161 | |||
162 | #region IGroupsServicesConnector Members | 173 | #region IGroupsServicesConnector Members |
163 | 174 | ||
164 | /// <summary> | 175 | /// <summary> |
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. | 176 | /// 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. |
166 | /// </summary> | 177 | /// </summary> |
167 | public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, | 178 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, |
168 | int membershipFee, bool openEnrollment, bool allowPublish, | 179 | int membershipFee, bool openEnrollment, bool allowPublish, |
169 | bool maturePublish, UUID founderID) | 180 | bool maturePublish, UUID founderID) |
170 | { | 181 | { |
@@ -236,7 +247,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
236 | 247 | ||
237 | 248 | ||
238 | 249 | ||
239 | Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param); | 250 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); |
240 | 251 | ||
241 | if (respData.Contains("error")) | 252 | if (respData.Contains("error")) |
242 | { | 253 | { |
@@ -248,7 +259,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
248 | return UUID.Parse((string)respData["GroupID"]); | 259 | return UUID.Parse((string)respData["GroupID"]); |
249 | } | 260 | } |
250 | 261 | ||
251 | public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, | 262 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
252 | UUID insigniaID, int membershipFee, bool openEnrollment, | 263 | UUID insigniaID, int membershipFee, bool openEnrollment, |
253 | bool allowPublish, bool maturePublish) | 264 | bool allowPublish, bool maturePublish) |
254 | { | 265 | { |
@@ -262,10 +273,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
262 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 273 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
263 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 274 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
264 | 275 | ||
265 | XmlRpcCall(requestID, "groups.updateGroup", param); | 276 | XmlRpcCall(requestingAgentID, "groups.updateGroup", param); |
266 | } | 277 | } |
267 | 278 | ||
268 | public void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 279 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
269 | string title, ulong powers) | 280 | string title, ulong powers) |
270 | { | 281 | { |
271 | Hashtable param = new Hashtable(); | 282 | Hashtable param = new Hashtable(); |
@@ -276,19 +287,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
276 | param["Title"] = title; | 287 | param["Title"] = title; |
277 | param["Powers"] = powers.ToString(); | 288 | param["Powers"] = powers.ToString(); |
278 | 289 | ||
279 | XmlRpcCall(requestID, "groups.addRoleToGroup", param); | 290 | XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param); |
280 | } | 291 | } |
281 | 292 | ||
282 | public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID) | 293 | public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) |
283 | { | 294 | { |
284 | Hashtable param = new Hashtable(); | 295 | Hashtable param = new Hashtable(); |
285 | param["GroupID"] = groupID.ToString(); | 296 | param["GroupID"] = groupID.ToString(); |
286 | param["RoleID"] = roleID.ToString(); | 297 | param["RoleID"] = roleID.ToString(); |
287 | 298 | ||
288 | XmlRpcCall(requestID, "groups.removeRoleFromGroup", param); | 299 | XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); |
289 | } | 300 | } |
290 | 301 | ||
291 | public void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 302 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
292 | string title, ulong powers) | 303 | string title, ulong powers) |
293 | { | 304 | { |
294 | Hashtable param = new Hashtable(); | 305 | Hashtable param = new Hashtable(); |
@@ -308,10 +319,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
308 | } | 319 | } |
309 | param["Powers"] = powers.ToString(); | 320 | param["Powers"] = powers.ToString(); |
310 | 321 | ||
311 | XmlRpcCall(requestID, "groups.updateGroupRole", param); | 322 | XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param); |
312 | } | 323 | } |
313 | 324 | ||
314 | public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName) | 325 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) |
315 | { | 326 | { |
316 | Hashtable param = new Hashtable(); | 327 | Hashtable param = new Hashtable(); |
317 | if (GroupID != UUID.Zero) | 328 | if (GroupID != UUID.Zero) |
@@ -323,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
323 | param["Name"] = GroupName.ToString(); | 334 | param["Name"] = GroupName.ToString(); |
324 | } | 335 | } |
325 | 336 | ||
326 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 337 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
327 | 338 | ||
328 | if (respData.Contains("error")) | 339 | if (respData.Contains("error")) |
329 | { | 340 | { |
@@ -334,12 +345,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
334 | 345 | ||
335 | } | 346 | } |
336 | 347 | ||
337 | public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID) | 348 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
338 | { | 349 | { |
339 | Hashtable param = new Hashtable(); | 350 | Hashtable param = new Hashtable(); |
340 | param["GroupID"] = GroupID.ToString(); | 351 | param["GroupID"] = GroupID.ToString(); |
341 | 352 | ||
342 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 353 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
343 | 354 | ||
344 | if (respData.Contains("error")) | 355 | if (respData.Contains("error")) |
345 | { | 356 | { |
@@ -347,38 +358,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
347 | return new GroupProfileData(); | 358 | return new GroupProfileData(); |
348 | } | 359 | } |
349 | 360 | ||
350 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID); | 361 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); |
351 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 362 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
352 | 363 | ||
353 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 364 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
354 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 365 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; |
355 | 366 | ||
356 | return MemberGroupProfile; | 367 | return MemberGroupProfile; |
357 | |||
358 | } | 368 | } |
359 | 369 | ||
360 | 370 | public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) | |
361 | |||
362 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | ||
363 | { | 371 | { |
364 | Hashtable param = new Hashtable(); | 372 | Hashtable param = new Hashtable(); |
365 | param["AgentID"] = AgentID.ToString(); | 373 | param["AgentID"] = AgentID.ToString(); |
366 | param["GroupID"] = GroupID.ToString(); | 374 | param["GroupID"] = GroupID.ToString(); |
367 | 375 | ||
368 | XmlRpcCall(requestID, "groups.setAgentActiveGroup", param); | 376 | XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param); |
369 | } | 377 | } |
370 | 378 | ||
371 | public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 379 | public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
372 | { | 380 | { |
373 | Hashtable param = new Hashtable(); | 381 | Hashtable param = new Hashtable(); |
374 | param["AgentID"] = AgentID.ToString(); | 382 | param["AgentID"] = AgentID.ToString(); |
375 | param["GroupID"] = GroupID.ToString(); | 383 | param["GroupID"] = GroupID.ToString(); |
376 | param["SelectedRoleID"] = RoleID.ToString(); | 384 | param["SelectedRoleID"] = RoleID.ToString(); |
377 | 385 | ||
378 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 386 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
379 | } | 387 | } |
380 | 388 | ||
381 | public void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 389 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
382 | { | 390 | { |
383 | Hashtable param = new Hashtable(); | 391 | Hashtable param = new Hashtable(); |
384 | param["AgentID"] = AgentID.ToString(); | 392 | param["AgentID"] = AgentID.ToString(); |
@@ -386,11 +394,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
386 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 394 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
387 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 395 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
388 | 396 | ||
389 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 397 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
390 | 398 | ||
391 | } | 399 | } |
392 | 400 | ||
393 | public void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 401 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
394 | { | 402 | { |
395 | Hashtable param = new Hashtable(); | 403 | Hashtable param = new Hashtable(); |
396 | param["InviteID"] = inviteID.ToString(); | 404 | param["InviteID"] = inviteID.ToString(); |
@@ -398,16 +406,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
398 | param["RoleID"] = roleID.ToString(); | 406 | param["RoleID"] = roleID.ToString(); |
399 | param["GroupID"] = groupID.ToString(); | 407 | param["GroupID"] = groupID.ToString(); |
400 | 408 | ||
401 | XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param); | 409 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param); |
402 | 410 | ||
403 | } | 411 | } |
404 | 412 | ||
405 | public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 413 | public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
406 | { | 414 | { |
407 | Hashtable param = new Hashtable(); | 415 | Hashtable param = new Hashtable(); |
408 | param["InviteID"] = inviteID.ToString(); | 416 | param["InviteID"] = inviteID.ToString(); |
409 | 417 | ||
410 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param); | 418 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param); |
411 | 419 | ||
412 | if (respData.Contains("error")) | 420 | if (respData.Contains("error")) |
413 | { | 421 | { |
@@ -423,60 +431,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
423 | return inviteInfo; | 431 | return inviteInfo; |
424 | } | 432 | } |
425 | 433 | ||
426 | public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 434 | public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
427 | { | 435 | { |
428 | Hashtable param = new Hashtable(); | 436 | Hashtable param = new Hashtable(); |
429 | param["InviteID"] = inviteID.ToString(); | 437 | param["InviteID"] = inviteID.ToString(); |
430 | 438 | ||
431 | XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param); | 439 | XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param); |
432 | } | 440 | } |
433 | 441 | ||
434 | public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 442 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
435 | { | 443 | { |
436 | Hashtable param = new Hashtable(); | 444 | Hashtable param = new Hashtable(); |
437 | param["AgentID"] = AgentID.ToString(); | 445 | param["AgentID"] = AgentID.ToString(); |
438 | param["GroupID"] = GroupID.ToString(); | 446 | param["GroupID"] = GroupID.ToString(); |
439 | param["RoleID"] = RoleID.ToString(); | 447 | param["RoleID"] = RoleID.ToString(); |
440 | 448 | ||
441 | XmlRpcCall(requestID, "groups.addAgentToGroup", param); | 449 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param); |
442 | } | 450 | } |
443 | 451 | ||
444 | public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 452 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
445 | { | 453 | { |
446 | Hashtable param = new Hashtable(); | 454 | Hashtable param = new Hashtable(); |
447 | param["AgentID"] = AgentID.ToString(); | 455 | param["AgentID"] = AgentID.ToString(); |
448 | param["GroupID"] = GroupID.ToString(); | 456 | param["GroupID"] = GroupID.ToString(); |
449 | 457 | ||
450 | XmlRpcCall(requestID, "groups.removeAgentFromGroup", param); | 458 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param); |
451 | } | 459 | } |
452 | 460 | ||
453 | public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 461 | public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
454 | { | 462 | { |
455 | Hashtable param = new Hashtable(); | 463 | Hashtable param = new Hashtable(); |
456 | param["AgentID"] = AgentID.ToString(); | 464 | param["AgentID"] = AgentID.ToString(); |
457 | param["GroupID"] = GroupID.ToString(); | 465 | param["GroupID"] = GroupID.ToString(); |
458 | param["RoleID"] = RoleID.ToString(); | 466 | param["RoleID"] = RoleID.ToString(); |
459 | 467 | ||
460 | XmlRpcCall(requestID, "groups.addAgentToGroupRole", param); | 468 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param); |
461 | } | 469 | } |
462 | 470 | ||
463 | public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 471 | public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
464 | { | 472 | { |
465 | Hashtable param = new Hashtable(); | 473 | Hashtable param = new Hashtable(); |
466 | param["AgentID"] = AgentID.ToString(); | 474 | param["AgentID"] = AgentID.ToString(); |
467 | param["GroupID"] = GroupID.ToString(); | 475 | param["GroupID"] = GroupID.ToString(); |
468 | param["RoleID"] = RoleID.ToString(); | 476 | param["RoleID"] = RoleID.ToString(); |
469 | 477 | ||
470 | XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); | 478 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param); |
471 | } | 479 | } |
472 | 480 | ||
473 | 481 | public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search) | |
474 | public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) | ||
475 | { | 482 | { |
476 | Hashtable param = new Hashtable(); | 483 | Hashtable param = new Hashtable(); |
477 | param["Search"] = search; | 484 | param["Search"] = search; |
478 | 485 | ||
479 | Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param); | 486 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); |
480 | 487 | ||
481 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 488 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
482 | 489 | ||
@@ -498,13 +505,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
498 | return findings; | 505 | return findings; |
499 | } | 506 | } |
500 | 507 | ||
501 | public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 508 | public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
502 | { | 509 | { |
503 | Hashtable param = new Hashtable(); | 510 | Hashtable param = new Hashtable(); |
504 | param["AgentID"] = AgentID.ToString(); | 511 | param["AgentID"] = AgentID.ToString(); |
505 | param["GroupID"] = GroupID.ToString(); | 512 | param["GroupID"] = GroupID.ToString(); |
506 | 513 | ||
507 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param); | 514 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param); |
508 | 515 | ||
509 | if (respData.Contains("error")) | 516 | if (respData.Contains("error")) |
510 | { | 517 | { |
@@ -516,12 +523,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
516 | return data; | 523 | return data; |
517 | } | 524 | } |
518 | 525 | ||
519 | public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID) | 526 | public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) |
520 | { | 527 | { |
521 | Hashtable param = new Hashtable(); | 528 | Hashtable param = new Hashtable(); |
522 | param["AgentID"] = AgentID.ToString(); | 529 | param["AgentID"] = AgentID.ToString(); |
523 | 530 | ||
524 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param); | 531 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param); |
525 | 532 | ||
526 | if (respData.Contains("error")) | 533 | if (respData.Contains("error")) |
527 | { | 534 | { |
@@ -531,13 +538,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
531 | return HashTableToGroupMembershipData(respData); | 538 | return HashTableToGroupMembershipData(respData); |
532 | } | 539 | } |
533 | 540 | ||
534 | 541 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) | |
535 | public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) | ||
536 | { | 542 | { |
537 | Hashtable param = new Hashtable(); | 543 | Hashtable param = new Hashtable(); |
538 | param["AgentID"] = AgentID.ToString(); | 544 | param["AgentID"] = AgentID.ToString(); |
539 | 545 | ||
540 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param); | 546 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param); |
541 | 547 | ||
542 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 548 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
543 | 549 | ||
@@ -552,13 +558,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
552 | return memberships; | 558 | return memberships; |
553 | } | 559 | } |
554 | 560 | ||
555 | public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 561 | public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
556 | { | 562 | { |
557 | Hashtable param = new Hashtable(); | 563 | Hashtable param = new Hashtable(); |
558 | param["AgentID"] = AgentID.ToString(); | 564 | param["AgentID"] = AgentID.ToString(); |
559 | param["GroupID"] = GroupID.ToString(); | 565 | param["GroupID"] = GroupID.ToString(); |
560 | 566 | ||
561 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param); | 567 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param); |
562 | 568 | ||
563 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 569 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
564 | 570 | ||
@@ -584,12 +590,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
584 | 590 | ||
585 | } | 591 | } |
586 | 592 | ||
587 | public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID) | 593 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) |
588 | { | 594 | { |
589 | Hashtable param = new Hashtable(); | 595 | Hashtable param = new Hashtable(); |
590 | param["GroupID"] = GroupID.ToString(); | 596 | param["GroupID"] = GroupID.ToString(); |
591 | 597 | ||
592 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param); | 598 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); |
593 | 599 | ||
594 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 600 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
595 | 601 | ||
@@ -617,12 +623,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
617 | 623 | ||
618 | 624 | ||
619 | 625 | ||
620 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) | 626 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) |
621 | { | 627 | { |
622 | Hashtable param = new Hashtable(); | 628 | Hashtable param = new Hashtable(); |
623 | param["GroupID"] = GroupID.ToString(); | 629 | param["GroupID"] = GroupID.ToString(); |
624 | 630 | ||
625 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param); | 631 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param); |
626 | 632 | ||
627 | List<GroupMembersData> members = new List<GroupMembersData>(); | 633 | List<GroupMembersData> members = new List<GroupMembersData>(); |
628 | 634 | ||
@@ -650,12 +656,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
650 | 656 | ||
651 | } | 657 | } |
652 | 658 | ||
653 | public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID) | 659 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
654 | { | 660 | { |
655 | Hashtable param = new Hashtable(); | 661 | Hashtable param = new Hashtable(); |
656 | param["GroupID"] = GroupID.ToString(); | 662 | param["GroupID"] = GroupID.ToString(); |
657 | 663 | ||
658 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param); | 664 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param); |
659 | 665 | ||
660 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 666 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
661 | 667 | ||
@@ -674,12 +680,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
674 | return members; | 680 | return members; |
675 | } | 681 | } |
676 | 682 | ||
677 | public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID) | 683 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) |
678 | { | 684 | { |
679 | Hashtable param = new Hashtable(); | 685 | Hashtable param = new Hashtable(); |
680 | param["GroupID"] = GroupID.ToString(); | 686 | param["GroupID"] = GroupID.ToString(); |
681 | 687 | ||
682 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param); | 688 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param); |
683 | 689 | ||
684 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 690 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
685 | 691 | ||
@@ -701,12 +707,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
701 | return values; | 707 | return values; |
702 | 708 | ||
703 | } | 709 | } |
704 | public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID) | 710 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
705 | { | 711 | { |
706 | Hashtable param = new Hashtable(); | 712 | Hashtable param = new Hashtable(); |
707 | param["NoticeID"] = noticeID.ToString(); | 713 | param["NoticeID"] = noticeID.ToString(); |
708 | 714 | ||
709 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param); | 715 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); |
710 | 716 | ||
711 | 717 | ||
712 | if (respData.Contains("error")) | 718 | if (respData.Contains("error")) |
@@ -732,7 +738,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
732 | 738 | ||
733 | return data; | 739 | return data; |
734 | } | 740 | } |
735 | public void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 741 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
736 | { | 742 | { |
737 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 743 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
738 | 744 | ||
@@ -745,7 +751,70 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
745 | param["BinaryBucket"] = binBucket; | 751 | param["BinaryBucket"] = binBucket; |
746 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 752 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
747 | 753 | ||
748 | XmlRpcCall(requestID, "groups.addGroupNotice", param); | 754 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); |
755 | } | ||
756 | |||
757 | |||
758 | |||
759 | #endregion | ||
760 | |||
761 | #region GroupSessionTracking | ||
762 | |||
763 | public void ResetAgentGroupChatSessions(UUID agentID) | ||
764 | { | ||
765 | foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values) | ||
766 | { | ||
767 | agentList.Remove(agentID); | ||
768 | } | ||
769 | } | ||
770 | |||
771 | public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
772 | { | ||
773 | // If we're tracking this group, and we can find them in the tracking, then they've been invited | ||
774 | return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID) | ||
775 | && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID); | ||
776 | } | ||
777 | |||
778 | public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) | ||
779 | { | ||
780 | // If we're tracking drops for this group, | ||
781 | // and we find them, well... then they've dropped | ||
782 | return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID) | ||
783 | && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID); | ||
784 | } | ||
785 | |||
786 | public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID) | ||
787 | { | ||
788 | if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
789 | { | ||
790 | // If not in dropped list, add | ||
791 | if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
792 | { | ||
793 | m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); | ||
794 | } | ||
795 | } | ||
796 | } | ||
797 | |||
798 | public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
799 | { | ||
800 | // Add Session Status if it doesn't exist for this session | ||
801 | CreateGroupChatSessionTracking(groupID); | ||
802 | |||
803 | // If nessesary, remove from dropped list | ||
804 | if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
805 | { | ||
806 | m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); | ||
807 | } | ||
808 | } | ||
809 | |||
810 | private void CreateGroupChatSessionTracking(UUID groupID) | ||
811 | { | ||
812 | if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
813 | { | ||
814 | m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>()); | ||
815 | m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>()); | ||
816 | } | ||
817 | |||
749 | } | 818 | } |
750 | #endregion | 819 | #endregion |
751 | 820 | ||
@@ -778,7 +847,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
778 | 847 | ||
779 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | 848 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) |
780 | { | 849 | { |
781 | |||
782 | GroupRecord group = new GroupRecord(); | 850 | GroupRecord group = new GroupRecord(); |
783 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 851 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
784 | group.GroupName = groupProfile["Name"].ToString(); | 852 | group.GroupName = groupProfile["Name"].ToString(); |
@@ -797,6 +865,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
797 | 865 | ||
798 | return group; | 866 | return group; |
799 | } | 867 | } |
868 | |||
800 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | 869 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) |
801 | { | 870 | { |
802 | GroupMembershipData data = new GroupMembershipData(); | 871 | GroupMembershipData data = new GroupMembershipData(); |
@@ -829,6 +898,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
829 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | 898 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); |
830 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | 899 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); |
831 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | 900 | data.ShowInList = ((string)respData["ShowInList"] == "1"); |
901 | |||
832 | return data; | 902 | return data; |
833 | } | 903 | } |
834 | 904 | ||
@@ -837,15 +907,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
837 | /// <summary> | 907 | /// <summary> |
838 | /// Encapsulate the XmlRpc call to standardize security and error handling. | 908 | /// Encapsulate the XmlRpc call to standardize security and error handling. |
839 | /// </summary> | 909 | /// </summary> |
840 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) | 910 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) |
841 | { | 911 | { |
842 | if (requestID == null) | 912 | string UserService; |
843 | { | 913 | UUID SessionID; |
844 | requestID = new GroupRequestID(); | 914 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); |
845 | } | 915 | param.Add("requestingAgentID", requestingAgentID.ToString()); |
846 | param.Add("RequestingAgentID", requestID.AgentID.ToString()); | 916 | param.Add("RequestingAgentUserService", UserService); |
847 | param.Add("RequestingAgentUserService", requestID.UserServiceURL); | 917 | param.Add("RequestingSessionID", SessionID.ToString()); |
848 | param.Add("RequestingSessionID", requestID.SessionID.ToString()); | ||
849 | 918 | ||
850 | 919 | ||
851 | param.Add("ReadKey", m_groupReadKey); | 920 | param.Add("ReadKey", m_groupReadKey); |
@@ -862,7 +931,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
862 | 931 | ||
863 | try | 932 | try |
864 | { | 933 | { |
865 | resp = req.Send(m_serviceURL, 10000); | 934 | resp = req.Send(m_groupsServerURI, 10000); |
866 | } | 935 | } |
867 | catch (Exception e) | 936 | catch (Exception e) |
868 | { | 937 | { |
@@ -936,15 +1005,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
936 | } | 1005 | } |
937 | } | 1006 | } |
938 | 1007 | ||
1008 | |||
1009 | /// <summary> | ||
1010 | /// Group Request Tokens are an attempt to allow the groups service to authenticate | ||
1011 | /// requests. | ||
1012 | /// TODO: This broke after the big grid refactor, either find a better way, or discard this | ||
1013 | /// </summary> | ||
1014 | /// <param name="client"></param> | ||
1015 | /// <returns></returns> | ||
1016 | private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID) | ||
1017 | { | ||
1018 | UserServiceURL = ""; | ||
1019 | SessionID = UUID.Zero; | ||
939 | 1020 | ||
940 | } | ||
941 | 1021 | ||
942 | public class GroupNoticeInfo | 1022 | // Need to rework this based on changes to User Services |
943 | { | 1023 | /* |
944 | public GroupNoticeData noticeData = new GroupNoticeData(); | 1024 | UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); |
945 | public UUID GroupID = UUID.Zero; | 1025 | if (userAccount == null) |
946 | public string Message = string.Empty; | 1026 | { |
947 | public byte[] BinaryBucket = new byte[0]; | 1027 | // This should be impossible. If I've been passed a reference to a client |
1028 | // that client should be registered with the UserService. So something | ||
1029 | // is horribly wrong somewhere. | ||
1030 | |||
1031 | m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID); | ||
1032 | |||
1033 | } | ||
1034 | else if (userProfile is ForeignUserProfileData) | ||
1035 | { | ||
1036 | // They aren't from around here | ||
1037 | ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; | ||
1038 | UserServiceURL = fupd.UserServerURI; | ||
1039 | SessionID = fupd.CurrentAgent.SessionID; | ||
1040 | |||
1041 | } | ||
1042 | else | ||
1043 | { | ||
1044 | // They're a local user, use this: | ||
1045 | UserServiceURL = m_commManager.NetworkServersInfo.UserURL; | ||
1046 | SessionID = userProfile.CurrentAgent.SessionID; | ||
1047 | } | ||
1048 | */ | ||
1049 | } | ||
1050 | |||
948 | } | 1051 | } |
949 | } | 1052 | } |
950 | 1053 | ||