[Juser] Jabber questions, invisible, status, transports
Yao Peng
ysun at nfsmith.com
Mon Feb 16 14:51:48 CST 2004
Hi!
I am trying to change the password by java code but I donot have any
samples and information about it. Please tell me how to change the
password by java code.
I just know how to create a new account by java code. The following is
the java code for creating a new jabber account:
//create a new account
public void newUser(String loginID, String password)
{
//assume we can get connection
ConnectionBean JabConn=new ConnectionBean();
JabConn = getConnection();
//Construct an InfoQuery packet with register data
InfoQueryBuilder iqb=new InfoQueryBuilder();
InfoQuery iq;
//Create register data builder
IQRegisterExtensionBuilder iqExb=new
IQRegisterExtensionBuilder();
iqb.setType("set");
//user and password
iqExb.set("username",loginID);
iqExb.set("password",password);
try
{
iqb.addExtension(iqExb.build());
}
catch (InstantiationException e)
{
//building failed ?
System.out.println("Fatal Error on Auth object build:");
System.out.println(e.toString());
return;
}
//build the iq packet
try
{
iq=(InfoQuery)iqb.build();
}
catch (InstantiationException e)
{
//building failed ?
System.out.println("Fatal Error on IQ object build:");
System.out.println(e.toString());
return ;
}
//send the InfoQuery packet to the server to create a new
account
JabConn.send(iq);
try
{
JabConn.send(new PresenceBuilder().build());
}
catch (InstantiationException e)
{
//build failed ?
System.out.println("error creating Presence packet:");
System.out.println(e.toString());
return;
}
}//end newUser
Look forward to hearing from you shortly.
Sun
More information about the JUser
mailing list