roster.removeEntry(entry) does NOT work

I have your latest build 1.41 from 11/04.

I can’'t get roster.removeEntry(entry) to work properly.

The exodus client removes the entry, but the smack api doesn’‘t remove it from it’'s internal roster…

all packets are going accross and nothing is getting lost, but the removeEntry() method does not seem to remove it from the internal roster object.

If I do a roster.entrycount(), the original roster entry is still there.

HELP…

This is what I tried and it worked fine:

  1. Log into the server from a Smack client

  2. Add roster items to the roster of the user

  3. Log into the server from Exodus

  4. Remove the roster item from Exodus

This is the packet that Exodus sent to the server:

<iq id="jcl_165" type="set">
    <query xmlns="jabber:iq:roster"><item jid="user1@localhost" subscription="remove"/>
    </query>
</iq>

The Smack client received this packet from the server:

<iq id="567-88" to="user0@localhost/Smack" type="set">
  <query xmlns="jabber:iq:roster">
    <item jid="user1@localhost" subscription="remove"/>
  </query>
</iq>

and the roster of the user in Smack was updated accordingly. This is the expected result since Smack is always listening for the roster packets and will update the roster automatically.

I have a question for you, why are you mentioning the method #removeEntry()? Are you trying to manually remove the item from the roster? There is no need to do that since Smack will do that work for you. You need to send #removeEntry only if you are the one that is requesting to remove the entry from the roster but in my example there is no need for that since Exodus is the client that made the request.

Regards,

– Gato

I am trying to remove all the entries for a roster using the following:

for (Iterator i=roster.getEntries(); i.hasNext(); ) {

RosterEntry re = (RosterEntry)i.next();

System.out.println(“Deleting Roster Entry:”);

System.out.println(re.getName());

System.out.println(re.getUser());

roster.removeEntry(re);

}

However, only the first entry gets deleted.

What am I doing wrong?

I think I figured it out. This was a test program and I was not closing the XMPPConnection.