code: function() {
      var self = this;
      this.setAvailability('chat');
  
      this.keepalive = setInterval(function() {
        self.jabber.send(new xmpp.Message({}));
        self.emit('ping');
      }, 30000);
  
      // load our profile to get name
      this.getProfile(function(err, data) {
        if (err) {
          // This isn't technically a stream error which is what the `error`
          // event usually represents, but we want to treat a profile fetch
          // error as a fatal error and disconnect the bot.
          self.emit('error', null, 'Unable to get profile info: ' + err, null);
          return;
        }
  
        // now that we have our name we can let rooms be joined
        self.name = data.fn;
  
        // this is the name used to @mention us
        self.mention_name = data.nickname;
  
        self.emit('connect');
      });
    }
docs: Whenever an XMPP connection is made, this function is responsible for triggering the `connect` event and starting the 30s anti-idle. It will also set the availability of the bot to `chat`.