Comparar commits
5 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 9a9cbfff5a | |||
| 32514ea25d | |||
| 1e074075e3 | |||
| f89a856b7e | |||
| 411baae280 |
@@ -1,3 +1,10 @@
|
||||
v0.5.2 / 2014-01-28
|
||||
===
|
||||
- update strophe.js to v1.1.3
|
||||
- fix debug function (fix initial presence)
|
||||
- add debug log window
|
||||
- add warn|error debug functions
|
||||
|
||||
v0.5.1 / 2014-01-27
|
||||
===
|
||||
- fix chat window after call
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsxc",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"description": "Real-time chat app",
|
||||
"homepage": "http://jsxc.org/",
|
||||
"license": "MIT",
|
||||
|
||||
+120
-42
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* jsxc v0.5.1 - 2014-01-27
|
||||
* jsxc v0.5.2 - 2014-01-28
|
||||
*
|
||||
* Copyright (c) 2014 Klaus Herberth <klaus@jsxc.org> <br>
|
||||
* Released under the MIT license
|
||||
@@ -7,7 +7,7 @@
|
||||
* Please see http://jsxc.org/
|
||||
*
|
||||
* @author Klaus Herberth <klaus@jsxc.org>
|
||||
* @version 0.5.1
|
||||
* @version 0.5.2
|
||||
*/
|
||||
|
||||
var jsxc;
|
||||
@@ -22,7 +22,7 @@ var jsxc;
|
||||
*/
|
||||
jsxc = {
|
||||
/** Version of jsxc */
|
||||
version: '0.5.1',
|
||||
version: '0.5.2',
|
||||
|
||||
/** True if i'm the chief */
|
||||
chief: false,
|
||||
@@ -81,9 +81,6 @@ var jsxc;
|
||||
/** My css id */
|
||||
cid: null,
|
||||
|
||||
/** Shortcut for jsxc.options.debug */
|
||||
debug: null,
|
||||
|
||||
/** Some constants */
|
||||
CONST: {
|
||||
NOTIFICATION_DEFAULT: 'default',
|
||||
@@ -92,6 +89,53 @@ var jsxc;
|
||||
STATUS: [ 'offline', 'away', 'online' ]
|
||||
},
|
||||
|
||||
/**
|
||||
* Write debug message to console and to log.
|
||||
*
|
||||
* @memberOf jsxc
|
||||
* @param {String} msg Debug message
|
||||
* @param {Object} data
|
||||
* @param {String} Could be warn|error|null
|
||||
*/
|
||||
debug: function(msg, data, level) {
|
||||
if (level) {
|
||||
msg = '[' + level + '] ' + msg;
|
||||
}
|
||||
|
||||
if (data) {
|
||||
console.log(msg, data);
|
||||
jsxc.log = jsxc.log + msg + ': ' + $("<span>").prepend($(data).clone()).html() + '\n';
|
||||
} else {
|
||||
console.log(msg);
|
||||
jsxc.log = jsxc.log + msg + '\n';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Write warn message.
|
||||
*
|
||||
* @memberOf jsxc
|
||||
* @param {String} msg Warn message
|
||||
* @param {Object} data
|
||||
*/
|
||||
warn: function(msg, data) {
|
||||
jsxc.debug(msg, data, 'WARN');
|
||||
},
|
||||
|
||||
/**
|
||||
* Write error message.
|
||||
*
|
||||
* @memberOf jsxc
|
||||
* @param {String} msg Error message
|
||||
* @param {Object} data
|
||||
*/
|
||||
error: function(msg, data) {
|
||||
jsxc.debug(msg, data, 'ERROR');
|
||||
},
|
||||
|
||||
/** debug log */
|
||||
log: '',
|
||||
|
||||
/**
|
||||
* Starts the action
|
||||
*
|
||||
@@ -114,9 +158,6 @@ var jsxc;
|
||||
jsxc.storage.updateUserItem('options', key, value);
|
||||
};
|
||||
|
||||
// Shortcut
|
||||
jsxc.debug = jsxc.options.debug;
|
||||
|
||||
jsxc.storageNotConform = jsxc.storage.getItem('storageNotConform') || 2;
|
||||
|
||||
// detect language
|
||||
@@ -174,7 +215,9 @@ var jsxc;
|
||||
|
||||
// create jquery object
|
||||
var form = jsxc.options.loginForm.form = $(jsxc.options.loginForm.form);
|
||||
var events = form.data('events') || {submit: []};
|
||||
var events = form.data('events') || {
|
||||
submit: []
|
||||
};
|
||||
var submits = [];
|
||||
|
||||
// save attached submit events and remove them. Will be reattached
|
||||
@@ -182,7 +225,7 @@ var jsxc;
|
||||
$.each(events.submit, function(index, val) {
|
||||
submits.push(val.handler);
|
||||
});
|
||||
|
||||
|
||||
form.data('submits', submits);
|
||||
form.off('submit');
|
||||
|
||||
@@ -455,12 +498,12 @@ var jsxc;
|
||||
submitLoginForm: function() {
|
||||
var form = jsxc.options.loginForm.form.off('submit');
|
||||
|
||||
//Attach original events
|
||||
// Attach original events
|
||||
var submits = form.data('submits') || [];
|
||||
$.each(submits, function(index, val) {
|
||||
form.submit(val);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if (form.find('#submit')) {
|
||||
form.find('#submit').click();
|
||||
} else {
|
||||
@@ -526,7 +569,7 @@ var jsxc;
|
||||
var k = key.replace(/ /gi, '_');
|
||||
|
||||
if (!jsxc.l[k]) {
|
||||
jsxc.debug('[WARN] No translation for: ' + k);
|
||||
jsxc.warn('No translation for: ' + k);
|
||||
}
|
||||
|
||||
return jsxc.l[k] || key.replace(/_/gi, ' ');
|
||||
@@ -672,6 +715,7 @@ var jsxc;
|
||||
var ri = $('#' + cid); // roster item from user
|
||||
var we = jsxc.gui.getWindow(cid); // window element from user
|
||||
var ue = $('#' + cid + ', #jsxc_window_' + cid + ', .jsxc_buddy_' + cid); // both
|
||||
var bullet = $('.jsxc_buddy_' + cid);
|
||||
|
||||
// Attach data to corresponding roster item
|
||||
ri.data(data);
|
||||
@@ -681,6 +725,7 @@ var jsxc;
|
||||
|
||||
// Change name and add title
|
||||
ue.find('.jsxc_name').text(data.name).attr('title', 'is ' + jsxc.CONST.STATUS[data.status]);
|
||||
bullet.attr('title', 'is ' + jsxc.CONST.STATUS[data.status]);
|
||||
|
||||
// Update gui according to encryption state
|
||||
switch (data.msgstate) {
|
||||
@@ -738,7 +783,7 @@ var jsxc;
|
||||
jsxc.storage.setUserItem('avatar_' + data.avatar, src);
|
||||
setAvatar(src);
|
||||
}, Strophe.getBareJidFromJid(data.jid), function(msg) {
|
||||
jsxc.debug('Error', msg);
|
||||
jsxc.error('Could not load vcard.', msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1083,6 +1128,37 @@ var jsxc;
|
||||
*/
|
||||
showAboutDialog: function() {
|
||||
jsxc.gui.dialog.open(jsxc.gui.template.get('aboutDialog'));
|
||||
|
||||
$('#jsxc_dialog .jsxc_debuglog').click(function() {
|
||||
jsxc.gui.showDebugLog();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Show debug log.
|
||||
*
|
||||
* @memberOf jsxc.gui
|
||||
*/
|
||||
showDebugLog: function() {
|
||||
var userInfo = '<h3>User information</h3>';
|
||||
|
||||
if (navigator) {
|
||||
var key;
|
||||
for (key in navigator) {
|
||||
if (navigator.hasOwnProperty(key) && typeof navigator[key] === 'string') {
|
||||
userInfo += '<b>' + key + ':</b> ' + navigator[key] + '<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window.screen) {
|
||||
userInfo += '<b>Height:</b> ' + window.screen.height + '<br />';
|
||||
userInfo += '<b>Width:</b> ' + window.screen.width + '<br />';
|
||||
}
|
||||
|
||||
userInfo += '<b>jsxc version:</b> ' + jsxc.version + '<br />';
|
||||
|
||||
jsxc.gui.dialog.open('<div class="jsxc_log">'+userInfo+'<h3>Log</h3><pre>' + jsxc.escapeHTML(jsxc.log) + '</pre></div>');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1156,7 +1232,7 @@ var jsxc;
|
||||
*
|
||||
* @param {String} cid CSS compatible jid
|
||||
*/
|
||||
add: function(cid) {
|
||||
add: function(cid) {
|
||||
var data = jsxc.storage.getUserItem('buddy_' + cid);
|
||||
var bud = jsxc.gui.buddyTemplate.clone().attr('id', cid).attr('data-type', data.type || 'chat');
|
||||
|
||||
@@ -1577,9 +1653,9 @@ var jsxc;
|
||||
* @param {String} cid CSS compatible jid
|
||||
*/
|
||||
close: function(cid) {
|
||||
|
||||
|
||||
if (!jsxc.el_exists('#jsxc_window_' + cid)) {
|
||||
jsxc.debug('[Warning] Want to close a window, that is not open.');
|
||||
jsxc.warn('Want to close a window, that is not open.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1653,7 +1729,7 @@ var jsxc;
|
||||
*
|
||||
* @param {String} cid
|
||||
*/
|
||||
hide: function(cid) {
|
||||
hide: function(cid) {
|
||||
jsxc.storage.updateUserItem('window_' + cid, 'minimize', true);
|
||||
|
||||
jsxc.gui.window._hide(cid);
|
||||
@@ -1664,7 +1740,7 @@ var jsxc;
|
||||
*
|
||||
* @param {String} cid
|
||||
*/
|
||||
_hide: function(cid) {
|
||||
_hide: function(cid) {
|
||||
$('#jsxc_window_' + cid + ' .jsxc_window').slideUp();
|
||||
jsxc.gui.getWindow(cid).trigger('hidden.window.jsxc');
|
||||
},
|
||||
@@ -2019,7 +2095,8 @@ var jsxc;
|
||||
<br />\
|
||||
Real-time chat app for OwnCloud. This app requires external<br /> XMPP server (openfire, ejabberd etc.).<br />\
|
||||
<br />\
|
||||
<i>Released under the MIT license</i></p>'
|
||||
<i>Released under the MIT license</i></p>\
|
||||
<p class="jsxc_right"><a class="button jsxc_debuglog" href="#">Show debug log</a></p>'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2051,16 +2128,16 @@ var jsxc;
|
||||
// Create new connection (no login)
|
||||
jsxc.xmpp.conn = new Strophe.Connection(url);
|
||||
|
||||
// jsxc.xmpp.conn.xmlInput = function(data) {
|
||||
// jsxc.debug('<', data);
|
||||
// };
|
||||
// jsxc.xmpp.conn.xmlOutput = function(data) {
|
||||
// jsxc.debug('>', data);
|
||||
// };
|
||||
//
|
||||
// Strophe.log = function (level, msg) {
|
||||
// jsxc.debug(level + " " + msg);
|
||||
// };
|
||||
// jsxc.xmpp.conn.xmlInput = function(data) {
|
||||
// console.log('<', data);
|
||||
// };
|
||||
// jsxc.xmpp.conn.xmlOutput = function(data) {
|
||||
// console.log('>', data);
|
||||
// };
|
||||
|
||||
// Strophe.log = function (level, msg) {
|
||||
// console.log(level + " " + msg);
|
||||
// };
|
||||
|
||||
var callback = function(status, condition) {
|
||||
|
||||
@@ -2071,7 +2148,7 @@ var jsxc;
|
||||
jsxc.cid = jsxc.jidToCid(jsxc.xmpp.conn.jid.toLowerCase());
|
||||
$(document).trigger('connected.jsxc');
|
||||
break;
|
||||
case Strophe.Status.ATTACHED:
|
||||
case Strophe.Status.ATTACHED:
|
||||
$(document).trigger('attached.jsxc');
|
||||
break;
|
||||
case Strophe.Status.DISCONNECTED:
|
||||
@@ -2142,7 +2219,7 @@ var jsxc;
|
||||
jsxc.xmpp.conn.pause();
|
||||
|
||||
// Save sid and jid
|
||||
jsxc.storage.setItem('sid', jsxc.xmpp.conn.sid);
|
||||
jsxc.storage.setItem('sid', jsxc.xmpp.conn._proto.sid);
|
||||
jsxc.storage.setItem('jid', jsxc.xmpp.conn.jid.toLowerCase());
|
||||
|
||||
jsxc.storage.setItem('lastActivity', (new Date()).getTime());
|
||||
@@ -2191,7 +2268,7 @@ var jsxc;
|
||||
}).c('query', {
|
||||
xmlns: 'jabber:iq:roster'
|
||||
});
|
||||
|
||||
|
||||
jsxc.xmpp.conn.sendIQ(iq, jsxc.xmpp.onRoster);
|
||||
} else {
|
||||
jsxc.xmpp.sendPres();
|
||||
@@ -2226,6 +2303,7 @@ var jsxc;
|
||||
pres.c('c', jsxc.xmpp.conn.caps.generateCapsAttrs());
|
||||
}
|
||||
|
||||
jsxc.debug('Send presence', pres.toString());
|
||||
jsxc.xmpp.conn.send(pres);
|
||||
},
|
||||
|
||||
@@ -2392,7 +2470,7 @@ var jsxc;
|
||||
* @param {dom} presence
|
||||
* @private
|
||||
*/
|
||||
onPresence: function(presence) {
|
||||
onPresence: function(presence) {
|
||||
/*
|
||||
* <presence xmlns='jabber:client' type='unavailable' from='' to=''/>
|
||||
*
|
||||
@@ -2407,6 +2485,8 @@ var jsxc;
|
||||
* node='http://psi-im.org/caps' ver='caps-b75d8d2b25' ext='ca cs
|
||||
* ep-notify-2 html'/> </presence>
|
||||
*/
|
||||
jsxc.debug('onPresence', presence);
|
||||
|
||||
var ptype = $(presence).attr('type');
|
||||
var from = $(presence).attr('from');
|
||||
var jid = Strophe.getBareJidFromJid(from).toLowerCase();
|
||||
@@ -2418,14 +2498,12 @@ var jsxc;
|
||||
var status = null;
|
||||
var xVCard = $(presence).find('x[xmlns="vcard-temp:x:update"]');
|
||||
|
||||
jsxc.debug('onPresence', presence);
|
||||
|
||||
if (jid === to) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ptype === 'error') {
|
||||
jsxc.debug('[XMPP ERROR] ' + $(presence).attr('code'));
|
||||
jsxc.error('[XMPP] ' + $(presence).attr('code'));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2456,7 +2534,7 @@ var jsxc;
|
||||
}
|
||||
|
||||
var maxVal = [];
|
||||
var max = 0, prop;
|
||||
var max = 0, prop = null;
|
||||
for (prop in res) {
|
||||
if (res.hasOwnProperty(prop)) {
|
||||
if (max <= res[prop]) {
|
||||
@@ -2515,7 +2593,7 @@ var jsxc;
|
||||
* <body>...</body> <active
|
||||
* xmlns='http://jabber.org/protocol/chatstates'/> </message>
|
||||
*/
|
||||
|
||||
|
||||
jsxc.debug('Incoming message', message);
|
||||
|
||||
var type = $(message).attr('type');
|
||||
@@ -3205,7 +3283,7 @@ var jsxc;
|
||||
});
|
||||
|
||||
jsxc.buddyList[cid].on('error', function(err) {
|
||||
jsxc.debug('[OTR] ' + err);
|
||||
jsxc.error('[OTR] ', err);
|
||||
jsxc.gui.window.postMessage(cid, 'sys', '[OTR] ' + err);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* jsxc v0.5.1 - 2014-01-27
|
||||
* jsxc v0.5.2 - 2014-01-28
|
||||
*
|
||||
* Copyright (c) 2014 Klaus Herberth <klaus@jsxc.org> <br>
|
||||
* Released under the MIT license
|
||||
@@ -7,7 +7,7 @@
|
||||
* Please see http://jsxc.org/
|
||||
*
|
||||
* @author Klaus Herberth <klaus@jsxc.org>
|
||||
* @version 0.5.1
|
||||
* @version 0.5.2
|
||||
*/
|
||||
|
||||
/* jsxc, Strophe, SDPUtil, getUserMediaWithConstraints, setupRTC, jQuery */
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/* jshint -W117 */
|
||||
function TraceablePeerConnection(ice_config, constraints) {
|
||||
var setupRTC, getUserMediaWithConstraints, TraceablePeerConnection;
|
||||
|
||||
(function($){
|
||||
TraceablePeerConnection = function(ice_config, constraints) {
|
||||
var self = this;
|
||||
var RTCPeerconnection = navigator.mozGetUserMedia ? mozRTCPeerConnection : webkitRTCPeerConnection;
|
||||
this.peerconnection = new RTCPeerconnection(ice_config, constraints);
|
||||
@@ -176,7 +179,7 @@ TraceablePeerConnection.prototype.getStats = function(callback) {
|
||||
|
||||
|
||||
// mozilla chrome compat layer -- very similar to adapter.js
|
||||
function setupRTC() {
|
||||
setupRTC = function (){
|
||||
var RTC = null;
|
||||
if (navigator.mozGetUserMedia) {
|
||||
console.log('This appears to be Firefox');
|
||||
@@ -229,9 +232,9 @@ function setupRTC() {
|
||||
try { console.log('Browser does not appear to be WebRTC-capable'); } catch (e) { }
|
||||
}
|
||||
return RTC;
|
||||
}
|
||||
};
|
||||
|
||||
function getUserMediaWithConstraints(um, resolution, bandwidth, fps) {
|
||||
getUserMediaWithConstraints = function(um, resolution, bandwidth, fps) {
|
||||
var constraints = {audio: false, video: false};
|
||||
|
||||
if (um.indexOf('video') >= 0) {
|
||||
@@ -324,3 +327,4 @@ function getUserMediaWithConstraints(um, resolution, bandwidth, fps) {
|
||||
$(document).trigger('mediafailure.jingle');
|
||||
}
|
||||
}
|
||||
}(jQuery));
|
||||
@@ -1,4 +1,5 @@
|
||||
/* jshint -W117 */
|
||||
(function($){
|
||||
Strophe.addConnectionPlugin('jingle', {
|
||||
connection: null,
|
||||
sessions: {},
|
||||
@@ -257,3 +258,4 @@ Strophe.addConnectionPlugin('jingle', {
|
||||
// implement push?
|
||||
}
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/* jshint -W117 */
|
||||
var SDP;
|
||||
|
||||
(function($){
|
||||
// SDP STUFF
|
||||
function SDP(sdp) {
|
||||
SDP = function(sdp) {
|
||||
this.media = sdp.split('\r\nm=');
|
||||
for (var i = 1; i < this.media.length; i++) {
|
||||
this.media[i] = 'm=' + this.media[i];
|
||||
@@ -807,3 +810,4 @@ SDPUtil = {
|
||||
return line + '\r\n';
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
||||
@@ -1,6 +1,9 @@
|
||||
/* jshint -W117 */
|
||||
// Jingle stuff
|
||||
function JingleSession(me, sid, connection) {
|
||||
var JingleSession;
|
||||
|
||||
(function($){
|
||||
JingleSession = function(me, sid, connection) {
|
||||
this.me = me;
|
||||
this.sid = sid;
|
||||
this.connection = connection;
|
||||
@@ -853,3 +856,4 @@ JingleSession.prototype.getStats = function (interval) {
|
||||
return this.statsinterval;
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
|
||||
+2166
-1229
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+117
-39
@@ -69,9 +69,6 @@ var jsxc;
|
||||
/** My css id */
|
||||
cid: null,
|
||||
|
||||
/** Shortcut for jsxc.options.debug */
|
||||
debug: null,
|
||||
|
||||
/** Some constants */
|
||||
CONST: {
|
||||
NOTIFICATION_DEFAULT: 'default',
|
||||
@@ -80,6 +77,53 @@ var jsxc;
|
||||
STATUS: [ 'offline', 'away', 'online' ]
|
||||
},
|
||||
|
||||
/**
|
||||
* Write debug message to console and to log.
|
||||
*
|
||||
* @memberOf jsxc
|
||||
* @param {String} msg Debug message
|
||||
* @param {Object} data
|
||||
* @param {String} Could be warn|error|null
|
||||
*/
|
||||
debug: function(msg, data, level) {
|
||||
if (level) {
|
||||
msg = '[' + level + '] ' + msg;
|
||||
}
|
||||
|
||||
if (data) {
|
||||
console.log(msg, data);
|
||||
jsxc.log = jsxc.log + msg + ': ' + $("<span>").prepend($(data).clone()).html() + '\n';
|
||||
} else {
|
||||
console.log(msg);
|
||||
jsxc.log = jsxc.log + msg + '\n';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Write warn message.
|
||||
*
|
||||
* @memberOf jsxc
|
||||
* @param {String} msg Warn message
|
||||
* @param {Object} data
|
||||
*/
|
||||
warn: function(msg, data) {
|
||||
jsxc.debug(msg, data, 'WARN');
|
||||
},
|
||||
|
||||
/**
|
||||
* Write error message.
|
||||
*
|
||||
* @memberOf jsxc
|
||||
* @param {String} msg Error message
|
||||
* @param {Object} data
|
||||
*/
|
||||
error: function(msg, data) {
|
||||
jsxc.debug(msg, data, 'ERROR');
|
||||
},
|
||||
|
||||
/** debug log */
|
||||
log: '',
|
||||
|
||||
/**
|
||||
* Starts the action
|
||||
*
|
||||
@@ -102,9 +146,6 @@ var jsxc;
|
||||
jsxc.storage.updateUserItem('options', key, value);
|
||||
};
|
||||
|
||||
// Shortcut
|
||||
jsxc.debug = jsxc.options.debug;
|
||||
|
||||
jsxc.storageNotConform = jsxc.storage.getItem('storageNotConform') || 2;
|
||||
|
||||
// detect language
|
||||
@@ -162,7 +203,9 @@ var jsxc;
|
||||
|
||||
// create jquery object
|
||||
var form = jsxc.options.loginForm.form = $(jsxc.options.loginForm.form);
|
||||
var events = form.data('events') || {submit: []};
|
||||
var events = form.data('events') || {
|
||||
submit: []
|
||||
};
|
||||
var submits = [];
|
||||
|
||||
// save attached submit events and remove them. Will be reattached
|
||||
@@ -170,7 +213,7 @@ var jsxc;
|
||||
$.each(events.submit, function(index, val) {
|
||||
submits.push(val.handler);
|
||||
});
|
||||
|
||||
|
||||
form.data('submits', submits);
|
||||
form.off('submit');
|
||||
|
||||
@@ -443,12 +486,12 @@ var jsxc;
|
||||
submitLoginForm: function() {
|
||||
var form = jsxc.options.loginForm.form.off('submit');
|
||||
|
||||
//Attach original events
|
||||
// Attach original events
|
||||
var submits = form.data('submits') || [];
|
||||
$.each(submits, function(index, val) {
|
||||
form.submit(val);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if (form.find('#submit')) {
|
||||
form.find('#submit').click();
|
||||
} else {
|
||||
@@ -514,7 +557,7 @@ var jsxc;
|
||||
var k = key.replace(/ /gi, '_');
|
||||
|
||||
if (!jsxc.l[k]) {
|
||||
jsxc.debug('[WARN] No translation for: ' + k);
|
||||
jsxc.warn('No translation for: ' + k);
|
||||
}
|
||||
|
||||
return jsxc.l[k] || key.replace(/_/gi, ' ');
|
||||
@@ -660,6 +703,7 @@ var jsxc;
|
||||
var ri = $('#' + cid); // roster item from user
|
||||
var we = jsxc.gui.getWindow(cid); // window element from user
|
||||
var ue = $('#' + cid + ', #jsxc_window_' + cid + ', .jsxc_buddy_' + cid); // both
|
||||
var bullet = $('.jsxc_buddy_' + cid);
|
||||
|
||||
// Attach data to corresponding roster item
|
||||
ri.data(data);
|
||||
@@ -669,6 +713,7 @@ var jsxc;
|
||||
|
||||
// Change name and add title
|
||||
ue.find('.jsxc_name').text(data.name).attr('title', 'is ' + jsxc.CONST.STATUS[data.status]);
|
||||
bullet.attr('title', 'is ' + jsxc.CONST.STATUS[data.status]);
|
||||
|
||||
// Update gui according to encryption state
|
||||
switch (data.msgstate) {
|
||||
@@ -726,7 +771,7 @@ var jsxc;
|
||||
jsxc.storage.setUserItem('avatar_' + data.avatar, src);
|
||||
setAvatar(src);
|
||||
}, Strophe.getBareJidFromJid(data.jid), function(msg) {
|
||||
jsxc.debug('Error', msg);
|
||||
jsxc.error('Could not load vcard.', msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1071,6 +1116,37 @@ var jsxc;
|
||||
*/
|
||||
showAboutDialog: function() {
|
||||
jsxc.gui.dialog.open(jsxc.gui.template.get('aboutDialog'));
|
||||
|
||||
$('#jsxc_dialog .jsxc_debuglog').click(function() {
|
||||
jsxc.gui.showDebugLog();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Show debug log.
|
||||
*
|
||||
* @memberOf jsxc.gui
|
||||
*/
|
||||
showDebugLog: function() {
|
||||
var userInfo = '<h3>User information</h3>';
|
||||
|
||||
if (navigator) {
|
||||
var key;
|
||||
for (key in navigator) {
|
||||
if (navigator.hasOwnProperty(key) && typeof navigator[key] === 'string') {
|
||||
userInfo += '<b>' + key + ':</b> ' + navigator[key] + '<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window.screen) {
|
||||
userInfo += '<b>Height:</b> ' + window.screen.height + '<br />';
|
||||
userInfo += '<b>Width:</b> ' + window.screen.width + '<br />';
|
||||
}
|
||||
|
||||
userInfo += '<b>jsxc version:</b> ' + jsxc.version + '<br />';
|
||||
|
||||
jsxc.gui.dialog.open('<div class="jsxc_log">'+userInfo+'<h3>Log</h3><pre>' + jsxc.escapeHTML(jsxc.log) + '</pre></div>');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1144,7 +1220,7 @@ var jsxc;
|
||||
*
|
||||
* @param {String} cid CSS compatible jid
|
||||
*/
|
||||
add: function(cid) {
|
||||
add: function(cid) {
|
||||
var data = jsxc.storage.getUserItem('buddy_' + cid);
|
||||
var bud = jsxc.gui.buddyTemplate.clone().attr('id', cid).attr('data-type', data.type || 'chat');
|
||||
|
||||
@@ -1565,9 +1641,9 @@ var jsxc;
|
||||
* @param {String} cid CSS compatible jid
|
||||
*/
|
||||
close: function(cid) {
|
||||
|
||||
|
||||
if (!jsxc.el_exists('#jsxc_window_' + cid)) {
|
||||
jsxc.debug('[Warning] Want to close a window, that is not open.');
|
||||
jsxc.warn('Want to close a window, that is not open.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1641,7 +1717,7 @@ var jsxc;
|
||||
*
|
||||
* @param {String} cid
|
||||
*/
|
||||
hide: function(cid) {
|
||||
hide: function(cid) {
|
||||
jsxc.storage.updateUserItem('window_' + cid, 'minimize', true);
|
||||
|
||||
jsxc.gui.window._hide(cid);
|
||||
@@ -1652,7 +1728,7 @@ var jsxc;
|
||||
*
|
||||
* @param {String} cid
|
||||
*/
|
||||
_hide: function(cid) {
|
||||
_hide: function(cid) {
|
||||
$('#jsxc_window_' + cid + ' .jsxc_window').slideUp();
|
||||
jsxc.gui.getWindow(cid).trigger('hidden.window.jsxc');
|
||||
},
|
||||
@@ -2007,7 +2083,8 @@ var jsxc;
|
||||
<br />\
|
||||
Real-time chat app for OwnCloud. This app requires external<br /> XMPP server (openfire, ejabberd etc.).<br />\
|
||||
<br />\
|
||||
<i>Released under the MIT license</i></p>'
|
||||
<i>Released under the MIT license</i></p>\
|
||||
<p class="jsxc_right"><a class="button jsxc_debuglog" href="#">Show debug log</a></p>'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2039,16 +2116,16 @@ var jsxc;
|
||||
// Create new connection (no login)
|
||||
jsxc.xmpp.conn = new Strophe.Connection(url);
|
||||
|
||||
// jsxc.xmpp.conn.xmlInput = function(data) {
|
||||
// jsxc.debug('<', data);
|
||||
// };
|
||||
// jsxc.xmpp.conn.xmlOutput = function(data) {
|
||||
// jsxc.debug('>', data);
|
||||
// };
|
||||
//
|
||||
// Strophe.log = function (level, msg) {
|
||||
// jsxc.debug(level + " " + msg);
|
||||
// };
|
||||
// jsxc.xmpp.conn.xmlInput = function(data) {
|
||||
// console.log('<', data);
|
||||
// };
|
||||
// jsxc.xmpp.conn.xmlOutput = function(data) {
|
||||
// console.log('>', data);
|
||||
// };
|
||||
|
||||
// Strophe.log = function (level, msg) {
|
||||
// console.log(level + " " + msg);
|
||||
// };
|
||||
|
||||
var callback = function(status, condition) {
|
||||
|
||||
@@ -2059,7 +2136,7 @@ var jsxc;
|
||||
jsxc.cid = jsxc.jidToCid(jsxc.xmpp.conn.jid.toLowerCase());
|
||||
$(document).trigger('connected.jsxc');
|
||||
break;
|
||||
case Strophe.Status.ATTACHED:
|
||||
case Strophe.Status.ATTACHED:
|
||||
$(document).trigger('attached.jsxc');
|
||||
break;
|
||||
case Strophe.Status.DISCONNECTED:
|
||||
@@ -2130,7 +2207,7 @@ var jsxc;
|
||||
jsxc.xmpp.conn.pause();
|
||||
|
||||
// Save sid and jid
|
||||
jsxc.storage.setItem('sid', jsxc.xmpp.conn.sid);
|
||||
jsxc.storage.setItem('sid', jsxc.xmpp.conn._proto.sid);
|
||||
jsxc.storage.setItem('jid', jsxc.xmpp.conn.jid.toLowerCase());
|
||||
|
||||
jsxc.storage.setItem('lastActivity', (new Date()).getTime());
|
||||
@@ -2179,7 +2256,7 @@ var jsxc;
|
||||
}).c('query', {
|
||||
xmlns: 'jabber:iq:roster'
|
||||
});
|
||||
|
||||
|
||||
jsxc.xmpp.conn.sendIQ(iq, jsxc.xmpp.onRoster);
|
||||
} else {
|
||||
jsxc.xmpp.sendPres();
|
||||
@@ -2214,6 +2291,7 @@ var jsxc;
|
||||
pres.c('c', jsxc.xmpp.conn.caps.generateCapsAttrs());
|
||||
}
|
||||
|
||||
jsxc.debug('Send presence', pres.toString());
|
||||
jsxc.xmpp.conn.send(pres);
|
||||
},
|
||||
|
||||
@@ -2380,7 +2458,7 @@ var jsxc;
|
||||
* @param {dom} presence
|
||||
* @private
|
||||
*/
|
||||
onPresence: function(presence) {
|
||||
onPresence: function(presence) {
|
||||
/*
|
||||
* <presence xmlns='jabber:client' type='unavailable' from='' to=''/>
|
||||
*
|
||||
@@ -2395,6 +2473,8 @@ var jsxc;
|
||||
* node='http://psi-im.org/caps' ver='caps-b75d8d2b25' ext='ca cs
|
||||
* ep-notify-2 html'/> </presence>
|
||||
*/
|
||||
jsxc.debug('onPresence', presence);
|
||||
|
||||
var ptype = $(presence).attr('type');
|
||||
var from = $(presence).attr('from');
|
||||
var jid = Strophe.getBareJidFromJid(from).toLowerCase();
|
||||
@@ -2406,14 +2486,12 @@ var jsxc;
|
||||
var status = null;
|
||||
var xVCard = $(presence).find('x[xmlns="vcard-temp:x:update"]');
|
||||
|
||||
jsxc.debug('onPresence', presence);
|
||||
|
||||
if (jid === to) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ptype === 'error') {
|
||||
jsxc.debug('[XMPP ERROR] ' + $(presence).attr('code'));
|
||||
jsxc.error('[XMPP] ' + $(presence).attr('code'));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2444,7 +2522,7 @@ var jsxc;
|
||||
}
|
||||
|
||||
var maxVal = [];
|
||||
var max = 0, prop;
|
||||
var max = 0, prop = null;
|
||||
for (prop in res) {
|
||||
if (res.hasOwnProperty(prop)) {
|
||||
if (max <= res[prop]) {
|
||||
@@ -2503,7 +2581,7 @@ var jsxc;
|
||||
* <body>...</body> <active
|
||||
* xmlns='http://jabber.org/protocol/chatstates'/> </message>
|
||||
*/
|
||||
|
||||
|
||||
jsxc.debug('Incoming message', message);
|
||||
|
||||
var type = $(message).attr('type');
|
||||
@@ -3193,7 +3271,7 @@ var jsxc;
|
||||
});
|
||||
|
||||
jsxc.buddyList[cid].on('error', function(err) {
|
||||
jsxc.debug('[OTR] ' + err);
|
||||
jsxc.error('[OTR] ', err);
|
||||
jsxc.gui.window.postMessage(cid, 'sys', '[OTR] ' + err);
|
||||
});
|
||||
|
||||
|
||||
+1
-1
Submodule lib/strophe.jingle updated: 09bba9af8e...0c1544d6d7
+2166
-1229
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Referência em uma Nova Issue
Bloquear um usuário