Comparar commits

..

7 Commits

Autor SHA1 Mensagem Data
sualko 66ca116934 add automatic login 2017-06-29 16:12:51 +02:00
Klaus dbc6ed082c Update .travis.yml 2017-06-29 11:02:26 +02:00
sualko e7c5473298 use span for emoticons 2017-06-29 10:22:45 +02:00
sualko 2231d19c35 add function to retrieve last message 2017-06-29 10:21:59 +02:00
sualko 6e1622a6be fix uncaught type error (fix #569) 2017-06-28 18:19:50 +02:00
sualko 0fbcca2f5e fix selection dialog (fix #552) 2017-06-26 15:47:46 +02:00
sualko f65be0b254 fix unlimited max size for http file upload 2017-06-14 10:06:27 +02:00
7 arquivos alterados com 92 adições e 15 exclusões
+2
Ver Arquivo
@@ -1,5 +1,7 @@
language: node_js
dist: trusty
node_js:
- "node"
+7 -1
Ver Arquivo
@@ -211,7 +211,7 @@
}
li {
div {
span {
float: left;
cursor: pointer;
border-radius: 3px;
@@ -548,6 +548,12 @@
background-image: image-url("filetypes/text.svg");
}
}
.jsxc_emoticon.jsxc_large {
width: 40px;
height: 40px;
margin-bottom: 7px;
}
}
.jsxc_timestamp {
-6
Ver Arquivo
@@ -5,12 +5,6 @@
background-size: contain;
border: 0;
vertical-align: bottom;
&.jsxc_large {
width: 40px;
height: 40px;
margin-bottom: 7px;
}
}
#jsxc_roster .jsxc_emoticon.jsxc_large {
+1 -1
Ver Arquivo
@@ -144,7 +144,7 @@ jsxc.fileTransfer.showFileTooLarge = function(bid, file) {
jsxc.fileTransfer.fileSelected = function(jid, msg, file) {
var bid = jsxc.jidToBid(jid);
var httpUploadOptions = jsxc.options.get('httpUpload') || {};
var maxSize = httpUploadOptions.maxSize || 0;
var maxSize = httpUploadOptions.maxSize || -1;
if (file.transportMethod !== 'webrtc' && jsxc.xmpp.httpUpload.ready && maxSize >= 0 && file.size > maxSize) {
jsxc.debug('File too large for http upload.');
+8 -4
Ver Arquivo
@@ -1113,7 +1113,7 @@ jsxc.gui = {
dialog.find('.btn-primary').text(opt.primary.label);
}
if (opt.primary && opt.option.label) {
if (opt.option && opt.option.label) {
dialog.find('.btn-default').text(opt.option.label);
}
@@ -1121,8 +1121,8 @@ jsxc.gui = {
dialog.find('.btn-primary').click(opt.primary.cb);
}
if (opt.primary && opt.option.cb) {
dialog.find('.btn-primary').click(opt.option.cb);
if (opt.option && opt.option.cb) {
dialog.find('.btn-default').click(opt.option.cb);
}
},
@@ -1422,7 +1422,7 @@ jsxc.gui = {
src = jsxc.options.root + '/lib/emojione/assets/svg/' + filename + '.svg';
}
var div = $('<div>');
var div = $('<span>');
div.addClass('jsxc_emoticon');
div.css('background-image', 'url(' + src + ')');
@@ -2550,6 +2550,10 @@ jsxc.gui.window = {
message.htmlMsg = message.msg;
}
if (typeof message.msg === 'undefined') {
message.msg = '';
}
// remove html tags and reencode html tags
message.msg = jsxc.removeHTML(message.msg);
message.msg = jsxc.escapeHTML(message.msg);
+69 -2
Ver Arquivo
@@ -295,6 +295,7 @@ jsxc = {
window.addEventListener('storage', jsxc.storage.onStorage, false);
$(document).on('attached.jsxc', jsxc.registerLogout);
$(document).on('disconnected.jsxc', jsxc.relogin);
var isStorageAttachParameters = jsxc.storage.getItem('rid') && jsxc.storage.getItem('sid') && jsxc.storage.getItem('jid');
var isOptionsAttachParameters = jsxc.options.xmpp.rid && jsxc.options.xmpp.sid && jsxc.options.xmpp.jid;
@@ -303,6 +304,10 @@ jsxc = {
// Check if we have to establish a new connection
if ((!isStorageAttachParameters && !isOptionsAttachParameters) || isForceLoginForm) {
if (jsxc.relogin()) {
return;
}
// clean up rid and sid
jsxc.storage.removeItem('rid');
jsxc.storage.removeItem('sid');
@@ -414,8 +419,8 @@ jsxc = {
return false;
}
if (jsxc.xmpp.conn && jsxc.xmpp.connected) {
jsxc.debug('We are already connected');
if (jsxc.xmpp.conn && jsxc.xmpp.conn.authenticated) {
jsxc.debug('We are already connected and authenticated');
return false;
}
@@ -434,6 +439,47 @@ jsxc = {
});
},
relogin: function() {
jsxc.debug('Try to relogin');
var jid = jsxc.storage.getItem('jid');
jsxc.bid = jsxc.bid || (jid ? jsxc.jidToBid(jid) : null);
if (!jsxc.bid || jsxc.storage.getUserItem('forcedLogout')) {
jsxc.debug('Logout was forced or I found no valid jid');
return false;
}
var xmppOptions = jsxc.options.xmpp;
if (xmppOptions.url && (xmppOptions.jid || (xmppOptions.username && xmppOptions.domain)) && xmppOptions.password) {
xmppOptions.jid = xmppOptions.jid || (xmppOptions.username + xmppOptions.domain);
jsxc.start(xmppOptions.jid, xmppOptions.password);
return true;
}
var loadSettingsAllKnowing = jsxc.storage.getUserItem('loadSettingsAllKnowing');
if (xmppOptions.url && loadSettingsAllKnowing) {
jsxc.options.loadSettings(null, null, function(settings) {
jsxc._prepareLogin(null, null, function(settings) {
if (settings !== false) {
jsxc.start(jsxc.options.xmpp.jid, jsxc.options.xmpp.password);
}
}, settings);
});
return true;
}
jsxc.debug('I am not able to relogin');
return false;
},
registerLogout: function() {
// Looking for logout element
if (jsxc.options.logoutElement !== null && $(jsxc.options.logoutElement).length > 0) {
@@ -571,6 +617,11 @@ jsxc = {
jsxc.options.xmpp.jid = jid;
jsxc.options.xmpp.password = password;
var tempBid = jsxc.bid;
jsxc.bid = jsxc.jidToBid(jid);
jsxc.storage.setUserItem('loadSettingsAllKnowing', !!jid && !!password);
jsxc.bid = tempBid;
cb(settings);
},
@@ -964,5 +1015,21 @@ jsxc = {
jsxc.debug('UI State changed to ' + Object.keys(jsxc.CONST.UISTATE)[state]);
$(document).trigger('stateUIChange.jsxc', state);
},
getLastMsg: function(bid) {
var history = jsxc.storage.getUserItem('history', bid) || [];
var i = 0;
while (history.length > i) {
var message = new jsxc.Message(history[i]);
if (message.direction !== jsxc.Message.SYS) {
return {
text: message.msg,
date: message.stamp
};
}
i++;
}
}
};
+5 -1
Ver Arquivo
@@ -184,6 +184,8 @@ jsxc.xmpp = {
*/
logout: function(complete) {
jsxc.storage.setUserItem('forcedLogout', true);
jsxc.triggeredFromElement = (typeof complete === 'boolean') ? complete : true;
if (!jsxc.master) {
@@ -262,6 +264,8 @@ jsxc.xmpp = {
var rosterVerSupport = $(jsxc.xmpp.conn.features).find('[xmlns="urn:xmpp:features:rosterver"]').length > 0;
jsxc.storage.setUserItem('rosterVerSupport', rosterVerSupport);
jsxc.storage.removeUserItem('forcedLogout');
if (jsxc.options.loginForm.triggered) {
switch (jsxc.options.loginForm.onConnected || 'submit') {
case 'submit':
@@ -460,7 +464,7 @@ jsxc.xmpp = {
disconnected: function() {
jsxc.debug('disconnected');
jsxc.storage.removeItem('jid');
//jsxc.storage.removeItem('jid');
jsxc.storage.removeItem('sid');
jsxc.storage.removeItem('rid');
jsxc.storage.removeItem('hidden');