Merge branch 'maint/0.83.4'

This commit is contained in:
James McCoy 2011-12-06 01:18:18 -05:00
commit ca23cbb774
8 changed files with 23 additions and 11 deletions

View File

@ -382,6 +382,8 @@ class Misc(callbacks.Plugin):
Tells the <nick> whatever <text> is. Use nested commands to your
benefit here.
"""
if irc.nested:
irc.error('This command cannot be nested.', Raise=True)
if target.lower() == 'me':
target = msg.nick
if ircutils.isChannel(target):

View File

@ -142,6 +142,9 @@ class MiscTestCase(ChannelPluginTestCase):
m = self.getMsg('tell me you love me')
self.failUnless(m.args[0] == self.nick)
def testNoNestedTell(self):
self.assertRegexp('echo [tell %s foo]' % self.nick, 'nested')
def testTellDoesNotPropogateAction(self):
m = self.getMsg('tell foo [action bar]')
self.failIf(ircmsgs.isAction(m))

View File

@ -61,7 +61,7 @@ class Services(callbacks.Plugin):
self.channels = []
self.sentGhost = None
self.identified = False
self.waitingJoins = []
self.waitingJoins = {}
def disabled(self, irc):
disabled = self.registryValue('disabledNetworks')
@ -76,7 +76,8 @@ class Services(callbacks.Plugin):
if self.registryValue('noJoinsUntilIdentified'):
self.log.info('Holding JOIN to %s until identified.',
msg.args[0])
self.waitingJoins.append(msg)
self.waitingJoins.setdefault(irc.network, [])
self.waitingJoins[irc.network].append(msg)
return None
return msg
@ -301,6 +302,8 @@ class Services(callbacks.Plugin):
pass
elif ('now recognized' in s) or \
('already identified' in s) or \
('already logged in' in s) or \
('successfully identified' in s) or \
('password accepted' in s) or \
('now identified' in s):
# freenode, oftc, arstechnica, zirc, ....
@ -311,10 +314,10 @@ class Services(callbacks.Plugin):
self.checkPrivileges(irc, channel)
for channel in self.channels:
irc.queueMsg(networkGroup.channels.join(channel))
if self.waitingJoins:
for m in self.waitingJoins:
waitingJoins = self.waitingJoins.pop(irc.network, None)
if waitingJoins:
for m in waitingJoins:
irc.sendMsg(m)
self.waitingJoins = []
elif 'not yet authenticated' in s:
# zirc.org has this, it requires an auth code.
email = s.split()[-1]

View File

@ -46,6 +46,7 @@ import supybot.conf as conf
import supybot.utils as utils
import supybot.ircdb as ircdb
from supybot.commands import *
import supybot.ircmsgs as ircmsgs
import supybot.callbacks as callbacks
def getTracer(fd):

View File

@ -210,11 +210,9 @@ def newDriver(irc, moduleName=None):
return driver
def parseMsg(s):
start = time.time()
s = s.strip()
if s:
msg = ircmsgs.IrcMsg(s)
msg.tag('receivedAt', start)
return msg
else:
return None

View File

@ -778,6 +778,7 @@ class Irc(IrcCommandDispatcher):
"""Called by the IrcDriver; feeds a message received."""
msg.tag('receivedBy', self)
msg.tag('receivedOn', self.network)
msg.tag('receivedAt', time.time())
if msg.args and self.isChannel(msg.args[0]):
channel = msg.args[0]
else:

View File

@ -182,7 +182,7 @@ class IrcMsg(object):
return self._hash
self._hash = hash(self.command) ^ \
hash(self.prefix) ^ \
hash(self.args)
hash(repr(self.args))
return self._hash
def __repr__(self):
@ -522,7 +522,8 @@ def unbans(channel, hostmasks, prefix='', msg=None):
if msg and not prefix:
prefix = msg.prefix
return IrcMsg(prefix=prefix, command='MODE', msg=msg,
args=(channel, '-' + ('b'*len(hostmasks)), hostmasks))
args=(channel, '-' + ('b'*len(hostmasks)),
' '.join(hostmasks)))
def kick(channel, nick, s='', prefix='', msg=None):
"""Returns a KICK to kick nick from channel with the message msg."""
@ -727,7 +728,10 @@ def whois(nick, mask='', prefix='', msg=None):
assert isNick(nick), repr(nick)
if msg and not prefix:
prefix = msg.prefix
return IrcMsg(prefix=prefix, command='WHOIS', args=(nick, mask), msg=msg)
args = (nick,)
if mask:
args = (nick, mask)
return IrcMsg(prefix=prefix, command='WHOIS', args=args, msg=msg)
def names(channel=None, prefix='', msg=None):
if conf.supybot.protocols.irc.strictRfc():

View File

@ -73,7 +73,7 @@ def isIPV4(s):
0
"""
try:
return bool(socket.inet_pton(socket.AF_INET, s))
return bool(socket.inet_aton(s))
except socket.error:
return False