Merge remote-tracking branch 'progval/testing' into mkaysi

This commit is contained in:
Mika Suomalainen 2011-09-18 11:40:38 +03:00
commit ba4e4a6c47
10 changed files with 43 additions and 9 deletions

View File

@ -490,8 +490,8 @@ class Misc(callbacks.Plugin):
irc.action = False irc.action = False
text = '* %s %s' % (irc.nick, text) text = '* %s %s' % (irc.nick, text)
s = _('%s wants me to tell you: %s') % (msg.nick, text) s = _('%s wants me to tell you: %s') % (msg.nick, text)
irc.reply(s, to=target, private=True)
irc.replySuccess() irc.replySuccess()
irc.reply(s, to=target, private=True)
tell = wrap(tell, ['something', 'text']) tell = wrap(tell, ['something', 'text'])
@internationalizeDocstring @internationalizeDocstring

View File

@ -1 +1 @@
Insert a description of your plugin here, with any notes, etc. about using it. This plugin allows you to setup a relay between networks.

View File

@ -1 +1 @@
Insert a description of your plugin here, with any notes, etc. about using it. This plugin allows you to use different reply commands.

View File

@ -1 +1 @@
Insert a description of your plugin here, with any notes, etc. about using it. This plugin features commands to shorten URLs through different services.

View File

@ -1 +1 @@
Insert a description of your plugin here, with any notes, etc. about using it. This plugin allows you to view different bot statistics, for example, uptime.

View File

@ -1 +1 @@
Insert a description of your plugin here, with any notes, etc. about using it. This plugin allows you to use different time functions.

View File

@ -1 +1 @@
Insert a description of your plugin here, with any notes, etc. about using it. This plugin records how many URLs have been mentioned in the channel and what the last URL was.

View File

@ -258,7 +258,7 @@ class SpaceSeparatedSetOfChannels(registry.SpaceSeparatedListOf):
else: else:
return ircmsgs.join(channel) return ircmsgs.join(channel)
def registerNetwork(name, password='', ssl=False): def registerNetwork(name, password='', ssl=False, sasl_username=''):
network = registerGroup(supybot.networks, name) network = registerGroup(supybot.networks, name)
registerGlobalValue(network, 'password', registry.String(password, registerGlobalValue(network, 'password', registry.String(password,
_("""Determines what password will be used on %s. Yes, we know that _("""Determines what password will be used on %s. Yes, we know that
@ -277,6 +277,14 @@ def registerNetwork(name, password='', ssl=False):
registerChannelValue(network.channels, 'key', registry.String('', registerChannelValue(network.channels, 'key', registry.String('',
_("""Determines what key (if any) will be used to join the _("""Determines what key (if any) will be used to join the
channel."""))) channel.""")))
sasl = registerGroup(network, 'sasl')
registerGlobalValue(sasl, 'username', registry.String(sasl_username,
_("""Determines what SASL username will be used on %s. This should
be the bot's account name. Due to the way SASL works, you can't use
any grouped nick.""") % name, private=False))
registerGlobalValue(sasl, 'password', registry.String(password,
_("""Determines what SASL password will be used on %s.""") \
% name, private=True))
return network return network
# Let's fill our networks. # Let's fill our networks.

View File

@ -31,6 +31,7 @@ import re
import copy import copy
import time import time
import random import random
import base64
import supybot.log as log import supybot.log as log
import supybot.conf as conf import supybot.conf as conf
@ -862,6 +863,8 @@ class Irc(IrcCommandDispatcher):
self.ident = conf.supybot.ident() self.ident = conf.supybot.ident()
self.alternateNicks = conf.supybot.nick.alternates()[:] self.alternateNicks = conf.supybot.nick.alternates()[:]
self.password = conf.supybot.networks.get(self.network).password() self.password = conf.supybot.networks.get(self.network).password()
self.sasl_username = conf.supybot.networks.get(self.network).sasl.username()
self.sasl_password = conf.supybot.networks.get(self.network).sasl.password()
self.prefix = '%s!%s@%s' % (self.nick, self.ident, 'unset.domain') self.prefix = '%s!%s@%s' % (self.nick, self.ident, 'unset.domain')
# The rest. # The rest.
self.lastTake = 0 self.lastTake = 0
@ -875,6 +878,18 @@ class Irc(IrcCommandDispatcher):
self.driver.die() self.driver.die()
self._reallyDie() self._reallyDie()
else: else:
if self.sasl_password:
if not self.sasl_username:
log.error('SASL username is not set, unable to identify.')
else:
auth_string = base64.b64encode('%s\x00%s\x00%s' % (self.sasl_username,
self.sasl_username, self.sasl_password))
log.debug('Sending CAP REQ command, requesting capability \'sasl\'.')
self.queueMsg(ircmsgs.IrcMsg(command="CAP", args=('REQ', 'sasl')))
log.debug('Sending AUTHENTICATE command, using mechanism PLAIN.')
self.queueMsg(ircmsgs.IrcMsg(command="AUTHENTICATE", args=('PLAIN',)))
log.info('Sending AUTHENTICATE command, not logging the password.')
self.queueMsg(ircmsgs.IrcMsg(command="AUTHENTICATE", args=(auth_string,)))
if self.password: if self.password:
log.info('Sending PASS command, not logging the password.') log.info('Sending PASS command, not logging the password.')
self.queueMsg(ircmsgs.password(self.password)) self.queueMsg(ircmsgs.password(self.password))
@ -884,6 +899,17 @@ class Irc(IrcCommandDispatcher):
self.ident, self.user) self.ident, self.user)
self.queueMsg(ircmsgs.user(self.ident, self.user)) self.queueMsg(ircmsgs.user(self.ident, self.user))
def do903(self, msg):
log.info('%s: SASL authentication successful' % self.network)
log.debug('Sending CAP END command.')
self.queueMsg(ircmsgs.IrcMsg(command="CAP", args=('END',)))
def do904(self, msg):
log.warning('%s: SASL authentication failed' % self.network)
log.debug('Aborting authentication.')
log.debug('Sending CAP END command.')
self.queueMsg(ircmsgs.IrcMsg(command="CAP", args=('END',)))
def _getNextNick(self): def _getNextNick(self):
if self.alternateNicks: if self.alternateNicks:
nick = self.alternateNicks.pop(0) nick = self.alternateNicks.pop(0)

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change """stick the various versioning attributes in here, so we only have to change
them once.""" them once."""
version = '0.83.4.1+limnoria (2011-09-11T20:13:20+0200)' version = '0.83.4.1+limnoria (2011-09-18T10:31:09+0200)'