diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 287 |
1 files changed, 203 insertions, 84 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 24ae4f7..8e7aa68 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -40,7 +40,9 @@ 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; | ||
43 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
45 | using OpenSim.Services.Interfaces; | ||
44 | 46 | ||
45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 47 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
46 | { | 48 | { |
@@ -59,13 +61,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
59 | 61 | ||
60 | private bool m_connectorEnabled = false; | 62 | private bool m_connectorEnabled = false; |
61 | 63 | ||
62 | private string m_serviceURL = string.Empty; | 64 | private string m_groupsServerURI = string.Empty; |
63 | 65 | ||
64 | private bool m_disableKeepAlive = false; | 66 | private bool m_disableKeepAlive = false; |
65 | 67 | ||
66 | private string m_groupReadKey = string.Empty; | 68 | private string m_groupReadKey = string.Empty; |
67 | private string m_groupWriteKey = string.Empty; | 69 | private string m_groupWriteKey = string.Empty; |
68 | 70 | ||
71 | private IUserAccountService m_accountService = null; | ||
72 | |||
73 | // Used to track which agents are have dropped from a group chat session | ||
74 | // Should be reset per agent, on logon | ||
75 | // TODO: move this to Flotsam XmlRpc Service | ||
76 | // SessionID, List<AgentID> | ||
77 | private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>(); | ||
78 | private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>(); | ||
79 | |||
69 | 80 | ||
70 | #region IRegionModuleBase Members | 81 | #region IRegionModuleBase Members |
71 | 82 | ||
@@ -100,13 +111,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
100 | return; | 111 | return; |
101 | } | 112 | } |
102 | 113 | ||
103 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); | 114 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); |
104 | 115 | ||
105 | m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); | 116 | m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); |
106 | if ((m_serviceURL == null) || | 117 | if ((m_groupsServerURI == null) || |
107 | (m_serviceURL == string.Empty)) | 118 | (m_groupsServerURI == string.Empty)) |
108 | { | 119 | { |
109 | m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); | 120 | m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); |
110 | m_connectorEnabled = false; | 121 | m_connectorEnabled = false; |
111 | return; | 122 | return; |
112 | } | 123 | } |
@@ -116,6 +127,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
116 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 127 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
117 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 128 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
118 | 129 | ||
130 | |||
131 | |||
132 | |||
119 | // If we got all the config options we need, lets start'er'up | 133 | // If we got all the config options we need, lets start'er'up |
120 | m_connectorEnabled = true; | 134 | m_connectorEnabled = true; |
121 | } | 135 | } |
@@ -129,13 +143,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
129 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 143 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
130 | { | 144 | { |
131 | if (m_connectorEnabled) | 145 | if (m_connectorEnabled) |
146 | { | ||
147 | |||
148 | if (m_accountService == null) | ||
149 | { | ||
150 | m_accountService = scene.UserAccountService; | ||
151 | } | ||
152 | |||
153 | |||
132 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | 154 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); |
155 | } | ||
133 | } | 156 | } |
134 | 157 | ||
135 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 158 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
136 | { | 159 | { |
137 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | 160 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) |
161 | { | ||
138 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | 162 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); |
163 | } | ||
139 | } | 164 | } |
140 | 165 | ||
141 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | 166 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -155,14 +180,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
155 | 180 | ||
156 | #endregion | 181 | #endregion |
157 | 182 | ||
158 | |||
159 | |||
160 | #region IGroupsServicesConnector Members | 183 | #region IGroupsServicesConnector Members |
161 | 184 | ||
162 | /// <summary> | 185 | /// <summary> |
163 | /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. | 186 | /// 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. |
164 | /// </summary> | 187 | /// </summary> |
165 | public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, | 188 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, |
166 | int membershipFee, bool openEnrollment, bool allowPublish, | 189 | int membershipFee, bool openEnrollment, bool allowPublish, |
167 | bool maturePublish, UUID founderID) | 190 | bool maturePublish, UUID founderID) |
168 | { | 191 | { |
@@ -234,7 +257,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
234 | 257 | ||
235 | 258 | ||
236 | 259 | ||
237 | Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param); | 260 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); |
238 | 261 | ||
239 | if (respData.Contains("error")) | 262 | if (respData.Contains("error")) |
240 | { | 263 | { |
@@ -246,7 +269,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
246 | return UUID.Parse((string)respData["GroupID"]); | 269 | return UUID.Parse((string)respData["GroupID"]); |
247 | } | 270 | } |
248 | 271 | ||
249 | public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, | 272 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
250 | UUID insigniaID, int membershipFee, bool openEnrollment, | 273 | UUID insigniaID, int membershipFee, bool openEnrollment, |
251 | bool allowPublish, bool maturePublish) | 274 | bool allowPublish, bool maturePublish) |
252 | { | 275 | { |
@@ -260,10 +283,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
260 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 283 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
261 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 284 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
262 | 285 | ||
263 | XmlRpcCall(requestID, "groups.updateGroup", param); | 286 | XmlRpcCall(requestingAgentID, "groups.updateGroup", param); |
264 | } | 287 | } |
265 | 288 | ||
266 | public void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 289 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
267 | string title, ulong powers) | 290 | string title, ulong powers) |
268 | { | 291 | { |
269 | Hashtable param = new Hashtable(); | 292 | Hashtable param = new Hashtable(); |
@@ -274,19 +297,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
274 | param["Title"] = title; | 297 | param["Title"] = title; |
275 | param["Powers"] = powers.ToString(); | 298 | param["Powers"] = powers.ToString(); |
276 | 299 | ||
277 | XmlRpcCall(requestID, "groups.addRoleToGroup", param); | 300 | XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param); |
278 | } | 301 | } |
279 | 302 | ||
280 | public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID) | 303 | public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) |
281 | { | 304 | { |
282 | Hashtable param = new Hashtable(); | 305 | Hashtable param = new Hashtable(); |
283 | param["GroupID"] = groupID.ToString(); | 306 | param["GroupID"] = groupID.ToString(); |
284 | param["RoleID"] = roleID.ToString(); | 307 | param["RoleID"] = roleID.ToString(); |
285 | 308 | ||
286 | XmlRpcCall(requestID, "groups.removeRoleFromGroup", param); | 309 | XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); |
287 | } | 310 | } |
288 | 311 | ||
289 | public void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 312 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
290 | string title, ulong powers) | 313 | string title, ulong powers) |
291 | { | 314 | { |
292 | Hashtable param = new Hashtable(); | 315 | Hashtable param = new Hashtable(); |
@@ -306,10 +329,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
306 | } | 329 | } |
307 | param["Powers"] = powers.ToString(); | 330 | param["Powers"] = powers.ToString(); |
308 | 331 | ||
309 | XmlRpcCall(requestID, "groups.updateGroupRole", param); | 332 | XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param); |
310 | } | 333 | } |
311 | 334 | ||
312 | public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName) | 335 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) |
313 | { | 336 | { |
314 | Hashtable param = new Hashtable(); | 337 | Hashtable param = new Hashtable(); |
315 | if (GroupID != UUID.Zero) | 338 | if (GroupID != UUID.Zero) |
@@ -321,7 +344,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
321 | param["Name"] = GroupName.ToString(); | 344 | param["Name"] = GroupName.ToString(); |
322 | } | 345 | } |
323 | 346 | ||
324 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 347 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
325 | 348 | ||
326 | if (respData.Contains("error")) | 349 | if (respData.Contains("error")) |
327 | { | 350 | { |
@@ -332,12 +355,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
332 | 355 | ||
333 | } | 356 | } |
334 | 357 | ||
335 | public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID) | 358 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
336 | { | 359 | { |
337 | Hashtable param = new Hashtable(); | 360 | Hashtable param = new Hashtable(); |
338 | param["GroupID"] = GroupID.ToString(); | 361 | param["GroupID"] = GroupID.ToString(); |
339 | 362 | ||
340 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 363 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
341 | 364 | ||
342 | if (respData.Contains("error")) | 365 | if (respData.Contains("error")) |
343 | { | 366 | { |
@@ -345,7 +368,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
345 | return new GroupProfileData(); | 368 | return new GroupProfileData(); |
346 | } | 369 | } |
347 | 370 | ||
348 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID); | 371 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); |
349 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 372 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
350 | 373 | ||
351 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 374 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
@@ -354,26 +377,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
354 | return MemberGroupProfile; | 377 | return MemberGroupProfile; |
355 | } | 378 | } |
356 | 379 | ||
357 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 380 | public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
358 | { | 381 | { |
359 | Hashtable param = new Hashtable(); | 382 | Hashtable param = new Hashtable(); |
360 | param["AgentID"] = AgentID.ToString(); | 383 | param["AgentID"] = AgentID.ToString(); |
361 | param["GroupID"] = GroupID.ToString(); | 384 | param["GroupID"] = GroupID.ToString(); |
362 | 385 | ||
363 | XmlRpcCall(requestID, "groups.setAgentActiveGroup", param); | 386 | XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param); |
364 | } | 387 | } |
365 | 388 | ||
366 | public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 389 | public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
367 | { | 390 | { |
368 | Hashtable param = new Hashtable(); | 391 | Hashtable param = new Hashtable(); |
369 | param["AgentID"] = AgentID.ToString(); | 392 | param["AgentID"] = AgentID.ToString(); |
370 | param["GroupID"] = GroupID.ToString(); | 393 | param["GroupID"] = GroupID.ToString(); |
371 | param["SelectedRoleID"] = RoleID.ToString(); | 394 | param["SelectedRoleID"] = RoleID.ToString(); |
372 | 395 | ||
373 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 396 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
374 | } | 397 | } |
375 | 398 | ||
376 | public void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 399 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
377 | { | 400 | { |
378 | Hashtable param = new Hashtable(); | 401 | Hashtable param = new Hashtable(); |
379 | param["AgentID"] = AgentID.ToString(); | 402 | param["AgentID"] = AgentID.ToString(); |
@@ -381,11 +404,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
381 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 404 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
382 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 405 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
383 | 406 | ||
384 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 407 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
385 | 408 | ||
386 | } | 409 | } |
387 | 410 | ||
388 | public void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 411 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
389 | { | 412 | { |
390 | Hashtable param = new Hashtable(); | 413 | Hashtable param = new Hashtable(); |
391 | param["InviteID"] = inviteID.ToString(); | 414 | param["InviteID"] = inviteID.ToString(); |
@@ -393,16 +416,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
393 | param["RoleID"] = roleID.ToString(); | 416 | param["RoleID"] = roleID.ToString(); |
394 | param["GroupID"] = groupID.ToString(); | 417 | param["GroupID"] = groupID.ToString(); |
395 | 418 | ||
396 | XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param); | 419 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param); |
397 | 420 | ||
398 | } | 421 | } |
399 | 422 | ||
400 | public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 423 | public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
401 | { | 424 | { |
402 | Hashtable param = new Hashtable(); | 425 | Hashtable param = new Hashtable(); |
403 | param["InviteID"] = inviteID.ToString(); | 426 | param["InviteID"] = inviteID.ToString(); |
404 | 427 | ||
405 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param); | 428 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param); |
406 | 429 | ||
407 | if (respData.Contains("error")) | 430 | if (respData.Contains("error")) |
408 | { | 431 | { |
@@ -418,59 +441,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
418 | return inviteInfo; | 441 | return inviteInfo; |
419 | } | 442 | } |
420 | 443 | ||
421 | public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 444 | public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
422 | { | 445 | { |
423 | Hashtable param = new Hashtable(); | 446 | Hashtable param = new Hashtable(); |
424 | param["InviteID"] = inviteID.ToString(); | 447 | param["InviteID"] = inviteID.ToString(); |
425 | 448 | ||
426 | XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param); | 449 | XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param); |
427 | } | 450 | } |
428 | 451 | ||
429 | public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 452 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
430 | { | 453 | { |
431 | Hashtable param = new Hashtable(); | 454 | Hashtable param = new Hashtable(); |
432 | param["AgentID"] = AgentID.ToString(); | 455 | param["AgentID"] = AgentID.ToString(); |
433 | param["GroupID"] = GroupID.ToString(); | 456 | param["GroupID"] = GroupID.ToString(); |
434 | param["RoleID"] = RoleID.ToString(); | 457 | param["RoleID"] = RoleID.ToString(); |
435 | 458 | ||
436 | XmlRpcCall(requestID, "groups.addAgentToGroup", param); | 459 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param); |
437 | } | 460 | } |
438 | 461 | ||
439 | public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 462 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
440 | { | 463 | { |
441 | Hashtable param = new Hashtable(); | 464 | Hashtable param = new Hashtable(); |
442 | param["AgentID"] = AgentID.ToString(); | 465 | param["AgentID"] = AgentID.ToString(); |
443 | param["GroupID"] = GroupID.ToString(); | 466 | param["GroupID"] = GroupID.ToString(); |
444 | 467 | ||
445 | XmlRpcCall(requestID, "groups.removeAgentFromGroup", param); | 468 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param); |
446 | } | 469 | } |
447 | 470 | ||
448 | public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 471 | public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
449 | { | 472 | { |
450 | Hashtable param = new Hashtable(); | 473 | Hashtable param = new Hashtable(); |
451 | param["AgentID"] = AgentID.ToString(); | 474 | param["AgentID"] = AgentID.ToString(); |
452 | param["GroupID"] = GroupID.ToString(); | 475 | param["GroupID"] = GroupID.ToString(); |
453 | param["RoleID"] = RoleID.ToString(); | 476 | param["RoleID"] = RoleID.ToString(); |
454 | 477 | ||
455 | XmlRpcCall(requestID, "groups.addAgentToGroupRole", param); | 478 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param); |
456 | } | 479 | } |
457 | 480 | ||
458 | public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 481 | public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
459 | { | 482 | { |
460 | Hashtable param = new Hashtable(); | 483 | Hashtable param = new Hashtable(); |
461 | param["AgentID"] = AgentID.ToString(); | 484 | param["AgentID"] = AgentID.ToString(); |
462 | param["GroupID"] = GroupID.ToString(); | 485 | param["GroupID"] = GroupID.ToString(); |
463 | param["RoleID"] = RoleID.ToString(); | 486 | param["RoleID"] = RoleID.ToString(); |
464 | 487 | ||
465 | XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); | 488 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param); |
466 | } | 489 | } |
467 | 490 | ||
468 | public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) | 491 | public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search) |
469 | { | 492 | { |
470 | Hashtable param = new Hashtable(); | 493 | Hashtable param = new Hashtable(); |
471 | param["Search"] = search; | 494 | param["Search"] = search; |
472 | 495 | ||
473 | Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param); | 496 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); |
474 | 497 | ||
475 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 498 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
476 | 499 | ||
@@ -492,13 +515,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
492 | return findings; | 515 | return findings; |
493 | } | 516 | } |
494 | 517 | ||
495 | public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 518 | public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
496 | { | 519 | { |
497 | Hashtable param = new Hashtable(); | 520 | Hashtable param = new Hashtable(); |
498 | param["AgentID"] = AgentID.ToString(); | 521 | param["AgentID"] = AgentID.ToString(); |
499 | param["GroupID"] = GroupID.ToString(); | 522 | param["GroupID"] = GroupID.ToString(); |
500 | 523 | ||
501 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param); | 524 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param); |
502 | 525 | ||
503 | if (respData.Contains("error")) | 526 | if (respData.Contains("error")) |
504 | { | 527 | { |
@@ -510,12 +533,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
510 | return data; | 533 | return data; |
511 | } | 534 | } |
512 | 535 | ||
513 | public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID) | 536 | public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) |
514 | { | 537 | { |
515 | Hashtable param = new Hashtable(); | 538 | Hashtable param = new Hashtable(); |
516 | param["AgentID"] = AgentID.ToString(); | 539 | param["AgentID"] = AgentID.ToString(); |
517 | 540 | ||
518 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param); | 541 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param); |
519 | 542 | ||
520 | if (respData.Contains("error")) | 543 | if (respData.Contains("error")) |
521 | { | 544 | { |
@@ -525,12 +548,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
525 | return HashTableToGroupMembershipData(respData); | 548 | return HashTableToGroupMembershipData(respData); |
526 | } | 549 | } |
527 | 550 | ||
528 | public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) | 551 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) |
529 | { | 552 | { |
530 | Hashtable param = new Hashtable(); | 553 | Hashtable param = new Hashtable(); |
531 | param["AgentID"] = AgentID.ToString(); | 554 | param["AgentID"] = AgentID.ToString(); |
532 | 555 | ||
533 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param); | 556 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param); |
534 | 557 | ||
535 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 558 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
536 | 559 | ||
@@ -545,13 +568,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
545 | return memberships; | 568 | return memberships; |
546 | } | 569 | } |
547 | 570 | ||
548 | public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 571 | public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
549 | { | 572 | { |
550 | Hashtable param = new Hashtable(); | 573 | Hashtable param = new Hashtable(); |
551 | param["AgentID"] = AgentID.ToString(); | 574 | param["AgentID"] = AgentID.ToString(); |
552 | param["GroupID"] = GroupID.ToString(); | 575 | param["GroupID"] = GroupID.ToString(); |
553 | 576 | ||
554 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param); | 577 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param); |
555 | 578 | ||
556 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 579 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
557 | 580 | ||
@@ -577,12 +600,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
577 | 600 | ||
578 | } | 601 | } |
579 | 602 | ||
580 | public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID) | 603 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) |
581 | { | 604 | { |
582 | Hashtable param = new Hashtable(); | 605 | Hashtable param = new Hashtable(); |
583 | param["GroupID"] = GroupID.ToString(); | 606 | param["GroupID"] = GroupID.ToString(); |
584 | 607 | ||
585 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param); | 608 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); |
586 | 609 | ||
587 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 610 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
588 | 611 | ||
@@ -610,12 +633,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
610 | 633 | ||
611 | 634 | ||
612 | 635 | ||
613 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) | 636 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) |
614 | { | 637 | { |
615 | Hashtable param = new Hashtable(); | 638 | Hashtable param = new Hashtable(); |
616 | param["GroupID"] = GroupID.ToString(); | 639 | param["GroupID"] = GroupID.ToString(); |
617 | 640 | ||
618 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param); | 641 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param); |
619 | 642 | ||
620 | List<GroupMembersData> members = new List<GroupMembersData>(); | 643 | List<GroupMembersData> members = new List<GroupMembersData>(); |
621 | 644 | ||
@@ -643,12 +666,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
643 | 666 | ||
644 | } | 667 | } |
645 | 668 | ||
646 | public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID) | 669 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
647 | { | 670 | { |
648 | Hashtable param = new Hashtable(); | 671 | Hashtable param = new Hashtable(); |
649 | param["GroupID"] = GroupID.ToString(); | 672 | param["GroupID"] = GroupID.ToString(); |
650 | 673 | ||
651 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param); | 674 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param); |
652 | 675 | ||
653 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 676 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
654 | 677 | ||
@@ -667,12 +690,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
667 | return members; | 690 | return members; |
668 | } | 691 | } |
669 | 692 | ||
670 | public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID) | 693 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) |
671 | { | 694 | { |
672 | Hashtable param = new Hashtable(); | 695 | Hashtable param = new Hashtable(); |
673 | param["GroupID"] = GroupID.ToString(); | 696 | param["GroupID"] = GroupID.ToString(); |
674 | 697 | ||
675 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param); | 698 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param); |
676 | 699 | ||
677 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 700 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
678 | 701 | ||
@@ -694,12 +717,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
694 | return values; | 717 | return values; |
695 | 718 | ||
696 | } | 719 | } |
697 | public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID) | 720 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
698 | { | 721 | { |
699 | Hashtable param = new Hashtable(); | 722 | Hashtable param = new Hashtable(); |
700 | param["NoticeID"] = noticeID.ToString(); | 723 | param["NoticeID"] = noticeID.ToString(); |
701 | 724 | ||
702 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param); | 725 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); |
703 | 726 | ||
704 | 727 | ||
705 | if (respData.Contains("error")) | 728 | if (respData.Contains("error")) |
@@ -725,7 +748,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
725 | 748 | ||
726 | return data; | 749 | return data; |
727 | } | 750 | } |
728 | public void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 751 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
729 | { | 752 | { |
730 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 753 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
731 | 754 | ||
@@ -738,9 +761,72 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
738 | param["BinaryBucket"] = binBucket; | 761 | param["BinaryBucket"] = binBucket; |
739 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 762 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
740 | 763 | ||
741 | XmlRpcCall(requestID, "groups.addGroupNotice", param); | 764 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); |
742 | } | 765 | } |
743 | #endregion | 766 | |
767 | |||
768 | |||
769 | #endregion | ||
770 | |||
771 | #region GroupSessionTracking | ||
772 | |||
773 | public void ResetAgentGroupChatSessions(UUID agentID) | ||
774 | { | ||
775 | foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values) | ||
776 | { | ||
777 | agentList.Remove(agentID); | ||
778 | } | ||
779 | } | ||
780 | |||
781 | public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
782 | { | ||
783 | // If we're tracking this group, and we can find them in the tracking, then they've been invited | ||
784 | return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID) | ||
785 | && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID); | ||
786 | } | ||
787 | |||
788 | public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) | ||
789 | { | ||
790 | // If we're tracking drops for this group, | ||
791 | // and we find them, well... then they've dropped | ||
792 | return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID) | ||
793 | && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID); | ||
794 | } | ||
795 | |||
796 | public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID) | ||
797 | { | ||
798 | if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
799 | { | ||
800 | // If not in dropped list, add | ||
801 | if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
802 | { | ||
803 | m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); | ||
804 | } | ||
805 | } | ||
806 | } | ||
807 | |||
808 | public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
809 | { | ||
810 | // Add Session Status if it doesn't exist for this session | ||
811 | CreateGroupChatSessionTracking(groupID); | ||
812 | |||
813 | // If nessesary, remove from dropped list | ||
814 | if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
815 | { | ||
816 | m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); | ||
817 | } | ||
818 | } | ||
819 | |||
820 | private void CreateGroupChatSessionTracking(UUID groupID) | ||
821 | { | ||
822 | if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
823 | { | ||
824 | m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>()); | ||
825 | m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>()); | ||
826 | } | ||
827 | |||
828 | } | ||
829 | #endregion | ||
744 | 830 | ||
745 | #region XmlRpcHashtableMarshalling | 831 | #region XmlRpcHashtableMarshalling |
746 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) | 832 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) |
@@ -831,15 +917,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
831 | /// <summary> | 917 | /// <summary> |
832 | /// Encapsulate the XmlRpc call to standardize security and error handling. | 918 | /// Encapsulate the XmlRpc call to standardize security and error handling. |
833 | /// </summary> | 919 | /// </summary> |
834 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) | 920 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) |
835 | { | 921 | { |
836 | if (requestID == null) | 922 | string UserService; |
837 | { | 923 | UUID SessionID; |
838 | requestID = new GroupRequestID(); | 924 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); |
839 | } | 925 | param.Add("requestingAgentID", requestingAgentID.ToString()); |
840 | param.Add("RequestingAgentID", requestID.AgentID.ToString()); | 926 | param.Add("RequestingAgentUserService", UserService); |
841 | param.Add("RequestingAgentUserService", requestID.UserServiceURL); | 927 | param.Add("RequestingSessionID", SessionID.ToString()); |
842 | param.Add("RequestingSessionID", requestID.SessionID.ToString()); | ||
843 | 928 | ||
844 | 929 | ||
845 | param.Add("ReadKey", m_groupReadKey); | 930 | param.Add("ReadKey", m_groupReadKey); |
@@ -856,7 +941,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
856 | 941 | ||
857 | try | 942 | try |
858 | { | 943 | { |
859 | resp = req.Send(m_serviceURL, 10000); | 944 | resp = req.Send(m_groupsServerURI, 10000); |
860 | } | 945 | } |
861 | catch (Exception e) | 946 | catch (Exception e) |
862 | { | 947 | { |
@@ -930,15 +1015,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
930 | } | 1015 | } |
931 | } | 1016 | } |
932 | 1017 | ||
1018 | |||
1019 | /// <summary> | ||
1020 | /// Group Request Tokens are an attempt to allow the groups service to authenticate | ||
1021 | /// requests. | ||
1022 | /// TODO: This broke after the big grid refactor, either find a better way, or discard this | ||
1023 | /// </summary> | ||
1024 | /// <param name="client"></param> | ||
1025 | /// <returns></returns> | ||
1026 | private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID) | ||
1027 | { | ||
1028 | UserServiceURL = ""; | ||
1029 | SessionID = UUID.Zero; | ||
1030 | |||
933 | 1031 | ||
934 | } | 1032 | // Need to rework this based on changes to User Services |
1033 | /* | ||
1034 | UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); | ||
1035 | if (userAccount == null) | ||
1036 | { | ||
1037 | // This should be impossible. If I've been passed a reference to a client | ||
1038 | // that client should be registered with the UserService. So something | ||
1039 | // is horribly wrong somewhere. | ||
935 | 1040 | ||
936 | public class GroupNoticeInfo | 1041 | m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID); |
937 | { | 1042 | |
938 | public GroupNoticeData noticeData = new GroupNoticeData(); | 1043 | } |
939 | public UUID GroupID = UUID.Zero; | 1044 | else if (userProfile is ForeignUserProfileData) |
940 | public string Message = string.Empty; | 1045 | { |
941 | public byte[] BinaryBucket = new byte[0]; | 1046 | // They aren't from around here |
1047 | ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; | ||
1048 | UserServiceURL = fupd.UserServerURI; | ||
1049 | SessionID = fupd.CurrentAgent.SessionID; | ||
1050 | |||
1051 | } | ||
1052 | else | ||
1053 | { | ||
1054 | // They're a local user, use this: | ||
1055 | UserServiceURL = m_commManager.NetworkServersInfo.UserURL; | ||
1056 | SessionID = userProfile.CurrentAgent.SessionID; | ||
1057 | } | ||
1058 | */ | ||
1059 | } | ||
1060 | |||
942 | } | 1061 | } |
943 | } | 1062 | } |
944 | 1063 | ||