Hi all
I am new to aSmack API. and now i have trouble in getting roster's presence.
i will post my code and the logs catched by Debugger Plugin on openfire.
mRosterListener = new RosterListener() { @Override publicvoid presenceChanged(Presence presence) { L.i("haha", "@RosterListener::presenceChanged(" + presence.getFrom() + "): " + presence); String jabberID = getJabberID(presence.getFrom()); RosterEntry rosterEntry = mRoster.getEntry(jabberID); updateRosterEntryInDB(rosterEntry); mService.rosterChanged(); } @Override publicvoid entriesUpdated(Collection<String> entries) { // TODO Auto-generated method stub } @Override publicvoid entriesDeleted(Collection<String> entries) { L.i(getClass(), "entriesDeleted(" + entries + ")"); } @Override publicvoid entriesAdded(Collection<String> entries) { L.i(getClass(), "entriesAdded(" + entries + ")"); };
and the logs
################### start ###################1401706778947
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-35, to: null, from: test1@192.168.253.2/XMPP, incoming: true, processed: false ]
xml: <presence id="u6pi2-35" from="test1@192.168.253.2/XMPP"><status>online</status><priority>0</priority><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack/" ver="AvZwVp3GnTQz86jNnqE6Knsrlj4="/></presence>
################### end #####################1401706778947
################### start ###################1401706778950
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-35, to: test1@192.168.253.2/XMPP, from: test1@192.168.253.2/XMPP, incoming: false, processed: false ]
xml: <presence id="u6pi2-35" from="test1@192.168.253.2/XMPP" to="test1@192.168.253.2/XMPP"><status>online</status><priority>0</priority><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack/" ver="AvZwVp3GnTQz86jNnqE6Knsrlj4="/></presence>
################### end #####################1401706778950
################### start ###################1401706778953
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-35, to: test1@192.168.253.2/XMPP, from: test1@192.168.253.2/XMPP, incoming: false, processed: true ]
xml: <presence id="u6pi2-35" from="test1@192.168.253.2/XMPP" to="test1@192.168.253.2/XMPP"><status>online</status><priority>0</priority><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack/" ver="AvZwVp3GnTQz86jNnqE6Knsrlj4="/></presence>
################### end #####################1401706778953
################### start ###################1401706779044
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-35, to: test1@192.168.253.2/XMPP, from: test1@192.168.253.2/XMPP, incoming: true, processed: true ]
xml: <presence id="u6pi2-35" from="test1@192.168.253.2/XMPP" to="test1@192.168.253.2/XMPP"><status>online</status><priority>0</priority><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack/" ver="AvZwVp3GnTQz86jNnqE6Knsrlj4="/></presence>
################### end #####################1401706779044
C2S - SENT (2813672): <iq type="result" id="u6pi2-34" to="test1@192.168.253.2/XMPP"/>
C2S - SENT (2813672): <presence id="u6pi2-35" from="test1@192.168.253.2/XMPP" to="test1@192.168.253.2/XMPP"><status>online</status><priority>0</priority><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack/" ver="AvZwVp3GnTQz86jNnqE6Knsrlj4="/></presence>
################### start ###################1401706787763
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-30, to: test1@192.168.253.2/XMPP, from: test2, incoming: false, processed: false ]
xml: <presence id="u6pi2-30" to="test1@192.168.253.2/XMPP" from="test2" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
################### end #####################1401706787763
################### start ###################1401706787766
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-30, to: test1@192.168.253.2/XMPP, from: test2, incoming: false, processed: true ]
xml: <presence id="u6pi2-30" to="test1@192.168.253.2/XMPP" from="test2" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
################### end #####################1401706787766
################### start ###################1401706787769
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-35, to: test1@192.168.253.2/XMPP, from: test2, incoming: false, processed: false ]
xml: <presence id="u6pi2-35" to="test1@192.168.253.2/XMPP" from="test2" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
################### end #####################1401706787769
################### start ###################1401706787775
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: u6pi2-35, to: test1@192.168.253.2/XMPP, from: test2, incoming: false, processed: true ]
xml: <presence id="u6pi2-35" to="test1@192.168.253.2/XMPP" from="test2" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
################### end #####################1401706787775
################### start ###################1401706787778
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: null, to: test1@192.168.253.2/XMPP, from: test2, incoming: false, processed: false ]
xml: <presence to="test1@192.168.253.2/XMPP" from="test2" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
################### end #####################1401706787778
################### start ###################1401706787780
id:c1743c3, address: test1@192.168.253.2/XMPP
info: [ packetID: null, to: test1@192.168.253.2/XMPP, from: test2, incoming: false, processed: true ]
xml: <presence to="test1@192.168.253.2/XMPP" from="test2" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
from the log we can see that i have done 2 things , sending my presence and receiving other roster's . sending presence does well but in receiving presence there is a 404 error which is ,i think ,caused by from = test2 and it should be from = test2@192.168.253.2/XMPP. but this packet is sent to me by server automaticly. how can i deal with it?
any advice wil be appricated deeply.
thanks in advanced !