aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-02-20 16:29:23 +0100
committerfiaxh <git@lightrise.org>2020-02-20 17:15:51 +0100
commita81af020f30bfda4dec60a52aec142a0c5abb297 (patch)
tree5c130196e3fc6c702ab6fc6bd1b8cf1e52cc6fc9 /xmpp-vala/src/module/xep
parent4c953b58827b0d3ccb1f3c052ed1c2b7242e7afa (diff)
downloaddino-a81af020f30bfda4dec60a52aec142a0c5abb297.tar.gz
dino-a81af020f30bfda4dec60a52aec142a0c5abb297.zip
Preserve unchanged conference data (name) in bookmarks
fixes #748
Diffstat (limited to 'xmpp-vala/src/module/xep')
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks.vala20
-rw-r--r--xmpp-vala/src/module/xep/0402_bookmarks2.vala2
2 files changed, 14 insertions, 8 deletions
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks.vala b/xmpp-vala/src/module/xep/0048_bookmarks.vala
index 2fd38bea..daacf1a4 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks.vala
@@ -7,7 +7,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0048_bookmarks_module");
public async Set<Conference>? get_conferences(XmppStream stream) {
- Set<Conference> ret = new HashSet<Conference>(Conference.hash_func, Conference.equal_func);
+ Set<Conference> ret = new HashSet<Conference>(Conference.hash_func, Conference.equals_func);
StanzaNode get_node = new StanzaNode.build("storage", NS_URI).add_self_xmlns();
stream.get_module(PrivateXmlStorage.Module.IDENTITY).retrieve(stream, get_node, (stream, node) => {
@@ -54,20 +54,26 @@ public class Module : BookmarksProvider, XmppStreamModule {
public async void add_conference(XmppStream stream, Conference conference) {
Set<Conference>? conferences = yield get_conferences(stream);
conferences.add(conference);
- stream.get_module(Module.IDENTITY).set_conferences(stream, conferences);
+ set_conferences(stream, conferences);
}
- public async void replace_conference(XmppStream stream, Conference orig_conference, Conference modified_conference) {
+ public async void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference) {
Set<Conference>? conferences = yield get_conferences(stream);
- conferences.remove(orig_conference);
- conferences.add(modified_conference);
- stream.get_module(Module.IDENTITY).set_conferences(stream, conferences);
+ foreach (Conference conference in conferences) {
+ if (conference.jid.equals(muc_jid)) {
+ conference.autojoin = modified_conference.autojoin;
+ conference.name = modified_conference.name;
+ conference.nick = modified_conference.nick;
+ conference.password = modified_conference.password;
+ }
+ }
+ set_conferences(stream, conferences);
}
public async void remove_conference(XmppStream stream, Conference conference_remove) {
Set<Conference>? conferences = yield get_conferences(stream);
conferences.remove(conference_remove);
- stream.get_module(Module.IDENTITY).set_conferences(stream, conferences);
+ set_conferences(stream, conferences);
}
public override void attach(XmppStream stream) { }
diff --git a/xmpp-vala/src/module/xep/0402_bookmarks2.vala b/xmpp-vala/src/module/xep/0402_bookmarks2.vala
index 50c52ac2..563bc286 100644
--- a/xmpp-vala/src/module/xep/0402_bookmarks2.vala
+++ b/xmpp-vala/src/module/xep/0402_bookmarks2.vala
@@ -45,7 +45,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
yield stream.get_module(Pubsub.Module.IDENTITY).publish(stream, stream.get_flag(Bind.Flag.IDENTITY).my_jid.bare_jid, NS_URI, conference.jid.to_string(), conference_node, Xmpp.Xep.Pubsub.ACCESS_MODEL_WHITELIST);
}
- public async void replace_conference(XmppStream stream, Conference orig_conference, Conference modified_conference) {
+ public async void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference) {
yield add_conference(stream, modified_conference);
}