From bce709b794b558d0f055a3e24d0f49ed679d3ad3 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 24 Dec 2019 16:46:55 +0100 Subject: Store MUC passwords in bookmark fixes #470 --- xmpp-vala/src/module/xep/0045_muc/module.vala | 15 +++++---------- xmpp-vala/src/module/xep/0048_bookmarks.vala | 1 + xmpp-vala/src/module/xep/0048_conference.vala | 3 ++- 3 files changed, 8 insertions(+), 11 deletions(-) (limited to 'xmpp-vala/src/module/xep') diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index ec10d500..aef10f9f 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -70,8 +70,6 @@ public class Module : XmppStreamModule { public signal void room_name_set(XmppStream stream, Jid jid, string? room_name); public signal void invite_received(XmppStream stream, Jid room_jid, Jid from_jid, string? password, string? reason); - public signal void room_entered(XmppStream stream, Jid jid, string nick); - public signal void room_enter_error(XmppStream stream, Jid jid, MucEnterError? error); // TODO "?" shoudln't be necessary (vala bug), remove someday public signal void self_removed_from_room(XmppStream stream, Jid jid, StatusCode code); public signal void removed_from_room(XmppStream stream, Jid jid, StatusCode? code); @@ -226,12 +224,6 @@ public class Module : XmppStreamModule { if (stream.get_module(ServiceDiscovery.Module.IDENTITY) != null) { stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI); } - - room_entered.connect((stream, jid, nick) => { - query_affiliation(stream, jid, "member", null); - query_affiliation(stream, jid, "admin", null); - query_affiliation(stream, jid, "owner", null); - }); } public override void detach(XmppStream stream) { @@ -300,7 +292,6 @@ public class Module : XmppStreamModule { break; } if (error != MucEnterError.NONE) { - room_enter_error(stream, bare_jid, error); flag.enter_futures[bare_jid].set_value(new JoinResult() {muc_error=error}); } else { flag.enter_futures[bare_jid].set_value(new JoinResult() {stanza_error=error_stanza.condition}); @@ -319,7 +310,11 @@ public class Module : XmppStreamModule { if (status_codes.contains(StatusCode.SELF_PRESENCE)) { Jid bare_jid = presence.from.bare_jid; if (flag.get_enter_id(bare_jid) != null) { - room_entered(stream, bare_jid, presence.from.resourcepart); + + query_affiliation(stream, bare_jid, "member", null); + query_affiliation(stream, bare_jid, "admin", null); + query_affiliation(stream, bare_jid, "owner", null); + flag.finish_muc_enter(bare_jid, presence.from.resourcepart); flag.enter_futures[bare_jid].set_value(new JoinResult() {nick=presence.from.resourcepart}); } diff --git a/xmpp-vala/src/module/xep/0048_bookmarks.vala b/xmpp-vala/src/module/xep/0048_bookmarks.vala index 8454d711..2fd38bea 100644 --- a/xmpp-vala/src/module/xep/0048_bookmarks.vala +++ b/xmpp-vala/src/module/xep/0048_bookmarks.vala @@ -42,6 +42,7 @@ public class Module : BookmarksProvider, XmppStreamModule { conference_node.put_node(new StanzaNode.build("nick", NS_URI) .put_node(new StanzaNode.text(conference.nick))); } + // TODO (?) Bookmarks 2 currently don't define a password storage_node.put_node(conference_node); } } diff --git a/xmpp-vala/src/module/xep/0048_conference.vala b/xmpp-vala/src/module/xep/0048_conference.vala index fdc26152..b61de1c0 100644 --- a/xmpp-vala/src/module/xep/0048_conference.vala +++ b/xmpp-vala/src/module/xep/0048_conference.vala @@ -71,9 +71,10 @@ public class Bookmarks1Conference : Conference { return; } if (password_node == null) { - password_node = new StanzaNode.build(NODE_PASSWORD); + password_node = new StanzaNode.build(NODE_PASSWORD, NS_URI); stanza_node.put_node(password_node); } + password_node.sub_nodes.clear(); password_node.put_node(new StanzaNode.text(value)); } } -- cgit v1.2.3-70-g09d2