var junction = require('junction');
var argv = require('optimist').argv;

console.log('Junction: Presence Example');
console.log('  (using Junction + ' + junction.version + ')');

var options = {
  type: 'client',
  jid: argv.I,
  password: argv.P
};

var connection = junction.createConnection(options);
connection.on('online', function() {
  console.log('Connected as: ' + connection.jid);
  connection.send(new junction.elements.Presence());
});

connection.use(junction.presence(function(handler) {
  handler.on('available', function(stanza) {
    console.log(stanza.from + ' is available');
  });
  handler.on('unavailable', function(stanza) {
    console.log(stanza.from + ' is unavailable');
  });
}));

connection.use(junction.serviceUnavailable());
connection.use(junction.errorHandler());

@@ -281,170 +281,9 @@
 eate
-Connection(options);%0Aconnection.on('online', function() %7B%0A  console.log('Connected as: ' + connection.jid);%0A  connection.send(new junction.elements.Presence());%0A%7D
+(
 );%0A%0A
@@ -627,12 +627,206 @@
 Handler());%0A
+connection.filter(junction.filters.dump());%0A%0Aconnection.connect(options).on('online', function() %7B%0A  console.log('Connected as: ' + this.jid);%0A  this.send(new junction.elements.Presence());%0A%7D);%0A

Update presence example.