public bool RemoveIgnored(Ignored ignored) { Ignored ignored2; bool result; if (this.m_ignoreds.TryRemove(ignored.Account.Id, out ignored2)) { this.m_relationsToRemove.Push(ignored.Relation); FriendHandler.SendIgnoredDeleteResultMessage(this.Owner.Client, true, ignored.Session, ignored.Account.Nickname); result = true; } else { FriendHandler.SendIgnoredDeleteResultMessage(this.Owner.Client, false, ignored.Session, ignored.Account.Nickname); result = false; } return(result); }
public bool AddIgnored(WorldAccount ignoredAccount, bool session = false) { var result = CanAddIgnored(ignoredAccount); if (result != null) { FriendHandler.SendIgnoredAddFailureMessage(Owner.Client, result.Value); return(false); } var relation = new AccountRelation { AccountId = Owner.Client.Account.Id, TargetId = ignoredAccount.Id, Type = AccountRelationType.Ignored }; if (!session) { m_relations.AddOrUpdate(relation.TargetId, relation, (key, value) => { value.Type = AccountRelationType.Ignored; return(value); }); } Ignored ignored; if (ignoredAccount.ConnectedCharacter.HasValue) { var character = World.Instance.GetCharacter(ignoredAccount.ConnectedCharacter.Value); ignored = new Ignored(relation, ignoredAccount, session, character); } else { ignored = new Ignored(relation, ignoredAccount, session); } var success = m_ignoreds.TryAdd(ignoredAccount.Id, ignored); FriendHandler.SendIgnoredAddedMessage(Owner.Client, ignored, session); return(success); }
public bool RemoveIgnored(Ignored ignored) { if (ignored.IsOnline()) { OnIgnoredLogout(ignored.Character); } Ignored dummy; if (m_ignoreds.TryRemove(ignored.Account.Id, out dummy)) { m_relationsToRemove.Push(ignored.Relation); FriendHandler.SendIgnoredDeleteResultMessage(Owner.Client, true, ignored.Session, ignored.Account.Nickname); return(true); } FriendHandler.SendIgnoredDeleteResultMessage(Owner.Client, false, ignored.Session, ignored.Account.Nickname); return(false); }
void OnIgnoredOnline(Ignored ignored) { ignored.Character.LoggedOut += OnIgnoredLogout; }