def start_file_transfer(self, jid, file_props, request=False): logger.info("start file transfer with file: %s", file_props) contact = gajim.contacts.get_contact_with_highest_priority( self.name, gajim.get_jid_without_resource(jid)) if gajim.contacts.is_gc_contact(self.name, jid): gcc = jid.split('/') if len(gcc) == 2: contact = gajim.contacts.get_gc_contact( self.name, gcc[0], gcc[1]) if contact is None: return use_security = contact.supports(nbxmpp.NS_JINGLE_XTLS) jingle = JingleSession(self, weinitiate=True, jid=jid, werequest=request) # this is a file transfer jingle.session_type_FT = True self._sessions[jingle.sid] = jingle file_props.sid = jingle.sid if contact.supports(nbxmpp.NS_JINGLE_BYTESTREAM): transport = JingleTransportSocks5() elif contact.supports(nbxmpp.NS_JINGLE_IBB): transport = JingleTransportIBB() c = JingleFileTransfer(jingle, transport=transport, file_props=file_props, use_security=use_security) file_props.algo = self.__hash_support(contact) jingle.add_content('file' + helpers.get_random_string_16(), c) jingle.start_session() return c.transport.sid
def start_file_transfer(self, jid, file_props, request=False): logger.info("start file transfer with file: %s" % file_props) contact = gajim.contacts.get_contact_with_highest_priority(self.name, gajim.get_jid_without_resource(jid)) if gajim.contacts.is_gc_contact(self.name,jid): gcc = jid.split('/') if len(gcc) == 2: contact = gajim.contacts.get_gc_contact(self.name, gcc[0], gcc[1]) if contact is None: return use_security = contact.supports(nbxmpp.NS_JINGLE_XTLS) jingle = JingleSession(self, weinitiate=True, jid=jid, werequest=request) # this is a file transfer jingle.session_type_FT = True self._sessions[jingle.sid] = jingle file_props.sid = jingle.sid if contact.supports(nbxmpp.NS_JINGLE_BYTESTREAM): transport = JingleTransportSocks5() elif contact.supports(nbxmpp.NS_JINGLE_IBB): transport = JingleTransportIBB() c = JingleFileTransfer(jingle, transport=transport, file_props=file_props, use_security=use_security) file_props.algo = self.__hash_support(contact) jingle.add_content('file' + helpers.get_random_string_16(), c) jingle.start_session() return c.transport.sid
def start_whiteboard(self): conn = gajim.connections[self.chat_control.account] jingle = JingleSession(conn, weinitiate=True, jid=self.jid) self.sid = jingle.sid conn._sessions[jingle.sid] = jingle content = JingleWhiteboard(jingle) content.control = self jingle.add_content('xhtml', content) jingle.start_session()
def start_audio(self, jid): if self.get_jingle_session(jid, media='audio'): return self.get_jingle_session(jid, media='audio').sid jingle = self.get_jingle_session(jid, media='video') if jingle: jingle.add_content('voice', JingleAudio(jingle)) else: jingle = JingleSession(self, weinitiate=True, jid=jid) self._sessions[jingle.sid] = jingle jingle.add_content('voice', JingleAudio(jingle)) jingle.start_session() return jingle.sid