CTFBot.Program.ReactToSourceEvent C# (CSharp) Method

ReactToSourceEvent() public static method

Reacts to the Source Event, passed from SourceReader. Remember: this runs in the SourceReader thread!
public static ReactToSourceEvent ( SourceEvent r ) : void
r SourceEvent
return void
        public static void ReactToSourceEvent(SourceEvent r)
        {
            Hashtable attribs = new Hashtable();
            String message = "";

            switch (r.eventtype)
            {
                case SourceEvent.EventType.cluereport:
                    attribs.Add("line", r.fullstring);
                    attribs.Add("title", r.title);
                    attribs.Add("user", r.user);
                    attribs.Add("listduration", targetBlacklistDuration);
                    attribs.Add("listreason", "Autoblacklist: " + r.reason + " by [[User:ClueBot_NG|ClueBot NG]] on [[" + r.title + "]] at " + targetWikiproject);
                    attribs.Add("reason", r.reason);
                    attribs.Add("diff", r.url.Replace("/w/index.php?diff=", "/?diff="));
                    attribs.Add("history", "http://" + targetWikiproject + ".org/?title=" + CTFUtils.wikiEncode(r.title) + "&action=history");
                    attribs.Add("contribs", "http://" + targetWikiproject + ".org/wiki/Special:Contributions/" + CTFUtils.wikiEncode(r.user));

                    // Feed the feedchannel
                    message = getMessage(10100, ref attribs);
                    SendMessageFMulti(SendType.Message, targetFeedChannel, message, false, true);

                        // If it was reverted by ClueBot, blacklist it
                        if (r.reverted == "Reverted")
                        {
                            message = getMessage(20001, ref attribs);
                            SendMessageFMulti(SendType.Message, targetCVNChannel, message, false, true);
                        } else {
                            // Else send a warning
                                // TODO: Some "Not Reverted" events shouldn't be
                                // relayed to #cvn-wp-en as "Possible ignored vandalism"
                                // namely these:
                                // reason: "User is myself"
                                // reason: "Beaten by *"
                            if (r.reason == "User is myself" || r.reason.Contains("Beaten by "))
                            {
                                // We don't report if the
                                // * edit was not reverted by the bot, but by someone else
                                // * edit was not reverted by the bot, and made by the bot
                            } else {
                                message = getMessage(20002, ref attribs);
                                message = message + "\n" + getMessage(20003, ref attribs);
                                SendMessageFMulti(SendType.Message, targetCVNChannel, message, false, true);
                            }
                        }
                    break;
                case SourceEvent.EventType.somethingelse:
                    attribs.Add("line", r.fullstring);
                    /// Dont report other stuff
                    message = "";// getMessage(10101, ref attribs);
                    break;
            }
        }