Fix support for newest versions of Twisted (>=29094)

master
Valentin Lorentz 2012-07-29 20:32:28 +02:00
parent 59d9e90588
commit 3b8f689024
1 changed files with 9 additions and 4 deletions

View File

@ -254,7 +254,10 @@ class Sshd(callbacks.Plugin):
Displays a list of available protocols.
"""
L = [s.NAME for s in self.available.values()]
irc.reply(format('%L', L))
if L == []:
irc.reply('No protocols available.')
else:
irc.reply(format('%L', L))
available = wrap(protocols, ['sshdCapable'])
def running(self, irc, msg, args):
@ -276,7 +279,7 @@ class Sshd(callbacks.Plugin):
Start the server named by <protocol>. If the optional [port]
parameter is provided, the server is started listening on that port.
Otherwise the autoStart registry value for that protocol is used.
Otherwise the defaultPort registry value for that protocol is used.
"""
# needs changing
p = protocol
@ -289,6 +292,8 @@ class Sshd(callbacks.Plugin):
irc.replySuccess()
else:
irc.reply('Error: Already running')
else:
irc.error('Protocol not available')
start = wrap(start, ['owner', 'something', optional('int')])
def stop(self, irc, msg, args, protocol):
@ -1137,9 +1142,9 @@ class SshServer:
raise Exception, 'The SSH public key is missing'
self.debug('Loading RSA keys')
self.Fact.publicKeys = \
{'ssh-rsa':keys.getPublicKeyString(filename=pubpath)}
{'ssh-rsa':keys.Key.fromFile(filename=pubpath).blob()}
self.Fact.privateKeys = \
{'ssh-rsa':keys.getPrivateKeyObject(filename=privpath)}
{'ssh-rsa':keys.Key.fromFile(filename=pubpath).blob()}
class PyUser(SshUser):
def sendReply(self, reply, **kw):