diff options
Diffstat (limited to 'libdino/src/service/module_manager.vala')
-rw-r--r-- | libdino/src/service/module_manager.vala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libdino/src/service/module_manager.vala b/libdino/src/service/module_manager.vala index b10765f1..437ecaf0 100644 --- a/libdino/src/service/module_manager.vala +++ b/libdino/src/service/module_manager.vala @@ -33,20 +33,30 @@ public class ModuleManager { public ArrayList<Core.XmppStreamModule> get_modules(Account account, string? resource = null) { ArrayList<Core.XmppStreamModule> modules = new ArrayList<Core.XmppStreamModule>(); - modules.add(new Bind.Module(resource == null ? account.resourcepart : resource)); - modules.add(new PlainSasl.Module(account.bare_jid.to_string(), account.password)); lock (module_map) { if (!module_map.has_key(account)) initialize(account); foreach (Core.XmppStreamModule module in module_map[account]) modules.add(module); } + + foreach (Core.XmppStreamModule module in module_map[account]) { + if (module.get_id() == Bind.Module.IDENTITY.id) { + (module as Bind.Module).requested_resource == null ? account.resourcepart : resource; + } else if (module.get_id() == PlainSasl.Module.IDENTITY.id) { + (module as PlainSasl.Module).password = account.password; + } + } return modules; } public void initialize(Account account) { lock(module_map) { module_map[account] = new ArrayList<Core.XmppStreamModule>(); + module_map[account].add(new Iq.Module()); module_map[account].add(new Tls.Module()); module_map[account].add(new Xep.SrvRecordsTls.Module()); + module_map[account].add(new PlainSasl.Module(account.bare_jid.to_string(), account.password)); + module_map[account].add(new Xep.StreamManagement.Module()); + module_map[account].add(new Bind.Module(account.resourcepart)); module_map[account].add(new Session.Module()); module_map[account].add(new Roster.Module()); module_map[account].add(new Xep.ServiceDiscovery.Module.with_identity("client", "pc")); |