public override void FromKVP(Dictionary <string, object> values)
 {
     noticeData   = new GroupNoticeData(values["noticeData"] as Dictionary <string, object>);
     GroupID      = UUID.Parse(values["GroupID"].ToString());
     Message      = values["Message"].ToString();
     BinaryBucket = Utils.HexStringToBytes(values["BinaryBucket"].ToString(), true);
 }
 public override void FromOSD(OSDMap values)
 {
     noticeData = new GroupNoticeData();
     noticeData.FromOSD((OSDMap)values["noticeData"]);
     GroupID      = values["GroupID"];
     Message      = values["Message"];
     BinaryBucket = values["BinaryBucket"];
 }
        private byte[] CreateBitBucketForGroupAttachment(GroupNoticeData groupNoticeData, UUID groupID)
        {
            int i = 20;
            i += groupNoticeData.ItemName.Length;
            byte[] bitbucket = new byte[i];
            groupID.ToBytes(bitbucket, 2);
            byte[] name = Utils.StringToBytes(" " + groupNoticeData.ItemName);
            Array.ConstrainedCopy(name, 0, bitbucket, 18, name.Length);
            //Utils.Int16ToBytes((short)item.AssetType, bitbucket, 0);
            bitbucket[0] = 1; // 0 for no attachment, 1 for attachment
            bitbucket[1] = groupNoticeData.AssetType; // Asset type

            return bitbucket;
        }
 private static GroupNoticeData GroupNoticeQueryResult2GroupNoticeData(List<string> result)
 {
     GroupNoticeData GND = new GroupNoticeData
     {
         GroupID = UUID.Parse(result[0]),
         NoticeID = UUID.Parse(result[6]),
         Timestamp = uint.Parse(result[1]),
         FromName = result[2],
         Subject = result[3],
         HasAttachment = int.Parse(result[5]) == 1
     };
     if (GND.HasAttachment)
     {
         GND.ItemID = UUID.Parse(result[4]);
         GND.AssetType = (byte)int.Parse(result[8]);
         GND.ItemName = result[9];
     }
     return GND;
 }
        public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
        {
            object remoteValue = DoRemote(requestingAgentID, noticeID);
            if (remoteValue != null || m_doRemoteOnly)
                return (GroupNoticeInfo)remoteValue;

            QueryFilter filter = new QueryFilter();
            filter.andFilters["NoticeID"] = noticeID;
            string[] fields = new string[9]{
                "GroupID",
                "Timestamp",
                "FromName",
                "Subject",
                "ItemID",
                "HasAttachment",
                "Message",
                "AssetType",
                "ItemName"
            };
            List<string> notice = data.Query(fields, "osgroupnotice", filter, null, null, null);

            if (notice.Count != fields.Length)
            {
                return null;
            }

            GroupNoticeData GND = new GroupNoticeData
            {
                NoticeID = noticeID,
                Timestamp = uint.Parse(notice[1]),
                FromName = notice[2],
                Subject = notice[3],
                HasAttachment = int.Parse(notice[5]) == 1
            };
            if (GND.HasAttachment)
            {
                GND.ItemID = UUID.Parse(notice[4]);
                GND.AssetType = (byte)int.Parse(notice[7]);
                GND.ItemName = notice[8];
            }

            GroupNoticeInfo info = new GroupNoticeInfo
            {
                BinaryBucket = new byte[0],
                GroupID = UUID.Parse(notice[0]),
                Message = notice[6],
                noticeData = GND
            };

            return (!agentsCanBypassGroupNoticePermsCheck.Contains(requestingAgentID) && !CheckGroupPermissions(requestingAgentID, info.GroupID, (ulong)GroupPowers.ReceiveNotices)) ? null : info;
        }
        public GroupNoticeData GetGroupNoticeData(UUID requestingAgentID, UUID noticeID)
        {
            object remoteValue = DoRemote(requestingAgentID, noticeID);
            if (remoteValue != null || m_doRemoteOnly)
            {
                return (GroupNoticeData)remoteValue;
            }

            QueryFilter filter = new QueryFilter();
            filter.andFilters["NoticeID"] = noticeID;
            string[] fields = new string[9]{
                "GroupID",
                "Timestamp",
                "FromName",
                "Subject",
                "ItemID",
                "HasAttachment",
                "Message",
                "AssetType",
                "ItemName"
            };
            List<string> notice = data.Query(fields, "osgroupnotice", filter, null, null, null);

            if (notice.Count != fields.Length)
            {
                return null;
            }

            GroupNoticeData GND = new GroupNoticeData
            {
                GroupID = UUID.Parse(notice[0]),
                NoticeID = noticeID,
                Timestamp = uint.Parse(notice[1]),
                FromName = notice[2],
                Subject = notice[3],
                HasAttachment = int.Parse(notice[5]) == 1
            };
            if (GND.HasAttachment)
            {
                GND.ItemID = UUID.Parse(notice[4]);
                GND.AssetType = (byte)int.Parse(notice[7]);
                GND.ItemName = notice[8];
            }

            return GND;
        }
        public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
        {
            if (m_debugEnabled)
                MainConsole.Instance.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]  {0} called", MethodBase.GetCurrentMethod().Name);

            List<GroupNoticeData> values = new List<GroupNoticeData>();

            Dictionary<string, OSDMap> Notices;
            if (SimianGetGenericEntries(GroupID, "GroupNotice", out Notices))
            {
                foreach (KeyValuePair<string, OSDMap> Notice in Notices)
                {
                    GroupNoticeData data = new GroupNoticeData
                                               {
                                                   NoticeID = UUID.Parse(Notice.Key),
                                                   Timestamp = Notice.Value["TimeStamp"].AsUInteger(),
                                                   FromName = Notice.Value["FromName"].AsString(),
                                                   Subject = Notice.Value["Subject"].AsString(),
                                                   HasAttachment = Notice.Value["BinaryBucket"].AsBinary().Length > 0
                                               };
                    if (data.HasAttachment)
                    {
                        data.ItemID = Notice.Value["ItemID"].AsUUID();
                        data.AssetType = (byte) Notice.Value["AssetType"].AsInteger();
                        data.ItemName = Notice.Value["ItemName"].AsString();
                    }

                    values.Add(data);
                }
            }

            return values;
        }
 public override void FromOSD(OSDMap values)
 {
     noticeData = new GroupNoticeData();
     noticeData.FromOSD((OSDMap)values["noticeData"]);
     GroupID = values["GroupID"];
     Message = values["Message"];
     BinaryBucket = values["BinaryBucket"];
 }
 public override void FromKVP(Dictionary<string, object> values)
 {
     noticeData = new GroupNoticeData(values["noticeData"] as Dictionary<string, object>);
     GroupID = UUID.Parse(values["GroupID"].ToString());
     Message = values["Message"].ToString();
     BinaryBucket = Utils.HexStringToBytes(values["BinaryBucket"].ToString(), true);
 }