Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chat states): Send chat state (XEP-0085) #98

Merged
merged 3 commits into from
Feb 16, 2023

Conversation

nioc
Copy link
Owner

@nioc nioc commented Feb 14, 2023

Opt-out for composing/pauses/active states
Opt-in for inactive state
Save user preferences to local storage
And add icons to presence controller

#57

Opt-out for composing/pauses/active states
Opt-in for inactive state
Save user preferences to local storage
And add icons to presence controller
@nioc nioc self-assigned this Feb 14, 2023
@nioc nioc added the enhancement New feature or request label Feb 14, 2023
@nioc nioc added this to the 0.9.12 milestone Feb 14, 2023
@nioc
Copy link
Owner Author

nioc commented Feb 14, 2023

New UI for the presence controller with opt-in/out and icons:

image

@nioc nioc added the help wanted Extra attention is needed label Feb 14, 2023
@nioc
Copy link
Owner Author

nioc commented Feb 14, 2023

@Ppjet6 If I may ask you to take a quick look at this one, that would be very nice of you 😄
I would like to release the 0.9.12 with it.

@Ppjet6
Copy link
Contributor

Ppjet6 commented Feb 14, 2023

I have to admit I don't know your framework very much, and don't know this feature really well either.

Because you have an option not to send inactive states, I guess you'll want to replace every <inactive/> payload with <active/> when it's disabled.

I tried to run your branch but the stars won't align today and nothing is working. :(
I can have another look tomorrow if you want.

@nioc
Copy link
Owner Author

nioc commented Feb 14, 2023

When the user click on another room or contact chat, If he opt-in the "send inactive chat state", it will send <inactive xmlns='http://jabber.org/protocol/chatstates'/> , otherwise it is not sent.

For composing (and paused) states it is when user is typing (and after a delay), only if the user does not opt-out for it.

I hope I didn't break anything. I will attach a release.tar.gz in few hours for testing.

@nioc
Copy link
Owner Author

nioc commented Feb 14, 2023

Here the draft release xmpp-web-57-send-chat-states-xep-0085.tar.gz

Also the docker image:
docker pull nioc/xmpp-web:57-send-chat-states-xep-0085

@Ppjet6
Copy link
Contributor

Ppjet6 commented Feb 15, 2023

Looks like it's working alright! It's just sending chatstates right? Not reading.

@Ppjet6
Copy link
Contributor

Ppjet6 commented Feb 15, 2023

I realized it's not "clearing" the <paused/> state over the wire? A client may keep displaying it until it receives something else from XMPP Web.

@nioc
Copy link
Owner Author

nioc commented Feb 15, 2023

Yes it just do this 😄
If you mean by "reading": displaying chat states, it is already implemented with an icon on the top bar:
20230215_181334
If you mean read Mark it is another XEP 0333 on #4.

Yes it leaves in paused until you send or erase (active) or type again (composing). It is what I understood from the XEP spec.
Testing with Gajim which removes the state itself after a while without receiving anything from xmpp-web.

@nioc
Copy link
Owner Author

nioc commented Feb 15, 2023

Pseudo code :

On input (typing or erasing)
      Do nothing and finish if opt-out
      remove `pause` timer 
      If composing message not empty
         Prepare timer: in 15s send `paused`
         If already sent `composing` do nothing
         Send`composing`
      Else (cleared draft) 
         Send `active`

@Ppjet6
Copy link
Contributor

Ppjet6 commented Feb 16, 2023

The issue with leaving the <paused/> state hanging is that some clients don't clear it up themselves. The source of truth being the sending client and not what they think of the sending client. That's also more state to manage for the receiving client when you could just read and display what comes.

As for "reading", I meant displaying what other clients send you. And I don't think you do (and that's ok!)

@nioc
Copy link
Owner Author

nioc commented Feb 16, 2023

I agree it is not great, but it would only appears when a user leave unfinished his message without sending or erasing (the paused status is, in this case, relevant).
Reading the specs make me think that we should not sending other status.
The only workaround would be to send an active after a longer delay, but I propose releasing as-is and reacting if there are issues.

@nioc nioc merged commit f7c5ed0 into master Feb 16, 2023
@nioc nioc deleted the 57-send-chat-states-xep-0085 branch February 17, 2023 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants