Esempio n. 1
0
        public void HandleGit(IRCMessage sIRCMessage)
        {
            if (!IsAdmin(sIRCMessage.Nick, sIRCMessage.Host, AdminFlag.Operator))
            {
                return;
            }

            var sSendMessage = sIrcBase.Networks[sIRCMessage.ServerName].sSendMessage;

            if (sIRCMessage.Info.Length < 5)
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoValue", sIRCMessage.Channel, sIRCMessage.ServerName));
                return;
            }

            if (sIRCMessage.Info[4].ToLower() == "info")
            {
                var db = SchumixBase.DManager.Query("SELECT Name, Type, Channel FROM gitinfo WHERE ServerName = '{0}'", sIRCMessage.ServerName);
                if (!db.IsNull())
                {
                    foreach (DataRow row in db.Rows)
                    {
                        string   name    = row["Name"].ToString();
                        string   type    = row["Type"].ToString();
                        string[] channel = row["Channel"].ToString().Split(SchumixBase.Comma);
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("git/info", sIRCMessage.Channel, sIRCMessage.ServerName), name, type, channel.SplitToString(SchumixBase.Space));
                    }
                }
                else
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FaultyQuery", sIRCMessage.Channel, sIRCMessage.ServerName));
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "list")
            {
                var db = SchumixBase.DManager.Query("SELECT Name, Type FROM gitinfo WHERE ServerName = '{0}'", sIRCMessage.ServerName);
                if (!db.IsNull())
                {
                    string list = string.Empty;

                    foreach (DataRow row in db.Rows)
                    {
                        list += string.Format(", 3{0}15/7{1}", row["Name"].ToString(), row["Type"].ToString());
                    }

                    if (list.IsNullOrEmpty())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("git/list", sIRCMessage.Channel, sIRCMessage.ServerName), SchumixBase.Space + sLConsole.Other("Nothing"));
                    }
                    else
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("git/list", sIRCMessage.Channel, sIRCMessage.ServerName), list.Remove(0, 1, SchumixBase.Comma));
                    }
                }
                else
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FaultyQuery", sIRCMessage.Channel, sIRCMessage.ServerName));
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "start")
            {
                var text = sLManager.GetCommandTexts("git/start", sIRCMessage.Channel, sIRCMessage.ServerName);
                if (text.Length < 3)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                    return;
                }

                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info.Length < 7)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                foreach (var list in RssList)
                {
                    if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower() && sIRCMessage.Info[6].ToLower() == list.Type.ToLower())
                    {
                        if (list.Started)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name, list.Type);
                            return;
                        }

                        list.Start();
                        sSendMessage.SendChatMessage(sIRCMessage, text[1], list.Name, list.Type);
                        return;
                    }
                }

                sSendMessage.SendChatMessage(sIRCMessage, text[2], sIRCMessage.Info[5], sIRCMessage.Info[6]);
            }
            else if (sIRCMessage.Info[4].ToLower() == "stop")
            {
                var text = sLManager.GetCommandTexts("git/stop", sIRCMessage.Channel, sIRCMessage.ServerName);
                if (text.Length < 3)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                    return;
                }

                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info.Length < 7)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                foreach (var list in RssList)
                {
                    if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower() && sIRCMessage.Info[6].ToLower() == list.Type.ToLower())
                    {
                        if (!list.Started)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name, list.Type);
                            return;
                        }

                        list.Stop();
                        sSendMessage.SendChatMessage(sIRCMessage, text[1], list.Name, list.Type);
                        return;
                    }
                }

                sSendMessage.SendChatMessage(sIRCMessage, text[2], sIRCMessage.Info[5], sIRCMessage.Info[6]);
            }
            else if (sIRCMessage.Info[4].ToLower() == "reload")
            {
                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("No1Value", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info[5].ToLower() == "all")
                {
                    foreach (var list in RssList)
                    {
                        list.Reload();
                    }

                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("git/reload/all", sIRCMessage.Channel, sIRCMessage.ServerName));
                }
                else
                {
                    var text = sLManager.GetCommandTexts("git/reload", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 6)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    foreach (var list in RssList)
                    {
                        if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower() && sIRCMessage.Info[6].ToLower() == list.Type.ToLower())
                        {
                            list.Reload();
                            sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name, list.Type);
                            return;
                        }
                    }

                    sSendMessage.SendChatMessage(sIRCMessage, text[1], sIRCMessage.Info[5], sIRCMessage.Info[6]);
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "channel")
            {
                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoCommand", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info[5].ToLower() == "add")
                {
                    var text = sLManager.GetCommandTexts("git/channel/add", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 3)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 8)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 9)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoChannelName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[8]))
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    var db = SchumixBase.DManager.QueryFirstRow("SELECT Channel FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName);
                    if (!db.IsNull())
                    {
                        string[] channel = db["Channel"].ToString().Split(SchumixBase.Comma);
                        string   data    = channel.SplitToString(SchumixBase.Comma);

                        if (channel.ToList().Contains(sIRCMessage.Info[8].ToLower()))
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[2]);
                            return;
                        }

                        if (channel.Length == 1 && data.IsNullOrEmpty())
                        {
                            data += sIRCMessage.Info[8].ToLower();
                        }
                        else
                        {
                            data += SchumixBase.Comma + sIRCMessage.Info[8].ToLower();
                        }

                        SchumixBase.DManager.Update("gitinfo", string.Format("Channel = '{0}'", data), string.Format("LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName));
                        sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                    }
                    else
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                    }
                }
                else if (sIRCMessage.Info[5].ToLower() == "remove")
                {
                    var text = sLManager.GetCommandTexts("git/channel/remove", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 3)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 8)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 9)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoChannelName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[8]))
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    var db = SchumixBase.DManager.QueryFirstRow("SELECT Channel FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName);
                    if (!db.IsNull())
                    {
                        string[] channel = db["Channel"].ToString().Split(SchumixBase.Comma);
                        string   data    = string.Empty;

                        if (!channel.ToList().Contains(sIRCMessage.Info[8].ToLower()))
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[2]);
                            return;
                        }

                        for (int x = 0; x < channel.Length; x++)
                        {
                            if (channel[x] == sIRCMessage.Info[8].ToLower())
                            {
                                continue;
                            }

                            data += SchumixBase.Comma + channel[x];
                        }

                        SchumixBase.DManager.Update("gitinfo", string.Format("Channel = '{0}'", data.Remove(0, 1, SchumixBase.Comma)), string.Format("LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName));
                        sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                    }
                    else
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                    }
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "add")
            {
                var text = sLManager.GetCommandTexts("git/add", sIRCMessage.Channel, sIRCMessage.ServerName);
                if (text.Length < 2)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                    return;
                }

                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info.Length < 7)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info.Length < 8)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("UrlMissing", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info.Length < 9)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WebsiteNameMissing", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[6]), sIRCMessage.ServerName);
                if (db.IsNull())
                {
                    bool started = false;

                    foreach (var list in RssList)
                    {
                        if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower() && sIRCMessage.Info[6].ToLower() == list.Type.ToLower())
                        {
                            if (list.Started)
                            {
                                started = true;
                                continue;
                            }

                            list.Start();
                            started = true;
                        }
                    }

                    if (!started)
                    {
                        var rss = new GitRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[5]), sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7]), sUtilities.SqlEscape(sIRCMessage.Info[8].ToLower()));
                        RssList.Add(rss);
                        rss.Start();
                    }

                    SchumixBase.DManager.Insert("`gitinfo`(ServerId, ServerName, Name, Type, Link, Website)", sIRCMessage.ServerId, sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[5]), sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7]), sUtilities.SqlEscape(sIRCMessage.Info[8].ToLower()));
                    sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                }
                else
                {
                    sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "remove")
            {
                var text = sLManager.GetCommandTexts("git/remove", sIRCMessage.Channel, sIRCMessage.ServerName);
                if (text.Length < 2)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                    return;
                }

                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info.Length < 7)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[6]), sIRCMessage.ServerName);
                if (!db.IsNull())
                {
                    GitRss gitr   = null;
                    bool   isstop = false;

                    foreach (var list in RssList)
                    {
                        if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower() && sIRCMessage.Info[6].ToLower() == list.Type.ToLower())
                        {
                            if (!list.Started)
                            {
                                isstop = true;
                                continue;
                            }

                            list.Stop();
                            gitr   = list;
                            isstop = true;
                        }
                    }

                    if (isstop && !gitr.IsNull())
                    {
                        RssList.Remove(gitr);
                    }

                    SchumixBase.DManager.Delete("gitinfo", string.Format("Name = '{0}' And Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[5]), sUtilities.SqlEscape(sIRCMessage.Info[6]), sIRCMessage.ServerName));
                    sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                }
                else
                {
                    sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "change")
            {
                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoCommand", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info[5].ToLower() == "colors")
                {
                    var text = sLManager.GetCommandTexts("git/change/colors", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 8)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 9)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("StatusIsMissing", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (!sIRCMessage.Info[8].IsBoolean())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ValueIsNotTrueOrFalse", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    var db = SchumixBase.DManager.QueryFirstRow("SELECT Colors FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName);
                    if (!db.IsNull())
                    {
                        bool enabled = db["Colors"].ToBoolean();

                        if (sIRCMessage.Info[8].ToBoolean() == enabled)
                        {
                            if (enabled)
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn", sIRCMessage.Channel, sIRCMessage.ServerName));
                                return;
                            }
                            else
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff", sIRCMessage.Channel, sIRCMessage.ServerName));
                                return;
                            }
                        }

                        SchumixBase.DManager.Update("gitinfo", string.Format("Colors = '{0}'", sIRCMessage.Info[8].ToLower()), string.Format("LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName));
                        sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                    }
                    else
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                    }
                }
                else if (sIRCMessage.Info[5].ToLower() == "shorturl")
                {
                    var text = sLManager.GetCommandTexts("git/change/shorturl", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 8)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 9)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("StatusIsMissing", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (!sIRCMessage.Info[8].IsBoolean())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ValueIsNotTrueOrFalse", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    var db = SchumixBase.DManager.QueryFirstRow("SELECT ShortUrl FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName);
                    if (!db.IsNull())
                    {
                        bool enabled = db["ShortUrl"].ToBoolean();

                        if (sIRCMessage.Info[8].ToBoolean() == enabled)
                        {
                            if (enabled)
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn", sIRCMessage.Channel, sIRCMessage.ServerName));
                                return;
                            }
                            else
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff", sIRCMessage.Channel, sIRCMessage.ServerName));
                                return;
                            }
                        }

                        SchumixBase.DManager.Update("gitinfo", string.Format("ShortUrl = '{0}'", sIRCMessage.Info[8].ToLower()), string.Format("LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName));
                        sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                    }
                    else
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                    }
                }
                else if (sIRCMessage.Info[5].ToLower() == "url")
                {
                    var text = sLManager.GetCommandTexts("git/change/url", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 8)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 9)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("UrlMissing", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName);
                    if (!db.IsNull())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                        return;
                    }

                    SchumixBase.DManager.Update("gitinfo", string.Format("Link = '{0}'", sUtilities.SqlEscape(sIRCMessage.Info[8])), string.Format("LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName));
                    GitRss gitr   = null;
                    bool   isstop = false;

                    foreach (var list in RssList)
                    {
                        if (sIRCMessage.Info[6].ToLower() == list.Name.ToLower() && sIRCMessage.Info[7].ToLower() == list.Type.ToLower())
                        {
                            if (!list.Started)
                            {
                                isstop = true;
                                continue;
                            }

                            list.Stop();
                            gitr   = list;
                            isstop = true;
                        }
                    }

                    if (isstop && !gitr.IsNull())
                    {
                        RssList.Remove(gitr);
                    }

                    var db1 = SchumixBase.DManager.QueryFirstRow("SELECT Link, Website FROM gitinfo WHERE LOWER(Name) = '{0}' And Type = '{1}' And ServerName = '{2}'", sIRCMessage.Info[6].ToLower(), sIRCMessage.Info[7], sIRCMessage.ServerName);
                    if (!db1.IsNull())
                    {
                        var rss = new GitRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7]), db1["Link"].ToString(), db1["Website"].ToString());
                        RssList.Add(rss);
                        rss.Start();
                    }

                    sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                }
                else if (sIRCMessage.Info[5].ToLower() == "website")
                {
                    var text = sLManager.GetCommandTexts("git/change/website", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 8)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTypeName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 9)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WebsiteNameMissing", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM gitinfo WHERE LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName);
                    if (!db.IsNull())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, text[0]);
                        return;
                    }

                    SchumixBase.DManager.Update("gitinfo", string.Format("Website = '{0}'", sUtilities.SqlEscape(sIRCMessage.Info[8].ToLower())), string.Format("LOWER(Name) = '{0}' AND Type = '{1}' And ServerName = '{2}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sUtilities.SqlEscape(sIRCMessage.Info[7]), sIRCMessage.ServerName));
                    GitRss gitr   = null;
                    bool   isstop = false;

                    foreach (var list in RssList)
                    {
                        if (sIRCMessage.Info[6].ToLower() == list.Name.ToLower() && sIRCMessage.Info[7].ToLower() == list.Type.ToLower())
                        {
                            if (!list.Started)
                            {
                                isstop = true;
                                continue;
                            }

                            list.Stop();
                            gitr   = list;
                            isstop = true;
                        }
                    }

                    if (isstop && !gitr.IsNull())
                    {
                        RssList.Remove(gitr);
                    }

                    var db1 = SchumixBase.DManager.QueryFirstRow("SELECT Link, Website FROM gitinfo WHERE LOWER(Name) = '{0}' And Type = '{1}' And ServerName = '{2}'", sIRCMessage.Info[6].ToLower(), sIRCMessage.Info[7], sIRCMessage.ServerName);
                    if (!db1.IsNull())
                    {
                        var rss = new GitRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7]), db1["Link"].ToString(), db1["Website"].ToString());
                        RssList.Add(rss);
                        rss.Start();
                    }

                    sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                }
            }
        }
Esempio n. 2
0
 public void IsServ2()
 {
     Assert.IsTrue(Rfc2812Util.IsServ("NickServ", Serv.NickServ));
     Assert.IsFalse(Rfc2812Util.IsServ("schumix", Serv.NickServ));
 }
Esempio n. 3
0
        protected void HandleMode(IRCMessage sIRCMessage)
        {
            if (!IsAdmin(sIRCMessage.Nick, sIRCMessage.Host, AdminFlag.Operator))
            {
                return;
            }

            var text = sLManager.GetCommandTexts("mode", sIRCMessage.Channel, sIRCMessage.ServerName);

            if (text.Length < 9)
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                return;
            }

            if (!Rfc2812Util.IsValidChannelName(sIRCMessage.Channel))
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ThisIsNotAChannelDoNotWriteInPM", sIRCMessage.Channel, sIRCMessage.ServerName));
                return;
            }

            if (sIRCMessage.Info.Length < 5)
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoRank", sIRCMessage.Channel, sIRCMessage.ServerName));
                return;
            }

            string rank = sIRCMessage.Info[4].ToLower();

            if (rank.Length > 5)
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[1]);
                return;
            }

            if (rank.Split('+').Length == 1 && rank.Split('-').Length == 1)
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[2]);
                return;
            }

            if (!ModeRegex.IsMatch(rank.Substring(1)))
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[3]);
                return;
            }

            foreach (var c in rank.Substring(1).ToCharArray())
            {
                if (Rfc2812Util.CharToChannelMode(c).ToString().IsNumber())
                {
                    sSendMessage.SendChatMessage(sIRCMessage, text[4]);
                    return;
                }
            }

            if (sIRCMessage.Info.Length == 5)
            {
                sSender.Mode(sIRCMessage.Channel, sIRCMessage.Info[4].ToLower());
                return;
            }

            if (sIRCMessage.Info.Length < 6)
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoName", sIRCMessage.Channel, sIRCMessage.ServerName));
                return;
            }

            bool   StringEmpty = false;
            string name        = string.Empty;
            string error       = string.Empty;
            string rank2       = string.Empty;
            string status      = string.Empty;

            if (sIRCMessage.Info.Length >= 10)
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[5]);
                return;
            }

            if (rank.Length - 1 > sIRCMessage.Info.Length - 5)
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[6]);
                return;
            }

            if (rank.Length - 1 < sIRCMessage.Info.Length - 5)
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[7]);
                return;
            }

            if (rank.Contains(Rfc2812Util.ModeActionToChar(ModeAction.Remove).ToString()))
            {
                status = Rfc2812Util.ModeActionToChar(ModeAction.Remove).ToString();
            }
            else if (rank.Contains(Rfc2812Util.ModeActionToChar(ModeAction.Add).ToString()))
            {
                status = Rfc2812Util.ModeActionToChar(ModeAction.Add).ToString();
            }

            if (sIRCMessage.Info.Length >= 6 && Rfc2812Util.IsValidNick(sIRCMessage.Info[5]) && sIRCMessage.Info[5].ToLower() != sMyNickInfo.NickStorage.ToLower() && rank.Length > 1 && sChannelList.IsChannelRank(rank.Substring(1, 1)))
            {
                if (status == Rfc2812Util.ModeActionToChar(ModeAction.Remove).ToString())
                {
                    rank2 += rank.Substring(1, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[5];
                }
                else if (status == Rfc2812Util.ModeActionToChar(ModeAction.Add).ToString())
                {
                    rank2 += rank.Substring(1, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[5];
                }
            }
            else if (sIRCMessage.Info.Length >= 6 && !Rfc2812Util.IsValidNick(sIRCMessage.Info[5]) && sIRCMessage.Info[5].ToLower() != sMyNickInfo.NickStorage.ToLower())
            {
                if (!sIRCMessage.Info[5].IsNullOrEmpty())
                {
                    error += ", " + sIRCMessage.Info[5];
                }
                else
                {
                    StringEmpty = true;
                }
            }
            else if (sIRCMessage.Info.Length >= 6 && Rfc2812Util.IsValidNick(sIRCMessage.Info[5]) && sIRCMessage.Info[5].ToLower() == sMyNickInfo.NickStorage.ToLower())
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[0]);
            }

            if (sIRCMessage.Info.Length >= 7 && Rfc2812Util.IsValidNick(sIRCMessage.Info[6]) && sIRCMessage.Info[6].ToLower() != sMyNickInfo.NickStorage.ToLower() && rank.Length > 2 && sChannelList.IsChannelRank(rank.Substring(2).Substring(0, 1)))
            {
                if (status == Rfc2812Util.ModeActionToChar(ModeAction.Remove).ToString())
                {
                    rank2 += rank.Substring(2).Substring(0, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[6];
                }
                else if (status == Rfc2812Util.ModeActionToChar(ModeAction.Add).ToString())
                {
                    rank2 += rank.Substring(2).Substring(0, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[6];
                }
            }
            else if (sIRCMessage.Info.Length >= 7 && !Rfc2812Util.IsValidNick(sIRCMessage.Info[6]) && sIRCMessage.Info[6].ToLower() != sMyNickInfo.NickStorage.ToLower())
            {
                if (!sIRCMessage.Info[6].IsNullOrEmpty())
                {
                    error += ", " + sIRCMessage.Info[6];
                }
                else
                {
                    StringEmpty = true;
                }
            }
            else if (sIRCMessage.Info.Length >= 7 && Rfc2812Util.IsValidNick(sIRCMessage.Info[6]) && sIRCMessage.Info[6].ToLower() == sMyNickInfo.NickStorage.ToLower())
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[0]);
            }

            if (sIRCMessage.Info.Length >= 8 && Rfc2812Util.IsValidNick(sIRCMessage.Info[7]) && sIRCMessage.Info[7].ToLower() != sMyNickInfo.NickStorage.ToLower() && rank.Length > 3 && sChannelList.IsChannelRank(rank.Substring(3).Substring(0, 1)))
            {
                if (status == Rfc2812Util.ModeActionToChar(ModeAction.Remove).ToString())
                {
                    rank2 += rank.Substring(3).Substring(0, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[7];
                }
                else if (status == Rfc2812Util.ModeActionToChar(ModeAction.Add).ToString())
                {
                    rank2 += rank.Substring(3).Substring(0, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[7];
                }
            }
            else if (sIRCMessage.Info.Length >= 8 && !Rfc2812Util.IsValidNick(sIRCMessage.Info[7]) && sIRCMessage.Info[7].ToLower() != sMyNickInfo.NickStorage.ToLower())
            {
                if (!sIRCMessage.Info[7].IsNullOrEmpty())
                {
                    error += ", " + sIRCMessage.Info[7];
                }
                else
                {
                    StringEmpty = true;
                }
            }
            else if (sIRCMessage.Info.Length >= 8 && Rfc2812Util.IsValidNick(sIRCMessage.Info[7]) && sIRCMessage.Info[7].ToLower() == sMyNickInfo.NickStorage.ToLower())
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[0]);
            }

            if (sIRCMessage.Info.Length >= 9 && Rfc2812Util.IsValidNick(sIRCMessage.Info[8]) && sIRCMessage.Info[8].ToLower() != sMyNickInfo.NickStorage.ToLower() && rank.Length > 4 && sChannelList.IsChannelRank(rank.Substring(4).Substring(0, 1)))
            {
                if (status == Rfc2812Util.ModeActionToChar(ModeAction.Remove).ToString())
                {
                    rank2 += rank.Substring(4).Substring(0, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[8];
                }
                else if (status == Rfc2812Util.ModeActionToChar(ModeAction.Add).ToString())
                {
                    rank2 += rank.Substring(4).Substring(0, 1);
                    name  += SchumixBase.Space + sIRCMessage.Info[8];
                }
            }
            else if (sIRCMessage.Info.Length >= 9 && !Rfc2812Util.IsValidNick(sIRCMessage.Info[8]) && sIRCMessage.Info[8].ToLower() != sMyNickInfo.NickStorage.ToLower())
            {
                if (!sIRCMessage.Info[8].IsNullOrEmpty())
                {
                    error += ", " + sIRCMessage.Info[8];
                }
                else
                {
                    StringEmpty = true;
                }
            }
            else if (sIRCMessage.Info.Length >= 9 && Rfc2812Util.IsValidNick(sIRCMessage.Info[8]) && sIRCMessage.Info[8].ToLower() == sMyNickInfo.NickStorage.ToLower())
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[0]);
            }

            error = error.Remove(0, 2, ", ");

            if (!error.IsNullOrEmpty())
            {
                sSendMessage.SendChatMessage(sIRCMessage, error + SchumixBase.Colon + SchumixBase.Space + sLManager.GetWarningText("NotaNickNameHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName));
            }

            if (StringEmpty)
            {
                sSendMessage.SendChatMessage(sIRCMessage, text[8]);
            }

            ModePrivmsg = sIRCMessage.Channel;
            sSender.Mode(sIRCMessage.Channel, status + rank2, name.Remove(0, 1, SchumixBase.Space));

            // Clean
            Thread.Sleep(5 * 1000);

            if (sIRCMessage.Channel.ToLower() == ModePrivmsg.ToLower() || !ModePrivmsg.IsNullOrEmpty())
            {
                ModePrivmsg = string.Empty;
            }
        }
Esempio n. 4
0
 public bool BaseIsChannel(string ServerName, string Name)
 {
     servername = ServerName;
     return(Rfc2812Util.IsValidChannelName(Name));
 }
Esempio n. 5
0
        protected void HandleFunction(IRCMessage sIRCMessage)
        {
            if (!IsAdmin(sIRCMessage.Nick, sIRCMessage.Host, AdminFlag.Operator))
            {
                return;
            }

            if (sIRCMessage.Info.Length < 5)
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoValue", sIRCMessage.Channel, sIRCMessage.ServerName));
                return;
            }

            if (sIRCMessage.Info[4].ToLower() == "info")
            {
                var text = sLManager.GetCommandTexts("function/info", sIRCMessage.Channel, sIRCMessage.ServerName);
                if (text.Length < 2)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                    return;
                }

                string[] ChannelInfo = sMyChannelInfo.ChannelFunctionsInfo(sIRCMessage.Channel).Split('|');
                if (ChannelInfo.Length < 2)
                {
                    return;
                }

                sSendMessage.SendChatMessage(sIRCMessage, text[0], ChannelInfo[0]);
                sSendMessage.SendChatMessage(sIRCMessage, text[1], ChannelInfo[1]);
            }
            else if (sIRCMessage.Info[4].ToLower() == "all")
            {
                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("No1Value", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info[5].ToLower() == "info")
                {
                    var text = sLManager.GetCommandTexts("function/all/info", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    string f = sMyChannelInfo.FunctionsInfo();
                    if (f.IsNullOrEmpty())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FaultyQuery", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    string[] FunctionInfo = f.Split('|');
                    if (FunctionInfo.Length < 2)
                    {
                        return;
                    }

                    sSendMessage.SendChatMessage(sIRCMessage, text[0], FunctionInfo[0]);
                    sSendMessage.SendChatMessage(sIRCMessage, text[1], FunctionInfo[1]);
                }
                else
                {
                    var text = sLManager.GetCommandTexts("function/all", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    if (sIRCMessage.Info.Length < 7)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoFunctionName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info[5].ToLower() == SchumixBase.On || sIRCMessage.Info[5].ToLower() == SchumixBase.Off)
                    {
                        if (sIRCMessage.Info.Length >= 8)
                        {
                            string args           = string.Empty;
                            string onfunction     = string.Empty;
                            string offfunction    = string.Empty;
                            string nosuchfunction = string.Empty;

                            for (int i = 6; i < sIRCMessage.Info.Length; i++)
                            {
                                if (!sMyChannelInfo.SearchFunction(sIRCMessage.Info[i]))
                                {
                                    nosuchfunction += ", " + sIRCMessage.Info[i].ToLower();
                                    continue;
                                }

                                if (sMyChannelInfo.FSelect(sIRCMessage.Info[i]) && sIRCMessage.Info[5].ToLower() == SchumixBase.On)
                                {
                                    onfunction += ", " + sIRCMessage.Info[i].ToLower();
                                    continue;
                                }
                                else if (!sMyChannelInfo.FSelect(sIRCMessage.Info[i]) && sIRCMessage.Info[5].ToLower() == SchumixBase.Off)
                                {
                                    offfunction += ", " + sIRCMessage.Info[i].ToLower();
                                    continue;
                                }

                                args += ", " + sIRCMessage.Info[i].ToLower();
                                SchumixBase.DManager.Update("schumix", string.Format("FunctionStatus = '{0}'", sIRCMessage.Info[5].ToLower()), string.Format("FunctionName = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[i].ToLower()), sIRCMessage.ServerName));
                                sMyChannelInfo.FunctionsReload();
                            }

                            if (!onfunction.IsNullOrEmpty())
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn2", sIRCMessage.Channel, sIRCMessage.ServerName), onfunction.Remove(0, 2, ", "));
                            }

                            if (!offfunction.IsNullOrEmpty())
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff2", sIRCMessage.Channel, sIRCMessage.ServerName), offfunction.Remove(0, 2, ", "));
                            }

                            if (!nosuchfunction.IsNullOrEmpty())
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Other("NoSuchFunctions2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)), nosuchfunction.Remove(0, 2, ", "));
                            }

                            if (args.Length == 0)
                            {
                                return;
                            }

                            if (sIRCMessage.Info[5].ToLower() == SchumixBase.On)
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, text[0], args.Remove(0, 2, ", "));
                            }
                            else
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, text[1], args.Remove(0, 2, ", "));
                            }
                        }
                        else
                        {
                            if (!sMyChannelInfo.SearchFunction(sIRCMessage.Info[6]))
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Other("NoSuchFunctions", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                                return;
                            }

                            if (sMyChannelInfo.FSelect(sIRCMessage.Info[6]) && sIRCMessage.Info[5].ToLower() == SchumixBase.On)
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn", sIRCMessage.Channel, sIRCMessage.ServerName));
                                return;
                            }
                            else if (!sMyChannelInfo.FSelect(sIRCMessage.Info[6]) && sIRCMessage.Info[5].ToLower() == SchumixBase.Off)
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff", sIRCMessage.Channel, sIRCMessage.ServerName));
                                return;
                            }

                            if (sIRCMessage.Info[5].ToLower() == SchumixBase.On)
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, text[0], sIRCMessage.Info[6].ToLower());
                            }
                            else
                            {
                                sSendMessage.SendChatMessage(sIRCMessage, text[1], sIRCMessage.Info[6].ToLower());
                            }

                            SchumixBase.DManager.Update("schumix", string.Format("FunctionStatus = '{0}'", sIRCMessage.Info[5].ToLower()), string.Format("FunctionName = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName));
                            sMyChannelInfo.FunctionsReload();
                        }
                    }
                    else
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WrongSwitch", sIRCMessage.Channel, sIRCMessage.ServerName));
                    }
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "channel")
            {
                var text = sLManager.GetCommandTexts("function/channel", sIRCMessage.Channel, sIRCMessage.ServerName);
                if (text.Length < 3)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                    return;
                }

                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoChannelName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[5]))
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                var db0 = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM channels WHERE Channel = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sIRCMessage.ServerName);
                if (db0.IsNull())
                {
                    sSendMessage.SendChatMessage(sIRCMessage, text[2]);
                    return;
                }

                if (sIRCMessage.Info.Length < 7)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("No1Value", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                string channel = sIRCMessage.Info[5].ToLower();
                string status  = sIRCMessage.Info[6].ToLower();

                if (sIRCMessage.Info[6].ToLower() == "info")
                {
                    var text2 = sLManager.GetCommandTexts("function/channel/info", sIRCMessage.Channel, sIRCMessage.ServerName);
                    if (text2.Length < 2)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                        return;
                    }

                    string[] ChannelInfo = sMyChannelInfo.ChannelFunctionsInfo(channel).Split('|');
                    if (ChannelInfo.Length < 2)
                    {
                        return;
                    }

                    sSendMessage.SendChatMessage(sIRCMessage, text2[0], ChannelInfo[0]);
                    sSendMessage.SendChatMessage(sIRCMessage, text2[1], ChannelInfo[1]);
                }
                else if (status == SchumixBase.On || status == SchumixBase.Off)
                {
                    if (sIRCMessage.Info.Length < 8)
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoFunctionName", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    if (sIRCMessage.Info.Length >= 9)
                    {
                        string args           = string.Empty;
                        string onfunction     = string.Empty;
                        string offfunction    = string.Empty;
                        string nosuchfunction = string.Empty;

                        for (int i = 7; i < sIRCMessage.Info.Length; i++)
                        {
                            if (!sMyChannelInfo.SearchChannelFunction(sIRCMessage.Info[i]))
                            {
                                nosuchfunction += ", " + sIRCMessage.Info[i].ToLower();
                                continue;
                            }

                            if (sMyChannelInfo.FSelect(sIRCMessage.Info[i], channel) && status == SchumixBase.On)
                            {
                                onfunction += ", " + sIRCMessage.Info[i].ToLower();
                                continue;
                            }
                            else if (!sMyChannelInfo.FSelect(sIRCMessage.Info[i], channel) && status == SchumixBase.Off)
                            {
                                offfunction += ", " + sIRCMessage.Info[i].ToLower();
                                continue;
                            }

                            if (sMyChannelInfo.SearchFunction(sIRCMessage.Info[i]))
                            {
                                if (!sMyChannelInfo.FSelect(sIRCMessage.Info[i]) && status == SchumixBase.On)
                                {
                                    SchumixBase.DManager.Update("schumix", "FunctionStatus = 'on'", string.Format("FunctionName = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[i].ToLower()), sIRCMessage.ServerName));
                                    sMyChannelInfo.FunctionsReload();
                                }
                            }

                            args += ", " + sIRCMessage.Info[i].ToLower();
                            SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", sMyChannelInfo.ChannelFunctions(sIRCMessage.Info[i].ToLower(), status, channel)), string.Format("Channel = '{0}' And ServerName = '{1}'", channel, sIRCMessage.ServerName));
                            sMyChannelInfo.ChannelFunctionsReload();
                        }

                        if (!onfunction.IsNullOrEmpty())
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn2", sIRCMessage.Channel, sIRCMessage.ServerName), onfunction.Remove(0, 2, ", "));
                        }

                        if (!offfunction.IsNullOrEmpty())
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff2", sIRCMessage.Channel, sIRCMessage.ServerName), offfunction.Remove(0, 2, ", "));
                        }

                        if (!nosuchfunction.IsNullOrEmpty())
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Other("NoSuchFunctions2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)), nosuchfunction.Remove(0, 2, ", "));
                        }

                        if (args.Length == 0)
                        {
                            return;
                        }

                        if (status == SchumixBase.On)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[0], args.Remove(0, 2, ", "));
                        }
                        else
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[1], args.Remove(0, 2, ", "));
                        }
                    }
                    else
                    {
                        if (!sMyChannelInfo.SearchChannelFunction(sIRCMessage.Info[7]))
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Other("NoSuchFunctions", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                            return;
                        }

                        if (sMyChannelInfo.FSelect(sIRCMessage.Info[7], channel) && status == SchumixBase.On)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn", sIRCMessage.Channel, sIRCMessage.ServerName));
                            return;
                        }
                        else if (!sMyChannelInfo.FSelect(sIRCMessage.Info[7], channel) && status == SchumixBase.Off)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff", sIRCMessage.Channel, sIRCMessage.ServerName));
                            return;
                        }

                        if (sMyChannelInfo.SearchFunction(sIRCMessage.Info[7]))
                        {
                            if (!sMyChannelInfo.FSelect(sIRCMessage.Info[7]) && status == SchumixBase.On)
                            {
                                SchumixBase.DManager.Update("schumix", "FunctionStatus = 'on'", string.Format("FunctionName = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower()), sIRCMessage.ServerName));
                                sMyChannelInfo.FunctionsReload();
                            }
                        }

                        if (status == SchumixBase.On)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[0], sIRCMessage.Info[7].ToLower());
                        }
                        else
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[1], sIRCMessage.Info[7].ToLower());
                        }

                        SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", sMyChannelInfo.ChannelFunctions(sIRCMessage.Info[7].ToLower(), status, channel)), string.Format("Channel = '{0}' And ServerName = '{1}'", channel, sIRCMessage.ServerName));
                        sMyChannelInfo.ChannelFunctionsReload();
                    }
                }
                else
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WrongSwitch", sIRCMessage.Channel, sIRCMessage.ServerName));
                }
            }
            else if (sIRCMessage.Info[4].ToLower() == "update")
            {
                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("function/update", sIRCMessage.Channel, sIRCMessage.ServerName), sIRCMessage.Channel);
                    SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", sUtilities.GetFunctionUpdate()), string.Format("Channel = '{0}' And ServerName = '{1}'", sIRCMessage.Channel, sIRCMessage.ServerName));
                    sMyChannelInfo.ChannelFunctionsReload();
                    return;
                }

                if (sIRCMessage.Info[5].ToLower() == "all")
                {
                    var db = SchumixBase.DManager.Query("SELECT Channel FROM channel WHERE ServerName = '{0}'", _servername);
                    if (!db.IsNull())
                    {
                        foreach (DataRow row in db.Rows)
                        {
                            string channel = row["Channel"].ToString();
                            SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", sUtilities.GetFunctionUpdate()), string.Format("Channel = '{0}' And ServerName = '{1}'", channel, sIRCMessage.ServerName));
                        }

                        sMyChannelInfo.ChannelFunctionsReload();
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("function/update/all", sIRCMessage.Channel, sIRCMessage.ServerName));
                    }
                    else
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FaultyQuery", sIRCMessage.Channel, sIRCMessage.ServerName));
                    }
                }
                else
                {
                    if (!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[5]))
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName));
                        return;
                    }

                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("function/update", sIRCMessage.Channel, sIRCMessage.ServerName), sIRCMessage.Info[5].ToLower());
                    SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", sUtilities.GetFunctionUpdate()), string.Format("Channel = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sIRCMessage.ServerName));
                    sMyChannelInfo.ChannelFunctionsReload();
                }
            }
            else
            {
                var text = sLManager.GetCommandTexts("function", sIRCMessage.Channel, sIRCMessage.ServerName);
                if (text.Length < 2)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                    return;
                }

                if (sIRCMessage.Info.Length < 5)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoFunctionStatus", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                if (sIRCMessage.Info.Length < 6)
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoFunctionName", sIRCMessage.Channel, sIRCMessage.ServerName));
                    return;
                }

                string status = sIRCMessage.Info[4].ToLower();

                if (status == SchumixBase.On || status == SchumixBase.Off)
                {
                    if (sIRCMessage.Info.Length >= 7)
                    {
                        string args           = string.Empty;
                        string onfunction     = string.Empty;
                        string offfunction    = string.Empty;
                        string nosuchfunction = string.Empty;

                        for (int i = 5; i < sIRCMessage.Info.Length; i++)
                        {
                            if (!sMyChannelInfo.SearchChannelFunction(sIRCMessage.Info[i]))
                            {
                                nosuchfunction += ", " + sIRCMessage.Info[i].ToLower();
                                continue;
                            }

                            if (sMyChannelInfo.FSelect(sIRCMessage.Info[i], sIRCMessage.Channel) && status == SchumixBase.On)
                            {
                                onfunction += ", " + sIRCMessage.Info[i].ToLower();
                                continue;
                            }
                            else if (!sMyChannelInfo.FSelect(sIRCMessage.Info[i], sIRCMessage.Channel) && status == SchumixBase.Off)
                            {
                                offfunction += ", " + sIRCMessage.Info[i].ToLower();
                                continue;
                            }

                            if (sMyChannelInfo.SearchFunction(sIRCMessage.Info[i]))
                            {
                                if (!sMyChannelInfo.FSelect(sIRCMessage.Info[i]) && status == SchumixBase.On)
                                {
                                    SchumixBase.DManager.Update("schumix", "FunctionStatus = 'on'", string.Format("FunctionName = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[i].ToLower()), sIRCMessage.ServerName));
                                    sMyChannelInfo.FunctionsReload();
                                }
                            }

                            args += ", " + sIRCMessage.Info[i].ToLower();
                            SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", sMyChannelInfo.ChannelFunctions(sIRCMessage.Info[i].ToLower(), status, sIRCMessage.Channel)), string.Format("Channel = '{0}' And ServerName = '{1}'", sIRCMessage.Channel, sIRCMessage.ServerName));
                            sMyChannelInfo.ChannelFunctionsReload();
                        }

                        if (!onfunction.IsNullOrEmpty())
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn2", sIRCMessage.Channel, sIRCMessage.ServerName), onfunction.Remove(0, 2, ", "));
                        }

                        if (!offfunction.IsNullOrEmpty())
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff2", sIRCMessage.Channel, sIRCMessage.ServerName), offfunction.Remove(0, 2, ", "));
                        }

                        if (!nosuchfunction.IsNullOrEmpty())
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Other("NoSuchFunctions2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)), nosuchfunction.Remove(0, 2, ", "));
                        }

                        if (args.Length == 0)
                        {
                            return;
                        }

                        if (status == SchumixBase.On)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[0], args.Remove(0, 2, ", "));
                        }
                        else
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[1], args.Remove(0, 2, ", "));
                        }
                    }
                    else
                    {
                        if (!sMyChannelInfo.SearchChannelFunction(sIRCMessage.Info[5]))
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Other("NoSuchFunctions", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                            return;
                        }

                        if (sMyChannelInfo.FSelect(sIRCMessage.Info[5], sIRCMessage.Channel) && status == SchumixBase.On)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOn", sIRCMessage.Channel, sIRCMessage.ServerName));
                            return;
                        }
                        else if (!sMyChannelInfo.FSelect(sIRCMessage.Info[5], sIRCMessage.Channel) && status == SchumixBase.Off)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FunctionAlreadyTurnedOff", sIRCMessage.Channel, sIRCMessage.ServerName));
                            return;
                        }

                        if (sMyChannelInfo.SearchFunction(sIRCMessage.Info[5]))
                        {
                            if (!sMyChannelInfo.FSelect(sIRCMessage.Info[5]) && status == SchumixBase.On)
                            {
                                SchumixBase.DManager.Update("schumix", "FunctionStatus = 'on'", string.Format("FunctionName = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sIRCMessage.ServerName));
                                sMyChannelInfo.FunctionsReload();
                            }
                        }

                        if (status == SchumixBase.On)
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[0], sIRCMessage.Info[5].ToLower());
                        }
                        else
                        {
                            sSendMessage.SendChatMessage(sIRCMessage, text[1], sIRCMessage.Info[5].ToLower());
                        }

                        SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", sMyChannelInfo.ChannelFunctions(sIRCMessage.Info[5].ToLower(), status, sIRCMessage.Channel)), string.Format("Channel = '{0}' And ServerName = '{1}'", sIRCMessage.Channel, sIRCMessage.ServerName));
                        sMyChannelInfo.ChannelFunctionsReload();
                    }
                }
                else
                {
                    sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WrongSwitch", sIRCMessage.Channel, sIRCMessage.ServerName));
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///     Ignore parancs függvénye.
        /// </summary>
        protected void HandleIgnore(ConsoleMessage sConsoleMessage)
        {
            if (sConsoleMessage.Info.Length < 2)
            {
                Log.Error("Console", sLManager.GetConsoleWarningText("NoValue"));
                return;
            }

            if (sConsoleMessage.Info[1].ToLower() == "irc")
            {
                if (sConsoleMessage.Info.Length < 3)
                {
                    Log.Error("Console", sLManager.GetConsoleWarningText("No1Value"));
                    return;
                }

                if (sConsoleMessage.Info[2].ToLower() == "command")
                {
                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("No1Value"));
                        return;
                    }

                    if (sConsoleMessage.Info[3].ToLower() == "add")
                    {
                        var text = sLManager.GetConsoleCommandTexts("ignore/irc/command/add");
                        if (text.Length < 2)
                        {
                            Log.Error("Console", sLConsole.Translations("NoFound2"));
                            return;
                        }

                        if (sConsoleMessage.Info.Length < 5)
                        {
                            Log.Error("Console", sLManager.GetConsoleWarningText("NoCommand"));
                            return;
                        }

                        string command = sConsoleMessage.Info[4].ToLower();

                        if (sIrcBase.Networks[_servername].sIgnoreIrcCommand.IsIgnore(command))
                        {
                            Log.Error("Console", text[0]);
                            return;
                        }

                        sIrcBase.Networks[_servername].sIgnoreIrcCommand.Add(command);
                        Log.Notice("Console", text[1]);
                    }
                    else if (sConsoleMessage.Info[3].ToLower() == "remove")
                    {
                        var text = sLManager.GetConsoleCommandTexts("ignore/irc/command/remove");
                        if (text.Length < 2)
                        {
                            Log.Error("Console", sLConsole.Translations("NoFound2"));
                            return;
                        }

                        if (sConsoleMessage.Info.Length < 5)
                        {
                            Log.Error("Console", sLManager.GetConsoleWarningText("NoCommand"));
                            return;
                        }

                        string command = sConsoleMessage.Info[4].ToLower();

                        if (!sIrcBase.Networks[_servername].sIgnoreIrcCommand.IsIgnore(command))
                        {
                            Log.Error("Console", text[0]);
                            return;
                        }

                        sIrcBase.Networks[_servername].sIgnoreIrcCommand.Remove(command);
                        Log.Notice("Console", text[1]);
                    }
                    else if (sConsoleMessage.Info[3].ToLower() == "search")
                    {
                        var text = sLManager.GetConsoleCommandTexts("ignore/irc/command/search");
                        if (text.Length < 2)
                        {
                            Log.Error("Console", sLConsole.Translations("NoFound2"));
                            return;
                        }

                        if (sConsoleMessage.Info.Length < 5)
                        {
                            Log.Error("Console", sLManager.GetConsoleWarningText("NoCommand"));
                            return;
                        }

                        if (sIrcBase.Networks[_servername].sIgnoreIrcCommand.Contains(sConsoleMessage.Info[4].ToLower()))
                        {
                            Log.Notice("Console", text[0]);
                        }
                        else
                        {
                            Log.Error("Console", text[1]);
                        }
                    }
                }
            }
            else if (sConsoleMessage.Info[1].ToLower() == "command")
            {
                if (sConsoleMessage.Info.Length < 3)
                {
                    Log.Error("Console", sLManager.GetConsoleWarningText("No1Value"));
                    return;
                }

                if (sConsoleMessage.Info[2].ToLower() == "add")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/command/add");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoCommand"));
                        return;
                    }

                    string command = sConsoleMessage.Info[3].ToLower();

                    if (command == "ignore" || command == "admin")
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoIgnoreCommand"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreCommand.IsIgnore(command))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreCommand.Add(command);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "remove")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/command/remove");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoCommand"));
                        return;
                    }

                    string command = sConsoleMessage.Info[3].ToLower();

                    if (!sIrcBase.Networks[_servername].sIgnoreCommand.IsIgnore(command))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreCommand.Remove(command);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "search")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/command/search");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoCommand"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreCommand.Contains(sConsoleMessage.Info[3].ToLower()))
                    {
                        Log.Notice("Console", text[0]);
                    }
                    else
                    {
                        Log.Error("Console", text[1]);
                    }
                }
            }
            else if (sConsoleMessage.Info[1].ToLower() == "channel")
            {
                if (sConsoleMessage.Info.Length < 3)
                {
                    Log.Error("Console", sLManager.GetConsoleWarningText("No1Value"));
                    return;
                }

                if (sConsoleMessage.Info[2].ToLower() == "add")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/channel/add");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoChannelName"));
                        return;
                    }

                    string channel = sConsoleMessage.Info[3].ToLower();

                    if (!Rfc2812Util.IsValidChannelName(channel))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NotaChannelHasBeenSet"));
                        return;
                    }

                    if (channel == IRCConfig.List[_servername].MasterChannel.ToLower())
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoIgnoreMasterChannel"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreChannel.IsIgnore(channel))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreChannel.Add(channel);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "remove")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/channel/remove");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoChannelName"));
                        return;
                    }

                    string channel = sConsoleMessage.Info[3].ToLower();

                    if (!Rfc2812Util.IsValidChannelName(channel))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NotaChannelHasBeenSet"));
                        return;
                    }

                    if (!sIrcBase.Networks[_servername].sIgnoreChannel.IsIgnore(channel))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreChannel.Remove(channel);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "search")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/channel/search");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoChannelName"));
                        return;
                    }

                    string channel = sConsoleMessage.Info[3].ToLower();

                    if (!Rfc2812Util.IsValidChannelName(channel))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NotaChannelHasBeenSet"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreChannel.Contains(channel))
                    {
                        Log.Notice("Console", text[0]);
                    }
                    else
                    {
                        Log.Error("Console", text[1]);
                    }
                }
            }
            else if (sConsoleMessage.Info[1].ToLower() == "nick")
            {
                if (sConsoleMessage.Info.Length < 3)
                {
                    Log.Error("Console", sLManager.GetConsoleWarningText("No1Value"));
                    return;
                }

                if (sConsoleMessage.Info[2].ToLower() == "add")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/nick/add");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoName"));
                        return;
                    }

                    string nick = sConsoleMessage.Info[3].ToLower();

                    if (!Rfc2812Util.IsValidNick(nick))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NotaNickNameHasBeenSet"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreNickName.IsIgnore(nick))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreNickName.Add(nick);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "remove")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/nick/remove");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoName"));
                        return;
                    }

                    string nick = sConsoleMessage.Info[3].ToLower();

                    if (!Rfc2812Util.IsValidNick(nick))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NotaNickNameHasBeenSet"));
                        return;
                    }

                    if (!sIrcBase.Networks[_servername].sIgnoreNickName.IsIgnore(nick))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreNickName.Remove(nick);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "search")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/nick/search");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoName"));
                        return;
                    }

                    string nick = sConsoleMessage.Info[3].ToLower();

                    if (!Rfc2812Util.IsValidNick(nick))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NotaNickNameHasBeenSet"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreNickName.Contains(nick))
                    {
                        Log.Notice("Console", text[0]);
                    }
                    else
                    {
                        Log.Error("Console", text[1]);
                    }
                }
            }
            else if (sConsoleMessage.Info[1].ToLower() == "addon")
            {
                if (sConsoleMessage.Info.Length < 3)
                {
                    Log.Error("Console", sLManager.GetConsoleWarningText("No1Value"));
                    return;
                }

                if (sConsoleMessage.Info[2].ToLower() == "add")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/addon/add");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoName"));
                        return;
                    }

                    string addon = sConsoleMessage.Info[3].ToLower();

                    if (!sAddonManager.IsAddon(_servername, addon))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("ThereIsNoSuchAnAddon"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreAddon.IsIgnore(addon))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreAddon.Add(addon);
                    sIrcBase.Networks[_servername].sIgnoreAddon.UnloadPlugin(addon);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "remove")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/addon/remove");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoName"));
                        return;
                    }

                    string addon = sConsoleMessage.Info[3].ToLower();

                    if (!sAddonManager.IsAddon(_servername, addon))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("ThereIsNoSuchAnAddon"));
                        return;
                    }

                    if (!sIrcBase.Networks[_servername].sIgnoreAddon.IsIgnore(addon))
                    {
                        Log.Error("Console", text[0]);
                        return;
                    }

                    sIrcBase.Networks[_servername].sIgnoreAddon.Remove(addon);
                    sIrcBase.Networks[_servername].sIgnoreAddon.LoadPlugin(addon);
                    Log.Notice("Console", text[1]);
                }
                else if (sConsoleMessage.Info[2].ToLower() == "search")
                {
                    var text = sLManager.GetConsoleCommandTexts("ignore/addon/search");
                    if (text.Length < 2)
                    {
                        Log.Error("Console", sLConsole.Translations("NoFound2"));
                        return;
                    }

                    if (sConsoleMessage.Info.Length < 4)
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("NoName"));
                        return;
                    }

                    string addon = sConsoleMessage.Info[3].ToLower();

                    if (!sAddonManager.IsAddon(_servername, addon))
                    {
                        Log.Error("Console", sLManager.GetConsoleWarningText("ThereIsNoSuchAnAddon"));
                        return;
                    }

                    if (sIrcBase.Networks[_servername].sIgnoreAddon.Contains(addon))
                    {
                        Log.Notice("Console", text[0]);
                    }
                    else
                    {
                        Log.Error("Console", text[1]);
                    }
                }
            }
        }