1
var Cc = Components.classes;
2
var Ci = Components.interfaces;
3
var Cu = Components.utils;
5
Cu.import("resource://weave/xmpp/xmppClient.js");
7
var transport = new HTTPPollingTransport( "http://127.0.0.1:5280/http-poll",
11
var auth = new PlainAuthenticator();
12
var client = new JabberClient("bob",
13
"jonathan-dicarlos-macbook-pro.local",
18
var testSync = new TestSynchronizer( client,
19
"alice@jonathan-dicarlos-macbook-pro.local" );
20
client.registerMessageHandler( testSync );
22
// Note: for ejabberd, the correct string to use for "host" here, when
23
// connecting, is what's specified on the {hosts, ... line of ejabberd.cfg.
24
client.connect( "jonathan-dicarlos-macbook-pro.local" ); // jabber host
26
client.waitForConnection();
27
if ( client._connectionStatus == client.FAILED ) {
28
dump( "Connection attempt failed. Boo hoo!\n" );
30
client.announcePresence();
31
testSync.waitForPartnerOnline();
33
client.sendMessage( "alice@jonathan-dicarlos-macbook-pro.local", "Hello from Bob" );
35
for ( var x = 0; x < 10; x++ ) {
36
dump( "Bob doing part " + x + " of the test.\n" );
37
dump( "Bob entering barrier " + x + ".\n" );
38
testSync.barrier( x );
39
dump( "Bob past barrier " + x + ".\n" );
42
client.waitForDisconnect();
47
/* var value = client.iqSet( "alice@jonathan-dicarlos-macbook-pro.local",
48
"Nonihilf", "Rocinante" );
49
dump( "Alice told me that the value of nonihilf is " + value + "\n" ); */