Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > BOOK: Professional XMPP Programming with JavaScript and jQuery
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional XMPP Programming with JavaScript and jQuery
This is the forum to discuss the Wrox book Professional XMPP Programming with JavaScript and jQuery by Jack Moffitt; ISBN: 978-0-470-54071-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XMPP Programming with JavaScript and jQuery section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 2nd, 2012, 12:34 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Issues with strophe register plugin

Dear Metajack,

i try to use the strophe register plugin and i'm facing issues... i commented the lines in the plugin as suggested here:

http://stackoverflow.com/questions/1...openfire-usage

...now this is my code for triggering the connect:

function connect() {
$(document).trigger('connect', {
jid : "register@maschine",
password : "register"
});
}

...and this is the handler method:

$(document).bind('connect', function (ev, data) {

var conn = new Strophe.Connection(MyConnection.url);

var callback = function (status) {
if (status === Strophe.Status.CONNECTED) {
console.log("logged in!");
$(document).trigger('connected');
} else if (status === Strophe.Status.REGISTER) {
console.log("in status register...");
conn.register.fields.username = "register";
conn.register.fields.password = "register";
conn.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
console.log("registered!");
conn.register.authenticate();
}

};

conn.register.connect("maschine", callback, 60, 1);

MyConnection.connection = conn;

});

...this works fine first time...the second time i start the app it tries to register again...why is strophe status "connected" never reached when i start the app again after the successful registration of the account? I did a console.log in the submit-method of the plugin and every time i start the app second time it seems to hang in this method...maybe you can tell me whats wrong with my code?

Before i used the plugin my code looked like this in the handler:

conn.connect(data.jid, data.password, function (status) {
if (status === Strophe.Status.CONNECTED) {
$(document).trigger('connected');
} else if (status === Strophe.Status.DISCONNECTED) {
connect();
}
else if (status === Strophe.Status.ERROR) {
alert ('error);
} else if (status === Strophe.Status.CONNECTING) {
alert ('connecting');
} else if (status === Strophe.Status.CONNFAIL) {
alert ('connfail');
} else if (status === Strophe.Status.AUTHENTICATING) {
alert ('authenticating');
} else if (status === Strophe.Status.AUTHFAIL) {
alert('authfail');
} else if (status === Strophe.Status.ATTACHED) {
alert ('attached');
} else {
alert("error" + status);
}

});

...if i use this code, where do i have to put the code for the registration, so that registration only happens if needed and otherwise a normal login happens? I'm not a javascript expert so it would be nice if you perhaps could show me the code for this problem. I would be very thankful... Please tell me if you need more information...

greetz
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BOSH, Strophe, and Openfire iowadeifan BOOK: Professional XMPP Programming with JavaScript and jQuery 11 March 31st, 2014 03:08 PM
Joomla Strophe problem VladoAng BOOK: Professional XMPP Programming with JavaScript and jQuery 2 April 26th, 2012 04:55 AM
Strophe hangs after attaching nielsvh BOOK: Professional XMPP Programming with JavaScript and jQuery 1 February 5th, 2012 07:37 PM
Strophe Connection Error jpeterson7755 BOOK: Professional XMPP Programming with JavaScript and jQuery 1 February 28th, 2011 01:48 AM
Using sha1 passwords in Strophe.js semper BOOK: Professional XMPP Programming with JavaScript and jQuery 1 June 28th, 2010 02:15 PM



All times are GMT -4. The time now is 10:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.