Smack API 用户搜索 [英] Smack API User search

查看:37
本文介绍了Smack API 用户搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在基于 Smack-API 的 Jabber 客户端之上实现用户搜索.它可以使用以下方法创建用户:

I'm try to implement a user search on top of my working Smack-API based jabber client.It can create user using:

AccountManager manager = conn.getAccountManager();
manager.createAccount(usename,password);

但是,我需要添加一个功能,该功能将在创建帐户之前首先搜索现有"用户,但我找不到任何直接的方法来执行此操作.任何人都可以给我提示?

However I need to add a functionality that will first search for "existing" user before it creates the account, but I can't find any straightforward way to do it. Anyone can provide me hints?

谢谢.

推荐答案

显然需要的只是在 XMPPException 中捕获错误代码 409,因为如果用户存在,createAccount 会抛出异常.

Apparently what's needed is just to catch the error code 409 in the XMPPException, as createAccount throws exception if user exist.

这篇关于Smack API 用户搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆