powered by Jive Software

Smack Privacy List

I am trying to implement “block” functionality. When I call “createPrivacyList” I get “”

I am using smakc 4.1.7

here is my code:

List<PrivacyItem> privacyItems = new Vector<PrivacyItem>();
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid, jid+"@xxx.com", false, 2);
privacyItems.add(item);
try {
    privacyListManager.createPrivacyList(BLOCK_USER_LIST_NAME, privacyItems);
    privacyListManager.setDefaultListName(BLOCK_USER_LIST_NAME);
    Log.d(TAG, "createPrivacyList");
} catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException ex) {
    Log.d(TAG, ex.getMessage(), ex);
}

//Privacy
ProviderManager.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider());
ProviderManager.addIQProvider("query", "jabber:iq:version", new VersionProvider());
I got this crash:

D/SMACK: SENT (0):

D/SMACK: RECV (0):

D/QXMPPManager: XMPPError: internal-server-error - wait

** org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: internal-server-error - wait**

                                                                       at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 32)

                                                                       at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 13)

                                                                       at org.jivesoftware.smackx.privacy.PrivacyListManager.setRequest(PrivacyListManage r.java:251)

                                                                       at org.jivesoftware.smackx.privacy.PrivacyListManager.updatePrivacyList(PrivacyLis tManager.java:509)

                                                                       at org.jivesoftware.smackx.privacy.PrivacyListManager.**createPrivacyList**(PrivacyListManager.java:489)

                                                                       at com..communication.xmpp.QXMPPManager.doBlockUser(QXMPPManager.java:761)

                                                                       at com..adapter.ContactDetailListAdapter$4.onClick(ContactDetailListAdapter.java:2 47)

                                                                       at android.view.View.performClick(View.java:5198)

                                                                       at android.view.View$PerformClick.run(View.java:21147)

                                                                       at android.os.Handler.handleCallback(Handler.java:739)

                                                                       at android.os.Handler.dispatchMessage(Handler.java:95)

                                                                       at android.os.Looper.loop(Looper.java:148)

                                                                       at android.app.ActivityThread.main(ActivityThread.java:5417)

                                                                       at java.lang.reflect.Method.invoke(Native Method)

                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

                                                                       at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)

Any suggestion please?

** **

** **

** **

**Thank you.**

In Xmpp you get internal-server-error because you are not sending specific data to block a user. I am also got this error while blocking a user on server because sometimes my Jid is null so i got internal-server-error in response.So make sure you are send the Jid in specific form (Jid@servername)as required.