diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 402 |
1 files changed, 281 insertions, 121 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 964d0bb..79b9a16 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | ||
32 | 33 | ||
33 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
34 | 35 | ||
@@ -40,16 +41,16 @@ using OpenMetaverse; | |||
40 | using OpenMetaverse.StructuredData; | 41 | using OpenMetaverse.StructuredData; |
41 | 42 | ||
42 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
44 | using OpenSim.Framework.Communications; | ||
43 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
46 | using OpenSim.Services.Interfaces; | ||
44 | 47 | ||
45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 48 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
46 | { | 49 | { |
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
48 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector | 51 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector |
49 | { | 52 | { |
50 | private static readonly ILog m_log = | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | 54 | ||
54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 55 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | |
55 | GroupPowers.Accountable | | 56 | GroupPowers.Accountable | |
@@ -61,13 +62,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
61 | 62 | ||
62 | private bool m_connectorEnabled = false; | 63 | private bool m_connectorEnabled = false; |
63 | 64 | ||
64 | private string m_serviceURL = string.Empty; | 65 | private string m_groupsServerURI = string.Empty; |
65 | 66 | ||
66 | private bool m_disableKeepAlive = false; | 67 | private bool m_disableKeepAlive = false; |
67 | 68 | ||
68 | private string m_groupReadKey = string.Empty; | 69 | private string m_groupReadKey = string.Empty; |
69 | private string m_groupWriteKey = string.Empty; | 70 | private string m_groupWriteKey = string.Empty; |
70 | 71 | ||
72 | private IUserAccountService m_accountService = null; | ||
73 | |||
74 | private ExpiringCache<string, XmlRpcResponse> m_memoryCache; | ||
75 | private int m_cacheTimeout = 30; | ||
76 | |||
77 | // Used to track which agents are have dropped from a group chat session | ||
78 | // Should be reset per agent, on logon | ||
79 | // TODO: move this to Flotsam XmlRpc Service | ||
80 | // SessionID, List<AgentID> | ||
81 | private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>(); | ||
82 | private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>(); | ||
83 | |||
71 | 84 | ||
72 | #region IRegionModuleBase Members | 85 | #region IRegionModuleBase Members |
73 | 86 | ||
@@ -102,13 +115,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
102 | return; | 115 | return; |
103 | } | 116 | } |
104 | 117 | ||
105 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); | 118 | m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name); |
106 | 119 | ||
107 | m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); | 120 | m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); |
108 | if ((m_serviceURL == null) || | 121 | if ((m_groupsServerURI == null) || |
109 | (m_serviceURL == string.Empty)) | 122 | (m_groupsServerURI == string.Empty)) |
110 | { | 123 | { |
111 | m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); | 124 | m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); |
112 | m_connectorEnabled = false; | 125 | m_connectorEnabled = false; |
113 | return; | 126 | return; |
114 | } | 127 | } |
@@ -118,26 +131,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
118 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 131 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
119 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 132 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
120 | 133 | ||
134 | |||
135 | m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30); | ||
136 | if (m_cacheTimeout == 0) | ||
137 | { | ||
138 | m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled."); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout); | ||
143 | } | ||
144 | |||
121 | // If we got all the config options we need, lets start'er'up | 145 | // If we got all the config options we need, lets start'er'up |
146 | m_memoryCache = new ExpiringCache<string, XmlRpcResponse>(); | ||
122 | m_connectorEnabled = true; | 147 | m_connectorEnabled = true; |
123 | } | 148 | } |
124 | } | 149 | } |
125 | 150 | ||
126 | public void Close() | 151 | public void Close() |
127 | { | 152 | { |
128 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name); | 153 | m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name); |
129 | } | 154 | } |
130 | 155 | ||
131 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 156 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
132 | { | 157 | { |
133 | if (m_connectorEnabled) | 158 | if (m_connectorEnabled) |
159 | { | ||
160 | |||
161 | if (m_accountService == null) | ||
162 | { | ||
163 | m_accountService = scene.UserAccountService; | ||
164 | } | ||
165 | |||
166 | |||
134 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | 167 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); |
168 | } | ||
135 | } | 169 | } |
136 | 170 | ||
137 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 171 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
138 | { | 172 | { |
139 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | 173 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) |
174 | { | ||
140 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | 175 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); |
176 | } | ||
141 | } | 177 | } |
142 | 178 | ||
143 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | 179 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -157,14 +193,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
157 | 193 | ||
158 | #endregion | 194 | #endregion |
159 | 195 | ||
160 | |||
161 | |||
162 | #region IGroupsServicesConnector Members | 196 | #region IGroupsServicesConnector Members |
163 | 197 | ||
164 | /// <summary> | 198 | /// <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. | 199 | /// 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> | 200 | /// </summary> |
167 | public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, | 201 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, |
168 | int membershipFee, bool openEnrollment, bool allowPublish, | 202 | int membershipFee, bool openEnrollment, bool allowPublish, |
169 | bool maturePublish, UUID founderID) | 203 | bool maturePublish, UUID founderID) |
170 | { | 204 | { |
@@ -236,7 +270,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
236 | 270 | ||
237 | 271 | ||
238 | 272 | ||
239 | Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param); | 273 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); |
240 | 274 | ||
241 | if (respData.Contains("error")) | 275 | if (respData.Contains("error")) |
242 | { | 276 | { |
@@ -248,7 +282,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
248 | return UUID.Parse((string)respData["GroupID"]); | 282 | return UUID.Parse((string)respData["GroupID"]); |
249 | } | 283 | } |
250 | 284 | ||
251 | public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, | 285 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
252 | UUID insigniaID, int membershipFee, bool openEnrollment, | 286 | UUID insigniaID, int membershipFee, bool openEnrollment, |
253 | bool allowPublish, bool maturePublish) | 287 | bool allowPublish, bool maturePublish) |
254 | { | 288 | { |
@@ -262,10 +296,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
262 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 296 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
263 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 297 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
264 | 298 | ||
265 | XmlRpcCall(requestID, "groups.updateGroup", param); | 299 | XmlRpcCall(requestingAgentID, "groups.updateGroup", param); |
266 | } | 300 | } |
267 | 301 | ||
268 | public void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 302 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
269 | string title, ulong powers) | 303 | string title, ulong powers) |
270 | { | 304 | { |
271 | Hashtable param = new Hashtable(); | 305 | Hashtable param = new Hashtable(); |
@@ -276,19 +310,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
276 | param["Title"] = title; | 310 | param["Title"] = title; |
277 | param["Powers"] = powers.ToString(); | 311 | param["Powers"] = powers.ToString(); |
278 | 312 | ||
279 | XmlRpcCall(requestID, "groups.addRoleToGroup", param); | 313 | XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param); |
280 | } | 314 | } |
281 | 315 | ||
282 | public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID) | 316 | public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) |
283 | { | 317 | { |
284 | Hashtable param = new Hashtable(); | 318 | Hashtable param = new Hashtable(); |
285 | param["GroupID"] = groupID.ToString(); | 319 | param["GroupID"] = groupID.ToString(); |
286 | param["RoleID"] = roleID.ToString(); | 320 | param["RoleID"] = roleID.ToString(); |
287 | 321 | ||
288 | XmlRpcCall(requestID, "groups.removeRoleFromGroup", param); | 322 | XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); |
289 | } | 323 | } |
290 | 324 | ||
291 | public void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 325 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
292 | string title, ulong powers) | 326 | string title, ulong powers) |
293 | { | 327 | { |
294 | Hashtable param = new Hashtable(); | 328 | Hashtable param = new Hashtable(); |
@@ -308,10 +342,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
308 | } | 342 | } |
309 | param["Powers"] = powers.ToString(); | 343 | param["Powers"] = powers.ToString(); |
310 | 344 | ||
311 | XmlRpcCall(requestID, "groups.updateGroupRole", param); | 345 | XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param); |
312 | } | 346 | } |
313 | 347 | ||
314 | public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName) | 348 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) |
315 | { | 349 | { |
316 | Hashtable param = new Hashtable(); | 350 | Hashtable param = new Hashtable(); |
317 | if (GroupID != UUID.Zero) | 351 | if (GroupID != UUID.Zero) |
@@ -323,7 +357,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
323 | param["Name"] = GroupName.ToString(); | 357 | param["Name"] = GroupName.ToString(); |
324 | } | 358 | } |
325 | 359 | ||
326 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 360 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
327 | 361 | ||
328 | if (respData.Contains("error")) | 362 | if (respData.Contains("error")) |
329 | { | 363 | { |
@@ -334,12 +368,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
334 | 368 | ||
335 | } | 369 | } |
336 | 370 | ||
337 | public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID) | 371 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
338 | { | 372 | { |
339 | Hashtable param = new Hashtable(); | 373 | Hashtable param = new Hashtable(); |
340 | param["GroupID"] = GroupID.ToString(); | 374 | param["GroupID"] = GroupID.ToString(); |
341 | 375 | ||
342 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 376 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
343 | 377 | ||
344 | if (respData.Contains("error")) | 378 | if (respData.Contains("error")) |
345 | { | 379 | { |
@@ -347,38 +381,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
347 | return new GroupProfileData(); | 381 | return new GroupProfileData(); |
348 | } | 382 | } |
349 | 383 | ||
350 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID); | 384 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); |
351 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 385 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
352 | 386 | ||
353 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 387 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
354 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 388 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; |
355 | 389 | ||
356 | return MemberGroupProfile; | 390 | return MemberGroupProfile; |
357 | |||
358 | } | 391 | } |
359 | 392 | ||
360 | 393 | public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) | |
361 | |||
362 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | ||
363 | { | 394 | { |
364 | Hashtable param = new Hashtable(); | 395 | Hashtable param = new Hashtable(); |
365 | param["AgentID"] = AgentID.ToString(); | 396 | param["AgentID"] = AgentID.ToString(); |
366 | param["GroupID"] = GroupID.ToString(); | 397 | param["GroupID"] = GroupID.ToString(); |
367 | 398 | ||
368 | XmlRpcCall(requestID, "groups.setAgentActiveGroup", param); | 399 | XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param); |
369 | } | 400 | } |
370 | 401 | ||
371 | public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 402 | public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
372 | { | 403 | { |
373 | Hashtable param = new Hashtable(); | 404 | Hashtable param = new Hashtable(); |
374 | param["AgentID"] = AgentID.ToString(); | 405 | param["AgentID"] = AgentID.ToString(); |
375 | param["GroupID"] = GroupID.ToString(); | 406 | param["GroupID"] = GroupID.ToString(); |
376 | param["SelectedRoleID"] = RoleID.ToString(); | 407 | param["SelectedRoleID"] = RoleID.ToString(); |
377 | 408 | ||
378 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 409 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
379 | } | 410 | } |
380 | 411 | ||
381 | public void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 412 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
382 | { | 413 | { |
383 | Hashtable param = new Hashtable(); | 414 | Hashtable param = new Hashtable(); |
384 | param["AgentID"] = AgentID.ToString(); | 415 | param["AgentID"] = AgentID.ToString(); |
@@ -386,11 +417,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
386 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 417 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
387 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 418 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
388 | 419 | ||
389 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 420 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
390 | 421 | ||
391 | } | 422 | } |
392 | 423 | ||
393 | public void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 424 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
394 | { | 425 | { |
395 | Hashtable param = new Hashtable(); | 426 | Hashtable param = new Hashtable(); |
396 | param["InviteID"] = inviteID.ToString(); | 427 | param["InviteID"] = inviteID.ToString(); |
@@ -398,16 +429,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
398 | param["RoleID"] = roleID.ToString(); | 429 | param["RoleID"] = roleID.ToString(); |
399 | param["GroupID"] = groupID.ToString(); | 430 | param["GroupID"] = groupID.ToString(); |
400 | 431 | ||
401 | XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param); | 432 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param); |
402 | 433 | ||
403 | } | 434 | } |
404 | 435 | ||
405 | public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 436 | public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
406 | { | 437 | { |
407 | Hashtable param = new Hashtable(); | 438 | Hashtable param = new Hashtable(); |
408 | param["InviteID"] = inviteID.ToString(); | 439 | param["InviteID"] = inviteID.ToString(); |
409 | 440 | ||
410 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param); | 441 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param); |
411 | 442 | ||
412 | if (respData.Contains("error")) | 443 | if (respData.Contains("error")) |
413 | { | 444 | { |
@@ -423,60 +454,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
423 | return inviteInfo; | 454 | return inviteInfo; |
424 | } | 455 | } |
425 | 456 | ||
426 | public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 457 | public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
427 | { | 458 | { |
428 | Hashtable param = new Hashtable(); | 459 | Hashtable param = new Hashtable(); |
429 | param["InviteID"] = inviteID.ToString(); | 460 | param["InviteID"] = inviteID.ToString(); |
430 | 461 | ||
431 | XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param); | 462 | XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param); |
432 | } | 463 | } |
433 | 464 | ||
434 | public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 465 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
435 | { | 466 | { |
436 | Hashtable param = new Hashtable(); | 467 | Hashtable param = new Hashtable(); |
437 | param["AgentID"] = AgentID.ToString(); | 468 | param["AgentID"] = AgentID.ToString(); |
438 | param["GroupID"] = GroupID.ToString(); | 469 | param["GroupID"] = GroupID.ToString(); |
439 | param["RoleID"] = RoleID.ToString(); | 470 | param["RoleID"] = RoleID.ToString(); |
440 | 471 | ||
441 | XmlRpcCall(requestID, "groups.addAgentToGroup", param); | 472 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param); |
442 | } | 473 | } |
443 | 474 | ||
444 | public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 475 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
445 | { | 476 | { |
446 | Hashtable param = new Hashtable(); | 477 | Hashtable param = new Hashtable(); |
447 | param["AgentID"] = AgentID.ToString(); | 478 | param["AgentID"] = AgentID.ToString(); |
448 | param["GroupID"] = GroupID.ToString(); | 479 | param["GroupID"] = GroupID.ToString(); |
449 | 480 | ||
450 | XmlRpcCall(requestID, "groups.removeAgentFromGroup", param); | 481 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param); |
451 | } | 482 | } |
452 | 483 | ||
453 | public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 484 | public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
454 | { | 485 | { |
455 | Hashtable param = new Hashtable(); | 486 | Hashtable param = new Hashtable(); |
456 | param["AgentID"] = AgentID.ToString(); | 487 | param["AgentID"] = AgentID.ToString(); |
457 | param["GroupID"] = GroupID.ToString(); | 488 | param["GroupID"] = GroupID.ToString(); |
458 | param["RoleID"] = RoleID.ToString(); | 489 | param["RoleID"] = RoleID.ToString(); |
459 | 490 | ||
460 | XmlRpcCall(requestID, "groups.addAgentToGroupRole", param); | 491 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param); |
461 | } | 492 | } |
462 | 493 | ||
463 | public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 494 | public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
464 | { | 495 | { |
465 | Hashtable param = new Hashtable(); | 496 | Hashtable param = new Hashtable(); |
466 | param["AgentID"] = AgentID.ToString(); | 497 | param["AgentID"] = AgentID.ToString(); |
467 | param["GroupID"] = GroupID.ToString(); | 498 | param["GroupID"] = GroupID.ToString(); |
468 | param["RoleID"] = RoleID.ToString(); | 499 | param["RoleID"] = RoleID.ToString(); |
469 | 500 | ||
470 | XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); | 501 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param); |
471 | } | 502 | } |
472 | 503 | ||
473 | 504 | public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search) | |
474 | public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) | ||
475 | { | 505 | { |
476 | Hashtable param = new Hashtable(); | 506 | Hashtable param = new Hashtable(); |
477 | param["Search"] = search; | 507 | param["Search"] = search; |
478 | 508 | ||
479 | Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param); | 509 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); |
480 | 510 | ||
481 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 511 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
482 | 512 | ||
@@ -498,13 +528,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
498 | return findings; | 528 | return findings; |
499 | } | 529 | } |
500 | 530 | ||
501 | public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 531 | public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
502 | { | 532 | { |
503 | Hashtable param = new Hashtable(); | 533 | Hashtable param = new Hashtable(); |
504 | param["AgentID"] = AgentID.ToString(); | 534 | param["AgentID"] = AgentID.ToString(); |
505 | param["GroupID"] = GroupID.ToString(); | 535 | param["GroupID"] = GroupID.ToString(); |
506 | 536 | ||
507 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param); | 537 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param); |
508 | 538 | ||
509 | if (respData.Contains("error")) | 539 | if (respData.Contains("error")) |
510 | { | 540 | { |
@@ -516,12 +546,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
516 | return data; | 546 | return data; |
517 | } | 547 | } |
518 | 548 | ||
519 | public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID) | 549 | public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) |
520 | { | 550 | { |
521 | Hashtable param = new Hashtable(); | 551 | Hashtable param = new Hashtable(); |
522 | param["AgentID"] = AgentID.ToString(); | 552 | param["AgentID"] = AgentID.ToString(); |
523 | 553 | ||
524 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param); | 554 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param); |
525 | 555 | ||
526 | if (respData.Contains("error")) | 556 | if (respData.Contains("error")) |
527 | { | 557 | { |
@@ -531,13 +561,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
531 | return HashTableToGroupMembershipData(respData); | 561 | return HashTableToGroupMembershipData(respData); |
532 | } | 562 | } |
533 | 563 | ||
534 | 564 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) | |
535 | public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) | ||
536 | { | 565 | { |
537 | Hashtable param = new Hashtable(); | 566 | Hashtable param = new Hashtable(); |
538 | param["AgentID"] = AgentID.ToString(); | 567 | param["AgentID"] = AgentID.ToString(); |
539 | 568 | ||
540 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param); | 569 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param); |
541 | 570 | ||
542 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 571 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
543 | 572 | ||
@@ -552,13 +581,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
552 | return memberships; | 581 | return memberships; |
553 | } | 582 | } |
554 | 583 | ||
555 | public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 584 | public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
556 | { | 585 | { |
557 | Hashtable param = new Hashtable(); | 586 | Hashtable param = new Hashtable(); |
558 | param["AgentID"] = AgentID.ToString(); | 587 | param["AgentID"] = AgentID.ToString(); |
559 | param["GroupID"] = GroupID.ToString(); | 588 | param["GroupID"] = GroupID.ToString(); |
560 | 589 | ||
561 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param); | 590 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param); |
562 | 591 | ||
563 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 592 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
564 | 593 | ||
@@ -584,12 +613,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
584 | 613 | ||
585 | } | 614 | } |
586 | 615 | ||
587 | public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID) | 616 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) |
588 | { | 617 | { |
589 | Hashtable param = new Hashtable(); | 618 | Hashtable param = new Hashtable(); |
590 | param["GroupID"] = GroupID.ToString(); | 619 | param["GroupID"] = GroupID.ToString(); |
591 | 620 | ||
592 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param); | 621 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); |
593 | 622 | ||
594 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 623 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
595 | 624 | ||
@@ -617,12 +646,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
617 | 646 | ||
618 | 647 | ||
619 | 648 | ||
620 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) | 649 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) |
621 | { | 650 | { |
622 | Hashtable param = new Hashtable(); | 651 | Hashtable param = new Hashtable(); |
623 | param["GroupID"] = GroupID.ToString(); | 652 | param["GroupID"] = GroupID.ToString(); |
624 | 653 | ||
625 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param); | 654 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param); |
626 | 655 | ||
627 | List<GroupMembersData> members = new List<GroupMembersData>(); | 656 | List<GroupMembersData> members = new List<GroupMembersData>(); |
628 | 657 | ||
@@ -650,12 +679,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
650 | 679 | ||
651 | } | 680 | } |
652 | 681 | ||
653 | public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID) | 682 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
654 | { | 683 | { |
655 | Hashtable param = new Hashtable(); | 684 | Hashtable param = new Hashtable(); |
656 | param["GroupID"] = GroupID.ToString(); | 685 | param["GroupID"] = GroupID.ToString(); |
657 | 686 | ||
658 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param); | 687 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param); |
659 | 688 | ||
660 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 689 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
661 | 690 | ||
@@ -674,12 +703,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
674 | return members; | 703 | return members; |
675 | } | 704 | } |
676 | 705 | ||
677 | public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID) | 706 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) |
678 | { | 707 | { |
679 | Hashtable param = new Hashtable(); | 708 | Hashtable param = new Hashtable(); |
680 | param["GroupID"] = GroupID.ToString(); | 709 | param["GroupID"] = GroupID.ToString(); |
681 | 710 | ||
682 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param); | 711 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param); |
683 | 712 | ||
684 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 713 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
685 | 714 | ||
@@ -701,12 +730,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
701 | return values; | 730 | return values; |
702 | 731 | ||
703 | } | 732 | } |
704 | public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID) | 733 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
705 | { | 734 | { |
706 | Hashtable param = new Hashtable(); | 735 | Hashtable param = new Hashtable(); |
707 | param["NoticeID"] = noticeID.ToString(); | 736 | param["NoticeID"] = noticeID.ToString(); |
708 | 737 | ||
709 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param); | 738 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); |
710 | 739 | ||
711 | 740 | ||
712 | if (respData.Contains("error")) | 741 | if (respData.Contains("error")) |
@@ -732,7 +761,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
732 | 761 | ||
733 | return data; | 762 | return data; |
734 | } | 763 | } |
735 | public void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 764 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
736 | { | 765 | { |
737 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 766 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
738 | 767 | ||
@@ -745,7 +774,70 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
745 | param["BinaryBucket"] = binBucket; | 774 | param["BinaryBucket"] = binBucket; |
746 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 775 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
747 | 776 | ||
748 | XmlRpcCall(requestID, "groups.addGroupNotice", param); | 777 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); |
778 | } | ||
779 | |||
780 | |||
781 | |||
782 | #endregion | ||
783 | |||
784 | #region GroupSessionTracking | ||
785 | |||
786 | public void ResetAgentGroupChatSessions(UUID agentID) | ||
787 | { | ||
788 | foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values) | ||
789 | { | ||
790 | agentList.Remove(agentID); | ||
791 | } | ||
792 | } | ||
793 | |||
794 | public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
795 | { | ||
796 | // If we're tracking this group, and we can find them in the tracking, then they've been invited | ||
797 | return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID) | ||
798 | && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID); | ||
799 | } | ||
800 | |||
801 | public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) | ||
802 | { | ||
803 | // If we're tracking drops for this group, | ||
804 | // and we find them, well... then they've dropped | ||
805 | return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID) | ||
806 | && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID); | ||
807 | } | ||
808 | |||
809 | public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID) | ||
810 | { | ||
811 | if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
812 | { | ||
813 | // If not in dropped list, add | ||
814 | if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
815 | { | ||
816 | m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); | ||
817 | } | ||
818 | } | ||
819 | } | ||
820 | |||
821 | public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
822 | { | ||
823 | // Add Session Status if it doesn't exist for this session | ||
824 | CreateGroupChatSessionTracking(groupID); | ||
825 | |||
826 | // If nessesary, remove from dropped list | ||
827 | if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
828 | { | ||
829 | m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); | ||
830 | } | ||
831 | } | ||
832 | |||
833 | private void CreateGroupChatSessionTracking(UUID groupID) | ||
834 | { | ||
835 | if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
836 | { | ||
837 | m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>()); | ||
838 | m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>()); | ||
839 | } | ||
840 | |||
749 | } | 841 | } |
750 | #endregion | 842 | #endregion |
751 | 843 | ||
@@ -778,7 +870,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
778 | 870 | ||
779 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | 871 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) |
780 | { | 872 | { |
781 | |||
782 | GroupRecord group = new GroupRecord(); | 873 | GroupRecord group = new GroupRecord(); |
783 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 874 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
784 | group.GroupName = groupProfile["Name"].ToString(); | 875 | group.GroupName = groupProfile["Name"].ToString(); |
@@ -797,6 +888,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
797 | 888 | ||
798 | return group; | 889 | return group; |
799 | } | 890 | } |
891 | |||
800 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | 892 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) |
801 | { | 893 | { |
802 | GroupMembershipData data = new GroupMembershipData(); | 894 | GroupMembershipData data = new GroupMembershipData(); |
@@ -829,6 +921,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
829 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | 921 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); |
830 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | 922 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); |
831 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | 923 | data.ShowInList = ((string)respData["ShowInList"] == "1"); |
924 | |||
832 | return data; | 925 | return data; |
833 | } | 926 | } |
834 | 927 | ||
@@ -837,53 +930,86 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
837 | /// <summary> | 930 | /// <summary> |
838 | /// Encapsulate the XmlRpc call to standardize security and error handling. | 931 | /// Encapsulate the XmlRpc call to standardize security and error handling. |
839 | /// </summary> | 932 | /// </summary> |
840 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) | 933 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) |
841 | { | 934 | { |
842 | if (requestID == null) | 935 | XmlRpcResponse resp = null; |
936 | string CacheKey = null; | ||
937 | |||
938 | // Only bother with the cache if it isn't disabled. | ||
939 | if (m_cacheTimeout > 0) | ||
843 | { | 940 | { |
844 | requestID = new GroupRequestID(); | 941 | if (!function.StartsWith("groups.get")) |
942 | { | ||
943 | // Any and all updates cause the cache to clear | ||
944 | m_memoryCache.Clear(); | ||
945 | } | ||
946 | else | ||
947 | { | ||
948 | StringBuilder sb = new StringBuilder(requestingAgentID + function); | ||
949 | foreach (object key in param.Keys) | ||
950 | { | ||
951 | if (param[key] != null) | ||
952 | { | ||
953 | sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString()); | ||
954 | } | ||
955 | } | ||
956 | |||
957 | CacheKey = sb.ToString(); | ||
958 | m_memoryCache.TryGetValue(CacheKey, out resp); | ||
959 | } | ||
960 | |||
845 | } | 961 | } |
846 | param.Add("RequestingAgentID", requestID.AgentID.ToString()); | ||
847 | param.Add("RequestingAgentUserService", requestID.UserServiceURL); | ||
848 | param.Add("RequestingSessionID", requestID.SessionID.ToString()); | ||
849 | 962 | ||
963 | if( resp == null ) | ||
964 | { | ||
965 | string UserService; | ||
966 | UUID SessionID; | ||
967 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); | ||
968 | param.Add("requestingAgentID", requestingAgentID.ToString()); | ||
969 | param.Add("RequestingAgentUserService", UserService); | ||
970 | param.Add("RequestingSessionID", SessionID.ToString()); | ||
850 | 971 | ||
851 | param.Add("ReadKey", m_groupReadKey); | ||
852 | param.Add("WriteKey", m_groupWriteKey); | ||
853 | 972 | ||
973 | param.Add("ReadKey", m_groupReadKey); | ||
974 | param.Add("WriteKey", m_groupWriteKey); | ||
854 | 975 | ||
855 | IList parameters = new ArrayList(); | ||
856 | parameters.Add(param); | ||
857 | 976 | ||
858 | ConfigurableKeepAliveXmlRpcRequest req; | 977 | IList parameters = new ArrayList(); |
859 | req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); | 978 | parameters.Add(param); |
860 | 979 | ||
861 | XmlRpcResponse resp = null; | 980 | ConfigurableKeepAliveXmlRpcRequest req; |
981 | req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); | ||
862 | 982 | ||
863 | try | ||
864 | { | ||
865 | resp = req.Send(m_serviceURL, 10000); | ||
866 | } | ||
867 | catch (Exception e) | ||
868 | { | ||
869 | |||
870 | |||
871 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); | ||
872 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); | ||
873 | 983 | ||
874 | foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) | 984 | try |
875 | { | 985 | { |
876 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); | 986 | resp = req.Send(m_groupsServerURI, 10000); |
877 | } | 987 | |
988 | if ((m_cacheTimeout > 0) && (CacheKey != null)) | ||
989 | { | ||
990 | m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); | ||
991 | } | ||
878 | 992 | ||
879 | foreach (string key in param.Keys) | 993 | } |
994 | catch (Exception e) | ||
880 | { | 995 | { |
881 | m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); | 996 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); |
997 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", e.ToString()); | ||
998 | |||
999 | foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) | ||
1000 | { | ||
1001 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine); | ||
1002 | } | ||
1003 | |||
1004 | foreach (string key in param.Keys) | ||
1005 | { | ||
1006 | m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString()); | ||
1007 | } | ||
1008 | |||
1009 | Hashtable respData = new Hashtable(); | ||
1010 | respData.Add("error", e.ToString()); | ||
1011 | return respData; | ||
882 | } | 1012 | } |
883 | |||
884 | Hashtable respData = new Hashtable(); | ||
885 | respData.Add("error", e.ToString()); | ||
886 | return respData; | ||
887 | } | 1013 | } |
888 | 1014 | ||
889 | if (resp.Value is Hashtable) | 1015 | if (resp.Value is Hashtable) |
@@ -897,21 +1023,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
897 | return respData; | 1023 | return respData; |
898 | } | 1024 | } |
899 | 1025 | ||
900 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); | 1026 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); |
901 | 1027 | ||
902 | if (resp.Value is ArrayList) | 1028 | if (resp.Value is ArrayList) |
903 | { | 1029 | { |
904 | ArrayList al = (ArrayList)resp.Value; | 1030 | ArrayList al = (ArrayList)resp.Value; |
905 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: Contains {0} elements", al.Count); | 1031 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Contains {0} elements", al.Count); |
906 | 1032 | ||
907 | foreach (object o in al) | 1033 | foreach (object o in al) |
908 | { | 1034 | { |
909 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} :: {1}", o.GetType().ToString(), o.ToString()); | 1035 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", o.GetType().ToString(), o.ToString()); |
910 | } | 1036 | } |
911 | } | 1037 | } |
912 | else | 1038 | else |
913 | { | 1039 | { |
914 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: Function returned: {0}", resp.Value.ToString()); | 1040 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Function returned: {0}", resp.Value.ToString()); |
915 | } | 1041 | } |
916 | 1042 | ||
917 | Hashtable error = new Hashtable(); | 1043 | Hashtable error = new Hashtable(); |
@@ -921,30 +1047,64 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
921 | 1047 | ||
922 | private void LogRespDataToConsoleError(Hashtable respData) | 1048 | private void LogRespDataToConsoleError(Hashtable respData) |
923 | { | 1049 | { |
924 | m_log.Error("[XMLRPCGROUPDATA]: Error:"); | 1050 | m_log.Error("[XMLRPC-GROUPS-CONNECTOR]: Error:"); |
925 | 1051 | ||
926 | foreach (string key in respData.Keys) | 1052 | foreach (string key in respData.Keys) |
927 | { | 1053 | { |
928 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: Key: {0}", key); | 1054 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Key: {0}", key); |
929 | 1055 | ||
930 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); | 1056 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); |
931 | foreach (string line in lines) | 1057 | foreach (string line in lines) |
932 | { | 1058 | { |
933 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0}", line); | 1059 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line); |
934 | } | 1060 | } |
935 | 1061 | ||
936 | } | 1062 | } |
937 | } | 1063 | } |
938 | 1064 | ||
1065 | |||
1066 | /// <summary> | ||
1067 | /// Group Request Tokens are an attempt to allow the groups service to authenticate | ||
1068 | /// requests. | ||
1069 | /// TODO: This broke after the big grid refactor, either find a better way, or discard this | ||
1070 | /// </summary> | ||
1071 | /// <param name="client"></param> | ||
1072 | /// <returns></returns> | ||
1073 | private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID) | ||
1074 | { | ||
1075 | UserServiceURL = ""; | ||
1076 | SessionID = UUID.Zero; | ||
939 | 1077 | ||
940 | } | ||
941 | 1078 | ||
942 | public class GroupNoticeInfo | 1079 | // Need to rework this based on changes to User Services |
943 | { | 1080 | /* |
944 | public GroupNoticeData noticeData = new GroupNoticeData(); | 1081 | UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); |
945 | public UUID GroupID = UUID.Zero; | 1082 | if (userAccount == null) |
946 | public string Message = string.Empty; | 1083 | { |
947 | public byte[] BinaryBucket = new byte[0]; | 1084 | // This should be impossible. If I've been passed a reference to a client |
1085 | // that client should be registered with the UserService. So something | ||
1086 | // is horribly wrong somewhere. | ||
1087 | |||
1088 | m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID); | ||
1089 | |||
1090 | } | ||
1091 | else if (userProfile is ForeignUserProfileData) | ||
1092 | { | ||
1093 | // They aren't from around here | ||
1094 | ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; | ||
1095 | UserServiceURL = fupd.UserServerURI; | ||
1096 | SessionID = fupd.CurrentAgent.SessionID; | ||
1097 | |||
1098 | } | ||
1099 | else | ||
1100 | { | ||
1101 | // They're a local user, use this: | ||
1102 | UserServiceURL = m_commManager.NetworkServersInfo.UserURL; | ||
1103 | SessionID = userProfile.CurrentAgent.SessionID; | ||
1104 | } | ||
1105 | */ | ||
1106 | } | ||
1107 | |||
948 | } | 1108 | } |
949 | } | 1109 | } |
950 | 1110 | ||