From ae048d977a2c302958c91608dbc1ef4f809e4c53 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sun, 22 Aug 2004 18:58:28 +0000 Subject: [PATCH] Let's not bother getting database if it's not a channel. Good call. --- plugins/URL.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/plugins/URL.py b/plugins/URL.py index 9bce2651a..69e80bc8e 100644 --- a/plugins/URL.py +++ b/plugins/URL.py @@ -173,18 +173,19 @@ class URL(callbacks.PrivmsgCommandAndRegexp): def doPrivmsg(self, irc, msg): channel = msg.args[0] - db = self.getDb(channel) - if ircmsgs.isAction(msg): - text = ircmsgs.unAction(msg) - else: - text = msg.args[1] - for url in webutils.urlRe.findall(text): - r = self.registryValue('nonSnarfingRegexp', channel) - if r and r.search(url): - self.log.debug('Skipping adding %r to db.', url) - continue - self.log.debug('Adding %r to db.', url) - db.addUrl(url, msg.nick) + if ircutils.isChannel(channel): + db = self.getDb(channel) + if ircmsgs.isAction(msg): + text = ircmsgs.unAction(msg) + else: + text = msg.args[1] + for url in webutils.urlRe.findall(text): + r = self.registryValue('nonSnarfingRegexp', channel) + if r and r.search(url): + self.log.debug('Skipping adding %r to db.', url) + continue + self.log.debug('Adding %r to db.', url) + db.addUrl(url, msg.nick) callbacks.PrivmsgCommandAndRegexp.doPrivmsg(self, irc, msg) def tinyurlSnarfer(self, irc, msg, match):