public void HandleHg(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, Channel FROM hginfo WHERE ServerName = '{0}'", sIRCMessage.ServerName); if (!db.IsNull()) { foreach (DataRow row in db.Rows) { string name = row["Name"].ToString(); string[] channel = row["Channel"].ToString().Split(SchumixBase.Comma); sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("hg/info", sIRCMessage.Channel, sIRCMessage.ServerName), name, 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 FROM hginfo WHERE ServerName = '{0}'", sIRCMessage.ServerName); if (!db.IsNull()) { string list = string.Empty; foreach (DataRow row in db.Rows) { list += SchumixBase.Comma + SchumixBase.Space + row["Name"].ToString(); } if (list.IsNullOrEmpty()) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("hg/list", sIRCMessage.Channel, sIRCMessage.ServerName), SchumixBase.Space + sLConsole.Other("Nothing")); } else { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("hg/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("hg/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; } foreach (var list in RssList) { if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if (list.Started) { sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name); return; } list.Start(); sSendMessage.SendChatMessage(sIRCMessage, text[1], list.Name); return; } } sSendMessage.SendChatMessage(sIRCMessage, text[2], sIRCMessage.Info[5]); } else if (sIRCMessage.Info[4].ToLower() == "stop") { var text = sLManager.GetCommandTexts("hg/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; } foreach (var list in RssList) { if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if (!list.Started) { sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name); return; } list.Stop(); sSendMessage.SendChatMessage(sIRCMessage, text[1], list.Name); return; } } sSendMessage.SendChatMessage(sIRCMessage, text[2], sIRCMessage.Info[5]); } 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("hg/reload/all", sIRCMessage.Channel, sIRCMessage.ServerName)); } else { var text = sLManager.GetCommandTexts("hg/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; } foreach (var list in RssList) { if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { list.Reload(); sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name); return; } } sSendMessage.SendChatMessage(sIRCMessage, text[1], sIRCMessage.Info[5]); } } 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("hg/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("NoChannelName", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[7])) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT Channel FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), 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[7].ToLower())) { sSendMessage.SendChatMessage(sIRCMessage, text[2]); return; } if (channel.Length == 1 && data.IsNullOrEmpty()) { data += sIRCMessage.Info[7].ToLower(); } else { data += SchumixBase.Comma + sIRCMessage.Info[7].ToLower(); } SchumixBase.DManager.Update("hginfo", string.Format("Channel = '{0}'", data), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else { sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } else if (sIRCMessage.Info[5].ToLower() == "remove") { var text = sLManager.GetCommandTexts("hg/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("NoChannelName", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[7])) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT Channel FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if (!db.IsNull()) { string[] channel = db["Channel"].ToString().Split(SchumixBase.Comma); string data = string.Empty; if (!channel.ToList().Contains(sIRCMessage.Info[7].ToLower())) { sSendMessage.SendChatMessage(sIRCMessage, text[2]); return; } for (int x = 0; x < channel.Length; x++) { if (channel[x] == sIRCMessage.Info[7].ToLower()) { continue; } data += SchumixBase.Comma + channel[x]; } SchumixBase.DManager.Update("hginfo", string.Format("Channel = '{0}'", data.Remove(0, 1, SchumixBase.Comma)), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else { sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } } else if (sIRCMessage.Info[4].ToLower() == "add") { var text = sLManager.GetCommandTexts("hg/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("UrlMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (sIRCMessage.Info.Length < 8) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WebsiteNameMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sIRCMessage.ServerName); if (db.IsNull()) { bool started = false; foreach (var list in RssList) { if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if (list.Started) { started = true; continue; } list.Start(); started = true; } } if (!started) { var rss = new HgRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[5]), sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower())); RssList.Add(rss); rss.Start(); } SchumixBase.DManager.Insert("`hginfo`(ServerId, ServerName, Name, Link, Website)", sIRCMessage.ServerId, sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[5]), sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower())); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else { sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } else if (sIRCMessage.Info[4].ToLower() == "remove") { var text = sLManager.GetCommandTexts("hg/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; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sIRCMessage.ServerName); if (!db.IsNull()) { HgRss gitr = null; bool isstop = false; foreach (var list in RssList) { if (sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if (!list.Started) { isstop = true; continue; } list.Stop(); gitr = list; isstop = true; } } if (isstop && !gitr.IsNull()) { RssList.Remove(gitr); } SchumixBase.DManager.Delete("hginfo", string.Format("Name = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5]), 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("hg/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("StatusIsMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!sIRCMessage.Info[7].IsBoolean()) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ValueIsNotTrueOrFalse", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT Colors FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if (!db.IsNull()) { bool enabled = db["Colors"].ToBoolean(); if (sIRCMessage.Info[7].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("hginfo", string.Format("Colors = '{0}'", sIRCMessage.Info[7].ToLower()), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else { sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } else if (sIRCMessage.Info[5].ToLower() == "shorturl") { var text = sLManager.GetCommandTexts("hg/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("StatusIsMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!sIRCMessage.Info[7].IsBoolean()) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ValueIsNotTrueOrFalse", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT ShortUrl FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if (!db.IsNull()) { bool enabled = db["ShortUrl"].ToBoolean(); if (sIRCMessage.Info[7].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("hginfo", string.Format("ShortUrl = '{0}'", sIRCMessage.Info[7].ToLower()), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else { sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } else if (sIRCMessage.Info[5].ToLower() == "url") { var text = sLManager.GetCommandTexts("hg/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("UrlMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if (!db.IsNull()) { sSendMessage.SendChatMessage(sIRCMessage, text[0]); return; } SchumixBase.DManager.Update("hginfo", string.Format("Link = '{0}'", sUtilities.SqlEscape(sIRCMessage.Info[7])), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); HgRss gitr = null; bool isstop = false; foreach (var list in RssList) { if (sIRCMessage.Info[6].ToLower() == list.Name.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 hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sIRCMessage.Info[6].ToLower(), sIRCMessage.ServerName); if (!db1.IsNull()) { var rss = new HgRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[6]), 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("hg/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("WebsiteNameMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if (!db.IsNull()) { sSendMessage.SendChatMessage(sIRCMessage, text[0]); return; } SchumixBase.DManager.Update("hginfo", string.Format("Website = '{0}'", sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower())), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); HgRss gitr = null; bool isstop = false; foreach (var list in RssList) { if (sIRCMessage.Info[6].ToLower() == list.Name.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 hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sIRCMessage.Info[6].ToLower(), sIRCMessage.ServerName); if (!db1.IsNull()) { var rss = new HgRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[6]), db1["Link"].ToString(), db1["Website"].ToString()); RssList.Add(rss); rss.Start(); } sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } }
public void HandleHg(IRCMessage sIRCMessage) { var sSendMessage = sIrcBase.Networks[sIRCMessage.ServerName].sSendMessage; if(IsWarningAdmin(sIRCMessage.Nick, sIRCMessage.Host, AdminFlag.Operator)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WarningAdmin", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } 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("hg/info", sIRCMessage.Channel, sIRCMessage.ServerName); if(text.Length < 2) { sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName))); return; } var db = SchumixBase.DManager.Query("SELECT Name, Channel FROM hginfo WHERE ServerName = '{0}'", sIRCMessage.ServerName); if(!db.IsNull()) { if(db.Rows.Count == 0) { sSendMessage.SendChatMessage(sIRCMessage, text[1], sLConsole.Other("Nothing", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName))); return; } foreach(DataRow row in db.Rows) { bool started = false; string name = row["Name"].ToString(); string[] channel = row["Channel"].ToString().Split(SchumixBase.Comma); foreach(var list in RssList) { if(name.ToLower() == list.Name.ToLower()) { if(list.Started) started = true; break; } } if(channel.SplitToString(SchumixBase.Space).IsNullOrEmpty()) sSendMessage.SendChatMessage(sIRCMessage, text[0], started ? sLConsole.Other("Started", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)) : sLConsole.Other("Stopped", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)), name, sLConsole.Other("Nothing", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName))); else sSendMessage.SendChatMessage(sIRCMessage, text[0], started ? sLConsole.Other("Started", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)) : sLConsole.Other("Stopped", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)), name, 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 FROM hginfo WHERE ServerName = '{0}'", sIRCMessage.ServerName); if(!db.IsNull()) { if(db.Rows.Count == 0) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("hg/list", sIRCMessage.Channel, sIRCMessage.ServerName), sLConsole.Other("Nothing", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName))); return; } foreach(DataRow row in db.Rows) sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetCommandText("hg/list", sIRCMessage.Channel, sIRCMessage.ServerName), row["Name"].ToString()); } else sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("FaultyQuery", sIRCMessage.Channel, sIRCMessage.ServerName)); } else if(sIRCMessage.Info[4].ToLower() == "start") { var text = sLManager.GetCommandTexts("hg/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; } foreach(var list in RssList) { if(sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if(list.Started) { sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name); return; } list.Start(); sSendMessage.SendChatMessage(sIRCMessage, text[1], list.Name); return; } } sSendMessage.SendChatMessage(sIRCMessage, text[2], sIRCMessage.Info[5]); } else if(sIRCMessage.Info[4].ToLower() == "stop") { var text = sLManager.GetCommandTexts("hg/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; } foreach(var list in RssList) { if(sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if(!list.Started) { sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name); return; } list.Stop(); sSendMessage.SendChatMessage(sIRCMessage, text[1], list.Name); return; } } sSendMessage.SendChatMessage(sIRCMessage, text[2], sIRCMessage.Info[5]); } 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("hg/reload/all", sIRCMessage.Channel, sIRCMessage.ServerName)); } else { var text = sLManager.GetCommandTexts("hg/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; } foreach(var list in RssList) { if(sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { list.Reload(); sSendMessage.SendChatMessage(sIRCMessage, text[0], list.Name); return; } } sSendMessage.SendChatMessage(sIRCMessage, text[1], sIRCMessage.Info[5]); } } 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("hg/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("NoChannelName", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if(!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[7])) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT Channel FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), 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[7].ToLower())) { sSendMessage.SendChatMessage(sIRCMessage, text[2]); return; } if(channel.Length == 1 && data.IsNullOrEmpty()) data += sIRCMessage.Info[7].ToLower(); else data += SchumixBase.Comma + sIRCMessage.Info[7].ToLower(); SchumixBase.DManager.Update("hginfo", string.Format("Channel = '{0}'", data), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else sSendMessage.SendChatMessage(sIRCMessage, text[1]); } else if(sIRCMessage.Info[5].ToLower() == "remove") { var text = sLManager.GetCommandTexts("hg/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("NoChannelName", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if(!Rfc2812Util.IsValidChannelName(sIRCMessage.Info[7])) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NotaChannelHasBeenSet", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT Channel FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(!db.IsNull()) { string[] channel = db["Channel"].ToString().Split(SchumixBase.Comma); string data = string.Empty; if(!channel.ToList().Contains(sIRCMessage.Info[7].ToLower())) { sSendMessage.SendChatMessage(sIRCMessage, text[2]); return; } for(int x = 0; x < channel.Length; x++) { if(channel[x] == sIRCMessage.Info[7].ToLower()) continue; data += SchumixBase.Comma + channel[x]; } SchumixBase.DManager.Update("hginfo", string.Format("Channel = '{0}'", data.Remove(0, 1, SchumixBase.Comma)), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } else if(sIRCMessage.Info[4].ToLower() == "add") { var text = sLManager.GetCommandTexts("hg/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("UrlMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if(sIRCMessage.Info.Length < 8) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("WebsiteNameMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sIRCMessage.ServerName); if(db.IsNull()) { bool started = false; foreach(var list in RssList) { if(sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if(list.Started) { started = true; continue; } list.Start(); started = true; } } if(!started) { var rss = new HgRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[5]), sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower())); RssList.Add(rss); rss.Start(); } SchumixBase.DManager.Insert("`hginfo`(ServerId, ServerName, Name, Link, Website)", sIRCMessage.ServerId, sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[5]), sUtilities.SqlEscape(sIRCMessage.Info[6]), sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower())); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else sSendMessage.SendChatMessage(sIRCMessage, text[1]); } else if(sIRCMessage.Info[4].ToLower() == "remove") { var text = sLManager.GetCommandTexts("hg/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; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5].ToLower()), sIRCMessage.ServerName); if(!db.IsNull()) { HgRss gitr = null; bool isstop = false; foreach(var list in RssList) { if(sIRCMessage.Info[5].ToLower() == list.Name.ToLower()) { if(!list.Started) { isstop = true; continue; } list.Stop(); gitr = list; isstop = true; } } if(isstop && !gitr.IsNull()) RssList.Remove(gitr); SchumixBase.DManager.Delete("hginfo", string.Format("Name = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[5]), 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("hg/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("StatusIsMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if(!sIRCMessage.Info[7].IsBoolean()) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ValueIsNotTrueOrFalse", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT Colors FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(!db.IsNull()) { bool enabled = db["Colors"].ToBoolean(); if(sIRCMessage.Info[7].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("hginfo", string.Format("Colors = '{0}'", sIRCMessage.Info[7].ToLower()), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else sSendMessage.SendChatMessage(sIRCMessage, text[1]); } else if(sIRCMessage.Info[5].ToLower() == "shorturl") { var text = sLManager.GetCommandTexts("hg/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("StatusIsMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if(!sIRCMessage.Info[7].IsBoolean()) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ValueIsNotTrueOrFalse", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT ShortUrl FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(!db.IsNull()) { bool enabled = db["ShortUrl"].ToBoolean(); if(sIRCMessage.Info[7].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("hginfo", string.Format("ShortUrl = '{0}'", sIRCMessage.Info[7].ToLower()), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); sSendMessage.SendChatMessage(sIRCMessage, text[0]); } else sSendMessage.SendChatMessage(sIRCMessage, text[1]); } else if(sIRCMessage.Info[5].ToLower() == "url") { var text = sLManager.GetCommandTexts("hg/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("UrlMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(db.IsNull()) { sSendMessage.SendChatMessage(sIRCMessage, text[0]); return; } var db0 = SchumixBase.DManager.QueryFirstRow("SELECT Link FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(!db0.IsNull()) { if(sUtilities.SqlEscape(sIRCMessage.Info[7]) == db0["Link"].ToString()) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("TheGivenUrlIsntDifferent", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } } SchumixBase.DManager.Update("hginfo", string.Format("Link = '{0}'", sUtilities.SqlEscape(sIRCMessage.Info[7])), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); HgRss gitr = null; bool isstop = false; foreach(var list in RssList) { if(sIRCMessage.Info[6].ToLower() == list.Name.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 hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(!db1.IsNull()) { var rss = new HgRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[6]), 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("hg/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("WebsiteNameMissing", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } var db = SchumixBase.DManager.QueryFirstRow("SELECT 1 FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(db.IsNull()) { sSendMessage.SendChatMessage(sIRCMessage, text[0]); return; } var db0 = SchumixBase.DManager.QueryFirstRow("SELECT Website FROM hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(!db0.IsNull()) { if(sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower()) == db0["Website"].ToString()) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("TheGivenWebsiteIsntDifferent", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } } bool rsslb = false; foreach(var rsslist in Enum.GetNames(typeof(RssWebsiteList))) { if(sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower()) == rsslist.ToLower()) { rsslb = true; break; } } if(!rsslb) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ThisIsntInTheWebsiteList", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } SchumixBase.DManager.Update("hginfo", string.Format("Website = '{0}'", sUtilities.SqlEscape(sIRCMessage.Info[7].ToLower())), string.Format("LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName)); HgRss gitr = null; bool isstop = false; foreach(var list in RssList) { if(sIRCMessage.Info[6].ToLower() == list.Name.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 hginfo WHERE LOWER(Name) = '{0}' And ServerName = '{1}'", sUtilities.SqlEscape(sIRCMessage.Info[6].ToLower()), sIRCMessage.ServerName); if(!db1.IsNull()) { var rss = new HgRss(sIRCMessage.ServerName, sUtilities.SqlEscape(sIRCMessage.Info[6]), db1["Link"].ToString(), db1["Website"].ToString()); RssList.Add(rss); rss.Start(); } sSendMessage.SendChatMessage(sIRCMessage, text[1]); } } }