예제 #1
0
파일: StorageTmp.cs 프로젝트: xuedong/Tigwi
        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
파일: StorageTmp.cs 프로젝트: xuedong/Tigwi
        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
파일: StorageTmp.cs 프로젝트: xuedong/Tigwi
        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
파일: StorageTmp.cs 프로젝트: xuedong/Tigwi
        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
파일: StorageTmp.cs 프로젝트: xuedong/Tigwi
        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);
        }