aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs')
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs642
1 files changed, 642 insertions, 0 deletions
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
new file mode 100644
index 0000000..04328c9
--- /dev/null
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
@@ -0,0 +1,642 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Reflection;
32using System.Text;
33
34using OpenSim.Framework;
35using OpenSim.Server.Base;
36
37using OpenMetaverse;
38using log4net;
39
40namespace OpenSim.Groups
41{
42 public class GroupsServiceRemoteConnector
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 private string m_ServerURI;
47 private object m_Lock = new object();
48
49 public GroupsServiceRemoteConnector(string url)
50 {
51 m_ServerURI = url;
52 if (!m_ServerURI.EndsWith("/"))
53 m_ServerURI += "/";
54
55 m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}", m_ServerURI);
56 }
57
58 public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
59 bool allowPublish, bool maturePublish, UUID founderID, out string reason)
60 {
61 reason = string.Empty;
62
63 ExtendedGroupRecord rec = new ExtendedGroupRecord();
64 rec.AllowPublish = allowPublish;
65 rec.Charter = charter;
66 rec.FounderID = founderID;
67 rec.GroupName = name;
68 rec.GroupPicture = insigniaID;
69 rec.MaturePublish = maturePublish;
70 rec.MembershipFee = membershipFee;
71 rec.OpenEnrollment = openEnrollment;
72 rec.ShowInList = showInList;
73
74 Dictionary<string, object> sendData = GroupsDataUtils.GroupRecord(rec);
75 sendData["RequestingAgentID"] = RequestingAgentID;
76 sendData["OP"] = "ADD";
77 Dictionary<string, object> ret = MakeRequest("PUTGROUP", sendData);
78
79 if (ret == null)
80 return null;
81
82 if (ret["RESULT"].ToString() == "NULL")
83 {
84 reason = ret["REASON"].ToString();
85 return null;
86 }
87
88 return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
89
90 }
91
92 public ExtendedGroupRecord UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
93 {
94 ExtendedGroupRecord rec = new ExtendedGroupRecord();
95 rec.AllowPublish = allowPublish;
96 rec.Charter = charter;
97 rec.GroupPicture = insigniaID;
98 rec.MaturePublish = maturePublish;
99 rec.GroupID = groupID;
100 rec.MembershipFee = membershipFee;
101 rec.OpenEnrollment = openEnrollment;
102 rec.ShowInList = showInList;
103
104 Dictionary<string, object> sendData = GroupsDataUtils.GroupRecord(rec);
105 sendData["RequestingAgentID"] = RequestingAgentID;
106 sendData["OP"] = "UPDATE";
107 Dictionary<string, object> ret = MakeRequest("PUTGROUP", sendData);
108
109 if (ret == null || (ret != null && ret["RESULT"].ToString() == "NULL"))
110 return null;
111
112 return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
113 }
114
115 public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
116 {
117 if (GroupID == UUID.Zero && (GroupName == null || (GroupName != null && GroupName == string.Empty)))
118 return null;
119
120 Dictionary<string, object> sendData = new Dictionary<string, object>();
121 if (GroupID != UUID.Zero)
122 sendData["GroupID"] = GroupID.ToString();
123 if (GroupName != null && GroupName != string.Empty)
124 sendData["Name"] = GroupsDataUtils.Sanitize(GroupName);
125
126 sendData["RequestingAgentID"] = RequestingAgentID;
127
128 Dictionary<string, object> ret = MakeRequest("GETGROUP", sendData);
129
130 if (ret == null || (ret != null && ret["RESULT"].ToString() == "NULL"))
131 return null;
132
133 return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
134 }
135
136 public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
137 {
138 reason = string.Empty;
139
140 Dictionary<string, object> sendData = new Dictionary<string,object>();
141 sendData["AgentID"] = AgentID;
142 sendData["GroupID"] = GroupID.ToString();
143 sendData["RoleID"] = RoleID.ToString();
144 sendData["RequestingAgentID"] = RequestingAgentID;
145 sendData["AccessToken"] = token;
146 Dictionary<string, object> ret = MakeRequest("ADDAGENTTOGROUP", sendData);
147
148 if (ret == null)
149 return null;
150
151 if (!ret.ContainsKey("RESULT"))
152 return null;
153
154 if (ret["RESULT"].ToString() == "NULL")
155 {
156 reason = ret["REASON"].ToString();
157 return null;
158 }
159
160 return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
161
162 }
163
164 public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
165 {
166 Dictionary<string, object> sendData = new Dictionary<string, object>();
167 sendData["AgentID"] = AgentID;
168 sendData["GroupID"] = GroupID.ToString();
169 sendData["RequestingAgentID"] = RequestingAgentID;
170 MakeRequest("REMOVEAGENTFROMGROUP", sendData);
171 }
172
173 public ExtendedGroupMembershipData GetMembership(string RequestingAgentID, string AgentID, UUID GroupID)
174 {
175 Dictionary<string, object> sendData = new Dictionary<string, object>();
176 sendData["AgentID"] = AgentID;
177 if (GroupID != UUID.Zero)
178 sendData["GroupID"] = GroupID.ToString();
179 sendData["RequestingAgentID"] = RequestingAgentID;
180 Dictionary<string, object> ret = MakeRequest("GETMEMBERSHIP", sendData);
181
182 if (ret == null)
183 return null;
184
185 if (!ret.ContainsKey("RESULT"))
186 return null;
187
188 if (ret["RESULT"].ToString() == "NULL")
189 return null;
190
191 return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
192 }
193
194 public List<GroupMembershipData> GetMemberships(string RequestingAgentID, string AgentID)
195 {
196 List<GroupMembershipData> memberships = new List<GroupMembershipData>();
197
198 Dictionary<string, object> sendData = new Dictionary<string, object>();
199 sendData["AgentID"] = AgentID;
200 sendData["ALL"] = "true";
201 sendData["RequestingAgentID"] = RequestingAgentID;
202 Dictionary<string, object> ret = MakeRequest("GETMEMBERSHIP", sendData);
203
204 if (ret == null)
205 return memberships;
206
207 if (!ret.ContainsKey("RESULT"))
208 return memberships;
209
210 if (ret["RESULT"].ToString() == "NULL")
211 return memberships;
212
213 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
214 {
215 GroupMembershipData m = GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)v);
216 memberships.Add(m);
217 }
218
219 return memberships;
220 }
221
222 public List<ExtendedGroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
223 {
224 List<ExtendedGroupMembersData> members = new List<ExtendedGroupMembersData>();
225
226 Dictionary<string, object> sendData = new Dictionary<string, object>();
227 sendData["GroupID"] = GroupID.ToString();
228 sendData["RequestingAgentID"] = RequestingAgentID;
229 Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData);
230
231 if (ret == null)
232 return members;
233
234 if (!ret.ContainsKey("RESULT"))
235 return members;
236
237 if (ret["RESULT"].ToString() == "NULL")
238 return members;
239 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
240 {
241 ExtendedGroupMembersData m = GroupsDataUtils.GroupMembersData((Dictionary<string, object>)v);
242 members.Add(m);
243 }
244
245 return members;
246 }
247
248 public bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason)
249 {
250 reason = string.Empty;
251
252 Dictionary<string, object> sendData = new Dictionary<string, object>();
253 sendData["GroupID"] = groupID.ToString();
254 sendData["RoleID"] = roleID.ToString();
255 sendData["Name"] = GroupsDataUtils.Sanitize(name);
256 sendData["Description"] = GroupsDataUtils.Sanitize(description);
257 sendData["Title"] = GroupsDataUtils.Sanitize(title);
258 sendData["Powers"] = powers.ToString();
259 sendData["RequestingAgentID"] = RequestingAgentID;
260 sendData["OP"] = "ADD";
261 Dictionary<string, object> ret = MakeRequest("PUTROLE", sendData);
262
263 if (ret == null)
264 return false;
265
266 if (!ret.ContainsKey("RESULT"))
267 return false;
268
269 if (ret["RESULT"].ToString().ToLower() != "true")
270 {
271 reason = ret["REASON"].ToString();
272 return false;
273 }
274
275 return true;
276 }
277
278 public bool UpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers)
279 {
280 Dictionary<string, object> sendData = new Dictionary<string, object>();
281 sendData["GroupID"] = groupID.ToString();
282 sendData["RoleID"] = roleID.ToString();
283 sendData["Name"] = GroupsDataUtils.Sanitize(name);
284 sendData["Description"] = GroupsDataUtils.Sanitize(description);
285 sendData["Title"] = GroupsDataUtils.Sanitize(title);
286 sendData["Powers"] = powers.ToString();
287 sendData["RequestingAgentID"] = RequestingAgentID;
288 sendData["OP"] = "UPDATE";
289 Dictionary<string, object> ret = MakeRequest("PUTROLE", sendData);
290
291 if (ret == null)
292 return false;
293
294 if (!ret.ContainsKey("RESULT"))
295 return false;
296
297 if (ret["RESULT"].ToString().ToLower() != "true")
298 return false;
299
300 return true;
301 }
302
303 public void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID)
304 {
305 Dictionary<string, object> sendData = new Dictionary<string, object>();
306 sendData["GroupID"] = groupID.ToString();
307 sendData["RoleID"] = roleID.ToString();
308 sendData["RequestingAgentID"] = RequestingAgentID;
309 MakeRequest("REMOVEROLE", sendData);
310 }
311
312 public List<GroupRolesData> GetGroupRoles(string RequestingAgentID, UUID GroupID)
313 {
314 List<GroupRolesData> roles = new List<GroupRolesData>();
315
316 Dictionary<string, object> sendData = new Dictionary<string, object>();
317 sendData["GroupID"] = GroupID.ToString();
318 sendData["RequestingAgentID"] = RequestingAgentID;
319 Dictionary<string, object> ret = MakeRequest("GETGROUPROLES", sendData);
320
321 if (ret == null)
322 return roles;
323
324 if (!ret.ContainsKey("RESULT"))
325 return roles;
326
327 if (ret["RESULT"].ToString() == "NULL")
328 return roles;
329 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
330 {
331 GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
332 roles.Add(m);
333 }
334
335 return roles;
336 }
337
338 public List<ExtendedGroupRoleMembersData> GetGroupRoleMembers(string RequestingAgentID, UUID GroupID)
339 {
340 List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>();
341
342 Dictionary<string, object> sendData = new Dictionary<string, object>();
343 sendData["GroupID"] = GroupID.ToString();
344 sendData["RequestingAgentID"] = RequestingAgentID;
345 Dictionary<string, object> ret = MakeRequest("GETROLEMEMBERS", sendData);
346
347 if (ret == null)
348 return rmembers;
349
350 if (!ret.ContainsKey("RESULT"))
351 return rmembers;
352
353 if (ret["RESULT"].ToString() == "NULL")
354 return rmembers;
355
356 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
357 {
358 ExtendedGroupRoleMembersData m = GroupsDataUtils.GroupRoleMembersData((Dictionary<string, object>)v);
359 rmembers.Add(m);
360 }
361
362 return rmembers;
363 }
364
365 public bool AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
366 {
367 Dictionary<string, object> sendData = new Dictionary<string, object>();
368 sendData["AgentID"] = AgentID.ToString();
369 sendData["GroupID"] = GroupID.ToString();
370 sendData["RoleID"] = RoleID.ToString();
371 sendData["RequestingAgentID"] = RequestingAgentID;
372 sendData["OP"] = "ADD";
373
374 Dictionary<string, object> ret = MakeRequest("AGENTROLE", sendData);
375
376 if (ret == null)
377 return false;
378
379 if (!ret.ContainsKey("RESULT"))
380 return false;
381
382 if (ret["RESULT"].ToString().ToLower() != "true")
383 return false;
384
385 return true;
386 }
387
388 public bool RemoveAgentFromGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
389 {
390 Dictionary<string, object> sendData = new Dictionary<string, object>();
391 sendData["AgentID"] = AgentID.ToString();
392 sendData["GroupID"] = GroupID.ToString();
393 sendData["RoleID"] = RoleID.ToString();
394 sendData["RequestingAgentID"] = RequestingAgentID;
395 sendData["OP"] = "DELETE";
396
397 Dictionary<string, object> ret = MakeRequest("AGENTROLE", sendData);
398
399 if (ret == null)
400 return false;
401
402 if (!ret.ContainsKey("RESULT"))
403 return false;
404
405 if (ret["RESULT"].ToString().ToLower() != "true")
406 return false;
407
408 return true;
409 }
410
411 public List<GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
412 {
413 List<GroupRolesData> roles = new List<GroupRolesData>();
414
415 Dictionary<string, object> sendData = new Dictionary<string, object>();
416 sendData["AgentID"] = AgentID.ToString();
417 sendData["GroupID"] = GroupID.ToString();
418 sendData["RequestingAgentID"] = RequestingAgentID;
419 Dictionary<string, object> ret = MakeRequest("GETAGENTROLES", sendData);
420
421 if (ret == null)
422 return roles;
423
424 if (!ret.ContainsKey("RESULT"))
425 return roles;
426
427 if (ret["RESULT"].ToString() == "NULL")
428 return roles;
429
430 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
431 {
432 GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
433 roles.Add(m);
434 }
435
436 return roles;
437 }
438
439 public GroupMembershipData SetAgentActiveGroup(string RequestingAgentID, string AgentID, UUID GroupID)
440 {
441 Dictionary<string, object> sendData = new Dictionary<string, object>();
442 sendData["AgentID"] = AgentID.ToString();
443 sendData["GroupID"] = GroupID.ToString();
444 sendData["RequestingAgentID"] = RequestingAgentID;
445 sendData["OP"] = "GROUP";
446
447 Dictionary<string, object> ret = MakeRequest("SETACTIVE", sendData);
448
449 if (ret == null)
450 return null;
451
452 if (!ret.ContainsKey("RESULT"))
453 return null;
454
455 if (ret["RESULT"].ToString() == "NULL")
456 return null;
457
458 return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
459 }
460
461 public void SetAgentActiveGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
462 {
463 Dictionary<string, object> sendData = new Dictionary<string, object>();
464 sendData["AgentID"] = AgentID.ToString();
465 sendData["GroupID"] = GroupID.ToString();
466 sendData["RoleID"] = RoleID.ToString();
467 sendData["RequestingAgentID"] = RequestingAgentID;
468 sendData["OP"] = "ROLE";
469
470 MakeRequest("SETACTIVE", sendData);
471 }
472
473 public void UpdateMembership(string RequestingAgentID, string AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
474 {
475 Dictionary<string, object> sendData = new Dictionary<string, object>();
476 sendData["AgentID"] = AgentID.ToString();
477 sendData["GroupID"] = GroupID.ToString();
478 sendData["AcceptNotices"] = AcceptNotices.ToString();
479 sendData["ListInProfile"] = ListInProfile.ToString();
480 sendData["RequestingAgentID"] = RequestingAgentID;
481 MakeRequest("UPDATEMEMBERSHIP", sendData);
482 }
483
484 public bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID)
485 {
486 Dictionary<string, object> sendData = new Dictionary<string, object>();
487 sendData["InviteID"] = inviteID.ToString();
488 sendData["GroupID"] = groupID.ToString();
489 sendData["RoleID"] = roleID.ToString();
490 sendData["AgentID"] = agentID.ToString();
491 sendData["RequestingAgentID"] = RequestingAgentID;
492 sendData["OP"] = "ADD";
493
494 Dictionary<string, object> ret = MakeRequest("INVITE", sendData);
495
496 if (ret == null)
497 return false;
498
499 if (!ret.ContainsKey("RESULT"))
500 return false;
501
502 if (ret["RESULT"].ToString().ToLower() != "true") // it may return "NULL"
503 return false;
504
505 return true;
506 }
507
508 public GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
509 {
510 Dictionary<string, object> sendData = new Dictionary<string, object>();
511 sendData["InviteID"] = inviteID.ToString();
512 sendData["RequestingAgentID"] = RequestingAgentID;
513 sendData["OP"] = "GET";
514
515 Dictionary<string, object> ret = MakeRequest("INVITE", sendData);
516
517 if (ret == null)
518 return null;
519
520 if (!ret.ContainsKey("RESULT"))
521 return null;
522
523 if (ret["RESULT"].ToString() == "NULL")
524 return null;
525
526 return GroupsDataUtils.GroupInviteInfo((Dictionary<string, object>)ret["RESULT"]);
527 }
528
529 public void RemoveAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
530 {
531 Dictionary<string, object> sendData = new Dictionary<string, object>();
532 sendData["InviteID"] = inviteID.ToString();
533 sendData["RequestingAgentID"] = RequestingAgentID;
534 sendData["OP"] = "DELETE";
535
536 MakeRequest("INVITE", sendData);
537 }
538
539 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
540 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
541 {
542 Dictionary<string, object> sendData = new Dictionary<string, object>();
543 sendData["GroupID"] = groupID.ToString();
544 sendData["NoticeID"] = noticeID.ToString();
545 sendData["FromName"] = GroupsDataUtils.Sanitize(fromName);
546 sendData["Subject"] = GroupsDataUtils.Sanitize(subject);
547 sendData["Message"] = GroupsDataUtils.Sanitize(message);
548 sendData["HasAttachment"] = hasAttachment.ToString();
549 if (hasAttachment)
550 {
551 sendData["AttachmentType"] = attType.ToString();
552 sendData["AttachmentName"] = attName.ToString();
553 sendData["AttachmentItemID"] = attItemID.ToString();
554 sendData["AttachmentOwnerID"] = attOwnerID;
555 }
556 sendData["RequestingAgentID"] = RequestingAgentID;
557
558 Dictionary<string, object> ret = MakeRequest("ADDNOTICE", sendData);
559
560 if (ret == null)
561 return false;
562
563 if (!ret.ContainsKey("RESULT"))
564 return false;
565
566 if (ret["RESULT"].ToString().ToLower() != "true")
567 return false;
568
569 return true;
570 }
571
572 public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
573 {
574 Dictionary<string, object> sendData = new Dictionary<string, object>();
575 sendData["NoticeID"] = noticeID.ToString();
576 sendData["RequestingAgentID"] = RequestingAgentID;
577
578 Dictionary<string, object> ret = MakeRequest("GETNOTICES", sendData);
579
580 if (ret == null)
581 return null;
582
583 if (!ret.ContainsKey("RESULT"))
584 return null;
585
586 if (ret["RESULT"].ToString() == "NULL")
587 return null;
588
589 return GroupsDataUtils.GroupNoticeInfo((Dictionary<string, object>)ret["RESULT"]);
590 }
591
592 public List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID)
593 {
594 List<ExtendedGroupNoticeData> notices = new List<ExtendedGroupNoticeData>();
595
596 Dictionary<string, object> sendData = new Dictionary<string, object>();
597 sendData["GroupID"] = GroupID.ToString();
598 sendData["RequestingAgentID"] = RequestingAgentID;
599 Dictionary<string, object> ret = MakeRequest("GETNOTICES", sendData);
600
601 if (ret == null)
602 return notices;
603
604 if (!ret.ContainsKey("RESULT"))
605 return notices;
606
607 if (ret["RESULT"].ToString() == "NULL")
608 return notices;
609
610 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
611 {
612 ExtendedGroupNoticeData m = GroupsDataUtils.GroupNoticeData((Dictionary<string, object>)v);
613 notices.Add(m);
614 }
615
616 return notices;
617 }
618
619 #region Make Request
620
621 private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData)
622 {
623 sendData["METHOD"] = method;
624
625 string reply = string.Empty;
626 lock (m_Lock)
627 reply = SynchronousRestFormsRequester.MakeRequest("POST",
628 m_ServerURI + "groups",
629 ServerUtils.BuildQueryString(sendData));
630
631 if (reply == string.Empty)
632 return null;
633
634 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
635 reply);
636
637 return replyData;
638 }
639 #endregion
640
641 }
642}