javaandroidsmackmultiuserchat

How to unban user in multi user chat room using smack-android:4.1.4


I'm using smack-android:4.1.4 to connect to xmpp server, and I use this code to connect to a multi user chat room on that server:

MultiUserChatManager mucManager = MultiUserChatManager.getInstanceFor(connection);
MultiUserChat muc = mucManager.getMultiUserChat(roomName);
muc.join(nickName,password,discussionHistory,timeout);

In this room if I'm an owner then I can kick or ban a user, to ban a user:

muc.banUser(userJID, reason);

and I can get the banned users list in this room:

List<Affiliate> bannedList = muc.getOutcasts();

QUESTION 1: how can I unban a user from the previous list? the problem is I couldn't find any function like:

//muc.unbanUser(String userJID);    // there's nothing close to this

I read the whole documentation but came to nothing, so what am I missing here?

I can get the jid of any banned user through the outcasts list:

String jid = outcast.getJid();  // where outcast is of type Affiliate

but no function to use this jid to unban the user.

Question 2: this question is related to rooms but not to the banned list issue, in some rooms I get the following exception:

PacketParserUtils? Failed to parse extension packet in Presence packet. Attributes: from=roomName@conference.myXmppServer/someUserNickName id=null
org.jivesoftware.smack.SmackException: Caps elment with missing attributes. Attributes: hash=null version=1.0.0.84 node=http://www.google.com/xmpp/client/caps
        at org.jivesoftware.smackx.caps.provider.CapsExtensionProvider.parse(CapsExtensionProvider.java:54)
        at org.jivesoftware.smackx.caps.provider.CapsExtensionProvider.parse(CapsExtensionProvider.java:28)
        at org.jivesoftware.smack.provider.Provider.parse(Provider.java:35)
        at org.jivesoftware.smack.util.PacketParserUtils.parseExtensionElement(PacketParserUtils.java:929)
        at org.jivesoftware.smack.util.PacketParserUtils.addExtensionElement(PacketParserUtils.java:1060)
        at org.jivesoftware.smack.util.PacketParserUtils.parsePresence(PacketParserUtils.java:583)
        at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:155)
        at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:956)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500(XMPPTCPConnection.java:140)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:989)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:944)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:959)
        at java.lang.Thread.run(Thread.java:856)

and it refers to some code inside the smack library classes, so it's not some uncaught exception inside my code,

what is the cause of this exception? and isn't there a way to handle such unparsed data?

I'm using ParsingExceptionCallback in other part of my application:

connection.setParsingExceptionCallback( parsingExceptionCallback ); 

but this function is not called for this case, is there any similar functions for MultiUserChat class ?


Solution

  • maybe making a user member will remove the jid from banned list? because according to xmpp a jid can not be in more than one list... how ever there are five lists in xmpp, one for owners,admins,members, none and banned.

    at the following website

    http://xmpp.org/extensions/xep-0045.html

    read

    4.1 General Terms

    5.2.1 Privileges

    optional read

    1. Admin Use Cases