comparison src/plugins/plugin_xep_0065.py @ 956:132de9d487ac

plugin XEP-0065: fixed initialisation sequence
author Goffi <goffi@goffi.org>
date Mon, 31 Mar 2014 16:08:15 +0200
parents e1842ebcb2f3
children 301b342c697a
comparison
equal deleted inserted replaced
955:cad958239b5c 956:132de9d487ac
785 "File Transfer", profile_key=self.parent.profile) 785 "File Transfer", profile_key=self.parent.profile)
786 self.host.memory.setParam("Proxy port", streamhost_elt.getAttribute("port", ""), 786 self.host.memory.setParam("Proxy port", streamhost_elt.getAttribute("port", ""),
787 "File Transfer", profile_key=self.parent.profile) 787 "File Transfer", profile_key=self.parent.profile)
788 788
789 def connectionInitialized(self): 789 def connectionInitialized(self):
790 self.xmlstream.addObserver(BS_REQUEST, self.plugin_parent.streamQuery, profile=self.parent.profile) 790 def connection_ok(dummy):
791 proxy = self.host.memory.getParamA("Proxy", "File Transfer", profile_key=self.parent.profile) 791 self.xmlstream.addObserver(BS_REQUEST, self.plugin_parent.streamQuery, profile=self.parent.profile)
792 if not proxy: 792 proxy = self.host.memory.getParamA("Proxy", "File Transfer", profile_key=self.parent.profile)
793 def proxiesFound(entities): 793 if not proxy:
794 try: 794 def proxiesFound(entities):
795 proxy_ent = entities.pop() 795 try:
796 except KeyError: 796 proxy_ent = entities.pop()
797 info(_("No proxy found on this server")) 797 except KeyError:
798 return 798 info(_("No proxy found on this server"))
799 iq_elt = jabber_client.IQ(self.parent.xmlstream, 'get') 799 return
800 iq_elt["to"] = proxy_ent.full() 800 iq_elt = jabber_client.IQ(self.parent.xmlstream, 'get')
801 iq_elt.addElement('query', NS_BS) 801 iq_elt["to"] = proxy_ent.full()
802 iq_elt.addCallback(self._proxyDataResult) 802 iq_elt.addElement('query', NS_BS)
803 iq_elt.send() 803 iq_elt.addCallback(self._proxyDataResult)
804 d = self.host.findServiceEntities("proxy", "bytestreams", profile_key=self.parent.profile) 804 iq_elt.send()
805 d.addCallback(proxiesFound) 805 d = self.host.findServiceEntities("proxy", "bytestreams", profile_key=self.parent.profile)
806 d.addCallback(proxiesFound)
807 self.parent.getConnectionDeferred().addCallback(connection_ok)
806 808
807 809
808 def getDiscoInfo(self, requestor, target, nodeIdentifier=''): 810 def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
809 return [disco.DiscoFeature(NS_BS)] 811 return [disco.DiscoFeature(NS_BS)]
810 812