You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

estos_log.js 592B

1234567891011121314151617
  1. /* global Strophe */
  2. Strophe.addConnectionPlugin('logger', {
  3. // logs raw stanzas and makes them available for download as JSON
  4. connection: null,
  5. log: [],
  6. init: function (conn) {
  7. this.connection = conn;
  8. this.connection.rawInput = this.log_incoming.bind(this);
  9. this.connection.rawOutput = this.log_outgoing.bind(this);
  10. },
  11. log_incoming: function (stanza) {
  12. this.log.push([new Date().getTime(), 'incoming', stanza]);
  13. },
  14. log_outgoing: function (stanza) {
  15. this.log.push([new Date().getTime(), 'outgoing', stanza]);
  16. },
  17. });