From 97e31b8a5d7fc45f26b4eddb7d043e35c2f93f58 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 28 Apr 2012 19:32:00 -0400 Subject: [PATCH] RC objects are now work correctly for non-enwiki sites --- earwigbot/irc/rc.py | 5 +++-- earwigbot/irc/watcher.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/earwigbot/irc/rc.py b/earwigbot/irc/rc.py index 67c0080..828a31d 100644 --- a/earwigbot/irc/rc.py +++ b/earwigbot/irc/rc.py @@ -33,7 +33,8 @@ class RC(object): pretty_edit = "\x02New {0}\x0F: \x0314[[\x0307{1}\x0314]]\x0306 * \x0303{2}\x0306 * \x0302{3}\x0306 * \x0310{4}" pretty_log = "\x02New {0}\x0F: \x0303{1}\x0306 * \x0302{2}\x0306 * \x0310{3}" - def __init__(self, msg): + def __init__(self, chan, msg): + self.chan = chan self.msg = msg def parse(self): @@ -51,7 +52,7 @@ class RC(object): # We're probably missing the http:// part, because it's a log # entry, which lacks a URL: page, flags, user, comment = self.re_log.findall(msg)[0] - url = "".join(("http://en.wikipedia.org/wiki/", page)) + url = "http://{0}.org/wiki/{1}".format(self.chan, page) self.is_edit = False # This is a log entry, not edit diff --git a/earwigbot/irc/watcher.py b/earwigbot/irc/watcher.py index 8a45dff..a508af5 100644 --- a/earwigbot/irc/watcher.py +++ b/earwigbot/irc/watcher.py @@ -61,7 +61,7 @@ class Watcher(IRCConnection): return msg = " ".join(line[3:])[1:] - rc = RC(msg) # New RC object to store this event's data + rc = RC(chan, msg) # New RC object to store this event's data rc.parse() # Parse a message into pagenames, usernames, etc. self._process_rc_event(rc)