powered by Jive Software

Remove roster entry

Is there currently a way to remove a roster entry from the server? Maybe I’'m just not seeing it? If you remove a roster entry from a group, will it also remove it from the roster? Thanks!

Yep, removing a roster item from a group is the way to go. I suppose a method needs to be added to remove unfiled roster entries though. Maybe I should add a method to delete an entry entirely from your roster at once as well?



Having a method to remove a roster entry based on JID would be great for completeness. Certainly not a priority, since the functionality is essentially there in the removal-from-group method. Maybe I was the only one slightly confused by that =). I was testing using only unfiled entries.

Providing the ability to remove a roster entry at the packet level would be great. Currently, I am using Smack only at the packet level because I already have a previous infrastructure that was using a different XMPP library before. Thus, I am using RosterPacket and not the higher-level entities such as Roster and RosterGroup.

Currently I don’'t see a way of removing a roster entry just by setting up a RosterPacket and sending it. The necessary XML to remove a roster entry is something like this:






Perhaps you could add a method to RosterPacket that allows it to create a packet such as this?



The only change that need to be made for this is to add:

public static final ItemType REMOVE = new ItemType(“remove”);


else if (“remove”.equals(value)) {

return REMOVE;


into the RosterPacket.ItemType enumeration class.

Then you could remove an item as such:

RosterEntry entry = getRosterEntryByJID(JID);

RosterPacket packet = new RosterPacket();


RosterPacket.Item item = new RosterPacket.Item(entry.getUser(), entry.getName());




Easy temp solution until Matt adds it to Smack.

Take care,


Sounds like a good suggestion. I’'ll file a feature request for it.


Just checked this fix in (added REMOVE constant to RosterPacket class).



I’'m trying do delte a RosterEntry like this:

RosterPacket pack = new RosterPacket();


RosterPacket.Item item = new RosterPacket.Item(user, nick);




While running this code out of Netbeans 3.5 there is no problem.

But if make my project a jar file I get allways this error:

java.lang.NoClassDefFoundError: org/jivesoftware/smack/packet/Packet

Everything works fine with smack until I use that code…

(Class-Path is set to smack in Manifest and org.jivesoftware.smack.packet.* is imported)

Has someone an answer for that problem?

Are you compiling the Smack source code as part of your project? If so, you might want to just include the Smack JAR file as part of your classpath instead. That should likely work a lot better.



THX! Found my problem! There was an error in my Manifest. I don’'t know why it work without that code…