diff options
author | fiaxh <git@lightrise.org> | 2020-04-26 00:20:27 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-04-26 00:20:27 +0200 |
commit | af52c24df7749923df897a2dd53c367a9f8ef31f (patch) | |
tree | de9bbeef864cc90b84bd9498c28240fc308ee319 /xmpp-vala | |
parent | ee9795d8f466706e06b2fdbc9beca2f8ecbf5d08 (diff) | |
download | dino-af52c24df7749923df897a2dd53c367a9f8ef31f.tar.gz dino-af52c24df7749923df897a2dd53c367a9f8ef31f.zip |
Fix nick change in MUC, update bookmark accordingly; remove unused code
Diffstat (limited to 'xmpp-vala')
-rw-r--r-- | xmpp-vala/src/module/xep/0045_muc/flag.vala | 9 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0045_muc/module.vala | 4 |
2 files changed, 10 insertions, 3 deletions
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; |