예제 #1
0
 public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
 {
 }
        public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search)
        {
            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();
                    data.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)
        {
            if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]  {0} called", System.Reflection.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"];
                foreach (OSDMap entryMap in entryArray)
                {
                    DirGroupsReplyData data = new DirGroupsReplyData();
                    data.groupID = entryMap["OwnerID"].AsUUID();
                    data.groupName = entryMap["Key"].AsString();

                    // TODO: is there a better way to do this?
                    Dictionary<UUID, OSDMap> Members;
                    if (SimianGetGenericEntries("GroupMember", data.groupID.ToString(), out Members))
                    {
                        data.members = Members.Count;
                    }
                    else
                    {
                        data.members = 0;
                    }
                    
                    // TODO: sort results?
                    // data.searchOrder = order;

                    findings.Add(data);
                }
            }


            return findings;
        }
예제 #4
0
        public static Dictionary<string, object> DirGroupsReplyData(DirGroupsReplyData g)
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();

            dict["GroupID"] = g.groupID;
            dict["Name"] = g.groupName;
            dict["NMembers"] = g.members;
            dict["SearchOrder"] = g.searchOrder;

            return dict;
        }
예제 #5
0
 public void SendDirGroupsReply(OpenMetaverse.UUID queryID, DirGroupsReplyData[] data)
 {
 }
예제 #6
0
        public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
        {
            List<DirGroupsReplyData> groups = new List<DirGroupsReplyData>();

            GroupData[] data = m_Database.RetrieveGroups(search);

            if (data != null && data.Length > 0)
            {
                foreach (GroupData d in data)
                {
                    // Don't list group proxies
                    if (d.Data.ContainsKey("Location") && d.Data["Location"] != string.Empty)
                        continue;

                    DirGroupsReplyData g = new DirGroupsReplyData();
                    g.groupID = d.GroupID;

                    if (d.Data.ContainsKey("Name"))
                        g.groupName = d.Data["Name"];
                    else
                        m_log.DebugFormat("[Groups]: Key Name not found");

                    g.members = m_Database.MemberCount(d.GroupID);

                    groups.Add(g);
                }
            }

            return groups;
        }
예제 #7
0
 public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
 {
     throw new System.NotImplementedException();
 }
        private OpenSim.Framework.DirGroupsReplyData MapGroupReplyDataFromResult(Dictionary<string, string> result)
        {
            OpenSim.Framework.DirGroupsReplyData replyData = new OpenSim.Framework.DirGroupsReplyData();
            replyData.groupID = new UUID(result["GroupID"]);
            replyData.groupName = result["Name"];
            replyData.members = Int32.Parse(result["Members"]);

            return replyData;
        }
        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;
        }