' +
+ '
' +
+
'
' + nick.htmlEnc() + '
';
-
+
// Show the close button if not MUC and not anonymous
if(show_close) {
- html += '
' +
- 'x' +
+ html += '
' +
+ 'x' +
'
';
}
-
+
// Close the HTML
html += '
';
-
+
// Append the HTML code
$(chat_switch + 'chans, ' + chat_switch + 'more-content').append(html);
} catch(e) {
@@ -518,10 +519,10 @@ var Chat = (function () {
try {
// Remove the messages
$('#page-engine #' + chat + ' .content .one-group').remove();
-
+
// Clear the history database
Message.removeLocalArchive(chat);
-
+
// Focus again
$(document).oneTime(10, function() {
$('#page-engine #' + chat + ' .text .message-area').focus();
@@ -569,13 +570,13 @@ var Chat = (function () {
try {
Console.info('New chat: ' + xid);
-
+
// Create the chat content
self.generate(type, hash, xid, nick);
-
+
// Create the chat switcher
self.generateSwitch(type, hash, xid, nick);
-
+
// Is this a chat?
if(type == 'chat') {
// MAM? Get archives from there!
@@ -589,22 +590,22 @@ var Chat = (function () {
} else {
// Restore the chat history
var chat_history = Message.readLocalArchive(hash);
-
+
if(chat_history) {
// Generate hashs
var my_hash = hex_md5(Common.getXID());
var friend_hash = hex_md5(xid);
-
+
// Add chat history HTML
var path_sel = $('#' + hash);
path_sel.find('.content').append(chat_history);
-
+
// Filter old groups & messages
var one_group_sel = path_sel.find('.one-group');
one_group_sel.filter('[data-type="user-message"]').addClass('from-history').attr('data-type', 'old-message');
path_sel.find('.user-message').removeClass('user-message').addClass('old-message');
-
+
// Regenerate user names
one_group_sel.filter('.' + my_hash + ' b.name').text(
Name.getBuddy(Common.getXID())
@@ -613,18 +614,18 @@ var Chat = (function () {
one_group_sel.filter('.' + friend_hash + ' b.name').text(
Name.getBuddy(xid)
);
-
+
// Regenerate group dates
one_group_sel.each(function() {
var current_stamp = parseInt($(this).attr('data-stamp'), 10);
$(this).find('span.date').text(DateUtils.relative(current_stamp));
});
-
+
// Regenerate avatars
if(Common.exists('#' + hash + ' .one-group.' + my_hash + ' .avatar-container')) {
Avatar.get(Common.getXID(), 'cache', 'true', 'forget');
}
-
+
if(Common.exists('#' + hash + ' .one-group.' + friend_hash + ' .avatar-container')) {
Avatar.get(xid, 'cache', 'true', 'forget');
}
@@ -636,23 +637,23 @@ var Chat = (function () {
$('#' + hash + ' .tools-add').click(function() {
// Hide the icon (to tell the user all is okay)
$(this).hide();
-
+
// Send the subscribe request
Roster.addThisContact(xid, nick);
}).show();
}
}
-
+
// We catch the user's informations (like this avatar, vcard, and so on...)
UserInfos.get(hash, xid, nick, type);
-
+
// The icons-hover functions
Tooltip.icons(xid, hash);
-
+
// The event handlers
var input_sel = $('#page-engine #' + hash + ' .message-area');
self._createEvents(input_sel, xid, hash);
-
+
// Input events
ChatState.events(input_sel, xid, hash, 'chat');
Markers.events(input_sel, xid, hash, 'chat');
@@ -668,4 +669,4 @@ var Chat = (function () {
*/
return self;
-})();
\ No newline at end of file
+})();
diff --git a/source/app/javascripts/chatstate.js b/source/app/javascripts/chatstate.js
index 6459103..d0353fb 100644
--- a/source/app/javascripts/chatstate.js
+++ b/source/app/javascripts/chatstate.js
@@ -32,27 +32,27 @@ var ChatState = (function () {
try {
var user_type = $('#' + hash).attr('data-type');
-
+
// If the friend client supports chatstates and is online
if((user_type == 'groupchat') || ((user_type == 'chat') && $('#' + hash + ' .message-area').attr('data-chatstates') && !Common.exists('#page-switch .' + hash + ' .unavailable'))) {
// Already sent?
if(DataStore.getDB(Connection.desktop_hash, 'currentchatstate', xid) == state) {
return;
}
-
+
// Write the state
DataStore.setDB(Connection.desktop_hash, 'currentchatstate', xid, state);
-
+
// New message stanza
var aMsg = new JSJaCMessage();
aMsg.setTo(xid);
aMsg.setType(user_type);
-
+
// Append the chatstate node
aMsg.appendNode(state, {
'xmlns': NS_CHATSTATES
});
-
+
// Send this!
con.send(aMsg);
}
@@ -77,57 +77,57 @@ var ChatState = (function () {
// Groupchat?
if(type == 'groupchat') {
self.reset(hash, type);
-
+
// "gone" state not allowed
if(state != 'gone') {
$('#page-engine .page-engine-chan .user.' + hash).addClass(state);
}
}
-
+
// Chat
else {
// We change the buddy name color in the page-switch
self.reset(hash, type);
$('#page-switch .' + hash + ' .name').addClass(state);
-
+
// We generate the chatstate text
var text = '';
-
+
switch(state) {
// Active
case 'active':
text = Common._e("Your friend is paying attention to the conversation.");
-
+
break;
-
+
// Composing
case 'composing':
text = Common._e("Your friend is writing a message...");
-
+
break;
-
+
// Paused
case 'paused':
text = Common._e("Your friend stopped writing a message.");
-
+
break;
-
+
// Inactive
case 'inactive':
text = Common._e("Your friend is doing something else.");
-
+
break;
-
+
// Gone
case 'gone':
text = Common._e("Your friend closed the chat.");
-
+
break;
}
-
+
// We reset the previous state
$('#' + hash + ' .chatstate').remove();
-
+
// We create the chatstate
$('#' + hash + ' .content').after(
'
' + text + '
'
@@ -152,13 +152,13 @@ var ChatState = (function () {
try {
// Define the selector
var selector;
-
+
if(type == 'groupchat') {
selector = $('#page-engine .page-engine-chan .user.' + hash);
} else {
selector = $('#page-switch .' + hash + ' .name');
}
-
+
// Reset!
selector.removeClass('active composing paused inactive gone');
} catch(e) {
@@ -186,33 +186,33 @@ var ChatState = (function () {
if($(this).val() && (DataStore.getDB(Connection.desktop_hash, 'chatstate', xid) != 'on')) {
// We change the state detect input
DataStore.setDB(Connection.desktop_hash, 'chatstate', xid, 'on');
-
+
// We send the friend a "composing" chatstate
self.send('composing', xid, hash);
}
-
+
// Flushed the message which was being composed
else if(!$(this).val() && (DataStore.getDB(Connection.desktop_hash, 'chatstate', xid) == 'on')) {
// We change the state detect input
DataStore.setDB(Connection.desktop_hash, 'chatstate', xid, 'off');
-
+
// We send the friend an "active" chatstate
self.send('active', xid, hash);
}
}
});
-
+
target.change(function() {
// Reset the composing database entry
DataStore.setDB(Connection.desktop_hash, 'chatstate', xid, 'off');
});
-
+
target.focus(function() {
// Not needed
if(target.is(':disabled')) {
return;
}
-
+
// Something was written, user started writing again
if($(this).val()) {
self.send('composing', xid, hash);
@@ -223,7 +223,7 @@ var ChatState = (function () {
self.send('active', xid, hash);
}
});
-
+
target.blur(function() {
// Not needed
if(target.is(':disabled')) {
diff --git a/source/app/javascripts/common.js b/source/app/javascripts/common.js
index 2b340a5..5874604 100644
--- a/source/app/javascripts/common.js
+++ b/source/app/javascripts/common.js
@@ -154,16 +154,16 @@ var Common = (function () {
if(type == 'groupchat') {
return xid + '@' + HOST_MUC;
}
-
+
// Gateway XID
if(self.isDomain(xid) === true) {
return xid;
}
-
+
// User XID
return xid + '@' + HOST_MAIN;
}
-
+
// Nothing special (yet bare XID)
return xid;
} catch(e) {
@@ -221,14 +221,14 @@ var Common = (function () {
if(!given_char || !str) {
return '';
}
-
+
var char_index = str.lastIndexOf(given_char);
var str_return = str;
-
+
if(char_index >= 0) {
str_return = str.substr(char_index + 1);
}
-
+
return str_return;
} catch(e) {
Console.error('Common.strAfterLast', e);
@@ -250,7 +250,7 @@ var Common = (function () {
try {
// Get the index of our char to explode
var index = toStr.indexOf(toEx);
-
+
// We split if necessary the string
if(index !== -1) {
if(i === 0) {
@@ -259,7 +259,7 @@ var Common = (function () {
toStr = toStr.substr(index + 1);
}
}
-
+
// We return the value
return toStr;
} catch(e) {
@@ -424,12 +424,12 @@ var Common = (function () {
try {
// Cut the resource
xid = self.cutResource(xid);
-
+
// Launch nodeprep
if(xid.indexOf('@') !== -1) {
xid = self.nodeprep(self.getXIDNick(xid, true)) + '@' + self.getXIDHost(xid);
}
-
+
return xid;
} catch(e) {
Console.error('Common.bareXID', e);
@@ -450,12 +450,12 @@ var Common = (function () {
// Normalizes the XID
var full = self.bareXID(xid);
var resource = self.thisResource(xid);
-
+
// Any resource?
if(resource) {
full += '/' + resource;
}
-
+
return full;
} catch(e) {
Console.error('Common.fullXID', e);
@@ -480,7 +480,7 @@ var Common = (function () {
return self.explodeThis('\\40', aXID, 0);
}
}
-
+
return self.explodeThis('@', aXID, 0);
} catch(e) {
Console.error('Common.getXIDNick', e);
@@ -555,7 +555,7 @@ var Common = (function () {
/**
- * Gets the full XID of the user
+ * Gets the bare XID of the user
* @public
* @return {string}
*/
@@ -566,7 +566,7 @@ var Common = (function () {
if(con.username && con.domain) {
return con.username + '@' + con.domain;
}
-
+
return '';
} catch(e) {
Console.error('Common.getXID', e);
@@ -575,6 +575,29 @@ var Common = (function () {
};
+ /**
+ * Gets the full XID of the user
+ * @public
+ * @return {string}
+ */
+ self.getFullXID = function() {
+
+ try {
+ var xid = self.getXID();
+
+ // Return the full XID of the user
+ if(xid) {
+ return xid + '/' + con.resource;
+ }
+
+ return '';
+ } catch(e) {
+ Console.error('Common.getFullXID', e);
+ }
+
+ };
+
+
/**
* Generates the colors for a given user XID
* @public
@@ -592,15 +615,15 @@ var Common = (function () {
'00236b',
'4e005c'
);
-
+
var number = 0;
-
+
for(var i = 0; i < xid.length; i++) {
number += xid.charCodeAt(i);
}
-
+
var color = '#' + colors[number % (colors.length)];
-
+
return color;
} catch(e) {
Console.error('Common.generateColor', e);
@@ -642,12 +665,12 @@ var Common = (function () {
try {
var from = stanza.getFrom();
-
+
// No from, we assume this is our XID
if(!from) {
from = self.getXID();
}
-
+
return from;
} catch(e) {
Console.error('Common.getStanzaFrom', e);
@@ -692,12 +715,12 @@ var Common = (function () {
if(i > -10 && i < 0) {
return '-0' + (i * -1);
}
-
+
// Positive number (without first 0)
if(i < 10 && i >= 0) {
return '0' + i;
}
-
+
// All is okay
return i;
} catch(e) {
@@ -798,7 +821,7 @@ var Common = (function () {
if(window.XMLSerializer) {
xml_str = (new XMLSerializer()).serializeToString(xmlData);
}
-
+
// For Internet Explorer
if(window.ActiveXObject) {
xml_str = xmlData.xml;
@@ -825,21 +848,21 @@ var Common = (function () {
if(!sXML) {
return '';
}
-
+
// Add the XML tag
if(!sXML.match(/^<\?xml/i)) {
sXML = '' + sXML;
}
-
+
// Parse it!
if(window.DOMParser) {
return (new DOMParser()).parseFromString(sXML, 'text/xml');
}
-
+
if(window.ActiveXObject) {
var oXML = new ActiveXObject('Microsoft.XMLDOM');
oXML.loadXML(sXML);
-
+
return oXML;
}
} catch(e) {
@@ -861,7 +884,7 @@ var Common = (function () {
try {
var timer = 0;
-
+
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
@@ -880,4 +903,4 @@ var Common = (function () {
})();
-var JappixCommon = Common;
\ No newline at end of file
+var JappixCommon = Common;
diff --git a/source/app/javascripts/connection.js b/source/app/javascripts/connection.js
index 9a5f6d9..6f1dadb 100644
--- a/source/app/javascripts/connection.js
+++ b/source/app/javascripts/connection.js
@@ -45,20 +45,20 @@ var Connection = (function () {
try {
// Show the waiting image
Interface.showGeneralWait();
-
+
// Change the page title
Interface.title('wait');
-
+
// Send request
$.post('./server/register.php', {username: username, domain: domain, password: pass, captcha: captcha}, function(data) {
// Error registering
Interface.removeGeneralWait();
Interface.title('home');
-
+
// In all case, update CAPTCHA
$('#home img.captcha_img').attr('src', './server/captcha.php?id=' + genID());
$('#home input.captcha').val('');
-
+
// Registration okay
if($(data).find('query status').text() == '1') {
is_success = true;
@@ -66,28 +66,28 @@ var Connection = (function () {
} else {
// Show error message
var error_message = '';
-
+
switch($(data).find('query message').text()) {
case 'CAPTCHA Not Matching':
error_message = Common._e("The security code you entered is invalid. Please retry with another one.");
-
+
$('#home input.captcha').focus();
-
+
break;
-
+
case 'Username Unavailable':
error_message = Common._e("The username you picked is not available. Please try another one.");
-
+
$('#home input.nick').focus();
-
+
break;
-
+
default:
error_message = Common._e("There was an error registering your account. Please retry.");
-
+
break;
}
-
+
if(error_message) {
Errors.show('', error_message, '');
}
@@ -125,17 +125,17 @@ var Connection = (function () {
// Check BOSH origin
BOSH_SAME_ORIGIN = Origin.isSame(httpbase);
-
+
// We create the new http-binding connection
con = new JSJaCHttpBindingConnection({
httpbase: httpbase
});
}
-
+
// We setup the connection !
con.registerHandler('onconnect', self.handleRegistered);
con.registerHandler('onerror', Errors.handle);
-
+
con.connect({
'domain': $.trim(domain),
'username': $.trim(username),
@@ -145,10 +145,10 @@ var Connection = (function () {
'secure': true,
'xmllang': XML_LANG
});
-
+
// Show the waiting image
Interface.showGeneralWait();
-
+
// Change the page title
Interface.title('wait');
} catch(e) {
@@ -176,7 +176,7 @@ var Connection = (function () {
return self.cancelReconnect();
});
}
-
+
$('#reconnect a.finish.reconnect').click(function() {
return self.acceptReconnect(mode);
});
@@ -202,22 +202,22 @@ var Connection = (function () {
} else {
self.reconnect_timer = 120;
}
-
+
// Change the try number
self.reconnect_try++;
-
+
// Fire the event!
$('#reconnect a.finish.reconnect').everyTime('1s', function() {
// We can reconnect!
if(self.reconnect_timer === 0) {
return self.acceptReconnect(mode);
}
-
+
// Button text
if(self.reconnect_timer <= 10) {
$(this).text(Common._e("Reconnect") + ' (' + self.reconnect_timer + ')');
}
-
+
// Remove 1 second
self.reconnect_timer--;
});
@@ -248,10 +248,10 @@ var Connection = (function () {
// We remove the not completed class to avoid problems
$('#home .loginer input').removeClass('please-complete');
-
+
// We add the login wait div
Interface.showGeneralWait();
-
+
if(Common.hasWebSocket()) {
// WebSocket supported & configured
con = new JSJaCWebSocketConnection({
@@ -262,19 +262,19 @@ var Connection = (function () {
// Check BOSH origin
BOSH_SAME_ORIGIN = Origin.isSame(httpbase);
-
+
// We create the new http-binding connection
con = new JSJaCHttpBindingConnection({
httpbase: httpbase
});
}
-
+
// And we handle everything that happen
self.setupCon(con, extend_obj);
-
+
// Generate a resource
var random_resource = DataStore.getDB(self.desktop_hash, 'session', 'resource');
-
+
if(!random_resource) {
random_resource = lResource + ' (' + (new Date()).getTime() + ')';
}
@@ -289,29 +289,29 @@ var Connection = (function () {
};
self.desktop_hash = 'jd.' + hex_md5(con_args.username + '@' + con_args.domain);
-
+
// Store the resource (for reconnection)
DataStore.setDB(self.desktop_hash, 'session', 'resource', random_resource);
-
+
// Store session XML in temporary database
self.storeSession(lNick, lServer, lPass, lResource, lPriority, lRemember);
-
+
// We store the infos of the user into the data-base
DataStore.setDB(self.desktop_hash, 'priority', 1, lPriority);
-
+
// We connect !
con.connect(con_args);
-
+
// Change the page title
Interface.title('wait');
-
+
Console.info('Jappix is connecting...');
} catch(e) {
Console.error('Connection.doLogin', e);
// Reset Jappix
Talk.destroy();
-
+
// Open an unknown error
Board.openThisError(2);
} finally {
@@ -330,16 +330,16 @@ var Connection = (function () {
try {
Console.info('A new account has been registered.');
-
+
// We remove the waiting image
Interface.removeGeneralWait();
-
+
// Reset the title
Interface.title('home');
-
+
// We show the success information
$('#home .registerer .success').fadeIn('fast');
-
+
// We quit the session
if(Common.isConnected()) {
self.logout();
@@ -364,21 +364,21 @@ var Connection = (function () {
try {
Console.info('Trying to register an account...');
-
+
// We change the registered information text
$('#home .homediv.registerer').append(
- '
' +
- Common._e("You have been registered, here is your XMPP address:") +
- '
' + username.htmlEnc() + '@' + domain.htmlEnc() + ' - ' +
- '
' + Common._e("Login") + '' +
+ '
' +
+ Common._e("You have been registered, here is your XMPP address:") +
+ '
' + username.htmlEnc() + '@' + domain.htmlEnc() + ' - ' +
+ '
' + Common._e("Login") + '' +
'
'
);
-
+
// Login link
$('#home .homediv.registerer .success a').click(function() {
return self.doLogin(username, domain, pass, '', '10', false);
});
-
+
if((REGISTER_API == 'on') && (domain == HOST_MAIN) && captcha) {
self._doRegisterAPI(username, domain, pass, captcha);
} else {
@@ -402,28 +402,28 @@ var Connection = (function () {
try {
Console.info('Trying to login anonymously...');
-
+
var path_sel = $('#home .anonymouser');
var room = path_sel.find('.room').val();
var nick = path_sel.find('.nick').val();
-
+
// Form correctly completed?
if(room && nick) {
// We remove the not completed class to avoid problems
$('#home .anonymouser input').removeClass('please-complete');
-
+
// Redirect the user to the anonymous room
window.location.href = JAPPIX_LOCATION + '?r=' + room + '&n=' + nick;
} else {
path_sel.find('input[type="text"]').each(function() {
var this_sel = $(this);
-
+
if(!this_sel.val()) {
$(document).oneTime(10, function() {
this_sel.addClass('please-complete').focus();
});
} else {
- this_sel.removeClass('please-complete');
+ this_sel.removeClass('please-complete');
}
});
}
@@ -445,22 +445,22 @@ var Connection = (function () {
try {
Console.info('Jappix is now connected.');
-
+
// Connection markers
self.connected = true;
self.reconnect_try = 0;
self.reconnect_timer = 0;
-
+
// We hide the home page
$('#home').hide();
-
+
// Any suggest to do before triggering connected event?
Groupchat.suggestCheck();
-
+
// Remove the waiting item
Interface.removeGeneralWait();
- // Init Jingle
+ // Init call
Call.init();
} catch(e) {
Console.error('Connection.handleConnected', e);
@@ -483,25 +483,25 @@ var Connection = (function () {
if(DataStore.getDB(self.desktop_hash, 'remember', 'session')) {
DataStore.setPersistent('global', 'session', 1, self.current_session);
}
-
+
// We show the chatting app.
Talk.create();
-
+
// We reset the homepage
Home.change('default');
-
+
// We get all the other things
self.getEverything();
-
+
// Set last activity stamp
DateUtils.last_activity = DateUtils.getTimeStamp();
}
-
+
// Resumed
else {
// Send our presence
Presence.sendActions();
-
+
// Change the title
Interface.updateTitle();
}
@@ -521,7 +521,10 @@ var Connection = (function () {
try {
Console.info('Jappix is now disconnected.');
-
+
+ // Abort ongoing call (if any)
+ Call.stop(true);
+
// Normal disconnection
if(!self.current_session && !self.connected) {
Talk.destroy();
@@ -562,7 +565,7 @@ var Connection = (function () {
// Extended handlers
extend_obj = extend_obj || {};
-
+
jQuery.each(extend_obj, function(keywd,funct) {
con.registerHandler(keywd, funct);
});
@@ -611,13 +614,13 @@ var Connection = (function () {
if(Common.isConnected()) {
// Clear temporary session storage
self.resetConMarkers();
-
+
// Show the waiting item (useful if BOSH is sloooow)
Interface.showGeneralWait();
-
+
// Change the page title
Interface.title('wait');
-
+
// Disconnect from the XMPP server
self.logout();
}
@@ -640,13 +643,13 @@ var Connection = (function () {
if(!Common.isConnected()) {
return;
}
-
+
// We show the waiting image
Interface.showGeneralWait();
-
+
// Change the page title
Interface.title('wait');
-
+
// We disconnect from the XMPP server
self.logout();
} catch(e) {
@@ -666,34 +669,34 @@ var Connection = (function () {
try {
Console.error('This is not a normal disconnection, show the reconnect pane...');
-
+
// Reconnect pane not yet displayed?
if(!Common.exists('#reconnect')) {
// Blur the focused input/textarea/select
$('input, select, textarea').blur();
-
+
// Create the HTML code
- var html = '
' +
- '
' +
+ var html = '
';
-
+
// Append the code
$('body').append(html);
-
+
// Attach events
self._eventsReconnect(mode);
-
+
// Schedule next reconnect
self._scheduleReconnect(mode);
-
+
// Page title
Interface.updateTitle();
}
@@ -714,13 +717,13 @@ var Connection = (function () {
try {
Console.info('Trying to reconnect the user...');
-
+
// Resume marker
self.resume = true;
-
+
// Show waiting item
Interface.showGeneralWait();
-
+
// Reset some various stuffs
var groupchats = '#page-engine .page-engine-chan[data-type="groupchat"]';
var groupchats_sel = $(groupchats);
@@ -728,13 +731,13 @@ var Connection = (function () {
groupchats_sel.find('.list .role').hide();
groupchats_sel.find('.one-group, ' + groupchats + ' .list .user').remove();
groupchats_sel.attr('data-initial', 'false');
-
+
// Stop the timer
$('#reconnect a.finish.reconnect').stopTime();
-
+
// Remove the reconnect pane
$('#reconnect').remove();
-
+
// Try to login again
if(mode == 'normal') {
self.loginFromSession(Common.XMLFromString(self.current_session));
@@ -759,16 +762,16 @@ var Connection = (function () {
try {
Console.info('User has canceled automatic reconnection...');
-
+
// Stop the timer
$('#reconnect a.finish.reconnect').stopTime();
-
+
// Remove the reconnect pane
$('#reconnect').remove();
-
+
// Destroy the talk page
Talk.destroy();
-
+
// Renitialize the previous session parameters
self.resetConMarkers();
} catch(e) {
@@ -790,7 +793,7 @@ var Connection = (function () {
try {
// Clear temporary storage
self.resetConMarkers();
-
+
// Clear persistent storage
if($(Common.XMLFromString(DataStore.getPersistent('global', 'session', 1))).find('stored').text() == 'true') {
DataStore.removePersistent('global', 'session', 1);
@@ -833,7 +836,7 @@ var Connection = (function () {
try {
// Select the data
var session = $(data);
-
+
// Fire the login event
self.doLogin(
session.find('username').text(),
@@ -860,10 +863,10 @@ var Connection = (function () {
try {
// Reset our database
self.clearLastSession();
-
+
// We quit the current session
self.quit();
-
+
// We show an info
Board.openThisInfo(3);
} catch(e) {
@@ -909,23 +912,23 @@ var Connection = (function () {
try {
// Generate a session XML to be stored
- session_xml = '
' +
- 'true' +
- '' + lServer.htmlEnc() + '' +
- '' + lNick.htmlEnc() + '' +
- '' + lResource.htmlEnc() + '' +
- '' + lPass.htmlEnc() + '' +
- '' + lPriority.htmlEnc() + '' +
+ session_xml = '' +
+ 'true' +
+ '' + lServer.htmlEnc() + '' +
+ '' + lNick.htmlEnc() + '' +
+ '' + lResource.htmlEnc() + '' +
+ '' + lPass.htmlEnc() + '' +
+ '' + lPriority.htmlEnc() + '' +
'';
-
+
// Save the session parameters (for reconnect if network issue)
self.current_session = session_xml;
-
+
// Remember me?
if(lRemember) {
DataStore.setDB(self.desktop_hash, 'remember', 'session', 1);
}
-
+
return session_xml;
} catch(e) {
Console.error('Connection.storeSession', e);
@@ -945,12 +948,12 @@ var Connection = (function () {
$(document).ready(function() {
// Logouts when Jappix is closed
$(window).bind('beforeunload', Connection.terminate);
-
+
// Nothing to do when anonymous!
if(Utils.isAnonymous()) {
return;
}
-
+
// Connection params submitted in URL?
if(XMPPLinks.links_var.u && XMPPLinks.links_var.q) {
// Generate login data
@@ -961,7 +964,7 @@ var Connection = (function () {
var login_resource = JAPPIX_RESOURCE + ' (' + (new Date()).getTime() + ')';
var login_priority = '10';
var login_remember = 1;
-
+
// Must store session?
if(XMPPLinks.links_var.h && (XMPPLinks.links_var.h === '1')) {
// Store session
@@ -975,42 +978,42 @@ var Connection = (function () {
);
DataStore.setPersistent('global', 'session', 1, session_xml);
-
+
// Redirect to a clean URL
document.location.href = './';
} else {
// Hide the homepage
$('#home').hide();
-
+
// Show the waiting icon
Interface.showGeneralWait();
-
+
// Proceed login
self.doLogin(login_nick, login_server, login_pwd, login_resource, login_priority, login_remember);
}
-
+
return;
}
-
+
// Try to resume a stored session, if not anonymous
var session = Common.XMLFromString(
DataStore.getPersistent('global', 'session', 1)
);
-
+
if($(session).find('stored').text() == 'true') {
// Hide the homepage
$('#home').hide();
-
+
// Show the waiting icon
Interface.showGeneralWait();
-
+
// Login!
self.loginFromSession(session);
-
+
Console.info('Saved session found, resuming it...');
} else if((parent.location.hash != '#OK') && XMPPLinks.links_var.x) {
Home.change('loginer');
-
+
Console.info('A XMPP link is set, switch to login page.');
}
});
diff --git a/source/app/javascripts/constants.js b/source/app/javascripts/constants.js
index be9241e..69b71d1 100644
--- a/source/app/javascripts/constants.js
+++ b/source/app/javascripts/constants.js
@@ -187,7 +187,7 @@ function STANZA_ERROR(code, type, cond) {
if(window == this) {
return new STANZA_ERROR(code, type, cond);
}
-
+
this.code = code;
this.type = type;
this.cond = cond;
diff --git a/source/app/javascripts/correction.js b/source/app/javascripts/correction.js
index 1bfa930..deea70c 100644
--- a/source/app/javascripts/correction.js
+++ b/source/app/javascripts/correction.js
@@ -134,9 +134,9 @@ var Correction = (function () {
text_sel.addClass('correction-active');
text_sel.prepend(
- '