byte[] HandleFindGroups(Dictionary <string, object> request) { Dictionary <string, object> result = new Dictionary <string, object>(); if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("Query")) { NullResult(result, "Bad network data"); } List <DirGroupsReplyData> hits = m_GroupsService.FindGroups(request["RequestingAgentID"].ToString(), request["Query"].ToString()); if (hits == null || (hits != null && hits.Count == 0)) { NullResult(result, "No hits"); } else { Dictionary <string, object> dict = new Dictionary <string, object>(); int i = 0; foreach (DirGroupsReplyData n in hits) { dict["n-" + i++] = GroupsDataUtils.DirGroupsReplyData(n); } result["RESULT"] = dict; } string xmlString = ServerUtils.BuildXmlResponse(result); return(Util.UTF8NoBomEncoding.GetBytes(xmlString)); }
public List <DirGroupsReplyData> FindGroups(string RequestingAgentID, string query) { List <DirGroupsReplyData> hits = new List <DirGroupsReplyData>(); if (string.IsNullOrEmpty(query)) { return(hits); } Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["Query"] = query; sendData["RequestingAgentID"] = RequestingAgentID; Dictionary <string, object> ret = MakeRequest("FINDGROUPS", sendData); if (ret == null) { return(hits); } if (!ret.ContainsKey("RESULT")) { return(hits); } if (ret["RESULT"].ToString() == "NULL") { return(hits); } foreach (object v in ((Dictionary <string, object>)ret["RESULT"]).Values) { DirGroupsReplyData m = GroupsDataUtils.DirGroupsReplyData((Dictionary <string, object>)v); hits.Add(m); } return(hits); }