|
|
@@ -409,6 +409,30 @@ function dump(elem, filename){
|
|
409
|
409
|
/*
|
|
410
|
410
|
* Appends the given message to the chat conversation.
|
|
411
|
411
|
*/
|
|
|
412
|
+// <a onclick="dump(event.target);">my download button</a>
|
|
|
413
|
+function dump(elem, filename){
|
|
|
414
|
+ elem.download = filename || 'xmpplog.json';
|
|
|
415
|
+ elem.href = 'data:application/json;charset=utf-8,\n';
|
|
|
416
|
+ var data = {};
|
|
|
417
|
+ data.time = new Date();
|
|
|
418
|
+ data.url = window.location.href;
|
|
|
419
|
+ data.ua = navigator.userAgent;
|
|
|
420
|
+ if (connection.logger) {
|
|
|
421
|
+ data.xmpp = connection.logger.log;
|
|
|
422
|
+ }
|
|
|
423
|
+ if (connection.jingle) {
|
|
|
424
|
+ Object.keys(connection.jingle.sessions).forEach(function (sid) {
|
|
|
425
|
+ var session = connection.jingle.sessions[sid];
|
|
|
426
|
+ if (session.peerconnection && session.peerconnection.updateLog) {
|
|
|
427
|
+ // FIXME: should probably be a .dump call
|
|
|
428
|
+ data["jingle_" + session.sid] = session.peerconnection.updateLog;
|
|
|
429
|
+ }
|
|
|
430
|
+ });
|
|
|
431
|
+ }
|
|
|
432
|
+ elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));
|
|
|
433
|
+ return false;
|
|
|
434
|
+}
|
|
|
435
|
+
|
|
412
|
436
|
function updateChatConversation(nick, message)
|
|
413
|
437
|
{
|
|
414
|
438
|
var divClassName = '';
|