diff options
Diffstat (limited to 'OpenSim/Region')
3 files changed, 217 insertions, 330 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs index eff76cf..3a728da 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs | |||
@@ -50,13 +50,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
50 | private static readonly ILog m_log = | 50 | private static readonly ILog m_log = |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private string m_serviceURL = "http://osflotsam.org/xmlrpc.php"; | 53 | private string m_serviceURL = string.Empty; |
54 | 54 | ||
55 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | GroupPowers.JoinChat | GroupPowers.AllowVoiceChat | GroupPowers.ReceiveNotices | GroupPowers.StartProposal | GroupPowers.VoteOnProposal; | 55 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | GroupPowers.JoinChat | GroupPowers.AllowVoiceChat | GroupPowers.ReceiveNotices | GroupPowers.StartProposal | GroupPowers.VoteOnProposal; |
56 | 56 | ||
57 | public XmlRpcGroupDataProvider(string serviceURL) | 57 | private bool m_disableKeepAlive = false; |
58 | |||
59 | public XmlRpcGroupDataProvider(string serviceURL, bool disableKeepAlive) | ||
58 | { | 60 | { |
59 | m_serviceURL = serviceURL; | 61 | m_serviceURL = serviceURL.Trim().ToLower(); |
62 | m_disableKeepAlive = disableKeepAlive; | ||
63 | |||
64 | if ((serviceURL == null) | ||
65 | || (serviceURL == string.Empty) | ||
66 | ) | ||
67 | { | ||
68 | throw new Exception("Please specify a valid ServiceURL for XmlRpcGroupDataProvider in OpenSim.ini, [Groups], XmlRpcServiceURL"); | ||
69 | } | ||
70 | |||
60 | } | 71 | } |
61 | 72 | ||
62 | /// <summary> | 73 | /// <summary> |
@@ -131,15 +142,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
131 | 142 | ||
132 | 143 | ||
133 | 144 | ||
134 | IList parameters = new ArrayList(); | 145 | |
135 | parameters.Add(param); | 146 | Hashtable respData = XmlRpcCall("groups.createGroup", param); |
136 | XmlRpcRequest req = new XmlRpcRequest("groups.createGroup", parameters); | ||
137 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
138 | Hashtable respData = (Hashtable)resp.Value; | ||
139 | 147 | ||
140 | if (respData.Contains("error")) | 148 | if (respData.Contains("error")) |
141 | { | 149 | { |
142 | LogRespDataToConsoleError(respData); | 150 | // UUID is not nullable |
151 | |||
152 | return UUID.Zero; | ||
143 | } | 153 | } |
144 | 154 | ||
145 | return UUID.Parse((string)respData["GroupID"]); | 155 | return UUID.Parse((string)respData["GroupID"]); |
@@ -157,16 +167,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
157 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 167 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
158 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 168 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
159 | 169 | ||
160 | IList parameters = new ArrayList(); | 170 | XmlRpcCall("groups.updateGroup", param); |
161 | parameters.Add(param); | ||
162 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroup", parameters); | ||
163 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
164 | Hashtable respData = (Hashtable)resp.Value; | ||
165 | |||
166 | if (respData.Contains("error")) | ||
167 | { | ||
168 | LogRespDataToConsoleError(respData); | ||
169 | } | ||
170 | } | 171 | } |
171 | 172 | ||
172 | public void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) | 173 | public void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) |
@@ -179,16 +180,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
179 | param["Title"] = title; | 180 | param["Title"] = title; |
180 | param["Powers"] = powers.ToString(); | 181 | param["Powers"] = powers.ToString(); |
181 | 182 | ||
182 | IList parameters = new ArrayList(); | 183 | XmlRpcCall("groups.addRoleToGroup", param); |
183 | parameters.Add(param); | ||
184 | XmlRpcRequest req = new XmlRpcRequest("groups.addRoleToGroup", parameters); | ||
185 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
186 | Hashtable respData = (Hashtable)resp.Value; | ||
187 | |||
188 | if (respData.Contains("error")) | ||
189 | { | ||
190 | LogRespDataToConsoleError(respData); | ||
191 | } | ||
192 | } | 184 | } |
193 | 185 | ||
194 | public void RemoveGroupRole(UUID groupID, UUID roleID) | 186 | public void RemoveGroupRole(UUID groupID, UUID roleID) |
@@ -197,16 +189,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
197 | param["GroupID"] = groupID.ToString(); | 189 | param["GroupID"] = groupID.ToString(); |
198 | param["RoleID"] = roleID.ToString(); | 190 | param["RoleID"] = roleID.ToString(); |
199 | 191 | ||
200 | IList parameters = new ArrayList(); | 192 | XmlRpcCall("groups.removeRoleFromGroup", param); |
201 | parameters.Add(param); | ||
202 | XmlRpcRequest req = new XmlRpcRequest("groups.removeRoleFromGroup", parameters); | ||
203 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
204 | Hashtable respData = (Hashtable)resp.Value; | ||
205 | 193 | ||
206 | if (respData.Contains("error")) | ||
207 | { | ||
208 | LogRespDataToConsoleError(respData); | ||
209 | } | ||
210 | } | 194 | } |
211 | 195 | ||
212 | public void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) | 196 | public void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) |
@@ -228,16 +212,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
228 | } | 212 | } |
229 | param["Powers"] = powers.ToString(); | 213 | param["Powers"] = powers.ToString(); |
230 | 214 | ||
231 | IList parameters = new ArrayList(); | 215 | XmlRpcCall("groups.updateGroupRole", param); |
232 | parameters.Add(param); | ||
233 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroupRole", parameters); | ||
234 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
235 | Hashtable respData = (Hashtable)resp.Value; | ||
236 | |||
237 | if (respData.Contains("error")) | ||
238 | { | ||
239 | LogRespDataToConsoleError(respData); | ||
240 | } | ||
241 | } | 216 | } |
242 | 217 | ||
243 | public GroupRecord GetGroupRecord(UUID GroupID, string GroupName) | 218 | public GroupRecord GetGroupRecord(UUID GroupID, string GroupName) |
@@ -253,18 +228,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
253 | } | 228 | } |
254 | 229 | ||
255 | 230 | ||
256 | IList parameters = new ArrayList(); | 231 | Hashtable respData = XmlRpcCall("groups.getGroup", param); |
257 | parameters.Add(param); | ||
258 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); | ||
259 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
260 | Hashtable respData = (Hashtable)resp.Value; | ||
261 | 232 | ||
262 | if (respData.Contains("error")) | 233 | if (respData.Contains("error")) |
263 | { | 234 | { |
264 | if ((string)respData["error"] != "Group Not Found") | ||
265 | { | ||
266 | LogRespDataToConsoleError(respData); | ||
267 | } | ||
268 | return null; | 235 | return null; |
269 | } | 236 | } |
270 | 237 | ||
@@ -278,18 +245,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
278 | param["GroupID"] = GroupID.ToString(); | 245 | param["GroupID"] = GroupID.ToString(); |
279 | 246 | ||
280 | 247 | ||
281 | IList parameters = new ArrayList(); | 248 | Hashtable respData = XmlRpcCall("groups.getGroup", param); |
282 | parameters.Add(param); | ||
283 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); | ||
284 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
285 | Hashtable respData = (Hashtable)resp.Value; | ||
286 | 249 | ||
287 | if (respData.Contains("error")) | 250 | if (respData.Contains("error")) |
288 | { | 251 | { |
289 | if ((string)respData["error"] != "Group Not Found") | 252 | // GroupProfileData is not nullable |
290 | { | ||
291 | LogRespDataToConsoleError(respData); | ||
292 | } | ||
293 | return new GroupProfileData(); | 253 | return new GroupProfileData(); |
294 | } | 254 | } |
295 | 255 | ||
@@ -333,40 +293,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
333 | { | 293 | { |
334 | 294 | ||
335 | GroupRecord group = new GroupRecord(); | 295 | GroupRecord group = new GroupRecord(); |
336 | m_log.Debug("GroupID"); | ||
337 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 296 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
338 | |||
339 | m_log.Debug("Name"); | ||
340 | group.GroupName = groupProfile["Name"].ToString(); | 297 | group.GroupName = groupProfile["Name"].ToString(); |
341 | |||
342 | m_log.Debug("Charter"); | ||
343 | if (groupProfile["Charter"] != null) | 298 | if (groupProfile["Charter"] != null) |
344 | { | 299 | { |
345 | group.Charter = (string)groupProfile["Charter"]; | 300 | group.Charter = (string)groupProfile["Charter"]; |
346 | } | 301 | } |
347 | |||
348 | m_log.Debug("ShowInList"); | ||
349 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | 302 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; |
350 | |||
351 | m_log.Debug("InsigniaID"); | ||
352 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); | 303 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); |
353 | |||
354 | m_log.Debug("MembershipFee"); | ||
355 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | 304 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); |
356 | |||
357 | m_log.Debug("OpenEnrollment"); | ||
358 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | 305 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; |
359 | |||
360 | m_log.Debug("AllowPublish"); | ||
361 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | 306 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; |
362 | |||
363 | m_log.Debug("MaturePublish"); | ||
364 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | 307 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; |
365 | |||
366 | m_log.Debug("FounderID"); | ||
367 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | 308 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); |
368 | |||
369 | m_log.Debug("OwnerRoleID"); | ||
370 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); | 309 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); |
371 | 310 | ||
372 | return group; | 311 | return group; |
@@ -379,17 +318,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
379 | param["AgentID"] = AgentID.ToString(); | 318 | param["AgentID"] = AgentID.ToString(); |
380 | param["GroupID"] = GroupID.ToString(); | 319 | param["GroupID"] = GroupID.ToString(); |
381 | 320 | ||
382 | IList parameters = new ArrayList(); | 321 | XmlRpcCall("groups.setAgentActiveGroup", param); |
383 | parameters.Add(param); | ||
384 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentActiveGroup", parameters); | ||
385 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
386 | Hashtable respData = (Hashtable)resp.Value; | ||
387 | |||
388 | if (respData.Contains("error")) | ||
389 | { | ||
390 | LogRespDataToConsoleError(respData); | ||
391 | } | ||
392 | |||
393 | } | 322 | } |
394 | 323 | ||
395 | public void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 324 | public void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
@@ -399,17 +328,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
399 | param["GroupID"] = GroupID.ToString(); | 328 | param["GroupID"] = GroupID.ToString(); |
400 | param["SelectedRoleID"] = RoleID.ToString(); | 329 | param["SelectedRoleID"] = RoleID.ToString(); |
401 | 330 | ||
402 | IList parameters = new ArrayList(); | 331 | XmlRpcCall("groups.setAgentGroupInfo", param); |
403 | parameters.Add(param); | ||
404 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); | ||
405 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
406 | Hashtable respData = (Hashtable)resp.Value; | ||
407 | |||
408 | if (respData.Contains("error")) | ||
409 | { | ||
410 | LogRespDataToConsoleError(respData); | ||
411 | } | ||
412 | |||
413 | } | 332 | } |
414 | 333 | ||
415 | public void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 334 | public void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
@@ -420,16 +339,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
420 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 339 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
421 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 340 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
422 | 341 | ||
423 | IList parameters = new ArrayList(); | 342 | XmlRpcCall("groups.setAgentGroupInfo", param); |
424 | parameters.Add(param); | ||
425 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); | ||
426 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
427 | Hashtable respData = (Hashtable)resp.Value; | ||
428 | 343 | ||
429 | if (respData.Contains("error")) | ||
430 | { | ||
431 | LogRespDataToConsoleError(respData); | ||
432 | } | ||
433 | } | 344 | } |
434 | 345 | ||
435 | public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 346 | public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
@@ -440,20 +351,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
440 | param["RoleID"] = roleID.ToString(); | 351 | param["RoleID"] = roleID.ToString(); |
441 | param["GroupID"] = groupID.ToString(); | 352 | param["GroupID"] = groupID.ToString(); |
442 | 353 | ||
443 | IList parameters = new ArrayList(); | 354 | XmlRpcCall("groups.addAgentToGroupInvite", param); |
444 | parameters.Add(param); | ||
445 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupInvite", parameters); | ||
446 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
447 | Hashtable respData = (Hashtable)resp.Value; | ||
448 | |||
449 | if (respData.Contains("error")) | ||
450 | { | ||
451 | if (respData["error"] != "Duplicate group invite requested") | ||
452 | { | ||
453 | LogRespDataToConsoleError(respData); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | 355 | ||
458 | } | 356 | } |
459 | 357 | ||
@@ -462,17 +360,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
462 | Hashtable param = new Hashtable(); | 360 | Hashtable param = new Hashtable(); |
463 | param["InviteID"] = inviteID.ToString(); | 361 | param["InviteID"] = inviteID.ToString(); |
464 | 362 | ||
465 | IList parameters = new ArrayList(); | 363 | Hashtable respData = XmlRpcCall("groups.getAgentToGroupInvite", param); |
466 | parameters.Add(param); | ||
467 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentToGroupInvite", parameters); | ||
468 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
469 | Hashtable respData = (Hashtable)resp.Value; | ||
470 | |||
471 | 364 | ||
472 | if (respData.Contains("error")) | 365 | if (respData.Contains("error")) |
473 | { | 366 | { |
474 | LogRespDataToConsoleError(respData); | ||
475 | |||
476 | return null; | 367 | return null; |
477 | } | 368 | } |
478 | 369 | ||
@@ -490,16 +381,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
490 | Hashtable param = new Hashtable(); | 381 | Hashtable param = new Hashtable(); |
491 | param["InviteID"] = inviteID.ToString(); | 382 | param["InviteID"] = inviteID.ToString(); |
492 | 383 | ||
493 | IList parameters = new ArrayList(); | 384 | XmlRpcCall("groups.removeAgentToGroupInvite", param); |
494 | parameters.Add(param); | ||
495 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentToGroupInvite", parameters); | ||
496 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
497 | Hashtable respData = (Hashtable)resp.Value; | ||
498 | |||
499 | if (respData.Contains("error")) | ||
500 | { | ||
501 | LogRespDataToConsoleError(respData); | ||
502 | } | ||
503 | } | 385 | } |
504 | 386 | ||
505 | public void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID) | 387 | public void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID) |
@@ -509,16 +391,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
509 | param["GroupID"] = GroupID.ToString(); | 391 | param["GroupID"] = GroupID.ToString(); |
510 | param["RoleID"] = RoleID.ToString(); | 392 | param["RoleID"] = RoleID.ToString(); |
511 | 393 | ||
512 | IList parameters = new ArrayList(); | 394 | XmlRpcCall("groups.addAgentToGroup", param); |
513 | parameters.Add(param); | ||
514 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroup", parameters); | ||
515 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
516 | Hashtable respData = (Hashtable)resp.Value; | ||
517 | |||
518 | if (respData.Contains("error")) | ||
519 | { | ||
520 | LogRespDataToConsoleError(respData); | ||
521 | } | ||
522 | } | 395 | } |
523 | 396 | ||
524 | public void RemoveAgentFromGroup(UUID AgentID, UUID GroupID) | 397 | public void RemoveAgentFromGroup(UUID AgentID, UUID GroupID) |
@@ -527,16 +400,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
527 | param["AgentID"] = AgentID.ToString(); | 400 | param["AgentID"] = AgentID.ToString(); |
528 | param["GroupID"] = GroupID.ToString(); | 401 | param["GroupID"] = GroupID.ToString(); |
529 | 402 | ||
530 | IList parameters = new ArrayList(); | 403 | XmlRpcCall("groups.removeAgentFromGroup", param); |
531 | parameters.Add(param); | ||
532 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroup", parameters); | ||
533 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
534 | Hashtable respData = (Hashtable)resp.Value; | ||
535 | 404 | ||
536 | if (respData.Contains("error")) | ||
537 | { | ||
538 | LogRespDataToConsoleError(respData); | ||
539 | } | ||
540 | } | 405 | } |
541 | 406 | ||
542 | public void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 407 | public void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
@@ -546,16 +411,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
546 | param["GroupID"] = GroupID.ToString(); | 411 | param["GroupID"] = GroupID.ToString(); |
547 | param["RoleID"] = RoleID.ToString(); | 412 | param["RoleID"] = RoleID.ToString(); |
548 | 413 | ||
549 | IList parameters = new ArrayList(); | 414 | XmlRpcCall("groups.addAgentToGroupRole", param); |
550 | parameters.Add(param); | ||
551 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupRole", parameters); | ||
552 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
553 | Hashtable respData = (Hashtable)resp.Value; | ||
554 | |||
555 | if (respData.Contains("error")) | ||
556 | { | ||
557 | LogRespDataToConsoleError(respData); | ||
558 | } | ||
559 | } | 415 | } |
560 | 416 | ||
561 | public void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 417 | public void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
@@ -565,16 +421,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
565 | param["GroupID"] = GroupID.ToString(); | 421 | param["GroupID"] = GroupID.ToString(); |
566 | param["RoleID"] = RoleID.ToString(); | 422 | param["RoleID"] = RoleID.ToString(); |
567 | 423 | ||
568 | IList parameters = new ArrayList(); | 424 | XmlRpcCall("groups.removeAgentFromGroupRole", param); |
569 | parameters.Add(param); | ||
570 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroupRole", parameters); | ||
571 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | ||
572 | Hashtable respData = (Hashtable)resp.Value; | ||
573 | |||
574 | if (respData.Contains("error")) | ||
575 | { | ||
576 | LogRespDataToConsoleError(respData); | ||
577 | } | ||
578 | } | 425 | } |
579 | 426 | ||
580 | 427 | ||
@@ -583,22 +430,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
583 | Hashtable param = new Hashtable(); | 430 | Hashtable param = new Hashtable(); |
584 | param["Search"] = search; | 431 | param["Search"] = search; |
585 | 432 | ||
586 | IList parameters = new ArrayList(); | 433 | Hashtable respData = XmlRpcCall("groups.findGroups", param); |
587 | parameters.Add(param); | ||
588 | XmlRpcRequest req = new XmlRpcRequest("groups.findGroups", parameters); | ||
589 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
590 | Hashtable respData = (Hashtable)resp.Value; | ||
591 | 434 | ||
592 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 435 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
593 | 436 | ||
594 | if (respData.Contains("error")) | 437 | if (!respData.Contains("error")) |
595 | { | ||
596 | if (respData["error"].ToString() != "No groups found.") | ||
597 | { | ||
598 | LogRespDataToConsoleError(respData); | ||
599 | } | ||
600 | } | ||
601 | else | ||
602 | { | 438 | { |
603 | Hashtable results = (Hashtable)respData["results"]; | 439 | Hashtable results = (Hashtable)respData["results"]; |
604 | foreach (Hashtable groupFind in results.Values) | 440 | foreach (Hashtable groupFind in results.Values) |
@@ -622,18 +458,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
622 | param["AgentID"] = AgentID.ToString(); | 458 | param["AgentID"] = AgentID.ToString(); |
623 | param["GroupID"] = GroupID.ToString(); | 459 | param["GroupID"] = GroupID.ToString(); |
624 | 460 | ||
625 | IList parameters = new ArrayList(); | 461 | Hashtable respData = XmlRpcCall("groups.getAgentGroupMembership", param); |
626 | parameters.Add(param); | ||
627 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMembership", parameters); | ||
628 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
629 | Hashtable respData = (Hashtable)resp.Value; | ||
630 | 462 | ||
631 | if (respData.Contains("error")) | 463 | if (respData.Contains("error")) |
632 | { | 464 | { |
633 | if ((string)respData["error"] != "None Found") | ||
634 | { | ||
635 | LogRespDataToConsoleError(respData); | ||
636 | } | ||
637 | return null; | 465 | return null; |
638 | } | 466 | } |
639 | 467 | ||
@@ -647,74 +475,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
647 | Hashtable param = new Hashtable(); | 475 | Hashtable param = new Hashtable(); |
648 | param["AgentID"] = AgentID.ToString(); | 476 | param["AgentID"] = AgentID.ToString(); |
649 | 477 | ||
650 | IList parameters = new ArrayList(); | 478 | Hashtable respData = XmlRpcCall("groups.getAgentActiveMembership", param); |
651 | parameters.Add(param); | ||
652 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentActiveMembership", parameters); | ||
653 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
654 | Hashtable respData = (Hashtable)resp.Value; | ||
655 | 479 | ||
656 | if (respData.Contains("error")) | 480 | if (respData.Contains("error")) |
657 | { | 481 | { |
658 | if (respData["error"].ToString() == "No Active Group Specified") | ||
659 | { | ||
660 | return null; | 482 | return null; |
661 | } | 483 | } |
662 | LogRespDataToConsoleError(respData); | ||
663 | return null; | ||
664 | } | ||
665 | 484 | ||
666 | try | 485 | return HashTableToGroupMembershipData(respData); |
667 | { | ||
668 | GroupMembershipData data = HashTableToGroupMembershipData(respData); | ||
669 | return data; | ||
670 | } | ||
671 | catch (System.Exception e) | ||
672 | { | ||
673 | LogRespDataToConsoleError(respData); | ||
674 | throw e; | ||
675 | } | ||
676 | } | ||
677 | |||
678 | private void LogRespDataToConsoleError(Hashtable respData) | ||
679 | { | ||
680 | m_log.Error("[GROUPDATA] Error:"); | ||
681 | |||
682 | foreach (string key in respData.Keys) | ||
683 | { | ||
684 | m_log.ErrorFormat("[GROUPDATA] Key: {0}", key); | ||
685 | |||
686 | object o = respData[key]; | ||
687 | |||
688 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); | ||
689 | foreach (string line in lines) | ||
690 | { | ||
691 | m_log.ErrorFormat("[GROUPDATA] {0}", line); | ||
692 | } | 486 | } |
693 | 487 | ||
694 | } | ||
695 | } | ||
696 | 488 | ||
697 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID) | 489 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID) |
698 | { | 490 | { |
699 | Hashtable param = new Hashtable(); | 491 | Hashtable param = new Hashtable(); |
700 | param["AgentID"] = AgentID.ToString(); | 492 | param["AgentID"] = AgentID.ToString(); |
701 | 493 | ||
702 | IList parameters = new ArrayList(); | 494 | Hashtable respData = XmlRpcCall("groups.getAgentGroupMemberships", param); |
703 | parameters.Add(param); | ||
704 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMemberships", parameters); | ||
705 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
706 | Hashtable respData = (Hashtable)resp.Value; | ||
707 | 495 | ||
708 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 496 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
709 | 497 | ||
710 | if (respData.Contains("error")) | 498 | if (!respData.Contains("error")) |
711 | { | ||
712 | if (respData["error"].ToString() != "No Memberships") | ||
713 | { | ||
714 | LogRespDataToConsoleError(respData); | ||
715 | } | ||
716 | } | ||
717 | else | ||
718 | { | 499 | { |
719 | foreach (object membership in respData.Values) | 500 | foreach (object membership in respData.Values) |
720 | { | 501 | { |
@@ -730,20 +511,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
730 | param["AgentID"] = AgentID.ToString(); | 511 | param["AgentID"] = AgentID.ToString(); |
731 | param["GroupID"] = GroupID.ToString(); | 512 | param["GroupID"] = GroupID.ToString(); |
732 | 513 | ||
733 | IList parameters = new ArrayList(); | 514 | Hashtable respData = XmlRpcCall("groups.getAgentRoles", param); |
734 | parameters.Add(param); | ||
735 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentRoles", parameters); | ||
736 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
737 | Hashtable respData = (Hashtable)resp.Value; | ||
738 | 515 | ||
739 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 516 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
740 | 517 | ||
741 | if (respData.Contains("error")) | 518 | if (respData.Contains("error")) |
742 | { | 519 | { |
743 | if ((string)respData["error"] != "None found") | ||
744 | { | ||
745 | LogRespDataToConsoleError(respData); | ||
746 | } | ||
747 | return Roles; | 520 | return Roles; |
748 | } | 521 | } |
749 | 522 | ||
@@ -769,19 +542,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
769 | Hashtable param = new Hashtable(); | 542 | Hashtable param = new Hashtable(); |
770 | param["GroupID"] = GroupID.ToString(); | 543 | param["GroupID"] = GroupID.ToString(); |
771 | 544 | ||
772 | IList parameters = new ArrayList(); | 545 | Hashtable respData = XmlRpcCall("groups.getGroupRoles", param); |
773 | parameters.Add(param); | 546 | |
774 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoles", parameters); | 547 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
775 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
776 | Hashtable respData = (Hashtable)resp.Value; | ||
777 | 548 | ||
778 | if (respData.Contains("error")) | 549 | if (respData.Contains("error")) |
779 | { | 550 | { |
780 | LogRespDataToConsoleError(respData); | 551 | return Roles; |
781 | return null; | ||
782 | } | 552 | } |
783 | 553 | ||
784 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | ||
785 | foreach (Hashtable role in respData.Values) | 554 | foreach (Hashtable role in respData.Values) |
786 | { | 555 | { |
787 | GroupRolesData data = new GroupRolesData(); | 556 | GroupRolesData data = new GroupRolesData(); |
@@ -819,7 +588,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
819 | data.Active = data.GroupID.Equals(ActiveGroup); | 588 | data.Active = data.GroupID.Equals(ActiveGroup); |
820 | 589 | ||
821 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); | 590 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); |
591 | if (respData["Charter"] != null) | ||
592 | { | ||
822 | data.Charter = (string)respData["Charter"]; | 593 | data.Charter = (string)respData["Charter"]; |
594 | } | ||
823 | data.FounderID = new UUID((string)respData["FounderID"]); | 595 | data.FounderID = new UUID((string)respData["FounderID"]); |
824 | data.GroupID = new UUID((string)respData["GroupID"]); | 596 | data.GroupID = new UUID((string)respData["GroupID"]); |
825 | data.GroupName = (string)respData["GroupName"]; | 597 | data.GroupName = (string)respData["GroupName"]; |
@@ -836,19 +608,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
836 | Hashtable param = new Hashtable(); | 608 | Hashtable param = new Hashtable(); |
837 | param["GroupID"] = GroupID.ToString(); | 609 | param["GroupID"] = GroupID.ToString(); |
838 | 610 | ||
839 | IList parameters = new ArrayList(); | 611 | Hashtable respData = XmlRpcCall("groups.getGroupMembers", param); |
840 | parameters.Add(param); | 612 | |
841 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupMembers", parameters); | 613 | List<GroupMembersData> members = new List<GroupMembersData>(); |
842 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
843 | Hashtable respData = (Hashtable)resp.Value; | ||
844 | 614 | ||
845 | if (respData.Contains("error")) | 615 | if (respData.Contains("error")) |
846 | { | 616 | { |
847 | LogRespDataToConsoleError(respData); | 617 | return members; |
848 | return null; | ||
849 | } | 618 | } |
850 | 619 | ||
851 | List<GroupMembersData> members = new List<GroupMembersData>(); | ||
852 | foreach (Hashtable membership in respData.Values) | 620 | foreach (Hashtable membership in respData.Values) |
853 | { | 621 | { |
854 | GroupMembersData data = new GroupMembersData(); | 622 | GroupMembersData data = new GroupMembersData(); |
@@ -873,19 +641,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
873 | Hashtable param = new Hashtable(); | 641 | Hashtable param = new Hashtable(); |
874 | param["GroupID"] = GroupID.ToString(); | 642 | param["GroupID"] = GroupID.ToString(); |
875 | 643 | ||
876 | IList parameters = new ArrayList(); | 644 | Hashtable respData = XmlRpcCall("groups.getGroupRoleMembers", param); |
877 | parameters.Add(param); | ||
878 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoleMembers", parameters); | ||
879 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
880 | Hashtable respData = (Hashtable)resp.Value; | ||
881 | |||
882 | if (respData.Contains("error")) | ||
883 | { | ||
884 | LogRespDataToConsoleError(respData); | ||
885 | return null; | ||
886 | } | ||
887 | 645 | ||
888 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 646 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
647 | |||
648 | if (!respData.Contains("error")) | ||
649 | { | ||
889 | foreach (Hashtable membership in respData.Values) | 650 | foreach (Hashtable membership in respData.Values) |
890 | { | 651 | { |
891 | GroupRoleMembersData data = new GroupRoleMembersData(); | 652 | GroupRoleMembersData data = new GroupRoleMembersData(); |
@@ -895,7 +656,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
895 | 656 | ||
896 | members.Add(data); | 657 | members.Add(data); |
897 | } | 658 | } |
898 | 659 | } | |
899 | return members; | 660 | return members; |
900 | } | 661 | } |
901 | 662 | ||
@@ -904,22 +665,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
904 | Hashtable param = new Hashtable(); | 665 | Hashtable param = new Hashtable(); |
905 | param["GroupID"] = GroupID.ToString(); | 666 | param["GroupID"] = GroupID.ToString(); |
906 | 667 | ||
907 | IList parameters = new ArrayList(); | 668 | Hashtable respData = XmlRpcCall("groups.getGroupNotices", param); |
908 | parameters.Add(param); | ||
909 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotices", parameters); | ||
910 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
911 | Hashtable respData = (Hashtable)resp.Value; | ||
912 | 669 | ||
913 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 670 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
914 | 671 | ||
915 | if (respData.Contains("error")) | 672 | if (!respData.Contains("error")) |
916 | { | ||
917 | if ((string)respData["error"] != "No Notices") | ||
918 | { | ||
919 | LogRespDataToConsoleError(respData); | ||
920 | } | ||
921 | } | ||
922 | else | ||
923 | { | 673 | { |
924 | foreach (Hashtable value in respData.Values) | 674 | foreach (Hashtable value in respData.Values) |
925 | { | 675 | { |
@@ -942,22 +692,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
942 | Hashtable param = new Hashtable(); | 692 | Hashtable param = new Hashtable(); |
943 | param["NoticeID"] = noticeID.ToString(); | 693 | param["NoticeID"] = noticeID.ToString(); |
944 | 694 | ||
945 | IList parameters = new ArrayList(); | 695 | Hashtable respData = XmlRpcCall("groups.getGroupNotice", param); |
946 | parameters.Add(param); | ||
947 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotice", parameters); | ||
948 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | ||
949 | Hashtable respData = (Hashtable)resp.Value; | ||
950 | |||
951 | 696 | ||
952 | 697 | ||
953 | if (respData.Contains("error")) | 698 | if (!respData.Contains("error")) |
954 | { | 699 | { |
955 | if ((string)respData["error"] != "Group Notice Not Found") | ||
956 | { | ||
957 | LogRespDataToConsoleError(respData); | ||
958 | return null; | 700 | return null; |
959 | } | 701 | } |
960 | } | ||
961 | 702 | ||
962 | GroupNoticeInfo data = new GroupNoticeInfo(); | 703 | GroupNoticeInfo data = new GroupNoticeInfo(); |
963 | data.GroupID = UUID.Parse((string)respData["GroupID"]); | 704 | data.GroupID = UUID.Parse((string)respData["GroupID"]); |
@@ -990,20 +731,78 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
990 | param["BinaryBucket"] = binBucket; | 731 | param["BinaryBucket"] = binBucket; |
991 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 732 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
992 | 733 | ||
734 | XmlRpcCall("groups.addGroupNotice", param); | ||
735 | } | ||
736 | |||
737 | private Hashtable XmlRpcCall(string function, Hashtable param) | ||
738 | { | ||
993 | IList parameters = new ArrayList(); | 739 | IList parameters = new ArrayList(); |
994 | parameters.Add(param); | 740 | parameters.Add(param); |
995 | XmlRpcRequest req = new XmlRpcRequest("groups.addGroupNotice", parameters); | 741 | |
742 | XmlRpcRequest req; | ||
743 | if (!m_disableKeepAlive) | ||
744 | { | ||
745 | req = new XmlRpcRequest(function, parameters); | ||
746 | } | ||
747 | else | ||
748 | { | ||
749 | // This seems to solve a major problem on some windows servers | ||
750 | req = new NoKeepAliveXmlRpcRequest(function, parameters); | ||
751 | } | ||
752 | |||
996 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 753 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
997 | Hashtable respData = (Hashtable)resp.Value; | ||
998 | 754 | ||
999 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 755 | if( resp.Value is Hashtable ) |
756 | { | ||
757 | Hashtable respData = (Hashtable)resp.Value; | ||
758 | if (respData.Contains("error") && !respData.Contains("succeed")) | ||
759 | { | ||
760 | LogRespDataToConsoleError(respData); | ||
761 | } | ||
1000 | 762 | ||
1001 | if (respData.Contains("error")) | 763 | return respData; |
764 | } | ||
765 | |||
766 | m_log.ErrorFormat("[XmlRpcGroupData] The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); | ||
767 | |||
768 | if (resp.Value is ArrayList) | ||
1002 | { | 769 | { |
1003 | LogRespDataToConsoleError(respData); | 770 | ArrayList al = (ArrayList)resp.Value; |
771 | m_log.ErrorFormat("[XmlRpcGroupData] Contains {0} elements", al.Count); | ||
772 | |||
773 | foreach (object o in al) | ||
774 | { | ||
775 | m_log.ErrorFormat("[XmlRpcGroupData] {0} :: {1}", o.GetType().ToString(), o.ToString()); | ||
776 | } | ||
1004 | } | 777 | } |
778 | else | ||
779 | { | ||
780 | m_log.ErrorFormat("[XmlRpcGroupData] Function returned: {0}", resp.Value.ToString()); | ||
781 | } | ||
782 | |||
783 | Hashtable error = new Hashtable(); | ||
784 | error.Add("error", "invalid return value"); | ||
785 | return error; | ||
786 | } | ||
787 | |||
788 | private void LogRespDataToConsoleError(Hashtable respData) | ||
789 | { | ||
790 | m_log.Error("[GROUPDATA] Error:"); | ||
791 | |||
792 | foreach (string key in respData.Keys) | ||
793 | { | ||
794 | m_log.ErrorFormat("[GROUPDATA] Key: {0}", key); | ||
795 | |||
796 | object o = respData[key]; | ||
797 | |||
798 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); | ||
799 | foreach (string line in lines) | ||
800 | { | ||
801 | m_log.ErrorFormat("[GROUPDATA] {0}", line); | ||
1005 | } | 802 | } |
1006 | 803 | ||
804 | } | ||
805 | } | ||
1007 | 806 | ||
1008 | } | 807 | } |
1009 | 808 | ||
@@ -1015,3 +814,61 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1015 | public byte[] BinaryBucket = new byte[0]; | 814 | public byte[] BinaryBucket = new byte[0]; |
1016 | } | 815 | } |
1017 | } | 816 | } |
817 | |||
818 | namespace Nwc.XmlRpc | ||
819 | { | ||
820 | using System; | ||
821 | using System.Collections; | ||
822 | using System.IO; | ||
823 | using System.Xml; | ||
824 | using System.Net; | ||
825 | using System.Text; | ||
826 | using System.Reflection; | ||
827 | |||
828 | /// <summary>Class supporting the request side of an XML-RPC transaction.</summary> | ||
829 | public class NoKeepAliveXmlRpcRequest : XmlRpcRequest | ||
830 | { | ||
831 | private Encoding _encoding = new ASCIIEncoding(); | ||
832 | private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); | ||
833 | private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); | ||
834 | |||
835 | /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary> | ||
836 | /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request | ||
837 | /// should be directed to.</param> | ||
838 | /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param> | ||
839 | public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) | ||
840 | { | ||
841 | MethodName = methodName; | ||
842 | _params = parameters; | ||
843 | } | ||
844 | |||
845 | /// <summary>Send the request to the server.</summary> | ||
846 | /// <param name="url"><c>String</c> The url of the XML-RPC server.</param> | ||
847 | /// <returns><c>XmlRpcResponse</c> The response generated.</returns> | ||
848 | public XmlRpcResponse Send(String url) | ||
849 | { | ||
850 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); | ||
851 | if (request == null) | ||
852 | throw new XmlRpcException(XmlRpcErrorCodes.TRANSPORT_ERROR, | ||
853 | XmlRpcErrorCodes.TRANSPORT_ERROR_MSG + ": Could not create request with " + url); | ||
854 | request.Method = "POST"; | ||
855 | request.ContentType = "text/xml"; | ||
856 | request.AllowWriteStreamBuffering = true; | ||
857 | request.KeepAlive = false; | ||
858 | |||
859 | Stream stream = request.GetRequestStream(); | ||
860 | XmlTextWriter xml = new XmlTextWriter(stream, _encoding); | ||
861 | _serializer.Serialize(xml, this); | ||
862 | xml.Flush(); | ||
863 | xml.Close(); | ||
864 | |||
865 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | ||
866 | StreamReader input = new StreamReader(response.GetResponseStream()); | ||
867 | |||
868 | XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); | ||
869 | input.Close(); | ||
870 | response.Close(); | ||
871 | return resp; | ||
872 | } | ||
873 | } | ||
874 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs index 10561a6..34af325 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs | |||
@@ -212,6 +212,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
212 | // Incoming message from a group | 212 | // Incoming message from a group |
213 | if ((msg.dialog == (byte)InstantMessageDialog.SessionSend) && (msg.fromGroup == true)) | 213 | if ((msg.dialog == (byte)InstantMessageDialog.SessionSend) && (msg.fromGroup == true)) |
214 | { | 214 | { |
215 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] OnGridInstantMessage from group session {0} going to agent {1}", msg.fromAgentID, msg.toAgentID); | ||
216 | |||
215 | if (m_ActiveClients.ContainsKey(msg.toAgentID)) | 217 | if (m_ActiveClients.ContainsKey(msg.toAgentID)) |
216 | { | 218 | { |
217 | UUID GroupID = new UUID(msg.fromAgentID); | 219 | UUID GroupID = new UUID(msg.fromAgentID); |
@@ -220,6 +222,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
220 | GroupRecord GroupInfo = m_GroupsModule.GetGroupRecord(GroupID); | 222 | GroupRecord GroupInfo = m_GroupsModule.GetGroupRecord(GroupID); |
221 | if (GroupInfo != null) | 223 | if (GroupInfo != null) |
222 | { | 224 | { |
225 | // TODO: Check to see if already a member of session, if so, do not send chatterbox, just forward message | ||
223 | 226 | ||
224 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Sending chatterbox invite instant message"); | 227 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Sending chatterbox invite instant message"); |
225 | 228 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs index a6f9ea1..ec26dff 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs | |||
@@ -53,14 +53,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
53 | public class XmlRpcGroupsModule : INonSharedRegionModule, IGroupsModule | 53 | public class XmlRpcGroupsModule : INonSharedRegionModule, IGroupsModule |
54 | { | 54 | { |
55 | /// <summary> | 55 | /// <summary> |
56 | /// To use this module, you must specify the following in your OpenSim.ini | 56 | /// ; To use this module, you must specify the following in your OpenSim.ini |
57 | /// [GROUPS] | 57 | /// [GROUPS] |
58 | /// Enabled = true | 58 | /// Enabled = true |
59 | /// Module = XmlRpcGroups | 59 | /// Module = XmlRpcGroups |
60 | /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php | ||
60 | /// XmlRpcMessagingEnabled = true | 61 | /// XmlRpcMessagingEnabled = true |
61 | /// XmlRpcNoticesEnabled = true | 62 | /// XmlRpcNoticesEnabled = true |
62 | /// XmlRpcDebugEnabled = true | 63 | /// XmlRpcDebugEnabled = true |
63 | /// | 64 | /// |
65 | /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for | ||
66 | /// ; a problem discovered on some Windows based region servers. Only disable | ||
67 | /// ; if you see a large number (dozens) of the following Exceptions: | ||
68 | /// ; System.Net.WebException: The request was aborted: The request was canceled. | ||
69 | /// | ||
70 | /// XmlRpcDisableKeepAlive = false | ||
64 | /// </summary> | 71 | /// </summary> |
65 | 72 | ||
66 | private static readonly ILog m_log = | 73 | private static readonly ILog m_log = |
@@ -113,7 +120,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
113 | } | 120 | } |
114 | 121 | ||
115 | string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); | 122 | string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); |
116 | m_groupData = new XmlRpcGroupDataProvider(ServiceURL); | 123 | bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); |
124 | |||
125 | m_groupData = new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive); | ||
117 | m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL); | 126 | m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL); |
118 | 127 | ||
119 | m_GroupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); | 128 | m_GroupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); |
@@ -496,6 +505,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
496 | 505 | ||
497 | // Trigger the above event handler | 506 | // Trigger the above event handler |
498 | OnInstantMessage(null, msg); | 507 | OnInstantMessage(null, msg); |
508 | |||
509 | |||
510 | // If a message from a group arrives here, it may need to be forwarded to a local client | ||
511 | if (msg.fromGroup == true) | ||
512 | { | ||
513 | switch( msg.dialog ) | ||
514 | { | ||
515 | case (byte)InstantMessageDialog.GroupInvitation: | ||
516 | case (byte)InstantMessageDialog.GroupNotice: | ||
517 | UUID toAgentID = new UUID(msg.toAgentID); | ||
518 | if (m_ActiveClients.ContainsKey(toAgentID)) | ||
519 | { | ||
520 | m_ActiveClients[toAgentID].SendInstantMessage(msg); | ||
521 | } | ||
522 | break; | ||
523 | } | ||
524 | } | ||
525 | |||
499 | } | 526 | } |
500 | 527 | ||
501 | 528 | ||