Exemplo n.º 1
0
        protected AParser()
        {
            Server = new Core.Server {Name = "test.bitpir.at"};

            Channel = new Channel {Name = "#test"};
            Server.AddChannel(Channel);

            Bot = new Bot {Name = "[XG]TestBot"};
            Channel.AddBot(Bot);
        }
Exemplo n.º 2
0
        public void RegisterParser(Server.Irc.AParser aParser)
        {
            IrcParser = aParser;

            IrcParser.ParsingError += delegate(string aData) { EventParsingError = aData; };

            IrcParser.AddDownload += delegate(Packet aPack, long aChunk, IPAddress aIp, int aPort)
            {
                EventPacket = aPack;
                EventChunk = aChunk;
                EventIp = aIp;
                EventPort = aPort;
            };
            IrcParser.RemoveDownload += delegate(Bot aBot) { EventBot = aBot; };

            IrcParser.SendData += delegate(Core.Server aServer, string aData)
            {
                Assert.AreEqual(Server, aServer);
                EventData = aData;
            };
            IrcParser.JoinChannel += delegate(Core.Server aServer, Channel aChannel)
            {
                Assert.AreEqual(Server, aServer);
                EventChannel = aChannel;
            };
            IrcParser.CreateTimer += delegate(Core.Server aServer, AObject aObject, int aTime, bool aOverride)
            {
                Assert.AreEqual(Server, aServer);
                EventObject = aObject;
                EventTime = aTime;
                EventOverride = aOverride;
            };

            IrcParser.RequestFromBot += delegate(Core.Server aServer, Bot aBot)
            {
                Assert.AreEqual(Server, aServer);
                EventBot = aBot;
            };
            IrcParser.UnRequestFromBot += delegate(Core.Server aServer, Bot aBot)
            {
                Assert.AreEqual(Server, aServer);
                EventBot = aBot;
            };
        }
Exemplo n.º 3
0
        void JoinChannel(Channel aChan)
        {
            // only join if the channel isnt connected
            if (aChan != null && _server.Channel(aChan.Name) != null && !aChan.Connected)
            {
                _log.Info("JoinChannel(" + aChan + ")");
                SendData("JOIN " + aChan.Name);

                // TODO maybe set a time to resend the command if the channel is not connected
                // it happend to me, that some available channels werent joined because no confirm messaes appeared

                // statistics
                Statistic.Instance.Increase(StatisticType.ChannelsJoined);
            }
        }
Exemplo n.º 4
0
        void PartChannel(Channel aChan)
        {
            if (aChan != null)
            {
                _log.Info("PartChannel(" + aChan + ")");
                SendData("PART " + aChan.Name);

                // statistics
                Statistic.Instance.Increase(StatisticType.ChannelsParted);
            }
        }
Exemplo n.º 5
0
 void IrcParserJoinChannel(Core.Server aServer, Channel aChannel)
 {
     if (_server == aServer)
     {
         JoinChannel(aChannel);
     }
 }
Exemplo n.º 6
0
 public void AddChannel(Channel aChannel)
 {
     Add(aChannel);
 }
Exemplo n.º 7
0
 public void RemoveChannel(Channel aChannel)
 {
     Remove(aChannel);
 }
Exemplo n.º 8
0
 public void AddChannel(string aChannel)
 {
     aChannel = aChannel.Trim().ToLower();
     if (!aChannel.StartsWith("#"))
     {
         aChannel = "#" + aChannel;
     }
     if (Channel(aChannel) == null)
     {
         var tChannel = new Channel {Name = aChannel, Enabled = Enabled};
         AddChannel(tChannel);
     }
 }
Exemplo n.º 9
0
 protected void FireJoinChannel(Core.Server aServer, Channel aChannel)
 {
     if (JoinChannel != null)
     {
         JoinChannel(aServer, aChannel);
     }
 }