psi-im / psi

XMPP client
https://psi-im.org/
Other
402 stars 123 forks source link

We need another message status: "undelivered" #376

Open Ri0n opened 6 years ago

Ri0n commented 6 years ago

with corresponding icons, status in bd and a ability to resend (preferable automatically). undelivered means: it was sent but wasn't stored in server's side offline storage/mam, so only a sender has a copy of the message.

Possible cases: 1) client-side SM detected the message wasn't delivered to server 2) 2nd party of offline and the 2ndparty's server has all offline storages disabled (server should report this back immediately) 3) server-side SM detects a message wasn't delivered to 2ndparty. So the server will report back with a delay (sometimes significant)

more on business logic: 1) undelivered messages can be cleared (marked as permanently lost but kept in db since still can have some useful info) 2) undelivered messages have to be cleared for disabled accounts 3) undelivered messages have to be cleared after some timeout (a week?) 4) Psi should try to resend undelivered messages on each next login and corresponding contact status change 5) Psi should should not resend the undelivered messages to offline contacts if it's detected a contact's server does not support offline storage.

Ri0n commented 6 years ago

Example of undelivered message from a server

<message to="me@myserver/myres" from="2ndparty@hisserv/hisserv" id="ab87a" type="error" xml:lang="it">
  <archived xmlns="urn:xmpp:mam:tmp" by="jabber.ru" id="1527668568646280"/>
  <stanza-id xmlns="urn:xmpp:sid:0" by="jabber.ru" id="1527668568646280"/>
  <active xmlns="http://jabber.org/protocol/chatstates"/>
  <request xmlns="urn:xmpp:receipts"/>
  <error code="503" type="cancel">
    <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">User session terminated</text>
  </error>
  <body>original message's text</body>
</message>