From b36087137883506158568ae317fb70119e8ac755 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 30 May 2013 13:16:36 +0000 Subject: [PATCH] Google: Fix previous commit. --- plugins/Google/plugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py index 49b3a88e0..4aedfec1a 100644 --- a/plugins/Google/plugin.py +++ b/plugins/Google/plugin.py @@ -287,7 +287,7 @@ class Google(callbacks.PluginRegexp): irc.reply(url, prefixNick=False) googleSnarfer = urlSnarfer(googleSnarfer) - def _googleUrl(self, s): + def _googleUrl(self, s, channel): s = s.replace('+', '%2B') s = s.replace(' ', '+') url = r'http://%s/search?q=%s' % \ @@ -313,7 +313,7 @@ class Google(callbacks.PluginRegexp): Uses Google's calculator to calculate the value of . """ channel = msg.args[0] - if not isChannel(channel): + if not ircutils.isChannel(channel): channel = None urlig = self._googleUrlIG(expr, channel) js = utils.web.getUrl(urlig).decode('utf8') @@ -326,7 +326,7 @@ class Google(callbacks.PluginRegexp): .replace('\\', '\\\\') js = json.loads(js) - url = self._googleUrl(expr) + url = self._googleUrl(expr, channel) html = utils.web.getUrl(url).decode('utf8') match = self._calcRe1.search(html) if match is None: @@ -355,7 +355,10 @@ class Google(callbacks.PluginRegexp): Looks up on Google. """ - url = self._googleUrl(phonenumber) + channel = msg.args[0] + if not ircutils.isChannel(channel): + channel = None + url = self._googleUrl(phonenumber, channel) html = utils.web.getUrl(url).decode('utf8') m = self._phoneRe.search(html) if m is not None: