public static Dictionary <string, object> GroupNoticeInfo(GroupNoticeInfo notice)
        {
            Dictionary <string, object> dict = GroupNoticeData(notice.noticeData);

            dict["GroupID"] = notice.GroupID.ToString();
            dict["Message"] = Sanitize(notice.Message);

            return(dict);
        }
        GroupNoticeInfo _NoticeDataToInfo(NoticeData data)
        {
            GroupNoticeInfo notice = new GroupNoticeInfo();

            notice.GroupID    = data.GroupID;
            notice.Message    = data.Data["Message"];
            notice.noticeData = _NoticeDataToData(data);

            return(notice);
        }
        public static GroupNoticeInfo GroupNoticeInfo(Dictionary <string, object> dict)
        {
            GroupNoticeInfo notice = new GroupNoticeInfo();

            notice.noticeData = GroupNoticeData(dict);
            notice.GroupID    = new UUID(dict["GroupID"].ToString());
            notice.Message    = Sanitize(dict["Message"].ToString());

            return(notice);
        }
Exemple #4
0
        public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
        {
            GroupNoticeInfo notice = m_LocalGroupsConnector.GetGroupNotice(AgentUUI(RequestingAgentID), noticeID);

            if (notice != null && notice.noticeData.HasAttachment && notice.noticeData.AttachmentOwnerID != null)
            {
                ImportForeigner(notice.noticeData.AttachmentOwnerID);
            }

            return(notice);
        }
        public bool AddGroupNotice(UUID groupID, UUID noticeID, GroupNoticeInfo notice, BooleanDelegate d)
        {
            if (d())
            {
                m_Cache.AddOrUpdate("notice-" + noticeID.ToString(), notice, GROUPS_CACHE_TIMEOUT);
                string cacheKey = "notices-" + groupID.ToString();
                m_Cache.Remove(cacheKey);

                return(true);
            }

            return(false);
        }
        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));
        }
Exemple #7
0
        public GroupNoticeInfo GetGroupNotice(UUID noticeID, NoticeDelegate d)
        {
            object notice    = null;
            bool   firstCall = false;
            string cacheKey  = "notice-" + noticeID.ToString();

            //m_log.DebugFormat("[XXX]: GetAgentGroupRoles {0}", cacheKey);

            while (true)
            {
                lock (m_Cache)
                {
                    if (m_Cache.TryGetValue(cacheKey, out notice))
                    {
                        return((GroupNoticeInfo)notice);
                    }

                    // not cached
                    if (!m_ActiveRequests.ContainsKey(cacheKey))
                    {
                        m_ActiveRequests.Add(cacheKey, true);
                        firstCall = true;
                    }
                }

                if (firstCall)
                {
                    try
                    {
                        GroupNoticeInfo _notice = d();

                        lock (m_Cache)
                        {
                            m_Cache.AddOrUpdate(cacheKey, _notice, GROUPS_CACHE_TIMEOUT);
                            return(_notice);
                        }
                    }
                    finally
                    {
                        lock (m_Cache)
                        {
                            m_ActiveRequests.Remove(cacheKey);
                        }
                    }
                }
                else
                {
                    Thread.Sleep(50);
                }
            }
        }
        public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
        {
            GroupNoticeInfo notice = m_GroupsService.GetGroupNotice(RequestingAgentID, noticeID);

            //if (notice != null && notice.noticeData.HasAttachment && notice.noticeData.AttachmentOwnerID != null)
            //{
            //    UUID userID = UUID.Zero;
            //    string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
            //    Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out userID, out url, out first, out last, out tmp);
            //    if (url != string.Empty)
            //        m_UserManagement.AddUser(userID, first, last, url);
            //}

            return(notice);
        }
        public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            GroupNoticeInfo notice = m_LocalGroupsConnector.GetGroupNotice(AgentUUI(RequestingAgentID), noticeID);

            if (notice != null && notice.noticeData.HasAttachment && notice.noticeData.AttachmentOwnerID != null)
            {
                ImportForeigner(notice.noticeData.AttachmentOwnerID);
            }

            return(notice);
        }
Exemple #10
0
        public bool VerifyNotice(UUID noticeID, UUID groupID)
        {
            GroupNoticeInfo notice = GetGroupNotice(string.Empty, noticeID);

            if (notice == null)
            {
                return(false);
            }

            if (notice.GroupID != groupID)
            {
                return(false);
            }

            return(true);
        }
        public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, 
            bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
        {
            GroupNoticeInfo notice = new GroupNoticeInfo();
            notice.GroupID = groupID;
            notice.Message = message;
            notice.noticeData = new ExtendedGroupNoticeData();
            notice.noticeData.AttachmentItemID = attItemID;
            notice.noticeData.AttachmentName = attName;
            notice.noticeData.AttachmentOwnerID = attOwnerID.ToString();
            notice.noticeData.AttachmentType = attType;
            notice.noticeData.FromName = fromName;
            notice.noticeData.HasAttachment = hasAttachment;
            notice.noticeData.NoticeID = noticeID;
            notice.noticeData.Subject = subject;
            notice.noticeData.Timestamp = (uint)Util.UnixTimeSinceEpoch();

            return m_CacheWrapper.AddGroupNotice(groupID, noticeID, notice, delegate
            {
                return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message,
                            hasAttachment, attType, attName, attItemID, attOwnerID);
            });
        }