public override bool Hook_SetConfig(config.channel chan, User invoker, string config, string value) { switch (config) { case "recent-changes-template": if (value != "null") { Module.SetConfig(chan, "RC.Template", value); core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List <string> { value, config }), chan); chan.SaveConfig(); return(true); } else { Module.SetConfig(chan, "RC.Template", ""); core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List <string> { "null", config }), chan); chan.SaveConfig(); return(true); } } return(false); }
public void Stat(string nick, string message, string host) { if (Module.GetConfig(channel, "Statistics.Enabled", false)) { list user = null; lock (data) { foreach (list item in data) { if (nick.ToUpper() == item.user.ToUpper()) { user = item; break; } } } if (user == null) { user = new list(); user.user = nick; user.logging_since = DateTime.Now; lock (data) { data.Add(user); } } user.URL = core.Host.Host2Name(host); user.messages++; Module.SetConfig(channel, "HTML.Update", true); changed = true; Stored = false; } }
public override void Hook_PRIV(config.channel channel, User invoker, string message) { ChanLog(message, channel, invoker.Nick, invoker.Host); if (message == config.CommandPrefix + "logon") { if (channel.Users.IsApproved(invoker, "admin")) { if (Module.GetConfig(channel, "Logging.Enabled", false)) { core.irc._SlowQueue.DeliverMessage(messages.get("ChannelLogged", channel.Language), channel.Name); return; } else { core.irc._SlowQueue.DeliverMessage(messages.get("LoggingOn", channel.Language), channel.Name); Module.SetConfig(channel, "Logging.Enabled", true); channel.SaveConfig(); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low); } return; } if (message == config.CommandPrefix + "logoff") { if (channel.Users.IsApproved(invoker.Nick, invoker.Host, "admin")) { if (!Module.GetConfig(channel, "Logging.Enabled", false)) { core.irc._SlowQueue.DeliverMessage(messages.get("LogsE1", channel.Language), channel.Name); return; } else { Module.SetConfig(channel, "Logging.Enabled", false); channel.SaveConfig(); core.irc._SlowQueue.DeliverMessage(messages.get("NotLogged", channel.Language), channel.Name); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low); } return; } }
public bool insertString(string WS, string Page) { wiki site = getWiki(WS); Page = Page.Replace("_", " "); if (site != null) { if (WS == "all" || channels.Contains(site.channel)) { IWatch currpage = null; lock (pages) { foreach (IWatch iw in pages) { if (iw.Channel == site.channel && iw.Page == Page) { currpage = iw; break; } } } if (Page.Contains("*")) { if (!Page.EndsWith("*") || Page.Replace("*", "") == "") { core.irc._SlowQueue.DeliverMessage(messages.get("rcfeed8", channel.Language), channel.Name); return(true); } } if (pages.Contains(currpage)) { core.irc._SlowQueue.DeliverMessage(messages.get("rcfeed9", channel.Language), channel.Name); return(true); } lock (pages) { pages.Add(new IWatch(site, Page, site.channel)); } core.irc._SlowQueue.DeliverMessage(messages.get("rcfeed10", channel.Language), channel.Name); Module.SetConfig(channel, "HTML.Update", true); Save(); return(true); } core.irc._SlowQueue.DeliverMessage(messages.get("rcfeed11", channel.Language), channel.Name); return(false); } core.irc._SlowQueue.DeliverMessage(messages.get("rcfeed12", channel.Language), channel.Name); return(false); }
public bool removeString(string WS, string Page) { Page = Page.Replace("_", " "); wiki site = null; site = getWiki(WS); if (site != null) { if (WS == "all" || channels.Contains(site.channel)) { IWatch currpage = null; lock (pages) { foreach (IWatch iw in pages) { if (iw.Page == Page && site.channel == iw.Channel) { currpage = iw; break; } } } if (pages.Contains(currpage)) { while (!writable) { System.Threading.Thread.Sleep(100); } pages.Remove(currpage); Module.SetConfig(channel, "HTML.Update", true); Save(); core.irc._SlowQueue.DeliverMessage(messages.get("rcfeed4", channel.Language), channel.Name); return(true); } core.irc._SlowQueue.DeliverMessage(messages.get("rcfeed5", channel.Language), channel.Name); return(true); } core.irc._SlowQueue.DeliverMessage( messages.get("rcfeed6", channel.Language), channel.Name); return(false); } core.irc._SlowQueue.DeliverMessage( messages.get("rcfeed7", channel.Language), channel.Name); return(false); }
public override bool Hook_SetConfig(config.channel chan, User invoker, string config, string value) { bool _temp_a; switch (config) { case "infobot-trim-white-space-in-name": if (bool.TryParse(value, out _temp_a)) { Module.SetConfig(chan, "Infobot.Trim-white-space-in-name", _temp_a); core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List <string> { value, config }), chan.Name); chan.SaveConfig(); return(true); } core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List <string> { config, value }), chan.Name); return(true); case "infobot-auto-complete": if (bool.TryParse(value, out _temp_a)) { Module.SetConfig(chan, "Infobot.auto-complete", _temp_a); core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List <string> { value, config }), chan.Name); chan.SaveConfig(); return(true); } core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List <string> { config, value }), chan.Name); return(true); case "infobot-sorted": if (bool.TryParse(value, out _temp_a)) { Module.SetConfig(chan, "Infobot.Sorted", _temp_a); core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List <string> { value, config }), chan.Name); chan.SaveConfig(); return(true); } core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List <string> { config, value }), chan.Name); return(true); case "infobot-help": if (bool.TryParse(value, out _temp_a)) { Module.SetConfig(chan, "Infobot.Help", _temp_a); core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List <string> { value, config }), chan.Name); chan.SaveConfig(); return(true); } core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List <string> { config, value }), chan.Name); return(true); case "infobot-case": if (bool.TryParse(value, out _temp_a)) { Module.SetConfig(chan, "Infobot.Case", _temp_a); core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List <string> { value, config }), chan.Name); chan.SaveConfig(); infobot_core infobot = (infobot_core)chan.RetrieveObject("Infobot"); if (infobot != null) { infobot.Sensitive = _temp_a; } return(true); } core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List <string> { config, value }), chan.Name); return(true); } return(false); }
public override void Hook_PRIV(config.channel channel, User invoker, string message) { if (Module.GetConfig(channel, "Statistics.Enabled", false)) { Statistics st = (Statistics)channel.RetrieveObject("Statistics"); if (st != null) { st.Stat(invoker.Nick, message, invoker.Host); } } if (message == config.CommandPrefix + "statistics-off") { if (channel.Users.IsApproved(invoker, "admin")) { if (!Module.GetConfig(channel, "Statistics.Enabled", false)) { core.irc._SlowQueue.DeliverMessage(messages.get("StatE2", channel.Language), channel); return; } else { Module.SetConfig(channel, "Statistics.Enabled", false); channel.SaveConfig(); core.irc._SlowQueue.DeliverMessage(messages.get("Stat-off", channel.Language), channel); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel, IRC.priority.low); } return; } if (message == config.CommandPrefix + "statistics-reset") { if (channel.Users.IsApproved(invoker, "admin")) { Statistics st = (Statistics)channel.RetrieveObject("Statistics"); if (st != null) { st.Delete(); } core.irc._SlowQueue.DeliverMessage(messages.get("Statdt", channel.Language), channel); return; } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel, IRC.priority.low); } return; } if (message == config.CommandPrefix + "statistics-on") { if (channel.Users.IsApproved(invoker, "admin")) { if (Module.GetConfig(channel, "Statistics.Enabled", false)) { core.irc._SlowQueue.DeliverMessage(messages.get("StatE1", channel.Language), channel); return; } else { Module.SetConfig(channel, "Statistics.Enabled", true); channel.SaveConfig(); core.irc._SlowQueue.DeliverMessage(messages.get("Stat-on", channel.Language), channel); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low); } return; } }