Hi,
How can i send the packet below using smack??
> <iq type='set' id='remove1'>
> <query xmlns='jabber:iq:roster'>
> <item
> jid='contact@example.org'
> subscription='remove'/>
> </query>
> </iq>
Regards,
Samba
Hi,
How can i send the packet below using smack??
> <iq type='set' id='remove1'>
> <query xmlns='jabber:iq:roster'>
> <item
> jid='contact@example.org'
> subscription='remove'/>
> </query>
> </iq>
Regards,
Samba
I would recommend that you do not use ‘raw’ stanzas to do this, but use the Roster object instead:
final Roster roster = connection.getRoster();
final RosterEntry entry = roster.getEntry("contact@example.org");
roster.removeEntry(entry);
Using the Roster is a less abstract and less error-prone way of doing this.
If you do want to send ‘raw’ stanzas, You can create an anonymous subclass of IQ, something along the lines of this:
final IQ iq = new IQ() {
@Override
public String getChildElementXML() {
return "<query xmlns='jabber:iq:roster'><item jid='contact@example.org' subscription='remove'/></query>";
}
};
iq.setType(IQ.Type.SET);
connection.sendPacket(iq);
As you see, the bottom example is a lot less clear. It’ll be harder to maintain code like this, and errors are more likely to sneak into your development process.
Hi,
Here is the test sequence and the problem i am facing regarding subscription request.
Now my problem comes here:-
Please guide me something and where i am thinking wrong?
Regards,
Samba
Actually i tried ur code but i am unable to send message at my psi client
moreever 5 users are login in xmpp servers
but i am not receiving presence information of any one.
i am also tried smack debugger
it shows foloowing message
iq id=“d94HS-2” to=“test9@intime-rajesh/Smack” type=“result”>
as i should receive presence information of all 5 users
If the users do not recieve presence information that the others generate, chances are that they are not subscribed to each-other. Could you use the Openfire admin panel to verify that all users are logged on, and have each-other on their respective rosters?
yeah i am receiving messages now thanks a lot sir !!
I am not able to receive iq packets when using packet listener and packet filter.
code
connection.addPacketListener(new MyPacketListener(),new PacketTypeFilter(IQ.class));
class MyPacketListener implements PacketListener{
public void processPacket(Packet packet){
System.out.println("Recv : " + packet.toXML());
}
This is what i get
Recv :
Actually, you do recieve the packet, but Smack doesn’t know how to process the child element of your IQ stanza. Please refer to http://www.igniterealtime.org/builds/smack/docs/latest/documentation/providers.h tml
i am trying to send a IQ packet/stanza but i dont find any constructor with no params for “org.igniterealtime.smack:smack-android-extensions:4.2.2” dependecy.
EDIT:
i replied to you 8 year later that’s funny
I don’t understand. What are you trying to do and what has it to do with smack-android-extensions?