protected internal override bool OnReply(IrcLine line, ref bool final) { if (client.CaseMappingComparer.Equals(line.Message, "NOTICE")) { if (line.Parameters[1].Length >= 2 && line.Parameters[1].StartsWith("\u0001") && line.Parameters[1].EndsWith("\u0001") && client.CaseMappingComparer.Equals(Hostmask.GetNickname(line.Prefix), this.target) && client.CaseMappingComparer.Equals(line.Parameters[0], client.Me.Nickname)) { var fields = line.Parameters[1].Substring(1, line.Parameters[1].Length - 2).Split(new[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries); if (this.request.Equals(fields[0], StringComparison.InvariantCultureIgnoreCase)) { this.taskSource.SetResult(fields.Length >= 2 ? fields[1] : null); final = true; return(true); } } } else if (line.Message[0] == '4') { if (client.CaseMappingComparer.Equals(line.Parameters[1], this.target)) { this.taskSource.SetException(new AsyncRequestErrorException(line)); final = true; return(true); } } return(false); }
protected internal override bool OnReply(IrcLine line, ref bool final) { if (this.user.Client.CaseMappingComparer.Equals(Hostmask.GetNickname(line.Prefix ?? this.user.Client.ServerName), this.user.Nickname) && this.user.Client.CaseMappingComparer.Equals(line.Parameters[0], this.target.Target)) { this.TaskSource.SetResult(line.Parameters[1]); final = true; } return(false); }
protected internal override bool OnReply(IrcLine line, ref bool final) { if (final) { if (!char.IsDigit(line.Message[0]) && this.nickname != null && line.Prefix != null && !this.client.CaseMappingComparer.Equals(this.nickname, Hostmask.GetNickname(line.Prefix))) { // Wrong user. final = false; return(false); } if (line.Message[0] == '4' || (this.errors != null && this.errors.Contains(line.Message))) { this.TaskSource.SetException(new AsyncRequestErrorException(line)); return(true); } this.TaskSource.SetResult(null); } return(false); }
internal IrcUser GetFromMonitor(string mask, bool add) => this.Get(Hostmask.GetNickname(mask), Hostmask.GetIdent(mask), Hostmask.GetHost(mask), null, null, true, add);
internal IrcUser GetFromExtendedJoin(string mask, string account, string fullName, bool add) => this.Get(Hostmask.GetNickname(mask), Hostmask.GetIdent(mask), Hostmask.GetHost(mask), account, fullName, false, add);
internal IrcUser Get(string mask, bool add) => this.Get(Hostmask.GetNickname(mask), Hostmask.GetIdent(mask), Hostmask.GetHost(mask), null, null, false, add);
public IEnumerable <IrcChannelUser> Matching(string hostmask) => this.Users.Values.Where(user => Hostmask.Matches(user.User.ToString(), hostmask));