コード例 #1
0
        public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["NoticeID"]          = noticeID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;

            Dictionary <string, object> ret = MakeRequest("GETNOTICES", sendData);

            if (ret == null)
            {
                return(null);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(null);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(null);
            }

            return(GroupsDataUtils.GroupNoticeInfo((Dictionary <string, object>)ret["RESULT"]));
        }
コード例 #2
0
        byte[] HandleGetNotices(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID"))
            {
                NullResult(result, "Bad network data");
            }

            else if (request.ContainsKey("NoticeID")) // just one
            {
                GroupNoticeInfo notice = m_GroupsService.GetGroupNotice(request["RequestingAgentID"].ToString(), new UUID(request["NoticeID"].ToString()));

                if (notice == null)
                {
                    NullResult(result, "NO such notice");
                }
                else
                {
                    result["RESULT"] = GroupsDataUtils.GroupNoticeInfo(notice);
                }
            }
            else if (request.ContainsKey("GroupID")) // all notices for group
            {
                List <ExtendedGroupNoticeData> notices = m_GroupsService.GetGroupNotices(request["RequestingAgentID"].ToString(), new UUID(request["GroupID"].ToString()));

                if (notices == null || (notices != null && notices.Count == 0))
                {
                    NullResult(result, "No notices");
                }
                else
                {
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    int i = 0;
                    foreach (ExtendedGroupNoticeData n in notices)
                    {
                        dict["n-" + i++] = GroupsDataUtils.GroupNoticeData(n);
                    }

                    result["RESULT"] = dict;
                }
            }
            else
            {
                NullResult(result, "Bad OP in request");
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }