public GroupNoticeInfo(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 GroupNoticeData ToGroupNoticeData()
        {
            GroupNoticeData n = new GroupNoticeData();
            n.FromName = this.FromName;
            n.AssetType = this.AttachmentType;
            n.HasAttachment = this.HasAttachment;
            n.NoticeID = this.NoticeID;
            n.Subject = this.Subject;
            n.Timestamp = this.Timestamp;

            return n;
        }
        public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
        {
            Hashtable param = new Hashtable();
            param["GroupID"] = GroupID.ToString();

            Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param);

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

            if (!respData.Contains("error"))
            {
                foreach (Hashtable value in respData.Values)
                {
                    GroupNoticeData data = new GroupNoticeData();
                    data.NoticeID = UUID.Parse((string)value["NoticeID"]);
                    data.Timestamp = uint.Parse((string)value["Timestamp"]);
                    data.FromName = (string)value["FromName"];
                    data.Subject = (string)value["Subject"];
                    data.HasAttachment = false;
                    data.AssetType = 0;

                    values.Add(data);
                }
            }

            return values;
        }
 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] = (byte)groupNoticeData.AssetType; // Asset type
     
     return bitbucket;
 }
        public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
        {
            if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]  {0} called", System.Reflection.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();
                    data.NoticeID = UUID.Parse(Notice.Key);
                    data.Timestamp = Notice.Value["TimeStamp"].AsUInteger();
                    data.FromName = Notice.Value["FromName"].AsString();
                    data.Subject = Notice.Value["Subject"].AsString();
                    data.HasAttachment = Notice.Value["BinaryBucket"].AsBinary().Length > 0;

                    //TODO: Figure out how to get this
                    data.AssetType = 0;

                    values.Add(data);
                }
            }

            return values;

        }
 public GroupNoticeInfo(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);
 }
 // This fetches a summary of a single notice for the notice list (no message body).
 private GroupNoticeData MapGroupNoticeDataFromResult(Dictionary<string, string> result)
 {
     GroupNoticeData data = new GroupNoticeData();
     byte[] bucket = Utils.HexStringToBytes(result["BinaryBucket"], true); 
     int bucketLen = bucket.GetLength(0);
     data.NoticeID = UUID.Parse(result["NoticeID"]);
     data.Timestamp = uint.Parse(result["Timestamp"]);
     data.FromName = result["FromName"];
     data.Subject = result["Subject"];
     if ((bucketLen < 35) || (bucket[0]==0)) {
         // no attachment data
         data.HasAttachment = false;
         data.AssetType = 0;
         data.OwnerID = UUID.Zero;
         data.ItemID = UUID.Zero;
         data.Attachment = "";
     } else {
         data.HasAttachment = true;
         data.AssetType = bucket[1];
         data.OwnerID = new UUID(bucket,2);
         data.ItemID = new UUID(bucket,18);
         data.Attachment = OpenMetaverse.Utils.BytesToString(bucket, 34, bucketLen - 34);
     }
     return data;
 }
        public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID)
        {
            XGroup group = GetXGroup(groupID, null);

            if (group == null)
                return null;

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

            foreach (XGroupNotice notice in group.notices.Values)
            {
                GroupNoticeData gnd = new GroupNoticeData()
                {
                    NoticeID = notice.noticeID,
                    Timestamp = notice.timestamp,
                    FromName = notice.fromName,
                    Subject = notice.subject,
                    HasAttachment = notice.hasAttachment,
                    AssetType = (byte)notice.assetType
                };

                notices.Add(gnd);
            }

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