Skip to content

Commit

Permalink
Allow creating new bookmark when there are no existing bookmarks
Browse files Browse the repository at this point in the history
This commit removes early return from the set_autojoin function
to allow creating a new bookmark (with add_conference function).
  • Loading branch information
kkonsw authored and mxlgv committed Apr 2, 2024
1 parent a41e499 commit 17c4516
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions libdino/src/service/muc_manager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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<Conference>? 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);
});
Expand Down

0 comments on commit 17c4516

Please sign in to comment.