Esempio n. 1
0
        public bool Feed(RawLine line)
        {
            if (!line.Reply.Equals("352"))
                return false;

            WhoReplyEntry s = new WhoReplyEntry(line.Arguments);
            _users.Add(s);
            //Debug.WriteLine("Feeding WhoReply: Channel {0}, {1}!{2}@{3}", s.Channel, s.Nickname, s.Username, s.Hostname);

            return true;
        }
Esempio n. 2
0
 void ParseReply(RawLine reply)
 {
     switch (reply.Reply.ToLower())
     {
         case "ping":
             // Auto-pong
             SendCommand("pong", reply.Arguments[0]);
             break;
         case "privmsg":
             LogLine("<{0} to {1}> {2}", reply.Source.Split('!')[0], reply.Arguments.First(), reply.Arguments.Last());
             ParseMessage(reply.Source, reply.Arguments[0], reply.Arguments[1]);
             break;
         case "notice":
             LogLine("-{0} to {1}- {2}", reply.Source.Split('!')[0], reply.Arguments.First(), reply.Arguments.Last());
             break;
         case "kick":
             {
                 if (reply.Arguments[1].Split(',').Contains(Nickname, StringComparer.OrdinalIgnoreCase))
                     RemoveChannel(reply.Arguments.First());
                 LogLine("{2} kicked from {0} because {1}", reply.Arguments.First(), reply.Arguments.Last(), reply.Arguments[1]);
             }
             break;
         case "invite":
             {
                 LogLine("Invited to {0}", reply.Arguments.Last());
                 SendCommand("join", reply.Arguments.Last());
                 AddChannel(reply.Arguments[1]);
             }
             break;
         case "004":
             {
                 LogLine("Registered to server.");
                 _NickServLogin();
                 SendCommand("join", string.Join(",", from n in XmlConfiguration.SelectNodes("//config/channel").Cast<XmlNode>() select n.Attributes["name"].Value));
             }
             break;
         case "join":
             GetChannel(reply.Arguments.First());
             LogLine("{0} joined {1}", reply.Source, reply.Arguments.First());
             break;
         case "part":
             if (reply.Source.Split('!').First() == Nickname)
                 RemoveChannel(reply.Arguments.First());
             LogLine("{0} left {1}", reply.Source, reply.Arguments.First());
             break;
         default:
             // Ignoring
             break;
     }
 }