public override bool Save() { bool result = store.Save(this); ChatUserProfile profile = ProfileCache.Instance.GetUserProfile(this.ID); //if (profile == null) return result; profile.Email = this.Email; profile.PassHashed = this.Password; profile.FirstName = this.FirstName; profile.LastName = this.LastName; profile.DoB = this.DateOfBirth; profile.Gender = this.Gender; profile.Banned = this.Banned; profile.LastLogoff = this.LastLogoff; return(result); }
public void Handle(ISession session) { ChatSession chatSession = session as ChatSession; if (Accepted) { string command = "sample mkfriend " + chatSession.Owner.Email + " " + new ChatUserStore().Load(TargetID).Email; Command.CommandManager.Instance.ExecuteCommand(ConsoleSender.Instance, command); AcceptedFriendResponse packet = new AcceptedFriendResponse(); packet.UserID = chatSession.Owner.ID.ToString(); packet.Name = chatSession.Owner.FirstName + " " + chatSession.Owner.LastName; ChatUser user; if (ChatUserManager.OnlineUsers.TryGetValue(TargetID, out user)) { user.Send(packet); chatSession.Send(new FinalizeAcceptedFriendRequest()); } // string encNoti = "acfriend:" + chatSession.Owner.ID + ":" + // chatSession.Owner.FirstName + " " + chatSession.Owner.LastName; string name = chatSession.Owner.FirstName + " " + chatSession.Owner.LastName; string encNoti = NotificationEncoder.Assemble( NotificationPrefixes.AcceptedFriend, chatSession.Owner.ID.ToString(), name, name, "accepted your friend request.", false); user = new ChatUserStore().Load(TargetID); user.Notifications.Add(encNoti); user.Save(); chatSession.Owner.Notifications.RemoveAt(NotiPosition); chatSession.Owner.Save(); } }