Aurora.Services.WebAPIHandler.GetNewsSources C# (CSharp) Method

GetNewsSources() private method

private GetNewsSources ( OSDMap map, UUID requestingAgentID ) : OSDMap
map OSDMap
requestingAgentID UUID
return OSDMap
        private OSDMap GetNewsSources(OSDMap map, UUID requestingAgentID)
        {
            OSDMap resp = new OSDMap();
            uint start = map.ContainsKey("Start") ? map["Start"].AsUInteger() : 0;
            uint count = map.ContainsKey("Count") ? map["Count"].AsUInteger() : 10;
            IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            IGroupsServiceConnector groups = Aurora.DataManager.DataManager.RequestPlugin<IGroupsServiceConnector>();

            if (generics == null)
            {
                resp["Failed"] = new OSDString("Could not find IGenericsConnector");
            }
            else if (groups == null)
            {
                resp["Failed"] = new OSDString("Could not find IGroupsServiceConnector");
            }
            else
            {
                OSDMap useValue = new OSDMap();
                useValue["Use"] = OSD.FromBoolean(true);
                List<UUID> GroupIDs = generics.GetOwnersByGeneric("Group", "WebUI_newsSource", useValue);
                resp["Total"] = GroupIDs.Count;
                resp["Start"] = (int)start;
                resp["Count"] = (int)count;

                OSDArray Groups = new OSDArray();
                if (start < GroupIDs.Count)
                {
                    int end = (int)count;
                    if (start + count > GroupIDs.Count)
                    {
                        end = GroupIDs.Count - (int)start;
                    }
                    List<UUID> page = GroupIDs.GetRange((int)start, end);
                    if (page.Count > 0)
                    {
                        List<GroupRecord> reply = groups.GetGroupRecords(requestingAgentID, page);
                        if (reply.Count > 0)
                        {
                            foreach (GroupRecord groupReply in reply)
                            {
                                Groups.Add(GroupRecord2OSDMap(groupReply));
                            }
                        }
                    }
                }
                resp["Groups"] = Groups;
            }

            return resp;
        }