public ChannelListLine(IrcLine baseLine) : base(baseLine) { if (baseLine.Numeric != 332) throw new ArgumentOutOfRangeException("baseLine", "CHANNELLIST_RPL 322 expected"); if (Parameters.Length < 3) throw new ArgumentOutOfRangeException("baseLine", "Need a minimum of 3 parameters"); if (!int.TryParse(Parameters[2], out userCount)) throw new ArgumentOutOfRangeException("baseLine", "Invalid user count, integer expected"); if (Parameters.Length > 3) { Regex ModeTopicRegex = new Regex(@"(?:\[\+([^ \]]*)] )?(.*)"); Match m = ModeTopicRegex.Match(Parameters[3]); if (m.Success) { modes = m.Groups[1].Value; topic = m.Groups[2].Value; } else { modes = ""; topic = ""; } } else { modes = ""; topic = ""; } }
public WhoLine(IrcLine baseLine) : base(baseLine) { if(baseLine.Numeric != 352) throw new ArgumentOutOfRangeException("baseLine", "RPL_WHOREPLY 352 expected"); if(Parameters.Length < 8) throw new ArgumentOutOfRangeException("baseLine", "Need a minimum of 8 parameters"); UserValue = new UserInfo(Parameters[5], Parameters[2], Parameters[3], Client); List<Mode> modes = new List<Mode>(); int i = 1; IsAwayValue = Parameters[6][0] == 'G'; IsOperValue = Parameters[6][i] == '*'; if(IsOper) i++; for(; i < Parameters[6].Length; i++) { if(Client.Standard.UserPrefixFlags.ContainsKey(Parameters[6][i])) { modes.Add(new Mode(Client.Standard.UserPrefixFlags[Parameters[6][i]], FlagArt.Set, User.NickName)); } } ModesValue = modes.ToArray(); RealNameValue = Parameters[7]; if(!int.TryParse(RealNameValue.Substring(1, RealNameValue.IndexOf(" ")), out HopCountValue)) throw new ArgumentOutOfRangeException("baseLine", "Invalid hop count, integer expected"); RealNameValue = RealNameValue.Substring(RealNameValue.IndexOf(" ") + 1); }
public PartReceivedEventArgs(IrcLine BaseLine) : base(BaseLine) { user = new UserInfo(BaseLine); channelName = BaseLine.Parameters[0]; if (BaseLine.Parameters.Length > 1) partMessage = BaseLine.Parameters[1]; }
public QuitReceivedEventArgs(IrcLine BaseLine) : base(BaseLine) { user = new UserInfo(BaseLine); if (BaseLine.Parameters.Length > 0) quitMessage = BaseLine.Parameters[0]; else quitMessage = ""; }
public ModeReceivedEventArgs(IrcLine BaseLine) : base(BaseLine) { long currentParam; FlagArt currentArt = FlagArt.Set; List<Mode> modes = new List<Mode>(); List<FlagDefinition> flags = new List<FlagDefinition>(); setter = BaseLine.Prefix; AimValue = BaseLine.Parameters[0]; if (Client.Standard.IsAllowedChannel(AimValue)) { flags.AddRange(Client.Standard.ChannelFlags); flags.AddRange(Client.Standard.UserPrefixFlags.Values); AimArtValue = ModeArt.Channel; } else { flags.AddRange(Client.Standard.UserFlags); AimArtValue = ModeArt.User; } currentParam = 2; foreach (char c in BaseLine.Parameters[1]) { if (c == '+') currentArt = FlagArt.Set; else if (c == '-') currentArt = FlagArt.Unset; else { foreach (FlagDefinition currentFlag in flags) { if (currentFlag.Char == c) { if (currentParam < BaseLine.Parameters.Length && currentFlag.IsParameter(currentArt, BaseLine.Parameters[currentParam])) { modes.Add(new Mode(currentFlag, currentArt, BaseLine.Parameters[currentParam])); currentParam++; } else if (!currentFlag.NeedParameter(currentArt)) { modes.Add(new Mode(currentFlag, currentArt)); } break; } } } } ModesValue = modes.ToArray(); }
public UserInfo(IrcLine BaseLine) { baseLine = BaseLine; Match hostPieces; hostPieces = hostRegex.Match(BaseLine.Prefix); if (hostPieces.Success) { nickName = hostPieces.Groups[1].Value; ident = hostPieces.Groups[2].Value; host = hostPieces.Groups[3].Value; client = BaseLine.Client; } else { // TODO: trow Exception } }
public PrivateMessageReceivedEventArgs(IrcLine baseLine) : base(baseLine) { sender = new UserInfo(baseLine); String line; line = Message; if (line[0] == '\x01' && line[line.Length - 1] == '\x01') { line = line.Substring(1, line.Length - 2); cTCPCommandString = line; int firstSpace = line.IndexOf(' '); if (firstSpace > 0) { cTCPCommandString = line.Substring(0, firstSpace); cTCPParameters = line.Substring(firstSpace + 1); } switch (cTCPCommandString) { case "ACTION": cTCPCommand = CTCPCommands.Action; break; case "VERSION": cTCPCommand = CTCPCommands.Version; break; default: cTCPCommand = CTCPCommands.Unkown; break; } } else { cTCPCommand = CTCPCommands.None; } }
public IrcEventArgs(IrcLine BaseLine) { handled = false; client = BaseLine.Client; baseLine = BaseLine; }
public NumericReceivedEventArgs(IrcLine baseLine) : base(baseLine) { }
public MotdEndEventArgs(IrcLine baseLine, IrcLine[] motdLines) : base(baseLine) { this.motdLines = motdLines; }
public WhoBeginEventArgs(IrcLine baseLine) : base(baseLine) { }
public LinksEndEventArgs(IrcLine baseLine, IrcLine[] linksLines) : base(baseLine) { this.linksLines = linksLines; }
public MotdBeginEventArgs(IrcLine baseLine) : base(baseLine) { }
public NoticeReceivedEventArgs(IrcLine baseLine) : base(baseLine) { }
public WhoEndEventArgs(IrcLine baseLine, IrcLine[] WhoLines) : base(baseLine) { whoLines = WhoLines; }
public UserInfo(UserInfo baseInfo) { baseLine = baseInfo.BaseLine; nickName = baseInfo.NickName; ident = baseInfo.Ident; host = baseInfo.Host; client = baseInfo.Client; }
public ChannelListBeginEventArgs(IrcLine baseLine) : base(baseLine) { }
public ChannelListEndEventArgs(IrcLine baseLine, IrcLine[] channellistLines) : base(baseLine) { channelListLines = channellistLines; }
public BadNickEventArgs(IrcLine baseLine, bool inLogin) : base(baseLine) { isLogin = inLogin; }
public NamesEndEventArgs(IrcLine baseLine, String[] names, String channelName) : base(baseLine) { this.names = names; ChannelNameValue = channelName; }
public IrcLine(IrcLine source) { prefix = source.Prefix; command = source.Command; parameters = source.Parameters; client = source.Client; int.TryParse(Command, out numeric); }
public LinksBeginEventArgs(IrcLine baseLine) : base(baseLine) { }
public InfoEndEventArgs(IrcLine baseLine, IrcLine[] infoLines) : base(baseLine) { this.infoLines = infoLines; }