comparison plugins/plugin_xep_0065.py @ 19:f2a745ca0fbc

refactoring: using xml params part III (parameters import)
author Goffi <goffi@goffi.org>
date Sat, 07 Nov 2009 21:23:28 +0100
parents 218ec9984fa5
children fc8c202cda87
comparison
equal deleted inserted replaced
18:6928e3cb73a8 19:f2a745ca0fbc
449 449
450 450
451 class XEP_0065(XMPPHandler): 451 class XEP_0065(XMPPHandler):
452 implements(iwokkel.IDisco) 452 implements(iwokkel.IDisco)
453 453
454 params = """
455 <params>
456 <category name="File Transfert">
457 <param name="IP" value="192.168.0.10" type="string" />
458 <param name="Port" value="28915" type="string" />
459 </category>
460 </params>
461 """
462
454 def __init__(self, host): 463 def __init__(self, host):
455 info("Plugin XEP_0065 initialization") 464 info("Plugin XEP_0065 initialization")
456 self.host = host 465 self.host = host
457 debug("registering") 466 debug("registering")
458 self.server_factory = Socks5ServerFactory() 467 self.server_factory = Socks5ServerFactory()
459 self.server_factory.protocol.host = self.host #needed for progress CB 468 self.server_factory.protocol.host = self.host #needed for progress CB
460 self.client_factory = Socks5ClientFactory() 469 self.client_factory = Socks5ClientFactory()
470 host.memory.import_params(self, XEP_0065.params)
461 port = int(self.host.memory.getParamV("Port", "File Transfert")) 471 port = int(self.host.memory.getParamV("Port", "File Transfert"))
462 info("Launching Socks5 Stream server on port %d", port) 472 info("Launching Socks5 Stream server on port %d", port)
463 reactor.listenTCP(port, self.server_factory) 473 reactor.listenTCP(port, self.server_factory)
464 474
465 def connectionInitialized(self): 475 def connectionInitialized(self):