示例#1
0
        internal Guid CreateList(Guid ownerId, string name, string description, bool isPrivate, bool isPersonal)
        {
            Guid id = Guid.NewGuid();

            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(ownerId);
            var listInfo = new FullListInfo
            {
                Id        = id,
                Followers = new HashSet <Guid> {
                    ownerId
                },
                ListInfo = new ListInfo(name, description, isPrivate, isPersonal),
                Members  = new HashSet <Guid> {
                    ownerId
                },
                Messages = new List <IMessage>(),
                OwnerId  = ownerId
            };

            accountInfo.MemberOfLists.Add(id);
            accountInfo.FollowerOfLists.Add(id);
            this.infoFromId.Add(id, listInfo);

            return(id);
        }
示例#2
0
        public Guid Copy(Guid accountId, Guid msgId)
        {
            // TODO: THATS NOT HOW RETWEET MUST WORK. DEFINITELY NOT.
            FullMessageInfo message = this.GetFullInfo(msgId);

            AccountStorageTmp.FullAccountInfo account = this.motherStorage.account.GetFullInfo(accountId);
            return(this.Post(accountId, message.MessageInfo.Content));
        }
示例#3
0
        public void Unfollow(Guid listId, Guid accountId)
        {
            FullListInfo listInfo = this.GetFullInfo(listId);

            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(accountId);

            listInfo.Followers.Remove(accountId);
            accountInfo.FollowerOfLists.Remove(listId);
        }
示例#4
0
        public void Add(Guid listId, Guid accountId)
        {
            FullListInfo listInfo = this.GetFullInfo(listId);

            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(accountId);

            listInfo.Members.Add(accountId);
            accountInfo.MemberOfLists.Add(listId);
        }
示例#5
0
        public Guid Post(Guid accountId, string content)
        {
            Guid id = Guid.NewGuid();

            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(accountId);
            var message = new Message(id, accountId, accountInfo.AccountInfo.Name, string.Empty, DateTime.Now, content)
            {
                Content      = content,
                Date         = DateTime.Now,
                Id           = id,
                PosterAvatar = string.Empty,
                PosterId     = accountId,
                PosterName   = accountInfo.AccountInfo.Name
            };

            foreach (var listId in accountInfo.MemberOfLists)
            {
                List <IMessage> messages = this.motherStorage.list.GetFullInfo(listId).Messages;
                messages.Add(message);
            }

            return(id);
        }