Example #1
0
 def handle_response(self, stanza):
     self.state = self.states.CONNECTING
     si = SI_FileTransfer.from_iq(stanza)
     self.stream = b = stream_connectors[si.feature.selected_stream](self)
     b.bind_event("stream_connected", self.transferring)
     b.bind_event("stream_connect_failed", self.stream_connect_failed)
     b.bind_event("stream_error", self.stream_error)
     b.bind_event("stream_closed", self.stream_closed)
     b.connect_stream()
Example #2
0
 def handle_response(self, stanza):
     self.state = self.states.CONNECTING
     si = SI_FileTransfer.from_iq(stanza)
     self.stream = b = stream_connectors[si.feature.selected_stream](self)
     b.bind_event("stream_connected", self.transferring)
     b.bind_event("stream_connect_failed", self.stream_connect_failed)
     b.bind_event("stream_error", self.stream_error)
     b.bind_event("stream_closed", self.stream_closed)
     b.connect_stream()
Example #3
0
    def __init__(self, si_handler, iq):
        self.si_handler = si_handler
        self.stanza = iq
        self.si_ft = SI_FileTransfer.from_iq(iq)
        self.bytestream = None
        self._lock = threading.RLock()

        if self.check_streams():
            #CAS: fix this with fail cases, i.e. check to see if this is a valid offer

            ft = self.si_ft
            self.numfiles = 1
            self.name     = ft.file.name
            self.size     = ft.file.size
            self.buddy    = self.si_handler.j.buddies[iq.get_from()]
            file_desc = unicode(ft.file.desc)
            IncomingFileTransfer.__init__(self)
            si_handler.j.hub.on_file_request(si_handler.j, self)

            self.on_get_buddy(self.buddy)
Example #4
0
    def __init__(self, si_handler, iq):
        self.si_handler = si_handler
        self.stanza = iq
        self.si_ft = SI_FileTransfer.from_iq(iq)
        self.bytestream = None
        self._lock = threading.RLock()

        if self.check_streams():
            #CAS: fix this with fail cases, i.e. check to see if this is a valid offer

            ft = self.si_ft
            self.numfiles = 1
            self.name = ft.file.name
            self.size = ft.file.size
            self.buddy = self.si_handler.j.buddies[iq.get_from()]
            file_desc = unicode(ft.file.desc)
            IncomingFileTransfer.__init__(self)
            si_handler.j.hub.on_file_request(si_handler.j, self)

            self.on_get_buddy(self.buddy)