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); }
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)); }
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); }
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); }
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); }