smack访问ejabberd 用户注册问题
请问:1:用smack+ejabberd做即时通讯,用户注册时如何判断用户已经注册过?2:修改用户密码时:可不可以做到不登陆就可以由管理员修改用户的密码?
3:网上某位大神写的查询用户的代码,在我的电脑上运行,报503异常,怎么解决
public static List<UserBean> searchUsers(XMPPConnection connection,String serverDomain,String userName) throws XMPPException
{
List<UserBean> results = new ArrayList<UserBean>();
System.out.println("查询开始..............."+connection.getHost()+connection.getServiceName());
UserSearchManager usm = new UserSearchManager(connection);
Form searchForm = usm.getSearchForm(serverDomain);
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Username", true);
answerForm.setAnswer("search", userName);
ReportedData data = usm.getSearchResults(answerForm, serverDomain);
Iterator<Row> it = data.getRows();
Row row = null;
UserBean user = null;
while(it.hasNext())
{
user = new UserBean();
row = it.next();
user.setUserName(row.getValues("Username").next().toString());
user.setName(row.getValues("Name").next().toString());
user.setEmail(row.getValues("Email").next().toString());
System.out.println(row.getValues("Username").next());
System.out.println(row.getValues("Name").next());
System.out.println(row.getValues("Email").next());
results.add(user);
//若存在,则有返回,UserName一定非空,其他两个若是有设,一定非空
}
return results;
}