29 using System.Reflection;
32 using System.Collections.Generic;
35 using OpenSim.Framework;
36 using OpenSim.Server.Base;
37 using OpenSim.Services.Interfaces;
38 using OpenSim.Framework.Servers.HttpServer;
39 using OpenSim.Framework.ServiceAuth;
40 using OpenSim.Server.Handlers.Base;
44 namespace OpenSim.Groups
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private string m_ConfigName =
"Groups";
54 base(config, server, configName)
56 string key = string.Empty;
57 if (configName != String.Empty)
58 m_ConfigName = configName;
60 m_log.DebugFormat(
"[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName);
62 IConfig groupsConfig = config.Configs[m_ConfigName];
63 if (groupsConfig != null)
65 key = groupsConfig.GetString(
"SecretKey", string.Empty);
66 m_log.DebugFormat(
"[Groups.RobustConnector]: Starting with secret key {0}",
key);
73 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
81 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
86 base(
"POST",
"/groups", auth)
88 m_GroupsService = service;
94 StreamReader sr =
new StreamReader(requestData);
95 string body = sr.ReadToEnd();
103 Dictionary<string, object> request =
104 ServerUtils.ParseQueryString(body);
106 if (!request.ContainsKey(
"METHOD"))
107 return FailureResult();
109 string method = request[
"METHOD"].ToString();
110 request.Remove(
"METHOD");
116 return HandleAddOrUpdateGroup(request);
118 return HandleGetGroup(request);
119 case "ADDAGENTTOGROUP":
120 return HandleAddAgentToGroup(request);
121 case "REMOVEAGENTFROMGROUP":
122 return HandleRemoveAgentFromGroup(request);
123 case "GETMEMBERSHIP":
124 return HandleGetMembership(request);
125 case "GETGROUPMEMBERS":
126 return HandleGetGroupMembers(request);
128 return HandlePutRole(request);
130 return HandleRemoveRole(request);
131 case "GETGROUPROLES":
132 return HandleGetGroupRoles(request);
133 case "GETROLEMEMBERS":
134 return HandleGetRoleMembers(request);
136 return HandleAgentRole(request);
137 case "GETAGENTROLES":
138 return HandleGetAgentRoles(request);
140 return HandleSetActive(request);
141 case "UPDATEMEMBERSHIP":
142 return HandleUpdateMembership(request);
144 return HandleInvite(request);
146 return HandleAddNotice(request);
148 return HandleGetNotices(request);
150 return HandleFindGroups(request);
152 m_log.DebugFormat(
"[GROUPS HANDLER]: unknown method request: {0}", method);
156 m_log.Error(string.Format(
"[GROUPS HANDLER]: Exception {0} ", e.Message), e);
159 return FailureResult();
162 byte[] HandleAddOrUpdateGroup(Dictionary<string, object> request)
164 Dictionary<string, object> result =
new Dictionary<string, object>();
167 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"OP"))
168 NullResult(result,
"Bad network data");
172 string RequestingAgentID = request[
"RequestingAgentID"].ToString();
173 string reason = string.Empty;
174 string op = request[
"OP"].ToString();
177 grec.GroupID = m_GroupsService.CreateGroup(RequestingAgentID, grec.GroupName, grec.Charter, grec.ShowInList, grec.GroupPicture, grec.MembershipFee,
178 grec.OpenEnrollment, grec.AllowPublish, grec.MaturePublish, grec.FounderID, out reason);
181 else if (op ==
"UPDATE")
183 m_GroupsService.UpdateGroup(RequestingAgentID, grec.GroupID, grec.Charter, grec.ShowInList, grec.GroupPicture, grec.MembershipFee,
184 grec.OpenEnrollment, grec.AllowPublish, grec.MaturePublish);
188 if (grec.GroupID != UUID.Zero)
190 grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID);
192 NullResult(result,
"Internal Error");
194 result[
"RESULT"] = GroupsDataUtils.GroupRecord(grec);
197 NullResult(result, reason);
200 string xmlString = ServerUtils.BuildXmlResponse(result);
203 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
206 byte[] HandleGetGroup(Dictionary<string, object> request)
208 Dictionary<string, object> result =
new Dictionary<string, object>();
210 if (!request.ContainsKey(
"RequestingAgentID"))
211 NullResult(result,
"Bad network data");
214 string RequestingAgentID = request[
"RequestingAgentID"].ToString();
215 ExtendedGroupRecord grec = null;
216 if (request.ContainsKey(
"GroupID"))
218 UUID groupID =
new UUID(request[
"GroupID"].ToString());
219 grec = m_GroupsService.GetGroupRecord(RequestingAgentID, groupID);
221 else if (request.ContainsKey(
"Name"))
223 string name = request[
"Name"].ToString();
224 grec = m_GroupsService.GetGroupRecord(RequestingAgentID, name);
228 NullResult(result,
"Group not found");
230 result[
"RESULT"] = GroupsDataUtils.GroupRecord(grec);
233 string xmlString = ServerUtils.BuildXmlResponse(result);
236 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
239 byte[] HandleAddAgentToGroup(Dictionary<string, object> request)
241 Dictionary<string, object> result =
new Dictionary<string, object>();
243 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"AgentID") ||
244 !request.ContainsKey(
"GroupID") || !request.ContainsKey(
"RoleID"))
245 NullResult(result,
"Bad network data");
248 UUID groupID =
new UUID(request[
"GroupID"].ToString());
249 UUID roleID =
new UUID(request[
"RoleID"].ToString());
250 string agentID = request[
"AgentID"].ToString();
251 string requestingAgentID = request[
"RequestingAgentID"].ToString();
252 string token = string.Empty;
253 string reason = string.Empty;
255 if (request.ContainsKey(
"AccessToken"))
256 token = request[
"AccessToken"].ToString();
258 if (!m_GroupsService.AddAgentToGroup(requestingAgentID, agentID, groupID, roleID, token, out reason))
259 NullResult(result, reason);
262 GroupMembershipData membership = m_GroupsService.GetAgentGroupMembership(requestingAgentID, agentID, groupID);
263 if (membership == null)
264 NullResult(result,
"Internal error");
266 result[
"RESULT"] = GroupsDataUtils.GroupMembershipData((ExtendedGroupMembershipData)membership);
270 string xmlString = ServerUtils.BuildXmlResponse(result);
273 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
276 byte[] HandleRemoveAgentFromGroup(Dictionary<string, object> request)
278 Dictionary<string, object> result =
new Dictionary<string, object>();
280 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"AgentID") || !request.ContainsKey(
"GroupID"))
281 NullResult(result,
"Bad network data");
284 UUID groupID =
new UUID(request[
"GroupID"].ToString());
285 string agentID = request[
"AgentID"].ToString();
286 string requestingAgentID = request[
"RequestingAgentID"].ToString();
288 if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
289 NullResult(result,
string.Format(
"Insufficient permissions.", agentID));
291 result[
"RESULT"] =
"true";
295 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
298 byte[] HandleGetMembership(Dictionary<string, object> request)
300 Dictionary<string, object> result =
new Dictionary<string, object>();
302 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"AgentID"))
303 NullResult(result,
"Bad network data");
306 string agentID = request[
"AgentID"].ToString();
307 UUID groupID = UUID.Zero;
308 if (request.ContainsKey(
"GroupID"))
309 groupID =
new UUID(request[
"GroupID"].ToString());
310 string requestingAgentID = request[
"RequestingAgentID"].ToString();
311 bool all = request.ContainsKey(
"ALL");
315 ExtendedGroupMembershipData membership = null;
316 if (groupID ==
UUID.Zero)
318 membership = m_GroupsService.GetAgentActiveMembership(requestingAgentID, agentID);
322 membership = m_GroupsService.GetAgentGroupMembership(requestingAgentID, agentID, groupID);
325 if (membership == null)
326 NullResult(result,
"No such membership");
328 result[
"RESULT"] = GroupsDataUtils.GroupMembershipData(membership);
332 List<GroupMembershipData> memberships = m_GroupsService.GetAgentGroupMemberships(requestingAgentID, agentID);
333 if (memberships == null || (memberships != null && memberships.Count == 0))
335 NullResult(result,
"No memberships");
339 Dictionary<string, object> dict =
new Dictionary<string, object>();
342 dict[
"m-" + i++] = GroupsDataUtils.GroupMembershipData((ExtendedGroupMembershipData)m);
344 result[
"RESULT"] = dict;
349 string xmlString = ServerUtils.BuildXmlResponse(result);
352 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
355 byte[] HandleGetGroupMembers(Dictionary<string, object> request)
357 Dictionary<string, object> result =
new Dictionary<string, object>();
359 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID"))
360 NullResult(result,
"Bad network data");
363 UUID groupID =
new UUID(request[
"GroupID"].ToString());
364 string requestingAgentID = request[
"RequestingAgentID"].ToString();
366 List<ExtendedGroupMembersData> members = m_GroupsService.GetGroupMembers(requestingAgentID, groupID);
367 if (members == null || (members != null && members.Count == 0))
369 NullResult(result,
"No members");
373 Dictionary<string, object> dict =
new Dictionary<string, object>();
375 foreach (ExtendedGroupMembersData m
in members)
377 dict[
"m-" + i++] = GroupsDataUtils.GroupMembersData(m);
380 result[
"RESULT"] = dict;
384 string xmlString = ServerUtils.BuildXmlResponse(result);
387 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
390 byte[] HandlePutRole(Dictionary<string, object> request)
392 Dictionary<string, object> result =
new Dictionary<string, object>();
394 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID") || !request.ContainsKey(
"RoleID") ||
395 !request.ContainsKey(
"Name") || !request.ContainsKey(
"Description") || !request.ContainsKey(
"Title") ||
396 !request.ContainsKey(
"Powers") || !request.ContainsKey(
"OP"))
397 NullResult(result,
"Bad network data");
401 string op = request[
"OP"].ToString();
402 string reason = string.Empty;
404 bool success =
false;
406 success = m_GroupsService.AddGroupRole(request[
"RequestingAgentID"].ToString(),
new UUID(request[
"GroupID"].ToString()),
407 new UUID(request[
"RoleID"].ToString()), request[
"Name"].ToString(), request[
"Description"].ToString(),
408 request[
"Title"].ToString(), UInt64.Parse(request[
"Powers"].ToString()), out reason);
410 else if (op ==
"UPDATE")
411 success = m_GroupsService.UpdateGroupRole(request[
"RequestingAgentID"].ToString(),
new UUID(request[
"GroupID"].ToString()),
412 new UUID(request[
"RoleID"].ToString()), request[
"Name"].ToString(), request[
"Description"].ToString(),
413 request[
"Title"].ToString(), UInt64.Parse(request[
"Powers"].ToString()));
415 result[
"RESULT"] = success.ToString();
418 string xmlString = ServerUtils.BuildXmlResponse(result);
421 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
424 byte[] HandleRemoveRole(Dictionary<string, object> request)
426 Dictionary<string, object> result =
new Dictionary<string, object>();
428 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID") || !request.ContainsKey(
"RoleID"))
429 NullResult(result,
"Bad network data");
433 m_GroupsService.RemoveGroupRole(request[
"RequestingAgentID"].ToString(),
new UUID(request[
"GroupID"].ToString()),
434 new UUID(request[
"RoleID"].ToString()));
435 result[
"RESULT"] =
"true";
439 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
442 byte[] HandleGetGroupRoles(Dictionary<string, object> request)
444 Dictionary<string, object> result =
new Dictionary<string, object>();
446 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID"))
447 NullResult(result,
"Bad network data");
450 UUID groupID =
new UUID(request[
"GroupID"].ToString());
451 string requestingAgentID = request[
"RequestingAgentID"].ToString();
453 List<GroupRolesData> roles = m_GroupsService.GetGroupRoles(requestingAgentID, groupID);
454 if (roles == null || (roles != null && roles.Count == 0))
456 NullResult(result,
"No members");
460 Dictionary<string, object> dict =
new Dictionary<string, object>();
463 dict[
"r-" + i++] = GroupsDataUtils.GroupRolesData(r);
465 result[
"RESULT"] = dict;
469 string xmlString = ServerUtils.BuildXmlResponse(result);
472 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
475 byte[] HandleGetRoleMembers(Dictionary<string, object> request)
477 Dictionary<string, object> result =
new Dictionary<string, object>();
479 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID"))
480 NullResult(result,
"Bad network data");
483 UUID groupID =
new UUID(request[
"GroupID"].ToString());
484 string requestingAgentID = request[
"RequestingAgentID"].ToString();
486 List<ExtendedGroupRoleMembersData> rmembers = m_GroupsService.GetGroupRoleMembers(requestingAgentID, groupID);
487 if (rmembers == null || (rmembers != null && rmembers.Count == 0))
489 NullResult(result,
"No members");
493 Dictionary<string, object> dict =
new Dictionary<string, object>();
495 foreach (ExtendedGroupRoleMembersData rm
in rmembers)
496 dict[
"rm-" + i++] = GroupsDataUtils.GroupRoleMembersData(rm);
498 result[
"RESULT"] = dict;
502 string xmlString = ServerUtils.BuildXmlResponse(result);
505 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
508 byte[] HandleAgentRole(Dictionary<string, object> request)
510 Dictionary<string, object> result =
new Dictionary<string, object>();
512 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID") || !request.ContainsKey(
"RoleID") ||
513 !request.ContainsKey(
"AgentID") || !request.ContainsKey(
"OP"))
514 NullResult(result,
"Bad network data");
518 string op = request[
"OP"].ToString();
520 bool success =
false;
522 success = m_GroupsService.AddAgentToGroupRole(request[
"RequestingAgentID"].ToString(), request[
"AgentID"].ToString(),
523 new UUID(request[
"GroupID"].ToString()),
new UUID(request[
"RoleID"].ToString()));
525 else if (op ==
"DELETE")
526 success = m_GroupsService.RemoveAgentFromGroupRole(request[
"RequestingAgentID"].ToString(), request[
"AgentID"].ToString(),
527 new UUID(request[
"GroupID"].ToString()),
new UUID(request[
"RoleID"].ToString()));
529 result[
"RESULT"] = success.ToString();
532 string xmlString = ServerUtils.BuildXmlResponse(result);
535 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
538 byte[] HandleGetAgentRoles(Dictionary<string, object> request)
540 Dictionary<string, object> result =
new Dictionary<string, object>();
542 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID") || !request.ContainsKey(
"AgentID"))
543 NullResult(result,
"Bad network data");
546 UUID groupID =
new UUID(request[
"GroupID"].ToString());
547 string agentID = request[
"AgentID"].ToString();
548 string requestingAgentID = request[
"RequestingAgentID"].ToString();
550 List<GroupRolesData> roles = m_GroupsService.GetAgentGroupRoles(requestingAgentID, agentID, groupID);
551 if (roles == null || (roles != null && roles.Count == 0))
553 NullResult(result,
"No members");
557 Dictionary<string, object> dict =
new Dictionary<string, object>();
560 dict[
"r-" + i++] = GroupsDataUtils.GroupRolesData(r);
562 result[
"RESULT"] = dict;
566 string xmlString = ServerUtils.BuildXmlResponse(result);
569 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
572 byte[] HandleSetActive(Dictionary<string, object> request)
574 Dictionary<string, object> result =
new Dictionary<string, object>();
576 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID") ||
577 !request.ContainsKey(
"AgentID") || !request.ContainsKey(
"OP"))
579 NullResult(result,
"Bad network data");
580 string xmlString = ServerUtils.BuildXmlResponse(result);
581 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
585 string op = request[
"OP"].ToString();
589 ExtendedGroupMembershipData group = m_GroupsService.SetAgentActiveGroup(request[
"RequestingAgentID"].ToString(),
590 request[
"AgentID"].ToString(),
new UUID(request[
"GroupID"].ToString()));
593 NullResult(result,
"Internal error");
595 result[
"RESULT"] = GroupsDataUtils.GroupMembershipData(group);
597 string xmlString = ServerUtils.BuildXmlResponse(result);
600 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
603 else if (op ==
"ROLE" && request.ContainsKey(
"RoleID"))
605 m_GroupsService.SetAgentActiveGroupRole(request[
"RequestingAgentID"].ToString(), request[
"AgentID"].ToString(),
606 new UUID(request[
"GroupID"].ToString()),
new UUID(request[
"RoleID"].ToString()));
607 result[
"RESULT"] =
"true";
610 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
615 byte[] HandleUpdateMembership(Dictionary<string, object> request)
617 Dictionary<string, object> result =
new Dictionary<string, object>();
619 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"AgentID") || !request.ContainsKey(
"GroupID") ||
620 !request.ContainsKey(
"AcceptNotices") || !request.ContainsKey(
"ListInProfile"))
621 NullResult(result,
"Bad network data");
625 m_GroupsService.UpdateMembership(request[
"RequestingAgentID"].ToString(), request[
"AgentID"].ToString(),
new UUID(request[
"GroupID"].ToString()),
626 bool.Parse(request[
"AcceptNotices"].ToString()), bool.Parse(request[
"ListInProfile"].ToString()));
628 result[
"RESULT"] =
"true";
632 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
635 byte[] HandleInvite(Dictionary<string, object> request)
637 Dictionary<string, object> result =
new Dictionary<string, object>();
639 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"InviteID"))
641 NullResult(result,
"Bad network data");
642 string xmlString = ServerUtils.BuildXmlResponse(result);
643 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
647 string op = request[
"OP"].ToString();
649 if (op ==
"ADD" && request.ContainsKey(
"GroupID") && request.ContainsKey(
"RoleID") && request.ContainsKey(
"AgentID"))
651 bool success = m_GroupsService.AddAgentToGroupInvite(request[
"RequestingAgentID"].ToString(),
652 new UUID(request[
"InviteID"].ToString()),
new UUID(request[
"GroupID"].ToString()),
653 new UUID(request[
"RoleID"].ToString()), request[
"AgentID"].ToString());
655 result[
"RESULT"] = success.ToString();
656 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
659 else if (op ==
"DELETE")
661 m_GroupsService.RemoveAgentToGroupInvite(request[
"RequestingAgentID"].ToString(),
new UUID(request[
"InviteID"].ToString()));
662 result[
"RESULT"] =
"true";
663 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
665 else if (op ==
"GET")
667 GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request[
"RequestingAgentID"].ToString(),
668 new UUID(request[
"InviteID"].ToString()));
671 result[
"RESULT"] = GroupsDataUtils.GroupInviteInfo(invite);
673 result[
"RESULT"] =
"NULL";
675 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
678 NullResult(result,
"Bad OP in request");
679 return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
684 byte[] HandleAddNotice(Dictionary<string, object> request)
686 Dictionary<string, object> result =
new Dictionary<string, object>();
688 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"GroupID") || !request.ContainsKey(
"NoticeID") ||
689 !request.ContainsKey(
"FromName") || !request.ContainsKey(
"Subject") || !request.ContainsKey(
"Message") ||
690 !request.ContainsKey(
"HasAttachment"))
691 NullResult(result,
"Bad network data");
696 bool hasAtt = bool.Parse(request[
"HasAttachment"].ToString());
698 string attName = string.Empty;
699 string attOwner = string.Empty;
700 UUID attItem = UUID.Zero;
701 if (request.ContainsKey(
"AttachmentType"))
702 attType = byte.Parse(request[
"AttachmentType"].ToString());
703 if (request.ContainsKey(
"AttachmentName"))
704 attName = request[
"AttachmentName"].ToString();
705 if (request.ContainsKey(
"AttachmentItemID"))
706 attItem =
new UUID(request[
"AttachmentItemID"].ToString());
707 if (request.ContainsKey(
"AttachmentOwnerID"))
708 attOwner = request[
"AttachmentOwnerID"].ToString();
710 bool success = m_GroupsService.AddGroupNotice(request[
"RequestingAgentID"].ToString(),
new UUID(request[
"GroupID"].ToString()),
711 new UUID(request[
"NoticeID"].ToString()), request[
"FromName"].ToString(), request[
"Subject"].ToString(),
712 request[
"Message"].ToString(), hasAtt, attType, attName, attItem, attOwner);
714 result[
"RESULT"] = success.ToString();
717 string xmlString = ServerUtils.BuildXmlResponse(result);
720 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
723 byte[] HandleGetNotices(Dictionary<string, object> request)
725 Dictionary<string, object> result =
new Dictionary<string, object>();
727 if (!request.ContainsKey(
"RequestingAgentID"))
728 NullResult(result,
"Bad network data");
730 else if (request.ContainsKey(
"NoticeID"))
732 GroupNoticeInfo notice = m_GroupsService.GetGroupNotice(request[
"RequestingAgentID"].ToString(),
new UUID(request[
"NoticeID"].ToString()));
735 NullResult(result,
"NO such notice");
737 result[
"RESULT"] = GroupsDataUtils.GroupNoticeInfo(notice);
740 else if (request.ContainsKey(
"GroupID"))
742 List<ExtendedGroupNoticeData> notices = m_GroupsService.GetGroupNotices(request[
"RequestingAgentID"].ToString(),
new UUID(request[
"GroupID"].ToString()));
744 if (notices == null || (notices != null && notices.Count == 0))
745 NullResult(result,
"No notices");
748 Dictionary<string, object> dict =
new Dictionary<string, object>();
750 foreach (ExtendedGroupNoticeData n
in notices)
751 dict[
"n-" + i++] = GroupsDataUtils.GroupNoticeData(n);
753 result[
"RESULT"] = dict;
758 NullResult(result,
"Bad OP in request");
760 string xmlString = ServerUtils.BuildXmlResponse(result);
761 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
764 byte[] HandleFindGroups(Dictionary<string, object> request)
766 Dictionary<string, object> result =
new Dictionary<string, object>();
768 if (!request.ContainsKey(
"RequestingAgentID") || !request.ContainsKey(
"Query"))
769 NullResult(result,
"Bad network data");
771 List<DirGroupsReplyData> hits = m_GroupsService.FindGroups(request[
"RequestingAgentID"].ToString(), request[
"Query"].ToString());
773 if (hits == null || (hits != null && hits.Count == 0))
774 NullResult(result,
"No hits");
777 Dictionary<string, object> dict =
new Dictionary<string, object>();
780 dict[
"n-" + i++] = GroupsDataUtils.DirGroupsReplyData(n);
782 result[
"RESULT"] = dict;
786 string xmlString = ServerUtils.BuildXmlResponse(result);
787 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
793 private void NullResult(Dictionary<string, object> result,
string reason)
795 result[
"RESULT"] =
"NULL";
796 result[
"REASON"] = reason;
799 private byte[] FailureResult()
801 Dictionary<string, object> result =
new Dictionary<string, object>();
802 NullResult(result,
"Unknown method");
803 string xmlString = ServerUtils.BuildXmlResponse(result);
804 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
807 private byte[] FailureResult(
string reason)
809 Dictionary<string, object> result =
new Dictionary<string, object>();
810 NullResult(result, reason);
811 string xmlString = ServerUtils.BuildXmlResponse(result);
812 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
GroupsServicePostHandler(GroupsService service, IServiceAuth auth)
Base streamed request handler.
Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) for given URLs.
GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)