diff options
author | mightymop <totzkotz@gmail.com> | 2022-02-26 21:21:52 +0300 |
---|---|---|
committer | mightymop <totzkotz@gmail.com> | 2022-02-27 03:43:35 +0300 |
commit | 1970ecad2995a7b06383606532e4f6e08727bd0c (patch) | |
tree | 4e88f9df114053766744a67fb33203e380d5cd8f | |
parent | f4b82b0cc0eb8cc7778191dd77ef6b8210615f6c (diff) |
fix: clean up after leave, fix rejoin muc
-rw-r--r-- | src/MultiUserContact.ts | 14 | ||||
-rw-r--r-- | src/ui/MultiUserChatWindow.ts | 4 | ||||
-rw-r--r-- | src/ui/RosterItem.ts | 6 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/MultiUserContact.ts b/src/MultiUserContact.ts index 0743a8d7..3f29bb41 100644 --- a/src/MultiUserContact.ts +++ b/src/MultiUserContact.ts @@ -117,11 +117,25 @@ export default class MultiUserContact extends Contact { this.removeAllMembers(); this.refreshFeatures(); + let nick = this.getNickname(); + if (nick === null || nick === undefined) { + nick = this.getAccount().getDefaultNickname(); + if (nick === null || nick === undefined) { + nick = this.getAccount().getJID().node; + } + this.setNickname(nick); + } return this.getService().joinMultiUserRoom(new JID(this.jid.bare, this.getNickname()), this.data.get('password')); } public leave() { + this.data.set('resources', {}); + this.data.set('presence', Presence.offline); + + this.setNickname(null); + this.removeAllMembers(); + return this.getService().leaveMultiUserRoom(this.getJid()); } diff --git a/src/ui/MultiUserChatWindow.ts b/src/ui/MultiUserChatWindow.ts index d9c88bad..155914df 100644 --- a/src/ui/MultiUserChatWindow.ts +++ b/src/ui/MultiUserChatWindow.ts @@ -165,6 +165,7 @@ export default class MultiUserChatWindow extends ChatWindow { this.addMenuEntry('jsxc-leave', Translation.t('Leave'), () => { this.contact.leave(); + this.contact.shutdown(); }); this.addMenuEntry('jsxc-invite', Translation.t('Invite'), () => { @@ -210,9 +211,12 @@ export default class MultiUserChatWindow extends ChatWindow { private enable() { this.element.removeClass('jsxc-disabled'); + this.enableMenu(); + this.getAccount().triggerChatWindowInitializedHook(this, this.contact); } private disable() { + this.disableMenu(); this.element.addClass('jsxc-disabled'); } } diff --git a/src/ui/RosterItem.ts b/src/ui/RosterItem.ts index b03d4df9..7c7ca4b2 100644 --- a/src/ui/RosterItem.ts +++ b/src/ui/RosterItem.ts @@ -62,6 +62,12 @@ export default class RosterItem { Client.getChatWindowList().minimizeAll(); } + if (contact.isGroupChat()) { + let mContact = <MultiUserContact>contact; + if (mContact.getNickname() === null || mContact.getNickname() === undefined) { + mContact.join(); + } + } chatWindow.openProminently(); }); |