public override void WriteLine(string message)
        {
            #if FALSE
            if (_session.TcpClient.Connected)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("(0x{0}) ", Thread.CurrentThread.ManagedThreadId.ToString("x"));
                sb.Append(' ', this.IndentLevel * this.IndentSize);

                foreach (String line in message.Split('\n'))
                {

                    NoticeMessage msg = new NoticeMessage("$ServerTraceLog", sb.ToString() + line);
                    msg.Sender = "trace!trace@internal";
                    msg.Receiver = _session.Nick;
                    _session.Send(msg);
                }
            }
            #endif
        }
예제 #2
0
        public override Boolean Execute(FilterArgs args)
        {
            if (String.IsNullOrEmpty(_channelName))
                return false;

            if (!String.IsNullOrEmpty(_matchPattern))
            {
                Boolean rerouteRequired =
                    Regex.IsMatch(args.Content, _matchPattern, RegexOptions.IgnoreCase) &&
                    ((String.IsNullOrEmpty(_userMatchPattern)) ? true : Regex.IsMatch(args.User.ScreenName, _userMatchPattern));

                if (!rerouteRequired)
                    return false;

                IRCMessage msg;
                switch (args.IRCMessageType.ToUpperInvariant())
                {
                    case "NOTICE":
                        msg = new NoticeMessage(_channelName, args.Content);
                        break;
                    case "PRIVMSG":
                    default:
                        msg = new PrivMsgMessage(_channelName, args.Content);
                        break;
                }
                msg.SenderNick = args.User.ScreenName;
                msg.SenderHost = "twitter@" + Server.ServerName;
                args.Session.Send(msg);

                if (!_duplicate)
                    args.Drop = true;

                return true;
            }
            return false;
        }
예제 #3
0
 private void Runner()
 {
     String line;
     try
     {
         while ((line = _streamReader.ReadLine()) != null)
         {
             try
             {
                 OnMessageReceived(IRCMessage.CreateMessage(line));
             }
             catch (IRCInvalidMessageException e)
             {
                 foreach (String l in e.ToString().Split(new Char[] { '\n' })) {
                     NoticeMessage n = new NoticeMessage();
                     n.Content = l;
                     n.Sender = "_Internal";
                     n.IsServerMessage = true;
                     OnMessageReceived(n);
                 }
             }
         }
     }
     catch (IOException) { }
 }