From 17c451652d6e8ab3fa63de6863f346d32698a546 Mon Sep 17 00:00:00 2001 From: Konstantin Kuznetsov Date: Tue, 2 Apr 2024 17:02:40 +0300 Subject: [PATCH] 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). --- libdino/src/service/muc_manager.vala | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala index b5fb3d38..ab779966 100644 --- a/libdino/src/service/muc_manager.vala +++ b/libdino/src/service/muc_manager.vala @@ -628,17 +628,19 @@ public class MucManager : StreamInteractionModule, Object { private void set_autojoin(Account account, XmppStream stream, Jid jid, string? nick, string? password) { bookmarks_provider[account].get_conferences.begin(stream, (_, res) => { Set? conferences = bookmarks_provider[account].get_conferences.end(res); - if (conferences == null) return; - foreach (Conference conference in conferences) { - if (conference.jid.equals(jid)) { - if (!conference.autojoin) { - 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); + if (conferences != null) { + foreach (Conference conference in conferences) { + if (conference.jid.equals(jid)) { + if (!conference.autojoin) { + 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 }; bookmarks_provider[account].add_conference.begin(stream, changed); });