diff --git a/app.js b/app.js index ec3320e99..8b27a68e8 100644 --- a/app.js +++ b/app.js @@ -409,6 +409,30 @@ function dump(elem, filename){ /* * Appends the given message to the chat conversation. */ +// my download button +function dump(elem, filename){ + elem.download = filename || 'xmpplog.json'; + elem.href = 'data:application/json;charset=utf-8,\n'; + var data = {}; + data.time = new Date(); + data.url = window.location.href; + data.ua = navigator.userAgent; + if (connection.logger) { + data.xmpp = connection.logger.log; + } + if (connection.jingle) { + Object.keys(connection.jingle.sessions).forEach(function (sid) { + var session = connection.jingle.sessions[sid]; + if (session.peerconnection && session.peerconnection.updateLog) { + // FIXME: should probably be a .dump call + data["jingle_" + session.sid] = session.peerconnection.updateLog; + } + }); + } + elem.href += encodeURIComponent(JSON.stringify(data, null, ' ')); + return false; +} + function updateChatConversation(nick, message) { var divClassName = '';