コード例 #1
0
    def connect_stream(self):
        try:  #protection against None stream
            self.hash = self.j.s5bserver.conn_id(self.sid, self.j.stream.me,
                                                 self.jid)
        except AttributeError:
            self.event("stream_connect_failed")
            return
        self.j.s5bserver.add_hash(self.hash)

        i = Iq(to_jid=self.jid, stanza_type='set')
        b = ByteStreams(sid=self.sid)
        if pref('jabber.use_direct_ft'):
            if not pref('jabber.use_faulty_localhost_ips'):
                [
                    b.add_host(self.j.stream.me, h[0], h[1])
                    for h in self.j.s5bserver.hosts
                ]
            else:
                [
                    b.add_host(self.j.stream.me, h[0].replace("192", "129"),
                               h[1]) for h in self.j.s5bserver.hosts
                ]
        if pref('jabber.use_proxy_ft'):
            b.hosts.extend(
                set(h for hosts in self.j.known_s5b_proxies.values()
                    for h in hosts))
            if pref('jabber.use_jabber_org_proxy', True):
                b.add_host("proxy.jabber.org", "208.245.212.98", 7777)
        b.as_xml(i.get_node())

        self.j.send_cb(i,
                       success=self.handle_ready,
                       error=self.handle_error,
                       timeout=self.timed_out)
コード例 #2
0
ファイル: initiateStream.py プロジェクト: AlexUlrich/digsby
    def send_offer(self):
        self.state = self.states.WAITING_FOR_BUDDY

        i = Iq(to_jid=self.jid, stanza_type='set')

        #CAS: id generator for streams
        si = SI_FileTransfer(self.sid)
        si.file = File(self.filestor.name, self.filestor.size)
        si.feature = Feature(possible_streams=supported_streams)
        si.as_xml(i.get_node())

        self.j.send_cb(i, success = self.handle_response,
                          error   = self.handle_error,
                          timeout = self.timed_out)
コード例 #3
0
ファイル: initiateStream.py プロジェクト: AlexUlrich/digsby
 def handle_proxy_connect(self):
     log.info('handle_proxy_connect called')
     self.conn.set_terminator(0)
     #activate
     streamhost = self.streamhost
     sh_jid = streamhost.jid
     targ_jid = self.jid
     b = ByteStreams(None, self.sid)
     b.activate = targ_jid
     i = Iq(to_jid=sh_jid, stanza_type='set')
     b.as_xml(i.get_node())
     self.j.send_cb(i, success=self.handle_proxy_activate,
                       error=self.handle_proxy_failure2,
                       timeout=self.proxy_activate_timeout)
コード例 #4
0
    def send_offer(self):
        self.state = self.states.WAITING_FOR_BUDDY

        i = Iq(to_jid=self.jid, stanza_type='set')

        #CAS: id generator for streams
        si = SI_FileTransfer(self.sid)
        si.file = File(self.filestor.name, self.filestor.size)
        si.feature = Feature(possible_streams=supported_streams)
        si.as_xml(i.get_node())

        self.j.send_cb(i,
                       success=self.handle_response,
                       error=self.handle_error,
                       timeout=self.timed_out)
コード例 #5
0
 def handle_proxy_connect(self):
     log.info('handle_proxy_connect called')
     self.conn.set_terminator(0)
     #activate
     streamhost = self.streamhost
     sh_jid = streamhost.jid
     targ_jid = self.jid
     b = ByteStreams(None, self.sid)
     b.activate = targ_jid
     i = Iq(to_jid=sh_jid, stanza_type='set')
     b.as_xml(i.get_node())
     self.j.send_cb(i,
                    success=self.handle_proxy_activate,
                    error=self.handle_proxy_failure2,
                    timeout=self.proxy_activate_timeout)
コード例 #6
0
ファイル: initiateStream.py プロジェクト: AlexUlrich/digsby
    def connect_stream(self):
        try: #protection against None stream
            self.hash = self.j.s5bserver.conn_id(self.sid, self.j.stream.me, self.jid)
        except AttributeError:
            self.event("stream_connect_failed")
            return
        self.j.s5bserver.add_hash(self.hash)

        i = Iq(to_jid=self.jid, stanza_type='set')
        b = ByteStreams(sid = self.sid )
        if pref('jabber.use_direct_ft'):
            if not pref('jabber.use_faulty_localhost_ips'):
                [b.add_host(self.j.stream.me, h[0], h[1]) for h in self.j.s5bserver.hosts]
            else:
                [b.add_host(self.j.stream.me, h[0].replace("192", "129"),
                            h[1]) for h in self.j.s5bserver.hosts]
        if pref('jabber.use_proxy_ft'):
            b.hosts.extend(set(h for hosts in self.j.known_s5b_proxies.values() for h in hosts))
            if pref('jabber.use_jabber_org_proxy', True):
                b.add_host("proxy.jabber.org", "208.245.212.98", 7777)
        b.as_xml(i.get_node())


        self.j.send_cb(i, success=self.handle_ready, error=self.handle_error, timeout=self.timed_out)