Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

estos_log.js 911B

1234567891011121314151617181920212223
  1. Strophe.addConnectionPlugin('logger', {
  2. // logs raw stanzas and makes them available for download as JSON
  3. connection: null,
  4. log: [],
  5. init: function (conn) {
  6. this.connection = conn;
  7. this.connection.rawInput = this.log_incoming.bind(this);;
  8. this.connection.rawOutput = this.log_outgoing.bind(this);;
  9. },
  10. log_incoming: function (stanza) {
  11. this.log.push([new Date().getTime(), 'incoming', stanza]);
  12. },
  13. log_outgoing: function (stanza) {
  14. this.log.push([new Date().getTime(), 'outgoing', stanza]);
  15. },
  16. // <a onclick="connection.logger.dump(event.target);">my download button</a>
  17. dump: function (what, filename){
  18. what.download = filename || 'xmpplog.json';
  19. what.href = 'data:application/json;charset=utf-8,\n';
  20. what.href += encodeURIComponent(JSON.stringify(this.log, null, ' '));
  21. return true;
  22. }
  23. });