From af52c24df7749923df897a2dd53c367a9f8ef31f Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 26 Apr 2020 00:20:27 +0200 Subject: Fix nick change in MUC, update bookmark accordingly; remove unused code --- xmpp-vala/src/module/xep/0045_muc/flag.vala | 9 +++++++-- xmpp-vala/src/module/xep/0045_muc/module.vala | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'xmpp-vala/src/module/xep') diff --git a/xmpp-vala/src/module/xep/0045_muc/flag.vala b/xmpp-vala/src/module/xep/0045_muc/flag.vala index ad181922..976291b8 100644 --- a/xmpp-vala/src/module/xep/0045_muc/flag.vala +++ b/xmpp-vala/src/module/xep/0045_muc/flag.vala @@ -50,6 +50,12 @@ public class Flag : XmppStreamFlag { public string? get_muc_nick(Jid muc_jid) { return own_nicks[muc_jid.bare_jid]; } + public void set_muc_nick(Jid muc_jid) { + if (muc_jid.is_full()) { + own_nicks[muc_jid.bare_jid] = muc_jid.resourcepart; + } + } + public string? get_enter_id(Jid muc_jid) { return enter_ids[muc_jid.bare_jid]; } public bool is_muc(Jid jid) { return own_nicks[jid] != null; } @@ -98,8 +104,7 @@ public class Flag : XmppStreamFlag { enter_ids[jid.bare_jid] = presence_id; } - internal void finish_muc_enter(Jid jid, string? nick = null) { - if (nick != null) own_nicks[jid.bare_jid] = nick; + internal void finish_muc_enter(Jid jid) { enter_ids.unset(jid.bare_jid); } diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index f8845427..9734fdbc 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -337,9 +337,11 @@ public class Module : XmppStreamModule { query_affiliation.begin(stream, bare_jid, "admin"); query_affiliation.begin(stream, bare_jid, "owner"); - flag.finish_muc_enter(bare_jid, presence.from.resourcepart); + flag.finish_muc_enter(bare_jid); flag.enter_futures[bare_jid].set_value(new JoinResult() {nick=presence.from.resourcepart}); } + + flag.set_muc_nick(presence.from); } string? affiliation_str = x_node.get_deep_attribute("item", "affiliation"); Affiliation? affiliation = null; -- cgit v1.2.3-70-g09d2