aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/connection_manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2024-09-29 16:54:50 +0200
committerfiaxh <git@lightrise.org>2024-09-29 16:57:31 +0200
commit4d4ba7dde6d3153fa5ea652a8b37d7b78f511484 (patch)
treeaca7991e647a326c2da88ffb60fa32f5ae4594c5 /libdino/src/service/connection_manager.vala
parent64e4fb00374b149580478145137f59374f287391 (diff)
downloaddino-4d4ba7dde6d3153fa5ea652a8b37d7b78f511484.tar.gz
dino-4d4ba7dde6d3153fa5ea652a8b37d7b78f511484.zip
Generate new resource on resource conflict
Diffstat (limited to 'libdino/src/service/connection_manager.vala')
-rw-r--r--libdino/src/service/connection_manager.vala10
1 files changed, 5 insertions, 5 deletions
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala
index 43580c06..2baf0ea8 100644
--- a/libdino/src/service/connection_manager.vala
+++ b/libdino/src/service/connection_manager.vala
@@ -179,13 +179,12 @@ public class ConnectionManager : Object {
}
}
- private async void connect_stream(Account account, string? resource = null) {
+ private async void connect_stream(Account account) {
if (!connections.has_key(account)) return;
debug("[%s] (Maybe) Establishing a new connection", account.bare_jid.to_string());
connection_errors.unset(account);
- if (resource == null) resource = account.resourcepart;
XmppStreamResult stream_result;
@@ -201,7 +200,7 @@ public class ConnectionManager : Object {
connection_directly_retry[account] = false;
change_connection_state(account, ConnectionState.CONNECTING);
- stream_result = yield Xmpp.establish_stream(account.bare_jid, module_manager.get_modules(account, resource), log_options,
+ stream_result = yield Xmpp.establish_stream(account.bare_jid, module_manager.get_modules(account), log_options,
(peer_cert, errors) => { return on_invalid_certificate(account.domainpart, peer_cert, errors); }
);
connections[account].stream = stream_result.stream;
@@ -226,7 +225,7 @@ public class ConnectionManager : Object {
XmppStream stream = stream_result.stream;
- debug("[%s] New connection with resource %s: %p", account.bare_jid.to_string(), resource, stream);
+ debug("[%s] New connection: %p", account.full_jid.to_string(), stream);
connections[account].established = new DateTime.now_utc();
stream.attached_modules.connect((stream) => {
@@ -263,7 +262,8 @@ public class ConnectionManager : Object {
set_connection_error(account, new ConnectionError(ConnectionError.Source.STREAM_ERROR, flag.error_type));
if (flag.resource_rejected) {
- connect_stream.begin(account, account.resourcepart + "-" + random_uuid());
+ account.set_random_resource();
+ connect_stream.begin(account);
return;
}
}