public override string Extension_DumpHtml(config.channel channel) { string HTML = ""; if (GetConfig(channel, "Rss.Enable", false)) { Feed list = (Feed)channel.RetrieveObject("rss"); if (list == null) { return ""; } if (GetConfig(channel, "Rss.Enable", false) != true) { return HTML; } HTML += "<h4>Rss feed</h4><br>"; HTML += "\n<br>\n<h4>Rss</h4>\n<br>\n\n<table class=\"infobot\" width=100% border=1>"; HTML += "<tr><th>Name</th><th>URL</th><th>Text</th><th>Enabled</th></tr>"; lock (list.Content) { foreach (Feed.item feed in list.Content) { HTML += "\n<tr><td>" + feed.name + "</td><td><a href=\"" + feed.URL + "\">" + feed.URL + "</a></td><td>" + feed.message + "</td><td>" + (!feed.disabled).ToString() + "</td></tr>"; } } HTML += "</table>\n"; } return HTML; }
public override void Hook_Channel(config.channel channel) { if (channel.RetrieveObject("Statistics") == null) { channel.RegisterObject(new Statistics(channel), NAME); } }
public override void Hook_PRIV(config.channel channel, User invoker, string message) { if (message.StartsWith("!") && message.Contains("|")) { DebugLog("Parsing: " + message, 6); string user = message.Substring(message.IndexOf("|") + 1); user = user.Trim(); DebugLog("Parsed user - " + user, 6); if (user.Contains(" ")) { user = user.Substring(0, user.IndexOf(" ")); } if (user != "") { DebugLog("Adding user to list " + user, 6); Ring.Add(new Buffer.Item(invoker.Nick, user)); } } else { message = message.ToLower(); if (message.Contains(channel.instance.Nick) && !message.Contains("thanks to") && (message.Contains("thanks") || message.Contains("thank you")) && !message.Contains("no thank")) { string response = "Hey " + invoker.Nick + ", you are welcome!"; Buffer.Item x = Ring.getUser(invoker.Nick); DebugLog("Checking if user was recently informed using infobot"); if (x != null) { response = "Hey " + invoker.Nick + ", you are welcome, but keep in mind I am just a stupid bot, it was actually " + x.User + " who helped you :-)"; Ring.Delete(x); } core.irc._SlowQueue.DeliverMessage(response, channel); } } }
public override void Hook_Channel(config.channel channel) { if (channel.RetrieveObject("RC") == null) { channel.RegisterObject(new RecentChanges(channel), "RC"); } }
public override void Hook_Channel(config.channel channel) { if (channel.RetrieveObject("rss") == null) { channel.RegisterObject(new Feed(channel), "rss"); } }
public override void Hook_Nick(config.channel channel, User Target, string OldNick) { Notification result = Notification.RetrieveTarget(Target.Nick); while (result != null) { core.irc._SlowQueue.DeliverMessage(result.Source_Name + "! " + OldNick + " just changed nicknames to " + Target.Nick + " which you wanted to talk with, in " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low); lock (Notification.NotificationList) { Notification.NotificationList.Remove(result); } result = Notification.RetrieveTarget(Target.Nick); } result = Notification.RetrieveTarget(OldNick); while (result != null) { core.irc._SlowQueue.DeliverMessage(result.Source_Name + "! " + OldNick + " just changed a nickname to " + Target.Nick + " which you wanted to talk with, in " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low); lock (Notification.NotificationList) { Notification.NotificationList.Remove(result); } result = Notification.RetrieveTarget(OldNick); } if (Target.Nick.ToLower() != OldNick.ToLower()) { result = Notification.RetrieveSource(OldNick); while (result != null) { result.Source_Name = Target.Nick; result = Notification.RetrieveSource(OldNick); } } }
/// <summary> /// Join channel /// </summary> /// <param name="chan">Channel</param> /// <param name="user">User</param> /// <param name="host">Host</param> /// <param name="message">Message</param> public static void addChannel(config.channel chan, string user, string host, string message) { try { if (message.StartsWith(config.CommandPrefix + "add")) { if (chan.Users.IsApproved(user, host, "admin")) { while (!core.FinishedJoining) { core.Log("Postponing request to join because bot is still loading", true); Thread.Sleep(2000); } if (message.Contains(" ")) { string channel = message.Substring(message.IndexOf(" ") + 1); if (!validFile(channel) || (channel.Contains("#") == false)) { irc._SlowQueue.DeliverMessage(messages.get("InvalidName", chan.Language), chan.Name); return; } lock (config.channels) { foreach (config.channel cu in config.channels) { if (channel == cu.Name) { irc._SlowQueue.DeliverMessage(messages.get("ChannelIn", chan.Language), chan.Name); return; } } } bool existing = config.channel.channelExist(channel); config.channel xx = new config.channel(channel); lock (config.channels) { config.channels.Add(xx); } config.Save(); xx.instance.irc.SendData("JOIN " + channel); Thread.Sleep(100); config.channel Chan = getChannel(channel); if (!existing) { Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + IRCTrust.normalize(host)); } return; } irc.Message(messages.get("InvalidName", chan.Language), chan.Name); return; } irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", chan.Language), chan.Name); } } catch (Exception b) { handleException(b); } }
public override void Hook_PRIV(config.channel channel, User invoker, string message) { if (message == "@replag") { core.irc._SlowQueue.DeliverMessage("Replication lag is approximately " + GetReplag(), channel); return; } }
public override void Hook_ChannelDrop(config.channel chan) { if (File.Exists(variables.config + Path.DirectorySeparatorChar + chan.Name + ".list")) { core.Log("RC: Removing db of " + chan.Name + " RC feed"); File.Delete(variables.config + Path.DirectorySeparatorChar + chan.Name + ".list"); } }
public string Format(string name_url, string url, string page, string username, string link, string summary, config.channel chan) { if (GetConfig(chan, "RC.Template", "") == "") { return messages.get("fl", chan.Language, new List<string> { "12" + name_url + "", "" + page + "", "" + username + "", url + "?diff=" + link, summary }); } return GetConfig(chan, "RC.Template", "").Replace("$wiki", name_url).Replace("$url", url).Replace("$link", link).Replace("$username", username).Replace("$page", page).Replace("$summary", summary); }
public RecentChanges(config.channel _channel) { channel = _channel; changed = false; Load(); lock (rc) { rc.Add(this); } }
/// <summary> /// Constructor /// </summary> /// <param name="channel"></param> public HtmlDump(config.channel channel) { dumpname = config.DumpDir + "/" + channel.Name + ".htm"; if (!System.IO.Directory.Exists(config.DumpDir)) { core.Log("Creating a directory for dump"); System.IO.Directory.CreateDirectory(config.DumpDir); } Channel = channel; }
/// <summary> /// /// </summary> /// <param name="chan">Channel</param> /// <param name="user">User</param> /// <param name="host">Host</param> /// <param name="message">Message</param> public static void addChannel(config.channel chan, string user, string host, string message) { try { if (message.StartsWith("@add")) { if (chan.Users.isApproved(user, host, "admin")) { if (message.Contains(" ")) { string channel = message.Substring(message.IndexOf(" ") + 1); if (!validFile(channel) || (channel.Contains("#") == false)) { irc._SlowQueue.DeliverMessage(messages.get("InvalidName", chan.Language), chan.Name); return; } lock (config.channels) { foreach (config.channel cu in config.channels) { if (channel == cu.Name) { irc._SlowQueue.DeliverMessage(messages.get("ChannelIn", chan.Language), chan.Name); return; } } } bool existing = config.channel.channelExist(channel); lock (config.channels) { config.channels.Add(new config.channel(channel)); } config.Save(); irc.wd.WriteLine("JOIN " + channel); irc.wd.Flush(); Thread.Sleep(100); config.channel Chan = getChannel(channel); if (!existing) { Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + IRCTrust.normalize(host)); } return; } irc.Message(messages.get("InvalidName", chan.Language), chan.Name); return; } irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", chan.Language), chan.Name); return; } } catch (Exception b) { handleException(b); } }
public override string Extension_DumpHtml(config.channel channel) { string HTML = ""; if (Module.GetConfig(channel, "Statistics.Enabled", false)) { Statistics list = (Statistics)channel.RetrieveObject(NAME); if (list != null) { HTML += "\n<br>\n<h4>Most active users :)</h4>\n<br>\n\n<table class=\"infobot\" width=100% border=1>"; HTML += "<tr><td>N.</td><th>Nick</th><th>Messages (average / day)</th><th>Number of posted messages</th><th>Active since</th></tr>"; int id = 0; int totalms = 0; DateTime startime = DateTime.Now; lock (list.data) { list.data.Sort(); list.data.Reverse(); foreach (Statistics.list user in list.data) { id++; totalms += user.messages; if (id > 100) { continue; } if (startime > user.logging_since) { startime = user.logging_since; } System.TimeSpan uptime = System.DateTime.Now - user.logging_since; float average = user.messages; average = ((float)user.messages / (float)(uptime.Days + 1)); if (user.URL != "") { HTML += "<tr><td>" + id.ToString() + ".</td><td><a target=\"_blank\" href=\"" + user.URL + "\">" + user.user + "</a></td><td>" + average.ToString() + "</td><td>" + user.messages.ToString() + "</td><td>" + user.logging_since.ToString() + "</td></tr>"; } else { HTML += "<tr><td>" + id.ToString() + ".</td><td>" + user.user + "</td><td>" + average.ToString() + "</td><td>" + user.messages.ToString() + "</td><td>" + user.logging_since.ToString() + "</td></tr>"; } HTML += " \n"; } } System.TimeSpan uptime_total = System.DateTime.Now - startime; float average2 = totalms; average2 = (float)totalms / (1 + uptime_total.Days); HTML += "<tr><td>N/A</td><th>Total:</th><th>" + average2.ToString() + "</th><th>" + totalms.ToString() + "</th><td>N/A</td></tr>"; HTML += " \n"; HTML += "</table>"; } } return HTML; }
public override void Hook_Kick(config.channel channel, User source, User user) { Notification result = Notification.RetrieveTarget(user.Nick); while (result != null) { core.irc._SlowQueue.DeliverMessage(result.Source_Name + "! " + user.Nick + " just got kicked from " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low); lock (Notification.NotificationList) { Notification.NotificationList.Remove(result); } result = Notification.RetrieveTarget(user.Nick); } }
public override string Extension_DumpHtml(config.channel channel) { string HTML = ""; if (GetConfig(channel, "RC.Enabled", false)) { RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC"); if (rc != null) { HTML = rc.ToTable(); } } return HTML; }
public static bool Linkable(config.channel host, config.channel guest) { if (host == null) { return false; } if (guest == null) { return false; } if (host.sharedlink.Contains(guest)) { return true; } return false; }
public void GetOp(config.channel chan) { if (!GetConfig(chan, "OP.Permanent", false)) { chan.instance.irc._SlowQueue.Send("CS op " + chan.Name, IRC.priority.high); return; } // get our user User user = chan.RetrieveUser(chan.instance.Nick); if (user == null) { chan.instance.irc._SlowQueue.Send("CS op " + chan.Name, IRC.priority.high); return; } if (!user.IsOperator) { chan.instance.irc._SlowQueue.Send("CS op " + chan.Name, IRC.priority.high); } }
public override string Extension_DumpHtml(config.channel channel) { string HTML = ""; infobot_core info = (infobot_core)channel.RetrieveObject("Infobot"); if (info != null) { HTML += "\n<table border=1 class=\"infobot\" width=100%>\n<tr><th width=10%>Key</th><th>Value</th></tr>\n"; List<infobot_core.InfobotKey> list = new List<infobot_core.InfobotKey>(); info.locked = true; lock (info.Keys) { if (Module.GetConfig(channel, "Infobot.Sorted", false) != false) { list = info.SortedItem(); } else { list.AddRange(info.Keys); } } if (info.Keys.Count > 0) { foreach (infobot_core.InfobotKey Key in list) { HTML += core.HTML.AddKey(Key.Key, Key.Text); } } HTML += "</table>\n"; HTML += "<h4>Aliases</h4>\n<table class=\"infobot\" border=1 width=100%>\n"; lock (info.Alias) { foreach (infobot_core.InfobotAlias data in info.Alias) { HTML += core.HTML.AddLink(data.Name, data.Key); } } HTML += "</table><br>\n"; info.locked = false; } return HTML; }
public override void Hook_PRIV(config.channel channel, User invoker, string message) { chanLog(message, channel, invoker.Nick, invoker.Host); if (message == "@logon") { if (channel.Users.isApproved(invoker.Nick, invoker.Host, "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 == "@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 override void Hook_OnSelf(config.channel channel, User self, string message) { chanLog(message, channel, config.username, ""); }
public override void Hook_ACTN(config.channel channel, User invoker, string message) { chanLog(message, channel, invoker.Nick, invoker.Host, false); }
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 override void Hook_PRIV(config.channel channel, User invoker, string message) { if (message.StartsWith(config.CommandPrefix + "RC-")) { if (channel.Users.IsApproved(invoker, "trust")) { if (GetConfig(channel, "RC.Enabled", false)) { string[] a = message.Split(' '); if (a.Length < 3) { core.irc._SlowQueue.DeliverMessage(messages.get("Feed8", channel.Language, new List<string> { invoker.Nick }), channel.Name); return; } string wiki = a[1]; string Page = a[2]; RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC"); if (rc != null) { rc.removeString(wiki, Page); } return; } else { core.irc._SlowQueue.DeliverMessage(messages.get("Feed3", channel.Language), channel.Name); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low); } return; } if (message.StartsWith(config.CommandPrefix + "recentchanges- ")) { if (channel.Users.IsApproved(invoker, "root")) { if (GetConfig(channel, "RC.Enabled", false)) { if (!message.Contains(" ")) { if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("InvalidWiki", channel.Language), channel.Name); } return; } string _channel = message.Substring(message.IndexOf(" ") + 1); if (RecentChanges.DeleteChannel(channel, _channel)) { core.irc._SlowQueue.DeliverMessage(messages.get("Wiki-", channel.Language), channel.Name, IRC.priority.high); } return; } else { core.irc._SlowQueue.DeliverMessage(messages.get("Feed3", channel.Language), channel.Name); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low); } return; } if (message.StartsWith(config.CommandPrefix + "RC+ ")) { if (channel.Users.IsApproved(invoker, "trust")) { if (GetConfig(channel, "RC.Enabled", false)) { string[] a = message.Split(' '); if (a.Length < 3) { core.irc._SlowQueue.DeliverMessage(messages.get("Feed4", channel.Language) + invoker.Nick + messages.get("Feed5", channel.Language), channel.Name); return; } string wiki = a[1]; string Page = a[2]; RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC"); if (rc != null) { rc.insertString(wiki, Page); } return; } else { core.irc._SlowQueue.DeliverMessage(messages.get("Feed3", channel.Language), channel.Name); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low); } return; } if (message == config.CommandPrefix + "recentchanges-off") { if (channel.Users.IsApproved(invoker, "admin")) { if (!GetConfig(channel, "RC.Enabled", false)) { core.irc._SlowQueue.DeliverMessage(messages.get("Feed6", channel.Language), channel.Name); return; } else { core.irc._SlowQueue.DeliverMessage(messages.get("Feed7", channel.Language), channel.Name); SetConfig(channel, "RC.Enabled", false); 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 + "recentchanges-on") { if (channel.Users.IsApproved(invoker, "recentchanges-manage")) { if (GetConfig(channel, "RC.Enabled", false)) { core.irc._SlowQueue.DeliverMessage(messages.get("Feed1", channel.Language), channel.Name); return; } else { core.irc._SlowQueue.DeliverMessage(messages.get("Feed2", channel.Language), channel.Name); SetConfig(channel, "RC.Enabled", true); channel.SaveConfig(); config.Save(); return; } } if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low); } return; } if (message.StartsWith(config.CommandPrefix + "recentchanges+")) { if (channel.Users.IsApproved(invoker, "recentchanges-manage")) { if (GetConfig(channel, "RC.Enabled", false)) { if (!message.Contains(" ")) { if (!channel.suppress_warnings) { core.irc._SlowQueue.DeliverMessage(messages.get("InvalidWiki", channel.Language), channel.Name); } return; } string _channel = message.Substring(message.IndexOf(" ") + 1); if (RecentChanges.InsertChannel(channel, _channel)) { core.irc._SlowQueue.DeliverMessage(messages.get("Wiki+", channel.Language), channel.Name); } return; } else { core.irc._SlowQueue.DeliverMessage(messages.get("Feed3", 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 override bool Hook_GetConfig(config.channel chan, User invoker, string config) { switch (config) { case "recent-changes-template": core.irc._SlowQueue.DeliverMessage("Value of " + config + " is: " + GetConfig(chan, "RC.Template", "<default value>"), chan); return true; } return false; }
public Feed(config.channel _owner) { DB = variables.config + "/" + _owner.Name + "_feed.xml"; owner = _owner; Load(); }
public override void Hook_Channel(config.channel channel) { core.Log("Loading " + channel.Name); if (channel == null) { core.Log("NULL"); } if (Snapshots) { try { if (Directory.Exists(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name) == false) { core.Log("Creating directory for infobot for " + channel.Name); Directory.CreateDirectory(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name); } } catch (Exception fail) { core.handleException(fail); } } if (channel.RetrieveObject("Infobot") == null) { // sensitivity bool cs = Module.GetConfig(channel, "Infobot.Case", true); channel.RegisterObject(new infobot_core(getDB(ref channel), channel.Name, cs), "Infobot"); } }
/// <summary> /// Log file /// </summary> /// <param name="message">Message</param> /// <param name="channel">Channel</param> /// <param name="user">User</param> /// <param name="host">Host</param> /// <param name="noac">Action (if true it's logged as message, if false it's action)</param> public void chanLog(string message, config.channel channel, string user, string host, bool noac = true) { try { if (Module.GetConfig(channel, "Logging.Enabled", false)) { lock (jobs) { string log; string URL = core.Host.Host2Name(host); string srcs = ""; string messagehtml = System.Web.HttpUtility.HtmlEncode(message); updateHttp(ref messagehtml); //updateBold(ref messagehtml); if (!noac) { if (URL != "") { srcs = "<font class=\"date\"><b>" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "</b></font><font>* <a target=\"_blank\" href=\"" + URL + "\">" + user + "</a> " + messagehtml + "</font><br>\n"; } else { srcs = "<font class=\"date\"><b>" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "</b></font><font>* " + user + " " + messagehtml + "</font><br>\n"; } log = "[" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "] * " + user + " " + message + "\n"; } else { if (URL != "") { srcs = "<font class=\"date\"><b>" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "</b></font><font class=\"nick\"><b> <<a target=\"_blank\" href=\"" + URL + "\">" + user + "</a>> </b></font><font>" + messagehtml + "</font><br>\n"; } else { srcs = "<font class=\"date\"><b>" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "</b></font><font class=\"nick\"><b> <" + user + "> </b></font><font>" + messagehtml + "</font><br>\n"; } log = "[" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "] " + "<" + user + ">\t " + message + "\n"; } Job line = new Job(); line.ch = channel; line.time = DateTime.Now; line.HTML = srcs; line.message = log; jobs.Add(line); } } } catch (Exception er) { // nothing handleException(er); } }
private bool writeLog(string message, string html, config.channel channel, System.DateTime _datetime) { try { System.IO.File.AppendAllText(config.path_txt + channel.LogDir + _datetime.Year + timedateToString(_datetime.Month) + timedateToString(_datetime.Day) + ".txt", message); System.IO.File.AppendAllText(config.path_htm + channel.LogDir + _datetime.Year + timedateToString(_datetime.Month) + timedateToString(_datetime.Day) + ".htm", html); return true; } catch (Exception er) { // nothing Log("Unable to write to log files, delaying write!", true); Console.WriteLine(er.Message); } return false; }
public string Format(string name_url, string url, string page, string username, string link, string summary, config.channel chan, bool bot, bool New, bool minor) { if (GetConfig(chan, "RC.Template", "") == "") { if (!New) { return messages.get("fl", chan.Language, new List<string> { "12" + name_url + "", "" + page + "", "" + username + "", url + "?diff=" + link, summary }); } return messages.get("fl", chan.Language, new List<string> { "12" + name_url + "", "" + page + "", "" + username + "", url + "?title=" + name_url, summary }); } string action = "modified"; string flags = ""; if (minor) { flags += "minor edit, "; } if (New) { flags += "new page, "; action = "created"; } if (bot) { flags += "bot edit"; } if (flags.EndsWith(", ")) { flags = flags.Substring(0, flags.Length - 2); } string fu = url + "?diff=" + link; if (New) { fu = url + "?title=" + System.Web.HttpUtility.UrlEncode(page).Replace("+", "_"); } return GetConfig(chan, "RC.Template", "").Replace("$wiki", name_url) .Replace("$encoded_wiki_page", System.Web.HttpUtility.UrlEncode(page).Replace("+", "_").Replace("%3a", ":").Replace("%2f", "/").Replace("%28", "(").Replace("%29", ")")) .Replace("$encoded_wiki_username", System.Web.HttpUtility.UrlEncode(username).Replace("+", "_").Replace("%3a", ":").Replace("%2f", "/").Replace("%28", "(").Replace("%29", ")")) .Replace("$encoded_page", System.Web.HttpUtility.UrlEncode(page)) .Replace("$encoded_username", System.Web.HttpUtility.UrlEncode(username)) .Replace("$url", url) .Replace("$link", link) .Replace("$fullurl", fu) .Replace("$username", username) .Replace("$page", page) .Replace("$summary", summary) .Replace("$flags", flags) .Replace("$action", action); }