prose-im / prose-app-macos

Prose macOS application. XMPP client for team messaging.
https://prose.org/downloads
Mozilla Public License 2.0
58 stars 3 forks source link

Sidebar: Current user states #44

Open valeriansaliou opened 2 years ago

valeriansaliou commented 2 years ago
nesium commented 2 years ago

Subscribe to the presence for the local user resource

I'm not sure if I'm understanding that correctly. From what I've read so far When connecting the client sends the initial presence to the server which signals availability. Either in that presence stanza or later the client also has the option to include the show and or status properties.

In my understanding the presence as such is a local thing. The Prose app would save the last configured presence by the user and would send it to the server once it is reconnected. Am I missing something?

valeriansaliou commented 2 years ago

It's even simpler. XMPP clients do not need to hold a persistent storage of presence states. The server does hold a runtime storage of all remote contact presences. When you (as a client) announce your first available presence, the server understands that it should (literally) flood you with the presence of all your online contacts. So you receive 1 presence stanza per online contact. Offline contacts would say silent in this case. Therefore, you can consider all contacts offline when the app boot (do not recover anything from the disk, it might be invalid and expired), and wait for your own server to re-announce all your contact presences (even remote ones, ie. those on another server).

nesium commented 2 years ago

Thanks! That's clear so far. I was specifically referring to what you've described as "presence for the local user resource", so your own presence. Especially that you suggested that one needs to "subscribe" to it. But it's the client where the presence originates from so there's no point in subscribing to it, unless I'm missing something.

As I've mentioned I do think that we should persist the user's presence setting. E.g. when the user sets themselves to 'away', after restarting the app should still have the same setting.

nesium commented 2 years ago

Is that for multi-device use? And we'd say that the device that is connected first determines the presence. When another device (from the same account) comes later online it doesn't overwrite the current presence but inherits it instead?