aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-12-18 21:14:43 +0100
committerfiaxh <git@lightrise.org>2022-12-20 19:49:03 +0100
commit30f99d1347f8f5e2db364a25910d76b0faf2ea36 (patch)
tree4a56f116edce6a65cd1193869a56a18c3fa01ff8 /libdino/src/service
parent4d50c51a75de70c0f30a196e1f128154ba1651fa (diff)
downloaddino-30f99d1347f8f5e2db364a25910d76b0faf2ea36.tar.gz
dino-30f99d1347f8f5e2db364a25910d76b0faf2ea36.zip
Fix connecting to jingle file provider multiple times
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/jingle_file_transfers.vala13
1 files changed, 6 insertions, 7 deletions
diff --git a/libdino/src/service/jingle_file_transfers.vala b/libdino/src/service/jingle_file_transfers.vala
index c607b6c6..adf10034 100644
--- a/libdino/src/service/jingle_file_transfers.vala
+++ b/libdino/src/service/jingle_file_transfers.vala
@@ -64,7 +64,7 @@ public class JingleFileProvider : FileProvider, Object {
public JingleFileProvider(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
- stream_interactor.stream_negotiated.connect(on_stream_negotiated);
+ stream_interactor.account_added.connect(on_account_added);
}
public FileMeta get_file_meta(FileTransfer file_transfer) throws FileReceiveError {
@@ -114,15 +114,14 @@ public class JingleFileProvider : FileProvider, Object {
return 1;
}
- private void on_stream_negotiated(Account account, XmppStream stream) {
+ private void on_account_added(Account account) {
+ XmppStream stream = stream_interactor.get_stream(account);
+
stream_interactor.module_manager.get_module(account, Xmpp.Xep.JingleFileTransfer.Module.IDENTITY).file_incoming.connect((stream, jingle_file_transfer) => {
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jingle_file_transfer.peer.bare_jid, account);
- if (conversation == null) {
- // TODO(hrxi): What to do?
- return;
- }
- string id = random_uuid();
+ if (conversation == null) return;
+ string id = random_uuid();
file_transfers[id] = jingle_file_transfer;
FileMeta file_meta = new FileMeta();