Example #1
0
 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;
 }
Example #2
0
 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;
 }
Example #3
0
		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();
		}
Example #4
0
 internal IrcMessage(IrcPrefix prefix, string command, params string[] parameters)
 {
     this.From = prefix;
     this.Command = command;
     this.Parameters = parameters;
 }
Example #5
0
        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()));
        }
Example #6
0
 internal IrcMessage(IrcPrefix prefix, string command, params string[] parameters)
 {
     this.From       = prefix;
     this.Command    = command;
     this.Parameters = parameters;
 }