aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/connection_manager.vala10
-rw-r--r--libdino/src/service/module_manager.vala4
2 files changed, 7 insertions, 7 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;
}
}
diff --git a/libdino/src/service/module_manager.vala b/libdino/src/service/module_manager.vala
index eeb5369a..eb9e4fbc 100644
--- a/libdino/src/service/module_manager.vala
+++ b/libdino/src/service/module_manager.vala
@@ -24,7 +24,7 @@ public class ModuleManager {
return null;
}
- public ArrayList<XmppStreamModule> get_modules(Account account, string? resource = null) {
+ public ArrayList<XmppStreamModule> get_modules(Account account) {
ArrayList<XmppStreamModule> modules = new ArrayList<XmppStreamModule>();
lock (module_map) {
@@ -34,7 +34,7 @@ public class ModuleManager {
foreach (XmppStreamModule module in module_map[account]) {
if (module.get_id() == Bind.Module.IDENTITY.id) {
- ((Bind.Module) module).requested_resource = resource ?? account.resourcepart;
+ ((Bind.Module) module).requested_resource = account.resourcepart;
} else if (module.get_id() == Sasl.Module.IDENTITY.id) {
((Sasl.Module) module).password = account.password;
}