private void FixupConversation(Conversation previousValue) { if (previousValue != null && previousValue.ConversationViews.Contains(this)) { previousValue.ConversationViews.Remove(this); } if (Conversation != null) { if (!Conversation.ConversationViews.Contains(this)) { Conversation.ConversationViews.Add(this); } if (ConversationID != Conversation.ID) { ConversationID = Conversation.ID; } } }
/// <summary> /// Create a new conversation when it is the first message /// </summary> /// <param name="toID"></param> /// <param name="excerpt"></param> /// <returns></returns> private Conversation CreateConversation(Guid toID, string excerpt) { var user = CfPerfCache.GetClimber(toID); if (user == null) { throw new ArgumentNullException("Cannot create conversation as no user exists for " + toID); } if (toID == CfIdentity.UserID) { throw new ArgumentNullException("Cannot start a conversation with yourself!"); } var convo = new Conversation() { ID = Guid.NewGuid(), PartyAID = CfIdentity.UserID, PartyBID = toID, StartedUtc = DateTime.UtcNow, LastActivityUtc = DateTime.UtcNow, LastSenderID = CfIdentity.UserID, LastExcerpt = excerpt }; //-- conversation view allows us to track the "view" from a specific users perspective and (eventually) enforce if one user wishes to block another convo.ConversationViews.Add( new ConversationView( ){ ID = Guid.NewGuid(), ConversationID = convo.ID, PartyID = toID, Status = (byte)ConversationStatus.Unread }); convo.ConversationViews.Add( new ConversationView( ){ ID = Guid.NewGuid(), ConversationID = convo.ID, PartyID = CfIdentity.UserID, Status = (byte)ConversationStatus.Read }); return convoRepo.Create(convo); }
public void UserDeleteMessage(Conversation conversation, Message msg) { throw new NotImplementedException("UserDeleteMessage"); }