Merge branch 'merge-supybot-master' into testing

This commit is contained in:
Valentin Lorentz 2012-04-03 17:15:03 +02:00
commit 74a3d61f2b
6 changed files with 39 additions and 5 deletions

View File

@ -108,6 +108,33 @@ class Misc(callbacks.Plugin):
return
# Now, for normal handling.
channel = msg.args[0]
# Only bother with the invaildCommand flood handling if it's actually
# enabled
if conf.supybot.abuse.flood.command.invalid():
# First, we check for invalidCommand floods. This is rightfully done
# here since this will be the last invalidCommand called, and thus it
# will only be called if this is *truly* an invalid command.
maximum = conf.supybot.abuse.flood.command.invalid.maximum()
banmasker = conf.supybot.protocols.irc.banmask.makeBanmask
self.invalidCommands.enqueue(msg)
if self.invalidCommands.len(msg) > maximum and \
not ircdb.checkCapability(msg.prefix, 'owner'):
penalty = conf.supybot.abuse.flood.command.invalid.punishment()
banmask = banmasker(msg.prefix)
self.log.info('Ignoring %s for %s seconds due to an apparent '
'invalid command flood.', banmask, penalty)
if tokens and tokens[0] == 'Error:':
self.log.warning('Apparent error loop with another Supybot '
'observed. Consider ignoring this bot '
'permanently.')
ircdb.ignores.add(banmask, time.time() + penalty)
if conf.supybot.abuse.flood.command.invalid.notify():
irc.reply('You\'ve given me %s invalid commands within '
'the last minute; I\'m now ignoring you for %s.' %
(maximum,
utils.timeElapsed(penalty, seconds=False)))
return
# Now, for normal handling.
if conf.get(conf.supybot.reply.whenNotCommand, channel):
if len(tokens) >= 2:
cb = irc.getCallback(tokens[0])

View File

@ -87,7 +87,12 @@ class String(callbacks.Plugin):
<http://docs.python.org/library/codecs.html#standard-encodings>.
"""
try:
irc.reply(text.decode(encoding))
s = text.decode(encoding)
# Not all encodings decode to a unicode object. Only encode those
# that do.
if isinstance(s, unicode):
s = s.encode('utf-8')
irc.reply(s)
except LookupError:
irc.errorInvalid(_('encoding'), encoding)
except binascii.Error:

View File

@ -41,6 +41,8 @@ try:
import ssl
SSLError = ssl.SSLError
except:
drivers.log.debug('ssl module is not available, '
'cannot connect to SSL servers.')
class SSLError(Exception):
pass

View File

@ -972,7 +972,7 @@ class Irc(IrcCommandDispatcher):
if umodes[0] in '+-':
(addSub, umodes) = (umodes[0], umodes[1:])
if supported:
umodes = filter(lambda m: m in supported, umodes)
umodes = ''.join([m for m in umodes if m in supported])
umodes = ''.join([addSub, umodes])
log.info('Sending user modes to %s: %s', self.network, umodes)
self.sendMsg(ircmsgs.mode(self.nick, umodes))

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2011, James Vega
# Copyright (c) 2009,2011, James Vega
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -458,7 +458,7 @@ def replyTo(msg):
return msg.nick
def dccIP(ip):
"""Returns an IP in the proper for DCC."""
"""Converts an IP string to the DCC integer form."""
assert utils.net.isIPV4(ip), \
'argument must be a string ip in xxx.yyy.zzz.www format.'
i = 0

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change
them once."""
version = '0.83.4.1+limnoria (2012-03-18T19:45:17+0000)'
version = '0.83.4.1+limnoria (2012-04-03T15:14:07+0000)'