Mercurial > libervia-desktop-kivy
comparison src/cagou/plugins/plugin_wid_chat.py @ 98:4d8c122b86a6
menu (upload): send transfer (i.e. P2P transfer) is now working
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 29 Dec 2016 23:47:10 +0100 |
parents | 5d2289127bb7 |
children | d7447c585603 |
comparison
equal
deleted
inserted
replaced
97:5d2289127bb7 | 98:4d8c122b86a6 |
---|---|
631 xmlui = progress_data['xmlui'] | 631 xmlui = progress_data['xmlui'] |
632 G.host.showUI(xmlui) | 632 G.host.showUI(xmlui) |
633 else: | 633 else: |
634 self._waiting_pids[progress_id] = (self.fileTransferDone, cleaning_cb) | 634 self._waiting_pids[progress_id] = (self.fileTransferDone, cleaning_cb) |
635 | 635 |
636 def onTransferOK(self, file_path, cleaning_cb): | 636 def onTransferOK(self, file_path, cleaning_cb, transfer_type): |
637 G.host.bridge.fileTransfer( | 637 if transfer_type == C.TRANSFER_UPLOAD: |
638 file_path, | 638 G.host.bridge.fileUpload( |
639 "", | 639 file_path, |
640 "", | 640 "", |
641 {"ignore_tls_errors": C.BOOL_TRUE}, # FIXME: should not be the default | 641 "", |
642 self.profile, | 642 {"ignore_tls_errors": C.BOOL_TRUE}, # FIXME: should not be the default |
643 callback = lambda progress_data: self.fileTransferCb(progress_data, cleaning_cb) | 643 self.profile, |
644 ) | 644 callback = lambda progress_data: self.fileTransferCb(progress_data, cleaning_cb) |
645 ) | |
646 elif transfer_type == C.TRANSFER_SEND: | |
647 if self.type == C.CHAT_GROUP: | |
648 log.warning(u"P2P transfer is not possible for group chat") | |
649 # TODO: show an error dialog to user, or better hide the send button for MUC | |
650 else: | |
651 jid_ = self.target | |
652 if not jid_.resource: | |
653 jid_ = G.host.contact_lists[self.profile].getFullJid(jid_) | |
654 G.host.bridge.fileSend(jid_, file_path, "", "", profile=self.profile) | |
655 # TODO: notification of sending/failing | |
656 else: | |
657 raise log.error(u"transfer of type {} are not handled".format(transfer_type)) | |
658 | |
645 | 659 |
646 def _mucJoinCb(self, joined_data): | 660 def _mucJoinCb(self, joined_data): |
647 joined, room_jid_s, occupants, user_nick, subject, profile = joined_data | 661 joined, room_jid_s, occupants, user_nick, subject, profile = joined_data |
648 self.host.mucRoomJoinedHandler(*joined_data[1:]) | 662 self.host.mucRoomJoinedHandler(*joined_data[1:]) |
649 jid_ = jid.JID(room_jid_s) | 663 jid_ = jid.JID(room_jid_s) |