internal IrcMessage(IrcTags tags, IrcPrefix prefix, string command, params string[] parameters) { this.Tags = tags; this.From = prefix; this.Command = command; this.Parameters = parameters; this.Received = DateTime.Now; }
public static bool IsIgnoreMatch(IrcPrefix prefix, IgnoreActions action) { if (prefix == null) { return false; } return (from ignore in _ignores.Values where ignore.IsMatch(prefix.Prefix, action) select true).Any(); }
internal IrcMessage(IrcPrefix prefix, string command, params string[] parameters) { this.From = prefix; this.Command = command; this.Parameters = parameters; }
internal static IrcMessage Parse(string data) { StringBuilder sb = new StringBuilder(); List <string> para = new List <string>(); int size = data.Length > 512 ? 512 : data.Length; Char[] c = data.ToCharArray(0, size); int pos = 0; string prefix = null; string command = null; if (c[0] == ':') { for (pos = 1; pos < c.Length; pos++) { if (c[pos] == ' ') { break; } sb.Append(c[pos]); } prefix = sb.ToString(); sb.Length = 0; pos++; } for (; pos < c.Length; pos++) { if (c[pos] == ' ') { break; } sb.Append(c[pos]); } command = sb.ToString(); sb.Length = 0; pos++; bool trailing = false; while (pos < c.Length) { if (c[pos] == ':') { trailing = true; pos++; } for (; pos < c.Length; pos++) { if (c[pos] == ' ' && !trailing) { break; } sb.Append(c[pos]); } para.Add(sb.ToString()); sb.Length = 0; pos++; } return(new IrcMessage(IrcPrefix.Parse(prefix), command, para.ToArray())); }