AnsweredAssumed Answered

Smack Privacy List

Question asked by Okka on Jun 19, 2016
Latest reply on Oct 18, 2016 by Abhishek singh

I am trying to implement "block" functionality. When I call "createPrivacyList" I get "<error code='500' type='wait'><internal-server-error xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"

 

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): <iq id='xwLW0-21' type='set'><query xmlns='jabber:iq:privacy'><list name="blockUserList"><item action="deny" order="2" type="jid" value="380990bdeea07091@xxx.com"/></list></query></iq>

 

 

D/SMACK: RECV (0): <iq from='4d756cfcd19776dd@xxx.com' to='4d756cfcd19776dd@xxx.com/Smack' id='xwLW0-21' type='error'><query xmlns='jabber:iq:privacy'><list name='blockUserList'><item action='deny' order='2' type='jid' value='380990bdeea07091@xxx.com'/></list></query><error code='500' type='wait'><internal-server-error xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>

 

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.

 

 

Outcomes