From 120035a5c174263afd9358c7a77fa542670840d5 Mon Sep 17 00:00:00 2001 From: Terence Simpson Date: Thu, 4 Aug 2011 13:30:34 +0100 Subject: [PATCH] $nick apparently was ubottu-specific, now it's in bzr Also added $who which will be replaced with the callers nick --- Encyclopedia/plugin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Encyclopedia/plugin.py b/Encyclopedia/plugin.py index f1145c2..58c53d5 100644 --- a/Encyclopedia/plugin.py +++ b/Encyclopedia/plugin.py @@ -170,6 +170,7 @@ class Encyclopedia(callbacks.Plugin): self.times = {} self.edits = {} self.alert = False + self.defaultIrc = irc def addeditor(self, irc, msg, args, name): """ @@ -526,7 +527,7 @@ class Encyclopedia(callbacks.Plugin): text, target, retmsg = self.get_target(msg.nick, orig_text, target) if text.startswith('bug ') and text != ('bug 1'): return - ret = self.factoid_lookup(text, channel, display_info, display_raw) + ret = self.factoid_lookup(text, channel, display_info, display_raw, msg.nick) if not ret: if len(text) > 15: @@ -594,7 +595,7 @@ class Encyclopedia(callbacks.Plugin): L = [] for factoid in factoids: - result = self.factoid_lookup(factoid.strip(prefix), channel, False) + result = self.factoid_lookup(factoid.strip(prefix), channel, False, False, nick) L.extend(result) if not L: @@ -716,7 +717,7 @@ class Encyclopedia(callbacks.Plugin): db.commit() return "I'll remember that, %s" % editor[:editor.find('!')] - def factoid_lookup(self, text, channel, display_info, display_raw=False): + def factoid_lookup(self, text, channel, display_info, display_raw, msgNick): def subvars(val): curStable = self.registryValue('curStable') curStableLong = self.registryValue('curStableLong') @@ -727,6 +728,8 @@ class Encyclopedia(callbacks.Plugin): curDevel = self.registryValue('curDevel') curDevelLong = self.registryValue('curDevelLong') curDevelNum = self.registryValue('curDevelNum') + val = val.replace('$who',msgNick) + val = val.reaplce('$nick',self.defaultIrc.nick) val = val.replace('$chan',channel) val = val.replace('$curStableLong',curStableLong) val = val.replace('$curStableNum',curStableNum)