Registering New Account

Hi, I have just started to use your XIFF classes and they are great. Could somebody please inform me how to register a new account.

I have tried using the XMPPConnection.sendRegistrationFields() method. But I don’'t understand what I need to pass as the object map, in attribute:value pairs, is this usermame,password and server??

this is the sort of thing i have been trying

var XMPPConnection = new XMPPConnection();

XMPPConnection.username = “myusername”;

XMPPConnection.password = “mypassword”;

XMPPConnection.server = “jabber.org”;

eventHandler = new Object();

eventHandler.handleEvent = function(eventObj) {

trace(eventObj.type);

// Do registration

};

connection.addEventListener(“registrationFields”, eventHandler);

XMPPConnection.sendRegistrationFields()

Hi, Well i worked it out. So thought I better answer my own question. Was getting a bit confused on what order it worked. XIFF is great, I think it would be nice if in the help documentation it had a little working example for each method a bit like the macromedia docuemntation.

import org.jivesoftware.xiff.data.Message;

import org.jivesoftware.xiff.core.XMPPConnection;

import org.jivesoftware.xiff.im.Roster;

//—

//— XMPPConnection - connection details

var connection = new XMPPConnection();

connection.username = null;

connection.server = “jabber.org”;

//

// Event handler

eventHandler = new Object();

eventHandler.handleEvent = function(eventObj) {

switch (eventObj.type) {

case “registrationFields” :

trace(“REG FIELDS”);

// Send Details

connection.sendRegistrationFields(_root.regInfo);

break;

case “registrationSuccess” :

trace(“REGISTATION SUCCESS”);

break;

}

};

connection.addEventListener(“registrationFields”, eventHandler);

connection.addEventListener(“registrationSuccess”, eventHandler);

connection.connect(“flash”);

_root.loginMC.onPress = function() {

// REG Object

_root.regInfo = new Object();

// Variables to register

var email:String = new String();

var password:String = new String();

var loginAfter:Boolean;

username = _root.usernameInput.text

email = _root.emailInput.text

password = _root.passwordInput.text

loginAfter = true;

//

_root.regInfo = {username:username, email:email, password:password, loginAfter:loginAfter};

// Get Reg Details

connection.getRegistrationFields();

};

Iain,

Thanks for posting the answer to your own question! Also, I am in the process of creating some documentation for XIFF that is similar to the SMACK documentation. It will be ready when we do the full release of XIFF v2.0. We should be releasing Beta 3 in a couple of days.