diff --git a/README.md b/README.md
index bacf98d..2820182 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ Lightweight web chat client for XMPP server.
- Retrieve contacts (roster) and bookmarked rooms (XEP-0048),
- Send and receive files over HTTP (XEP-0066, XEP-0363),
- Handle password protected room,
-- Display chat state notifications: is composing, is paused (XEP-0085),
+- Display and send chat state notifications: is composing, is paused (XEP-0085),
- Format messages: bold, italic, striked, link and code inline/block (XEP-0393),
- Pick emoji,
- Room creation and configuration,
diff --git a/src/assets/styles.scss b/src/assets/styles.scss
index 12ab5c3..b404966 100644
--- a/src/assets/styles.scss
+++ b/src/assets/styles.scss
@@ -173,6 +173,10 @@ body,
user-select: all;
}
+.has-no-wrap {
+ white-space: nowrap;
+}
+
.messages-container {
overflow-y: auto;
scroll-behavior: smooth;
diff --git a/src/components/Chat.vue b/src/components/Chat.vue
index 9b0884a..3843c12 100644
--- a/src/components/Chat.vue
+++ b/src/components/Chat.vue
@@ -98,6 +98,7 @@ export default {
...mapState(useStore, [
'activeChat',
'messages',
+ 'isSendingInactiveChatStates',
]),
hasGuestInviteLink () {
return window.config.hasGuestAccess && this.isRoom
@@ -112,6 +113,22 @@ export default {
// handle route prop
this.handleRoute()
},
+ async beforeUnmount () {
+ if (!this.userJid) {
+ // $xmpp is not loaded
+ return
+ }
+ if (!this.isSendingInactiveChatStates) {
+ // the user has not opted in
+ return
+ }
+ // notify leaving discussion
+ try {
+ await this.$xmpp.sendChatState(this.jid, this.isRoom, 'inactive')
+ } catch (error) {
+ console.warn(error.message)
+ }
+ },
methods: {
// check if a jid is current user (including MUC nick)
isUser (jid) {
diff --git a/src/components/Home.vue b/src/components/Home.vue
index 8c5f98e..8ffec28 100644
--- a/src/components/Home.vue
+++ b/src/components/Home.vue
@@ -11,7 +11,7 @@