public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search, uint? start, uint? count, uint queryflags) { object remoteValue = DoRemote(requestingAgentID, search, start, count, queryflags); if (remoteValue != null || m_doRemoteOnly) return (List<DirGroupsReplyData>)remoteValue; QueryFilter filter = new QueryFilter(); filter.andLikeFilters["Name"] = "%" + search + "%"; List<string> retVal = data.Query(new[]{ "GroupID", "Name", "ShowInList", "AllowPublish", "MaturePublish" }, "osgroup", filter, null, start, count); List<DirGroupsReplyData> Reply = new List<DirGroupsReplyData>(); for (int i = 0; i < retVal.Count; i += 5) { if (retVal[i + 2] == "0")// (ShowInList param) They don't want to be shown in search.. respect this { continue; } if ((queryflags & (uint)DirectoryManager.DirFindFlags.IncludeMature) != (uint)DirectoryManager.DirFindFlags.IncludeMature) { if (retVal[i + 4] == "1") // (MaturePublish param) Check for pg,mature { continue; } } DirGroupsReplyData dirgroup = new DirGroupsReplyData { groupID = UUID.Parse(retVal[i]), groupName = retVal[i + 1] }; filter = new QueryFilter(); filter.andFilters["GroupID"] = dirgroup.groupID; dirgroup.members = int.Parse(data.Query(new[] { "COUNT(AgentID)" }, "osgroupmembership", filter, null, null, null)[0]); Reply.Add(dirgroup); } return Reply; }
public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search, int StartQuery, uint queryflags) { QueryFilter filter = new QueryFilter(); filter.andLikeFilters["Name"] = "%" + search.MySqlEscape(50) + "%"; List<string> retVal = data.Query(new string[5]{ "GroupID", "Name", "ShowInList", "AllowPublish", "MaturePublish" }, "osgroup", filter, null, (uint)StartQuery, 50); List<DirGroupsReplyData> Reply = new List<DirGroupsReplyData>(); DirGroupsReplyData dirgroup; for (int i = 0; i < retVal.Count; i += 5) { if (retVal[i + 2] == "0")// (ShowInList param) They don't want to be shown in search.. respect this { continue; } if ((queryflags & (uint)DirectoryManager.DirFindFlags.IncludeMature) != (uint)DirectoryManager.DirFindFlags.IncludeMature) { if (retVal[i + 4] == "1") // (MaturePublish param) Check for pg,mature { continue; } } dirgroup = new DirGroupsReplyData(); dirgroup.groupID = UUID.Parse(retVal[i]); dirgroup.groupName = retVal[i + 1]; filter = new QueryFilter(); filter.andFilters["GroupID"] = dirgroup.groupID; dirgroup.members = int.Parse(data.Query(new string[1] { "COUNT(AgentID)" }, "osgroupmembership", filter, null, null, null)[0]); Reply.Add(dirgroup); } return Reply; }
public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search, uint? start, uint? count, uint queryflags) { Hashtable param = new Hashtable(); param["Search"] = search; Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); if (!respData.Contains("error")) { Hashtable results = (Hashtable) respData["results"]; foreach (Hashtable groupFind in results.Values) { DirGroupsReplyData data = new DirGroupsReplyData {groupID = new UUID((string) groupFind["GroupID"])}; ; data.groupName = (string) groupFind["Name"]; data.members = int.Parse((string) groupFind["Members"]); // data.searchOrder = order; findings.Add(data); } } return findings; }
public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search, int queryStart, uint queryflags) { if (m_debugEnabled) MainConsole.Instance.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", MethodBase.GetCurrentMethod().Name); List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); NameValueCollection requestArgs = new NameValueCollection { {"RequestMethod", "GetGenerics"}, {"Type", "Group"}, {"Key", search}, {"Fuzzy", "1"} }; OSDMap response = CachedPostRequest(requestArgs); if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) { OSDArray entryArray = (OSDArray) response["Entries"]; #if (!ISWIN) foreach (OSDMap entryMap in entryArray) { if (entryMap["AllowPublish"].AsBoolean() != false) { if ((queryflags & (uint) DirectoryManager.DirFindFlags.IncludeMature) != (uint) DirectoryManager.DirFindFlags.IncludeMature) if (entryMap["MaturePublish"].AsBoolean()) // Check for pg,mature continue; //Block mature DirGroupsReplyData data = new DirGroupsReplyData { groupID = entryMap["OwnerID"].AsUUID(), groupName = entryMap["Key"].AsString() }; // TODO: is there a better way to do this? Dictionary<UUID, OSDMap> Members; data.members = SimianGetGenericEntries("GroupMember", data.groupID.ToString(), out Members) ? Members.Count : 0; // TODO: sort results? // data.searchOrder = order; findings.Add(data); } } #else foreach (OSDMap entryMap in entryArray.Cast<OSDMap>().Where(entryMap => entryMap["AllowPublish"].AsBoolean() != false)) { if ((queryflags & (uint) DirectoryManager.DirFindFlags.IncludeMature) != (uint) DirectoryManager.DirFindFlags.IncludeMature) if (entryMap["MaturePublish"].AsBoolean()) // Check for pg,mature continue; //Block mature DirGroupsReplyData data = new DirGroupsReplyData { groupID = entryMap["OwnerID"].AsUUID(), groupName = entryMap["Key"].AsString() }; // TODO: is there a better way to do this? Dictionary<UUID, OSDMap> Members; data.members = SimianGetGenericEntries("GroupMember", data.groupID.ToString(), out Members) ? Members.Count : 0; // TODO: sort results? // data.searchOrder = order; findings.Add(data); } #endif } return findings; }