Merge remote-tracking branch 'supybot/master' into testing

Conflicts:
	INSTALL
	plugins/ChannelLogger/README.txt
	plugins/ChannelStats/README.txt
	plugins/Google/plugin.py
	plugins/Google/test.py
	plugins/Plugin/test.py
	plugins/Web/test.py
	setup.py
	src/callbacks.py
	src/ircdb.py
	src/irclib.py
	src/utils/str.py
	test/test_irclib.py
This commit is contained in:
Valentin Lorentz 2013-01-01 21:11:24 +01:00
commit 3dba9088b0
101 changed files with 139 additions and 273 deletions

View File

@ -1,6 +1,6 @@
Version 0.83.5
The minimum supported Python version has been bumped to 2.4.
The minimum supported Python version has been bumped to 2.6.
utils.str.perlVariableSubstitute is deprecated in favor of using Python's
string.Template directly. perlVariableSubstitute will be removed in a future

View File

@ -325,7 +325,7 @@ information on using wrap check out the wrap tutorial (The astute Python
programmer may note that this is very much like a decorator, and that's
precisely what it is. However, we developed this before decorators existed and
haven't changed the syntax due to our earlier requirement to stay compatible
with Python 2.3. As we now require Python 2.4 or greater, this may eventually
with Python 2.3. As we now require Python 2.6 or greater, this may eventually
change to support work via decorators.)
Now let's create a command with some arguments and see how we use those in our

View File

@ -39,7 +39,7 @@ master_doc = 'index'
# General information about the project.
project = u'Supybot'
copyright = u'2010, Jeremiah Fincher and James Vega'
copyright = u'2010, Jeremiah Fincher and James McCoy'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -174,7 +174,7 @@ htmlhelp_basename = 'Supybotdoc'
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Supybot.tex', u'Supybot Documentation',
u'Jeremiah Fincher and James Vega', 'manual'),
u'Jeremiah Fincher and James McCoy', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of

View File

@ -36,7 +36,7 @@ multiple times.
.IR supybot-plugin-doc (1),
.IR supybot-plugin-create (1)
.SH AUTHOR
This manual page was originally written by James Vega
<jamessan at supybot dot com>. Permission is granted to copy,
This manual page was originally written by James McCoy
<vega dot james at gmail dot com>. Permission is granted to copy,
distribute and/or modify this document under the terms of the Supybot
license, a BSD-style license.

View File

@ -48,7 +48,7 @@ when (re)starting the bot.
.IR supybot-plugin-doc (1),
.IR supybot-plugin-create (1)
.SH AUTHOR
This manual page was originally written by James Vega
<jamessan at supybot dot com>. Permission is granted to copy,
This manual page was originally written by James McCoy
<vega dot james at gmail dot com>. Permission is granted to copy,
distribute and/or modify this document under the terms of the Supybot
license, a BSD-style license.

View File

@ -37,7 +37,7 @@ Specify what real name the copyright is assigned to.
.IR supybot-adduser (1),
.IR supybot-plugin-doc (1)
.SH AUTHOR
This manual page was originally written by James Vega
<jamessan at supybot dot com>. Permission is granted to copy,
This manual page was originally written by James McCoy
<vega dot james at gmail dot com>. Permission is granted to copy,
distribute and/or modify this document under the terms of the Supybot
license, a BSD-style license.

View File

@ -42,7 +42,7 @@ them.
.IR supybot-adduser (1),
.IR supybot-plugin-create (1)
.SH AUTHOR
This manual page was originally written by James Vega
<jamessan at supybot dot com>. Permission is granted to copy,
This manual page was originally written by James McCoy
<vega dot james at gmail dot com>. Permission is granted to copy,
distribute and/or modify this document under the terms of the Supybot
license, a BSD-style license.

View File

@ -45,7 +45,7 @@ Looks in the given directory for plugins and loads the tests for all of them.
.IR supybot-plugin-doc (1),
.IR supybot-plugin-create (1)
.SH AUTHOR
This manual page was originally written by James Vega
<jamessan at supybot dot com>. Permission is granted to copy,
This manual page was originally written by James McCoy
<vega dot james at gmail dot com>. Permission is granted to copy,
distribute and/or modify this document under the terms of the Supybot
license, a BSD-style license.

View File

@ -36,7 +36,7 @@ connection.
.IR supybot-plugin-doc (1),
.IR supybot-plugin-create (1)
.SH AUTHOR
This manual page was originally written by James Vega
<jamessan at supybot dot com>. Permission is granted to copy,
This manual page was originally written by James McCoy
<vega dot james at gmail dot com>. Permission is granted to copy,
distribute and/or modify this document under the terms of the Supybot
license, a BSD-style license.

View File

@ -60,7 +60,7 @@ script.
.IR supybot-plugin-doc (1),
.IR supybot-plugin-create (1)
.SH AUTHOR
This manual page was originally written by James Vega
<jamessan at supybot dot com>. Permission is granted to copy,
This manual page was originally written by James McCoy
<vega dot james at gmail dot com>. Permission is granted to copy,
distribute and/or modify this document under the terms of the Supybot
license, a BSD-style license.

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Daniel DiPaolo
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Daniel DiPaolo
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1 +1 @@
This plugin automaticly logs the channels where the bot is.
This plugin automatically logs the channels where the bot is.

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1 +1 @@
This plugin keeps stats of the channel and returns them with the command ChannelStats.
This plugin keeps stats of the channel and returns them with the command channelstats.

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2008-2010, James Vega
# Copyright (c) 2008-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2010, James Vega
# Copyright (c) 2008-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -233,44 +233,6 @@ class Google(callbacks.PluginRegexp):
s = ', '.join([format('%s: %i', bold(s), i) for (i, s) in results])
irc.reply(s)
@internationalizeDocstring
def translate(self, irc, msg, args, sourceLang, targetLang, text):
"""<source language> [to] <target language> <text>
Returns <text> translated from <source language> into <target
language>.
"""
channel = msg.args[0]
headers = utils.web.defaultHeaders
headers['User-Agent'] = ('Mozilla/5.0 (X11; U; Linux i686) '
'Gecko/20071127 Firefox/2.0.0.11')
sourceLang = urllib.quote(sourceLang)
targetLang = urllib.quote(targetLang)
text = urllib.quote(text)
result = utils.web.getUrlFd('http://translate.google.com/translate_a/t'
'?client=t&hl=en&sl=%s&tl=%s&multires=1'
'&otf=1&ssel=0&tsel=0&uptl=en&sc=1&text='
'%s' % (sourceLang, targetLang, text),
headers).read()
while ',,' in result:
result = result.replace(',,', ',null,')
data = json.loads(result)
try:
language = data[2]
except:
language = 'unknown'
irc.reply(''.join(x[0] for x in data[0]), language)
translate = wrap(translate, ['something', 'to', 'something', 'text'])
def googleSnarfer(self, irc, msg, match):
r"^google\s+(.*)$"
if not self.registryValue('searchSnarfer', msg.args[0]):
@ -294,70 +256,6 @@ class Google(callbacks.PluginRegexp):
url = r'http://www.google.com/ig/calculator?hl=en&q=' + s
return url
_calcRe1 = re.compile(r'<table.*class="?obcontainer"?[^>]*>(.*?)</table>', re.I)
_calcRe2 = re.compile(r'<h\d class="?r"?[^>]*>(?:<b>)?(.*?)(?:</b>)?</h\d>', re.I | re.S)
_calcSupRe = re.compile(r'<sup>(.*?)</sup>', re.I)
_calcFontRe = re.compile(r'<font size=-2>(.*?)</font>')
_calcTimesRe = re.compile(r'&(?:times|#215);')
@internationalizeDocstring
def calc(self, irc, msg, args, expr):
"""<expression>
Uses Google's calculator to calculate the value of <expression>.
"""
urlig = self._googleUrlIG(expr)
js = utils.web.getUrl(urlig).decode('utf8')
# Convert JavaScript to JSON. Ouch.
js = js \
.replace('lhs:','"lhs":') \
.replace('rhs:','"rhs":') \
.replace('error:','"error":') \
.replace('icc:','"icc":') \
.replace('\\', '\\\\')
js = json.loads(js)
url = self._googleUrl(expr)
html = utils.web.getUrl(url).decode('utf8')
match = self._calcRe1.search(html)
if match is None:
match = self._calcRe2.search(html)
if match is not None:
s = match.group(1)
s = self._calcSupRe.sub(r'^(\1)', s)
s = self._calcFontRe.sub(r',', s)
s = self._calcTimesRe.sub(r'*', s)
s = utils.web.htmlToText(s)
if ' = ' in s: # Extra check, since the regex seems to fail.
irc.reply(s)
return
elif js['lhs'] and js['rhs']:
# Outputs the original result. Might look ugly.
irc.reply("%s = %s" % (js['lhs'], js['rhs'],))
return
irc.reply(_('Google says: Error: %s.') % (js['error'],))
irc.reply('Google\'s calculator didn\'t come up with anything.')
calc = wrap(calc, ['text'])
_phoneRe = re.compile(r'Phonebook.*?<font size=-1>(.*?)<a href')
@internationalizeDocstring
def phonebook(self, irc, msg, args, phonenumber):
"""<phone number>
Looks <phone number> up on Google.
"""
url = self._googleUrl(phonenumber)
html = utils.web.getUrl(url).decode('utf8')
m = self._phoneRe.search(html)
if m is not None:
s = m.group(1)
s = s.replace('<b>', '')
s = s.replace('</b>', '')
s = utils.web.htmlToText(s)
irc.reply(s)
else:
irc.reply(_('Google\'s phonebook didn\'t come up with anything.'))
phonebook = wrap(phonebook, ['text'])
Class = Google

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# Copyright (c) 2008-2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -33,21 +33,6 @@ from supybot.test import *
class GoogleTestCase(ChannelPluginTestCase):
plugins = ('Google', 'Config')
if network:
def testCalcHandlesMultiplicationSymbol(self):
self.assertNotRegexp('google calc seconds in a century', r'215')
def testCalc(self):
self.assertNotRegexp('google calc e^(i*pi)+1', r'didn\'t')
self.assertNotRegexp('google calc 1 usd in gbp', r'didn\'t')
def testHtmlHandled(self):
self.assertNotRegexp('google calc '
'the speed of light '
'in microns / fortnight', '<sup>')
self.assertNotRegexp('google calc '
'the speed of light '
'in microns / fortnight', '&times;')
def testSearch(self):
self.assertNotError('google foo')
self.assertRegexp('google dupa', r'dupa')
@ -69,7 +54,4 @@ class GoogleTestCase(ChannelPluginTestCase):
self.assertRegexp('fight supybot moobot', r'.*supybot.*: \d+')
self.assertNotError('fight ... !')
def testCalcDoesNotHaveExtraSpaces(self):
self.assertNotRegexp('google calc 1000^2', r'\s+,\s+')
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# Copyright (c) 2010-2011, James Vega
# Copyright (c) 2010-2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# Copyright (c) 2008-2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004, Brett Kelly
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# Copyright (c) 2008-2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -32,13 +32,13 @@ from supybot.test import *
class PluginTestCase(PluginTestCase):
plugins = ('Plugin', 'Utilities', 'Admin', 'Format')
def testPlugin(self):
self.assertRegexp('plugin plugin', 'available.*Plugin plugin')
self.assertResponse('echo [plugin plugin]', 'Plugin')
self.assertRegexp('plugin ignore', 'available.*Utilities plugin')
self.assertResponse('echo [plugin ignore]', 'Utilities')
def testPlugins(self):
self.assertRegexp('plugins join', '(Format.*Admin|Admin.*Format)')
self.assertRegexp('plugins plugin', 'Plugin')
def testList(self):
self.assertRegexp('plugin list', 'Plugin.*Utilities')

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004, Daniel DiPaolo
# Copyright (c) 2008-2010, James Vega
# Copyright (c) 2008-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004, Daniel DiPaolo
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2010, James Vega
# Copyright (c) 2008-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010-2011, James Vega
# Copyright (c) 2010-2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# Copyright (c) 2008-2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2003-2005, Daniel DiPaolo
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008-2010, James Vega
# Copyright (c) 2008-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -49,28 +49,8 @@ class WebTestCase(ChannelPluginTestCase):
self.assertNotError('size http://www.slashdot.org/')
def testTitle(self):
self.assertResponse('title http://www.slashdot.org/',
'Slashdot: News for nerds, stuff that matters')
# Amazon add a bunch of scripting stuff to the top of their page,
# so we need to allow for a larger peekSize
# Actually, screw Amazon. Even bumping this up to 10k doesn't give us enough
# info.
# try:
# orig = conf.supybot.protocols.http.peekSize()
# conf.supybot.protocols.http.peekSize.setValue(8192)
# self.assertNotRegexp('title '
# 'http://www.amazon.com/exec/obidos/tg/detail/-/'
# '1884822312/qid=1063140754/sr=8-1/ref=sr_8_1/'
# '002-9802970-2308826?v=glance&s=books&n=507846',
# 'no HTML title')
# finally:
# conf.supybot.protocols.http.peekSize.setValue(orig)
# Checks the non-greediness of the regexp
self.assertResponse('title '
'http://www.space.com/scienceastronomy/'
'jupiter_dark_spot_031023.html',
'SPACE.com -- Mystery Spot on Jupiter Baffles '
'Astronomers')
self.assertRegexp('title http://www.slashdot.org/',
'News for nerds, stuff that matters')
# Checks for @title not-working correctly
self.assertResponse('title '
'http://www.catb.org/~esr/jargon/html/F/foo.html',
@ -97,9 +77,8 @@ class WebTestCase(ChannelPluginTestCase):
def testTitleSnarfer(self):
try:
conf.supybot.plugins.Web.titleSnarfer.setValue(True)
self.assertSnarfResponse('http://microsoft.com/',
'Title: Microsoft Corporation'
' (at microsoft.com)')
self.assertSnarfRegexp('http://microsoft.com/',
'Title: Microsoft Corporation')
finally:
conf.supybot.plugins.Web.titleSnarfer.setValue(False)

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -2,7 +2,7 @@
###
# Copyright (c) 2003-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -44,8 +44,8 @@ import shutil
import signal
import cStringIO as StringIO
if sys.version_info < (2, 4, 0):
sys.stderr.write('This program requires Python >= 2.4.0')
if sys.version_info < (2, 6, 0):
sys.stderr.write('This program requires Python >= 2.6.0')
sys.stderr.write(os.linesep)
sys.exit(-1)

View File

@ -2,7 +2,7 @@
###
# Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -2,7 +2,7 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -43,8 +43,8 @@ def error(s):
sys.stderr.write(os.linesep)
sys.exit(-1)
if sys.version_info < (2, 4, 0):
error('This script requires Python 2.4 or newer.')
if sys.version_info < (2, 6, 0):
error('This script requires Python 2.6 or newer.')
import supybot.conf as conf
from supybot.questions import *

View File

@ -2,7 +2,7 @@
###
# Copyright (c) 2005, Ali Afshar
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -2,7 +2,7 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2011, James Vega
# Copyright (c) 2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -2,7 +2,7 @@
###
# Copyright (c) 2003-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -39,8 +39,8 @@ def error(s):
sys.stderr.write(os.linesep)
sys.exit(-1)
if sys.version_info < (2, 4, 0):
error('This program requires Python >= 2.4.0')
if sys.version_info < (2, 6, 0):
error('This program requires Python >= 2.6.0')
import supybot

View File

@ -2,7 +2,7 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -30,10 +30,12 @@
# POSSIBILITY OF SUCH DAMAGE.
###
import os
import sys
if sys.version_info < (2, 6, 0):
sys.stderr.write("Supybot requires Python 2.6 or newer.\n")
sys.stderr.write("Supybot requires Python 2.6 or newer.")
sys.stderr.write(os.linesep)
sys.exit(-1)
import textwrap

View File

@ -54,7 +54,7 @@ class Author(object):
class authors(object): # This is basically a bag.
jemfinch = Author('Jeremy Fincher', 'jemfinch', 'jemfinch@users.sf.net')
jamessan = Author('James Vega', 'jamessan', 'jamessan@users.sf.net')
jamessan = Author('James McCoy', 'jamessan', 'vega.james@gmail.com')
strike = Author('Daniel DiPaolo', 'Strike', 'ddipaolo@users.sf.net')
baggins = Author('William Robinson', 'baggins', 'airbaggins@users.sf.net')
skorobeus = Author('Kevin Murphy', 'Skorobeus', 'skoro@skoroworld.com')

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008-2010, James Vega
# Copyright (c) 2008-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -491,18 +491,23 @@ class RichReplyMethods(object):
if isinstance(capability, basestring): # checkCommandCapability!
log.warning('Denying %s for lacking %q capability.',
self.msg.prefix, capability)
if not self._getConfig(conf.supybot.reply.error.noCapability):
if capability in conf.supybot.capabilities.private():
v = self._getConfig(conf.supybot.replies.genericNoCapability)
else:
v = self._getConfig(conf.supybot.replies.noCapability)
v %= capability
s = self.__makeReply(v, s)
return self._error(s, **kwargs)
# noCapability means "don't send a specific capability error
# message" not "don't send a capability error message at all", like
# one would think
if self._getConfig(conf.supybot.reply.error.noCapability) or \
capability in conf.supybot.capabilities.private():
v = self._getConfig(conf.supybot.replies.genericNoCapability)
else:
log.debug('Not sending capability error, '
'supybot.reply.error.noCapability is False.')
raise SilentError
v = self._getConfig(conf.supybot.replies.noCapability)
v %= capability
s = self.__makeReply(v, s)
return self._error(s, **kwargs)
if self._getConfig(conf.supybot.reply.error.noCapability):
v = self._getConfig(conf.supybot.replies.genericNoCapability)
else:
v = self._getConfig(conf.supybot.replies.noCapability)
s = self.__makeReply(v % capability, s)
return self._error(s, **kwargs)
else:
log.warning('Denying %s for some unspecified capability '
'(or a default).', self.msg.prefix)

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008-2009,2011, James Vega
# Copyright (c) 2008-2009,2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# Copyright (c) 2008-2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2009, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# Copyright (c) 2011, Valentin Lorentz
# All rights reserved.
#

View File

@ -406,7 +406,7 @@ class IrcState(IrcCommandDispatcher):
"""Handles parsing the 004 reply
Supported user and channel modes are cached"""
# msg.args = [nickname, server, ircd-version, umodes, modes,
# msg.args = [nick, server, ircd-version, umodes, modes,
# modes that require arguments? (non-standard)]
self.supported['umodes'] = msg.args[3]
self.supported['chanmodes'] = msg.args[4]

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# Copyright (c) 2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009,2011, James Vega
# Copyright (c) 2009,2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2004-2005, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2011, James Vega
# Copyright (c) 2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,5 +1,5 @@
###
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2011, James Vega
# Copyright (c) 2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2005-2009, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# Copyright (c) 2009-2010, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# Copyright (c) 2008-2009, James McCoy
# Copyright (c) 2010, Valentin Lorentz
# All rights reserved.
#

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

View File

@ -288,7 +288,7 @@ class IrcStateTestCase(SupyTestCase):
def testSupportedUmodes(self):
state = irclib.IrcState()
state.addMsg(self.irc, ircmsgs.IrcMsg(':charm.oftc.net 004 adkwbot charm.oftc.net hybrid-7.2.2+oftc1.6.8 CDGPRSabcdfgiklnorsuwxyz biklmnopstveI bkloveI'))
state.addMsg(self.irc, ircmsgs.IrcMsg(':coulomb.oftc.net 004 testnick coulomb.oftc.net hybrid-7.2.2+oftc1.6.8 CDGPRSabcdfgiklnorsuwxyz biklmnopstveI bkloveI'))
self.assertEqual(state.supported['umodes'], 'CDGPRSabcdfgiklnorsuwxyz')
self.assertEqual(state.supported['chanmodes'],
'biklmnopstveI')

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# Copyright (c) 2008, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

Some files were not shown because too many files have changed in this diff Show More