webxdc: synchronous state for read-only-chats

already before,
we did _not_ sent updates to contact requests or other read-only-chats.
however, we _did_ modify the local database,
so that getAllUpdates() returns an update that was not sent out to other peers.

this is fixed by checking can_send() soon.

that way, all peers have the same state
also for contact requests or other read-only-chats
and webxdc in contact requests can be opened as usual.

further ui improvements may be needed for contact requests
(maybe allow the webxdc to know about that state or
maybe show a warning in the ui somewhere),
however, this is not part of this pr.
This commit is contained in:
B. Petersen
2022-01-22 16:58:02 +01:00
committed by bjoern
parent f21691c122
commit 05a3c0c89b
3 changed files with 54 additions and 1 deletions

View File

@@ -44,6 +44,13 @@ To get a shared state, the peers use `sendUpdate()` to send updates to each othe
All peers, including the sending one,
will receive the update by the callback given to `setUpdateListener()`.
There are situations where the user cannot send messages to a chat,
eg. contact requests or if the user has left a group.
In these cases, you can still call `sendUpdate()`,
however, the update won't be sent to other peers
and you won't get the update by `setUpdateListener()` nor by `getAllUpdates()`.
### setUpdateListener()
```js