[Juser] Jabber questions, invisible, status, transports
Peter Saint-Andre
stpeter at jabber.org
Tue Feb 17 16:03:09 CST 2004
Your question is probably more appropriate for the developer list:
https://jabberstudio.org/mailman/listinfo/jdev/
This list is for end users.
/psa
On Mon, 2004-02-16 at 13:51, Yao Peng wrote:
> 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
>
>
>
> _______________________________________________
> Juser mailing list
> Juser at jabber.org
> https://jabberstudio.org/mailman/listinfo/juser
>
More information about the JUser
mailing list