powered by Jive Software

Smack UserStatusListener should have a destroyRoom

Smack 4.0 and 4.1 does not have a listener to inform the user of the event when a room gets destroyed by the server.

This is not covered by a presence update, at least not by M-Link, the xmpp server I’using.

The muc user is now not informed about the destroy of a room.

the UserStatusListener? should have an destroyRoom event.

I solved this for now by adding an extra listener to my connection:

private class MyRoomDestroyListener implements PacketListener {     @Override
    public void processPacket(Packet packet) throws NotConnectedException {
      logger.finest("processPacket");
      MUCUser muc = (MUCUser) packet.getExtension("x", "http://jabber.org/protocol/muc#user");
      if ( muc != null ) {
        if ( muc.getDestroy() != null ) {
          handleRoomDestroyed((Presence)packet, muc.getDestroy());
        }
        if ( muc.getItem() != null && muc.getItem().getAffiliation() != null && muc.getItem().getAffiliation().equals("outcast") ) {
          userKickedFromRoom(null, "You are banned from this room.");
        }
      }
          }     public PacketFilter getFilter() {
      return new AndFilter(FromMatchesFilter.create(roomJID), new PacketTypeFilter(Presence.class), new PacketExtensionFilter("x", "http://jabber.org/protocol/muc#user"));
    }
      }

Thanks, logged as SMACK-619

BTW, if you are using a recent version of Smack, consider using

MUCUser mucUser = MUCUser.from(packet);

instead of

MUCUser muc = (MUCUser) packet.getExtension(“x”, “http://jabber.org/protocol/muc#user”);