2016-09-27 68 views
0

我想从我的ejabberd服务器删除用户,但我连续接收以下错误:org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: not-allowed - cancel删除用户(嫌)

我假设这事做与用户权限?所有人都可以注册,这样不应该成为问题吗?

这里是我的代码如下所示:

@Override 
protected Boolean doInBackground(String... params) { 

    builder.setUsernameAndPassword(params[0], params[1]); 
    mConnection = new XMPPTCPConnection(builder.build()); 
    try { 
     mConnection.connect(); 
    } catch (SmackException | IOException | XMPPException e) { 
     Log.d(TAG, "Something went wrong when trying to connect"); 
     e.printStackTrace(); 
     return false; 
    } 
    AccountManager manager = AccountManager.getInstance(mConnection); 
    manager.sensitiveOperationOverInsecureConnection(true); 
    try { 
     manager.deleteAccount(); 
    } catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException e) { 
     Log.d(TAG, "Something went wrong when trying delete the account"); 
     e.printStackTrace(); 
     return false; 

    } 
    return true; 

} 

回答

1

创建账户,只需要连接,但帐户删除需要登录:你需要能够删除的帐户(之前先进行登录,即你不能没有删除帐户不知道密码)。致电mConnection.connect().login()