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); }
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; }; }
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); } }
void PartChannel(Channel aChan) { if (aChan != null) { _log.Info("PartChannel(" + aChan + ")"); SendData("PART " + aChan.Name); // statistics Statistic.Instance.Increase(StatisticType.ChannelsParted); } }
void IrcParserJoinChannel(Core.Server aServer, Channel aChannel) { if (_server == aServer) { JoinChannel(aChannel); } }
public void AddChannel(Channel aChannel) { Add(aChannel); }
public void RemoveChannel(Channel aChannel) { Remove(aChannel); }
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); } }
protected void FireJoinChannel(Core.Server aServer, Channel aChannel) { if (JoinChannel != null) { JoinChannel(aServer, aChannel); } }