Allow creating new bookmark when there are no existing bookmarks

This commit removes early return from the set_autojoin function
to allow creating a new bookmark (with add_conference function).
This commit is contained in:
Konstantin Kuznetsov 2024-04-02 17:02:40 +03:00 committed by Maxim Logaev
parent a41e499bf0
commit 17c451652d

View file

@ -628,17 +628,19 @@ public class MucManager : StreamInteractionModule, Object {
private void set_autojoin(Account account, XmppStream stream, Jid jid, string? nick, string? password) { private void set_autojoin(Account account, XmppStream stream, Jid jid, string? nick, string? password) {
bookmarks_provider[account].get_conferences.begin(stream, (_, res) => { bookmarks_provider[account].get_conferences.begin(stream, (_, res) => {
Set<Conference>? conferences = bookmarks_provider[account].get_conferences.end(res); Set<Conference>? conferences = bookmarks_provider[account].get_conferences.end(res);
if (conferences == null) return;
foreach (Conference conference in conferences) { if (conferences != null) {
if (conference.jid.equals(jid)) { foreach (Conference conference in conferences) {
if (!conference.autojoin) { if (conference.jid.equals(jid)) {
Conference new_conference = new Conference() { jid=jid, nick=nick ?? conference.nick, name=conference.name, password=password ?? conference.password, autojoin=true }; if (!conference.autojoin) {
bookmarks_provider[account].replace_conference.begin(stream, jid, new_conference); Conference new_conference = new Conference() { jid=jid, nick=nick ?? conference.nick, name=conference.name, password=password ?? conference.password, autojoin=true };
bookmarks_provider[account].replace_conference.begin(stream, jid, new_conference);
}
return;
} }
return;
} }
} }
Conference changed = new Xep.Bookmarks.Bookmarks1Conference(jid) { nick=nick, password=password, autojoin=true }; 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);
}); });