Наследование: AObjects
Пример #1
0
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         Helper.Magicstring + " ((Bandwidth Usage|Bandbreite) " + Helper.Magicstring + "|)\\s*(Current|Derzeit): (?<speed_cur>[0-9.]*)(?<speed_cur_end>(K|)(i|)B)(\\/s|s)(,|)(.*Record: (?<speed_max>[0-9.]*)(?<speed_max_end>(K|)(i|))B(\\/s|s)|)"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         string speedCurEnd = match.Groups["speed_cur_end"].ToString().ToLower();
         string speedMaxEnd = match.Groups["speed_max_end"].ToString().ToLower();
         string speedCur = match.Groups["speed_cur"].ToString();
         string speedMax = match.Groups["speed_max"].ToString();
         if (Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",")
         {
             speedCur = speedCur.Replace('.', ',');
             speedMax = speedMax.Replace('.', ',');
         }
         double valueDouble;
         if (double.TryParse(speedCur, out valueDouble))
         {
             aBot.InfoSpeedCurrent = speedCurEnd.StartsWith("k", StringComparison.CurrentCulture) ? (Int64) (valueDouble * 1024) : (Int64) valueDouble;
         }
         if (double.TryParse(speedMax, out valueDouble))
         {
             aBot.InfoSpeedMax = speedMaxEnd.StartsWith("k", StringComparison.CurrentCulture) ? (Int64) (valueDouble * 1024) : (Int64) valueDouble;
         }
     }
     return match.Success;
 }
Пример #2
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                "Punish-ignore activated for .* \\(.*\\) (?<time_m>[0-9]*) minutes",
                "Auto-ignore activated for .* lasting (?<time_m>[0-9]*)m(?<time_s>[0-9]*)s\\. Further messages will increase duration\\.",
                "Zur Strafe wirst du .* \\(.*\\) f.r (?<time_m>[0-9]*) Minuten ignoriert(.|)",
                "Auto-ignore activated for .* \\(.*\\)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }

                int valueInt = 0;
                if (int.TryParse(match.Groups["time_m"].ToString(), out valueInt))
                {
                    int time = valueInt * 60 + 1;
                    if (int.TryParse(match.Groups["time_s"].ToString(), out valueInt))
                    {
                        time += valueInt;
                    }
                    FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, time * 1000));
                }

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #3
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " The Owner Has Requested That No New Connections Are Made In The Next (?<time>[0-9]+) Minute(s|)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }

                int valueInt = 0;
                if (int.TryParse(match.Groups["time"].ToString(), out valueInt))
                {
                    FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, (valueInt * 60 + 1) * 1000));
                }

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         Helper.Magicstring + " Die Nummer der Datei ist ung.ltig",
         Helper.Magicstring + " Invalid Pack Number, Try Again"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         Packet tPack = aBot.OldestActivePacket();
         if (tPack != null)
         {
             // remove all packets with ids beeing greater than the current one because they MUST be missing, too
             var tPackets = from packet in aBot.Packets where packet.Id >= tPack.Id select packet;
             foreach (Packet pack in tPackets)
             {
                 pack.Enabled = false;
                 aBot.RemovePacket(pack);
             }
         }
         Log.Error("Parse() invalid packetnumber from " + aBot);
     }
     return match.Success;
 }
Пример #5
0
        protected override bool ParseInternal(Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " All Slots Full, Main queue of size (?<queue_total>[0-9]+) is Full, Try Again Later",
                Helper.Magicstring + " Es laufen bereits genug .bertragungen, abgewiesen, die Warteschlange ist voll, max\\. (?<queue_total>[0-9]+) Dateien, Versuche es sp.ter nochmal"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }

                int valueInt;
                aBot.InfoSlotCurrent = 0;
                aBot.InfoQueueCurrent = 0;
                if (int.TryParse(match.Groups["queue_total"].ToString(), out valueInt))
                {
                    aBot.InfoQueueTotal = valueInt;
                }

                FireQueueRequestFromBot(this, new EventArgs<Bot, int>(aBot, Settings.Default.BotWaitTime));
            }
            return match.Success;
        }
Пример #6
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " You have a DCC pending, Set your client to receive the transfer\\. ((Type .*|Send XDCC CANCEL) to abort the transfer\\. |)\\((?<time>[0-9]+) seconds remaining until timeout\\)",
                Helper.Magicstring + " Du hast eine .bertragung schwebend, Du mu.t den Download jetzt annehmen\\. ((Schreibe .*|Sende XDCC CANCEL) an den Bot um die .bertragung abzubrechen\\. |)\\((?<time>[0-9]+) Sekunden bis zum Abbruch\\)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                int valueInt = 0;
                if (int.TryParse(match.Groups["time"].ToString(), out valueInt))
                {
                    if (valueInt == 30 && aBot.State != Bot.States.Active)
                    {
                        aBot.State = Bot.States.Idle;
                    }
                    FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, (valueInt + 2) * 1000));
                }

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #7
0
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         "Denied, You already have ([0-9]+) item(s|) queued, Try Again Later",
         Helper.Magicstring + " All Slots Full, Denied, You already have that item queued\\.",
         "You are already receiving or are queued for the maximum number of packs .*",
         "Du hast max\\. ([0-9]+) transfer auf einmal, Du bist jetzt in der Warteschlange f.r Datei .*",
         "Es laufen bereits genug .bertragungen, abgewiesen, Du hast diese Datei bereits in der Warteschlange\\."
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         if (aBot.State == Bot.States.Idle)
         {
             aBot.State = Bot.States.Waiting;
         }
         else if (aBot.State == Bot.States.Waiting)
         {
             // if there is no active packets lets remove us from the queue
             if (aBot.OldestActivePacket() == null)
             {
                 FireUnRequestFromBot(this, new EventArgs<Bot>(aBot));
             }
         }
     }
     return match.Success;
 }
Пример #8
0
 Bot createBot(String aName)
 {
     var bot = new Bot { Name = aName };
     for (int a = 1; a <= count; a++)
     {
         bot.AddPacket(createPacket(a));
     }
     bot.Packet(count).Id = fakeId;
     return bot;
 }
Пример #9
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                "(" + Helper.Magicstring + " All Slots Full, |)Added you to the main queue (for pack ([0-9]+) \\(\".*\"\\) |).*in positi(o|0)n (?<queue_cur>[0-9]+)\\. To Remove you(r|)self at a later time .*",
                "Queueing you for pack [0-9]+ \\(.*\\) in slot (?<queue_cur>[0-9]+)/(?<queue_total>[0-9]+)\\. To remove you(r|)self from the queue, type: .*\\. To check your position in the queue, type: .*\\. Estimated time remaining in queue: (?<queue_d>[0-9]+) days, (?<queue_h>[0-9]+) hours, (?<queue_m>[0-9]+) minutes",
                "(" + Helper.Magicstring + " |)Es laufen bereits genug .bertragungen, Du bist jetzt in der Warteschlange f.r Datei [0-9]+ \\(.*\\) in Position (?<queue_cur>[0-9]+)\\. Wenn Du sp.ter Abbrechen willst schreibe .*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Idle)
                {
                    aBot.State = Bot.States.Waiting;
                }

                int valueInt = 0;
                aBot.InfoSlotCurrent = 0;
                if (int.TryParse(match.Groups["queue_cur"].ToString(), out valueInt))
                {
                    aBot.QueuePosition = valueInt;
                    aBot.InfoQueueCurrent = aBot.QueuePosition;
                }

                if (int.TryParse(match.Groups["queue_total"].ToString(), out valueInt))
                {
                    aBot.InfoQueueTotal = valueInt;
                }
                else if (aBot.InfoQueueTotal < aBot.InfoQueueCurrent)
                {
                    aBot.InfoQueueTotal = aBot.InfoQueueCurrent;
                }

                int time = 0;
                if (int.TryParse(match.Groups["queue_m"].ToString(), out valueInt))
                {
                    time += valueInt * 60;
                }
                if (int.TryParse(match.Groups["queue_h"].ToString(), out valueInt))
                {
                    time += valueInt * 60 * 60;
                }
                if (int.TryParse(match.Groups["queue_d"].ToString(), out valueInt))
                {
                    time += valueInt * 60 * 60 * 24;
                }
                aBot.QueueTime = time;

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
        public void UpdateBot(Bot aBot, string aMessage = null)
        {
            if (aMessage != null)
            {
                Log.Info("Parse() message from " + aBot + ": " + aMessage);
                aBot.LastMessage = aMessage;
            }

            // set em to connected if it isnt already
            aBot.Connected = true;
            aBot.Commit();
        }
Пример #11
0
        protected AParser()
        {
            Server = new XG.Model.Domain.Server { Name = "test.bitpir.at" };

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

            Bot = new Bot {Name = "[XG]TestBot"};
            Channel.AddBot(Bot);

            Connection = new XG.Plugin.Irc.IrcConnection();
            Connection.Server = Server;

            //parser.Parse(null, "", CreateIrcEventArgs(Channel.Name, Bot.Name, "", ReceiveType.QueryMessage));
        }
Пример #12
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " ([0-9]*) (pack(s|)|Pa(c|)ket(e|)|Fil[e]+s) " + Helper.Magicstring + "\\s*(?<slot_cur>[0-9]*) (of|von) (?<slot_total>[0-9]*) (slot(s|)|Pl(a|�|.)tz(e|)) (open|opened|free|frei|in use|offen)(, ((Queue|Warteschlange): (?<queue_cur>[0-9]*)(\\/| of )(?<queue_total>[0-9]*),|).*(Record( [a-zA-Z]+|): (?<record>[0-9.]*)(K|)B\\/s|)|)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                int valueInt = 0;
                if (int.TryParse(match.Groups["slot_cur"].ToString(), out valueInt))
                {
                    aBot.InfoSlotCurrent = valueInt;
                }
                if (int.TryParse(match.Groups["slot_total"].ToString(), out valueInt))
                {
                    aBot.InfoSlotTotal = valueInt;
                }
                if (int.TryParse(match.Groups["queue_cur"].ToString(), out valueInt))
                {
                    aBot.InfoQueueCurrent = valueInt;
                }
                if (int.TryParse(match.Groups["queue_total"].ToString(), out valueInt))
                {
                    aBot.InfoQueueTotal = valueInt;
                }

                if (aBot.InfoSlotCurrent > aBot.InfoSlotTotal)
                {
                    aBot.InfoSlotTotal = aBot.InfoSlotCurrent;
                }
                if (aBot.InfoQueueCurrent > aBot.InfoQueueTotal)
                {
                    aBot.InfoQueueTotal = aBot.InfoQueueCurrent;
                }

                // uhm, there is a free slot and we are still waiting?
                if (aBot.InfoSlotCurrent > 0 && aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                    FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, 0));
                }

                UpdateBot(aBot);
                return true;
            }
            return false;
        }
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         Helper.Magicstring + ".* You already have that item queued.*"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         if (aBot.State == Bot.States.Idle)
         {
             aBot.State = Bot.States.Waiting;
         }
     }
     return match.Success;
 }
Пример #14
0
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         Helper.Magicstring + " You can only have ([0-9]+) transfer(s|) at a time,.*"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         if (aBot.State == Bot.States.Idle)
         {
             aBot.State = Bot.States.Waiting;
         }
     }
     return match.Success;
 }
Пример #15
0
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         Helper.Magicstring + " Sending You (Your Queued |)Pack .*",
         Helper.Magicstring + " Sende dir jetzt die Datei .*"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         if (aBot.State == Bot.States.Waiting)
         {
             aBot.State = Bot.States.Idle;
         }
     }
     return match.Success;
 }
Пример #16
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                "Queued ([0-9]+)h([0-9]+)m for .*, in position (?<queue_cur>[0-9]+) of (?<queue_total>[0-9]+). (?<queue_h>[0-9]+)h(?<queue_m>[0-9]+)m or .* remaining\\.",
                "In der Warteschlange seit  ([0-9]+)h([0-9]+)m f.r .*, in Position (?<queue_cur>[0-9]+) von (?<queue_total>[0-9]+). Ungef.hr (?<queue_h>[0-9]+)h(?<queue_m>[0-9]+)m oder .*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Idle)
                {
                    aBot.State = Bot.States.Waiting;
                }

                int valueInt = 0;
                aBot.InfoSlotCurrent = 0;
                if (int.TryParse(match.Groups["queue_cur"].ToString(), out valueInt))
                {
                    aBot.QueuePosition = valueInt;
                }
                if (int.TryParse(match.Groups["queue_total"].ToString(), out valueInt))
                {
                    aBot.InfoQueueTotal = valueInt;
                }
                else if (aBot.InfoQueueTotal < aBot.QueuePosition)
                {
                    aBot.InfoQueueTotal = aBot.QueuePosition;
                }

                int time = 0;
                if (int.TryParse(match.Groups["queue_m"].ToString(), out valueInt))
                {
                    time += valueInt * 60;
                }
                if (int.TryParse(match.Groups["queue_h"].ToString(), out valueInt))
                {
                    time += valueInt * 60 * 60;
                }
                aBot.QueueTime = time;

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #17
0
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         "(You Don't Appear To Be In A Queue|Removed you from the queue for.*)"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         if (aBot.State == Bot.States.Waiting)
         {
             aBot.State = Bot.States.Idle;
         }
         aBot.QueuePosition = 0;
         FireQueueRequestFromBot(this, new EventArgs<Bot, int>(aBot, Settings.Default.CommandWaitTime));
     }
     return match.Success;
 }
Пример #18
0
        protected override bool ParseInternal(Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " Removed From Queue: .*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }

                FireQueueRequestFromBot(this, new EventArgs<Bot, int>(aBot, Settings.Default.CommandWaitTime));
            }
            return match.Success;
        }
Пример #19
0
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         @".*\s+JOIN (?<channel>[^\s]+).*"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         string channel = match.Groups["channel"].ToString();
         if (!channel.StartsWith("#", System.StringComparison.CurrentCulture))
         {
             channel = "#" + channel;
         }
         FireJoinChannel(this, new EventArgs<Server, string>(aBot.Parent.Parent, channel));
     }
     return match.Success;
 }
Пример #20
0
        protected override bool ParseInternal(Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                "The XDCC is down, try again later.*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }

                FireQueueRequestFromBot(this, new EventArgs<Bot, int>(aBot, Settings.Default.BotWaitTime));
            }
            return match.Success;
        }
Пример #21
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + ".* You already have that item queued.*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Idle)
                {
                    aBot.State = Bot.States.Waiting;
                }

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #22
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " You can only have ([0-9]+) transfer(s|) at a time,.*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Idle)
                {
                    aBot.State = Bot.States.Waiting;
                }

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #23
0
 protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         @".*\s+JOIN (?<channel>[^\s]+).*"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         string channel = match.Groups["channel"].ToString();
         if (!channel.StartsWith("#"))
         {
             channel = "#" + channel;
         }
         FireJoinChannel(this, new EventArgs<Model.Domain.Server, string>(aConnection.Server, channel));
         return true;
     }
     return false;
 }
Пример #24
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " Sending You (Your Queued |)Pack .*",
                Helper.Magicstring + " Sende dir jetzt die Datei .*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
        protected override bool ParseInternal(Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " You already requested that pack(.*|)",
                Helper.Magicstring + ".* You already have that item queued.*",
                Helper.Magicstring + " Du hast diese Datei bereits angefordert(.*|)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Idle)
                {
                    aBot.State = Bot.States.Waiting;
                }

                FireQueueRequestFromBot(this, new EventArgs<Bot, int>(aBot, Settings.Default.BotWaitTime));
            }
            return match.Success;
        }
Пример #26
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " Removed From Queue: .*"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }
                FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, Settings.Default.CommandWaitTime));

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #27
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " (Closing Connection|Transfer Completed)(?<reason>.*)",
                Helper.Magicstring + " (Schlie.e Verbindung)(?<reason>.*)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State != Bot.States.Active)
                {
                    aBot.State = Bot.States.Idle;
                }
                else
                {
                    // kill that connection if the bot sends a close message , but our real bot
                    // connection is still alive and hangs for some crapy reason - maybe because
                    // some admins do some network fu to stop my downloads (happend to me)
                    FireRemoveDownload(this, new EventArgs<Model.Domain.Server, Bot>(aConnection.Server, aBot));
                }
                FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, Settings.Default.CommandWaitTime));

                match = Helper.Match(aMessage, @".*\s+JOIN (?<channel>[^\s]+).*");
                if (match.Success)
                {
                    string channel = match.Groups["channel"].ToString();
                    if (!channel.StartsWith("#"))
                    {
                        channel = "#" + channel;
                    }
                    FireJoinChannel(this, new EventArgs<Model.Domain.Server, string>(aConnection.Server, channel));
                }

                //** Closing Connection: Transfers from [mg]-request|bots are restricted to only MOVIEGODS users! /Part #Beast-xdcc + #elitewarez if you want to download from [MG]-Request|Bot|003

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #28
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                Helper.Magicstring + " XDCC SEND denied, (?<info>.*)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                string info = match.Groups["info"].ToString().ToLower();
                if (info.StartsWith("you must be on a known channel to request a pack"))
                {
                    FireJoinChannelsFromBot(this, new EventArgs<Model.Domain.Server, Bot>(aConnection.Server, aBot));
                    FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, Settings.Default.CommandWaitTime));
                }
                else if (info.StartsWith("i don't send transfers to"))
                {
                    foreach (Packet tPacket in aBot.Packets)
                    {
                        if (tPacket.Enabled)
                        {
                            tPacket.Enabled = false;
                            tPacket.Commit();
                        }
                    }
                }
                else
                {
                    if (aBot.State == Bot.States.Waiting)
                    {
                        aBot.State = Bot.States.Idle;
                    }
                    FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, Settings.Default.CommandWaitTime));
                    Log.Error("Parse() XDCC denied from " + aBot + ": " + info);
                }

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #29
0
        protected override bool ParseInternal(IrcConnection aConnection, Bot aBot, string aMessage)
        {
            string[] regexes =
            {
                "(You Don't Appear To Be In A Queue|Removed you from the queue for.*)"
            };
            var match = Helper.Match(aMessage, regexes);
            if (match.Success)
            {
                if (aBot.State == Bot.States.Waiting)
                {
                    aBot.State = Bot.States.Idle;
                }
                aBot.QueuePosition = 0;
                FireQueueRequestFromBot(this, new EventArgs<Model.Domain.Server, Bot, int>(aConnection.Server, aBot, Settings.Default.CommandWaitTime));

                UpdateBot(aBot, aMessage);
                return true;
            }
            return false;
        }
Пример #30
0
 protected override bool ParseInternal(Bot aBot, string aMessage)
 {
     string[] regexes =
     {
         Helper.Magicstring + " XDCC SEND denied, (?<info>.*)"
     };
     var match = Helper.Match(aMessage, regexes);
     if (match.Success)
     {
         string info = match.Groups["info"].ToString().ToLower();
         // ** XDCC SEND denied, you must have voice on a known channel to request a pack
         if (info.StartsWith("you must be on a known channel to request a pack", System.StringComparison.CurrentCulture))
         {
             FireJoinChannelsFromBot(this, new EventArgs<Bot>(aBot));
             FireQueueRequestFromBot(this, new EventArgs<Bot, int>(aBot, Settings.Default.CommandWaitTime));
         }
         else if (info.StartsWith("i don't send transfers to", System.StringComparison.CurrentCulture))
         {
             foreach (Packet tPacket in aBot.Packets)
             {
                 if (tPacket.Enabled)
                 {
                     tPacket.Enabled = false;
                     tPacket.Commit();
                 }
             }
         }
         else
         {
             if (aBot.State == Bot.States.Waiting)
             {
                 aBot.State = Bot.States.Idle;
             }
             FireQueueRequestFromBot(this, new EventArgs<Bot, int>(aBot, Settings.Default.CommandWaitTime));
             Log.Error("Parse() XDCC denied from " + aBot + ": " + info);
         }
     }
     return match.Success;
 }