mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Merge supybot's master (will make future merges easier)
Conflicts: plugins/Misc/plugin.py plugins/String/plugin.py src/drivers/Socket.py src/irclib.py src/ircutils.py
This commit is contained in:
commit
e92b8a62f5
@ -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])
|
||||
|
@ -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:
|
||||
|
@ -52,6 +52,13 @@ import supybot.drivers as drivers
|
||||
import supybot.schedule as schedule
|
||||
from supybot.utils.iter import imap
|
||||
|
||||
try:
|
||||
import ssl
|
||||
except ImportError:
|
||||
drivers.log.debug('ssl module is not available, '
|
||||
'cannot connect to SSL servers.')
|
||||
ssl = None
|
||||
|
||||
class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
def __init__(self, irc):
|
||||
self.irc = irc
|
||||
@ -176,6 +183,14 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
||||
drivers.log.connect(self.currentServer)
|
||||
try:
|
||||
self.conn = utils.net.getSocket(server[0])
|
||||
if self.networkGroup.get('ssl').value:
|
||||
if ssl:
|
||||
self.plainconn = self.conn
|
||||
self.conn = ssl.wrap_socket(self.conn)
|
||||
else:
|
||||
drivers.log.error('ssl module not available, '
|
||||
'cannot connect to SSL servers.')
|
||||
return
|
||||
vhost = conf.supybot.protocols.irc.vhost()
|
||||
self.conn.bind((vhost, 0))
|
||||
except socket.error, e:
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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-03T14:55:29+0000)'
|
||||
|
Loading…
Reference in New Issue
Block a user