From 21b1acd3f400109fe32f23933dc1c03120878bd8 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 30 Apr 2004 15:03:20 +0000 Subject: [PATCH] Oops, forgot to update these for the protocols change. --- plugins/Http.py | 16 +++++++++------- plugins/URL.py | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/Http.py b/plugins/Http.py index 663d46487..1594fa0f0 100644 --- a/plugins/Http.py +++ b/plugins/Http.py @@ -90,7 +90,8 @@ class Http(callbacks.Privmsg): if not url.startswith('http://'): irc.error('Only HTTP urls are valid.') return - s = webutils.getUrl(url, size=conf.supybot.httpPeekSize()) + size = conf.supybot.protocols.http.peekSize() + s = webutils.getUrl(url, size=size) m = self._doctypeRe.search(s) if m: s = utils.normalizeWhitespace(m.group(0)) @@ -113,13 +114,13 @@ class Http(callbacks.Privmsg): size = fd.headers['Content-Length'] irc.reply('%s is %s bytes long.' % (url, size)) except KeyError: - s = fd.read(conf.supybot.httpPeekSize()) - if len(s) != conf.supybot.httpPeekSize(): + size = conf.supybot.protocols.http.peekSize() + s = fd.read(size) + if len(s) != size: irc.reply('%s is %s bytes long.' % (url, len(s))) else: irc.reply('The server didn\'t tell me how long %s is ' - 'but it\'s longer than %s bytes.' % - (url,conf.supybot.httpPeekSize())) + 'but it\'s longer than %s bytes.' % (url, size) def title(self, irc, msg, args): """ @@ -129,13 +130,14 @@ class Http(callbacks.Privmsg): url = privmsgs.getArgs(args) if '://' not in url: url = 'http://%s' % url - text = webutils.getUrl(url, size=conf.supybot.httpPeekSize()) + size = conf.supybot.protocols.http.peekSize() + text = webutils.getUrl(url, size=size) m = self._titleRe.search(text) if m is not None: irc.reply(utils.htmlToText(m.group(1).strip())) else: irc.reply('That URL appears to have no HTML title ' - 'within the first %s bytes.'%conf.supybot.httpPeekSize()) + 'within the first %s bytes.' % size) def freshmeat(self, irc, msg, args): """ diff --git a/plugins/URL.py b/plugins/URL.py index a1534bd83..865601f13 100644 --- a/plugins/URL.py +++ b/plugins/URL.py @@ -198,7 +198,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp, if self.registryValue('titleSnarfer', channel): url = match.group(0) try: - text = webutils.getUrl(url, size=conf.supybot.httpPeekSize()) + size = conf.supybot.protocols.http.peekSize() + text = webutils.getUrl(url, size=size) except webutils.WebError, e: self.log.info('Couldn\'t snarf title of %s, %s.', url, e) return