Fix auto-joining bookmark without nick

This commit is contained in:
fiaxh 2020-01-08 18:15:42 +01:00
parent 067184f00c
commit b1bbb9f587
2 changed files with 3 additions and 3 deletions

View file

@ -38,7 +38,7 @@ public class MucManager : StreamInteractionModule, Object {
public async Muc.JoinResult? join(Account account, Jid jid, string? nick, string? password) { public async Muc.JoinResult? join(Account account, Jid jid, string? nick, string? password) {
XmppStream? stream = stream_interactor.get_stream(account); XmppStream? stream = stream_interactor.get_stream(account);
if (stream == null) return null; if (stream == null) return null;
string nick_ = nick ?? account.bare_jid.localpart ?? account.bare_jid.domainpart; string nick_ = (nick ?? account.localpart) ?? account.domainpart;
DateTime? history_since = null; DateTime? history_since = null;
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account);
@ -372,7 +372,6 @@ public class MucManager : StreamInteractionModule, Object {
Set<Conference>? conferences = bookmarks_provider[account].get_conferences.end(res); Set<Conference>? conferences = bookmarks_provider[account].get_conferences.end(res);
if (conferences == null) return; if (conferences == null) return;
Conference changed = new Xep.Bookmarks.Bookmarks1Conference(jid) { nick=nick, password=password, autojoin=true };
foreach (Conference conference in conferences) { foreach (Conference conference in conferences) {
if (conference.jid.equals(jid)) { if (conference.jid.equals(jid)) {
if (!conference.autojoin) { if (!conference.autojoin) {
@ -386,6 +385,7 @@ public class MucManager : StreamInteractionModule, Object {
return; return;
} }
} }
Conference changed = new Xep.Bookmarks.Bookmarks1Conference(jid) { nick=nick, password=password, autojoin=true };
bookmarks_provider[account].add_conference.begin(stream, changed); bookmarks_provider[account].add_conference.begin(stream, changed);
}); });
} }

View file

@ -47,7 +47,7 @@ public class Register : StreamInteractionModule, Object{
ret = ConnectionManager.ConnectionError.Source.SASL; ret = ConnectionManager.ConnectionError.Source.SASL;
Idle.add((owned)callback); Idle.add((owned)callback);
}); });
stream.connect.begin(account.bare_jid.domainpart, (_, res) => { stream.connect.begin(account.domainpart, (_, res) => {
try { try {
stream.connect.end(res); stream.connect.end(res);
} catch (Error e) { } catch (Error e) {