Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var connection = null;
- var server_dominio = 'server';
- var BOSH_SERVICE = '/xmpp-httpbind';
- $(document).ready(function () {
- connection = new Strophe.Connection(BOSH_SERVICE);
- $('#register').bind('click', function () {
- var user = $("#username").val();
- var pass = $("#password").val();
- connection.register.connect(server_dominio,function (status) {
- if (status === Strophe.Status.REGISTER) {
- connection.register.fields.username = user;
- connection.register.fields.password = pass;
- console.info("registering...",user," status ",status);
- connection.register.submit();
- }
- else if (status === Strophe.Status.REGISTERED) {
- alert("register");
- console.info("Registerd!",user," status ",status);
- //connection.disconnect();
- connection.authenticate();
- }
- else if (status === Strophe.Status.CONFLICT) {
- console.error("Username already exists.");
- }
- else if (status === Strophe.Status.NOTACCEPTABLE) {
- console.error("Registration form not properly filled out.");
- }
- else if (status === Strophe.Status.REGIFAIL) {
- console.log("The Server does not support In-Band Registration");
- }
- else if (status === Strophe.Status.CONNECTED) {
- console.info("Connected."," status ",status);
- }
- else if (status === Strophe.Status.DISCONNECTING) {
- console.log("Disconneting..."," status ",status);
- }
- else if (status === Strophe.Status.DISCONNECTED) {
- console.log("Disconneted."," status ",status);
- }
- else {
- }
- });
- });
- });
Add Comment
Please, Sign In to add comment