-
ContactChangeStatusEvent
has two properties:presence
- what is best calculated presence for contact andlastReceivedPresence
- contains presence what caused firing event. Please use latest library code, and try again. If it will not help, then I will need more details: what stanzas are received, etc. -
The problem still happens on code from today's repo. Here is complete log:
BestPresence: type=null, show=XA, status= (Not available as a result of being idle more than 15 min) BestPresence stanza: <presence xmlns="jabber:client" from="sample@domain/gajim.54W7RLVK" to="kobit@domain" id="abcd9250-6f46-4129-b612-ff4ec9012c2a"> <priority>30</priority> <show>xa</show> <status> (Not available as a result of being idle more than 15 min)</status> <idle xmlns="urn:xmpp:idle:1" since="2020-10-15T17:25:38Z"/> <c xmlns="http://jabber.org/protocol/caps" node="https://gajim.org" ver="lZlpLWr1GcE7e6Amd2w0l/77U48=" hash="sha-1"/> <x xmlns="vcard-temp:x:update"> <photo>869b7799d3a28c45b7ea2075834398bdc179bfeb</photo> </x> <delay xmlns="urn:xmpp:delay" stamp="2020-10-15T17:30:50Z" from="ik.nu"/> </presence> LastPresence: type=null, show=XA, status= (Not available as a result of being idle more than 15 min) LastPresence stanza: <presence xmlns="jabber:client" from="sample@domain/gajim.54W7RLVK" to="kobit@domain" id="abcd9250-6f46-4129-b612-ff4ec9012c2a"> <priority>30</priority> <show>xa</show> <status> (Not available as a result of being idle more than 15 min)</status> <idle xmlns="urn:xmpp:idle:1" since="2020-10-15T17:25:38Z"/> <c xmlns="http://jabber.org/protocol/caps" node="https://gajim.org" ver="lZlpLWr1GcE7e6Amd2w0l/77U48=" hash="sha-1"/> <x xmlns="vcard-temp:x:update"> <photo>869b7799d3a28c45b7ea2075834398bdc179bfeb</photo> </x> <delay xmlns="urn:xmpp:delay" stamp="2020-10-15T17:30:50Z" from="ik.nu"/> </presence>
And then a few seconds later:
BestPresence: type=null, show=XA, status= (Not available as a result of being idle more than 15 min) BestPresence stanza: <presence xmlns="jabber:client" from="sample@domain/gajim.54W7RLVK" to="kobit@domain" id="abcd9250-6f46-4129-b612-ff4ec9012c2a"> <priority>30</priority> <show>xa</show> <status> (Not available as a result of being idle more than 15 min)</status> <idle xmlns="urn:xmpp:idle:1" since="2020-10-15T17:25:38Z"/> <c xmlns="http://jabber.org/protocol/caps" node="https://gajim.org" ver="lZlpLWr1GcE7e6Amd2w0l/77U48=" hash="sha-1"/> <x xmlns="vcard-temp:x:update"> <photo>869b7799d3a28c45b7ea2075834398bdc179bfeb</photo> </x> <delay xmlns="urn:xmpp:delay" stamp="2020-10-15T17:30:50Z" from="ik.nu"/> </presence> LastPresence: type=null, show=null, status=null LastPresence stanza: <presence xmlns="jabber:client" from="sample@domain/Conversations.edWE" to="kobit@domain"> <c xmlns="http://jabber.org/protocol/caps" node="http://conversations.im" ver="i7p2hiK4xwPYfSVHCR6DAhqNrXU=" hash="sha-1"/> <x xmlns="vcard-temp:x:update"> <photo>869b7799d3a28c45b7ea2075834398bdc179bfeb</photo> </x> <delay xmlns="urn:xmpp:delay" stamp="2020-10-14T07:07:58Z" from="ik.nu"/> </presence>
My understanding of the concept is that, in the second part, the best presence should be the last presence as it is "better". It shows user as available, instead of XA.
-
Best presence returns the best presence according to the XMPP protocol, so the presence with highest
priority
. In this case presence withshow
ofxa
haspriority
of30
, while the secondary presence has no priority (default value in this case is0
). Due to that, first presence is better than second one, even though second has better availability.
I use
ContactChangeStatusEvent
to intercept contact's status changes.The event provides 2 presences: bestPresence and lastPresence. I am trying to use "bestPresence" to show contact's status in the app.
However, the best presence calculation seem to be off. In my logs I am seeing something like this:
The first line shows App's own status
AWAY
based on the best presence which hasshow=XA
- second line. However, as you can see in the third line, thelastPresence
is "all nulls" which means, the user is back from XA to "available". So, this should be his best presence.