powered by Jive Software

Re-login will resent the last sent unavailable Presence

Dear sir:

I write some code to exit login by

val presence = Presence(Presence.Type.unavailable)
mConnection?.disconnect(presence)

and I can see the logout’s log below

2020-08-18 02:28:00.579 4825-5921/com.njdn.smartrailway D/SMACK: SENT (0): <presence id='k4S8L-861' type='unavailable'></presence><a xmlns='urn:xmpp:sm:3' h='8'/>
2020-08-18 02:28:00.692 4825-5922/com.njdn.smartrailway D/SMACK: RECV (0): <presence id="k4S8L-861" type="unavailable" from="liyexin@localhost/Android" to="liyexin@localhost/Android"/></stream:stream>

and then I login again by

mConnection.login(name, password)

something stranged below, and this issue is not 100% but very high, log is

2020-08-18 02:28:15.074 4825-5990/com.njdn.smartrailway D/SMACK: SENT (0): <iq id='k4S8L-855' type='get'><query xmlns='http://jabber.org/protocol/getjoinedrooms'></query></iq><iq to='localhost' id='778-329' type='error'><error type='modify'><not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq><r xmlns='urn:xmpp:sm:3'/><presence id='k4S8L-861' type='unavailable'></presence><iq id='k4S8L-914' type='get'><query xmlns='jabber:iq:roster'></query></iq><presence id='k4S8L-915'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>

the unavailable presence is send again! it is the same as the log which I logout!
Also the log is strange that more than one root tag to print and the openfire server can rceive the unavailable presence again, it cause many issues.

Do you know why and how to resolve it? Please reply me if you have the answer, thanks a lot!

Which Smack version is that?

I am not sure if I understand what you meant here.

The version is 4.3.4.

I mean the unavailable presence has been sent when run logout code, but when I login again and the same presence is sent again.

log is strange that one sent log with more than one node.

2020-08-18 02:28:15.074 4825-5990/com.njdn.smartrailway D/SMACK: SENT (0):
 <iq id='k4S8L-855' type='get'><query xmlns='http://jabber.org/protocol/getjoinedrooms'></query></iq>
<iq to='localhost' id='778-329' type='error'><error type='modify'><not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
<r xmlns='urn:xmpp:sm:3'/>
<presence id='k4S8L-861' type='unavailable'></presence>
<iq id='k4S8L-914' type='get'><query xmlns='jabber:iq:roster'></query></iq>
<presence id='k4S8L-915'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>

I could be wrong, but this potentially fixes your issue

What do you mean with “more than one node”?

I think OP means that it is strange to have multiple elements (in this case 3 <iq/>, one <r/> and two <presence/>) in one logged line.

Yes, you are right, thank you.
it’s strange that one logged line with multiple elements.