1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00

Update sources to Jappix 1.1.2

This commit is contained in:
mbugeia 2014-11-25 23:42:38 +01:00
parent 88db60ddf9
commit 71db53b86c
132 changed files with 18072 additions and 15798 deletions

View file

@ -4,8 +4,22 @@ Jappix Changelog
Here's the log of what has changed over the Jappix releases.
Primo, v1.1.0 (Jun 2014)
------------------------
Primo, v1.1.2 (October 2014)
----------------------------
* XEP-0353: Jingle Message Initiation @valeriansaliou
* Fixes Jingle calls in Chrome 38+ @valeriansaliou
Primo, v1.1.1 (September 2014)
------------------------------
* Ignore empty XHTML-IM messages @eijebong, @valeriansaliou
* Fix a bug with message markers @valeriansaliou
Primo, v1.1.0 (June 2014)
-------------------------
* XEP-0272: Multiparty Jingle (Muji) @valeriansaliou
* Prevent client crash on huge messages @valeriansaliou

View file

@ -67,14 +67,15 @@ Here are listed the XMPP Protocol Extensions that Jappix supports, as well as th
* XEP-0334: Message Processing Hints *v0.1*
* XEP-0338: Jingle Grouping Framework *v0.1*
* XEP-0339: Source-Specific Media Attributes in Jingle *v0.1*
* XEP-0353: Jingle Message Initiation *v0.1*
# XMPP Extensions (Updated)
* XEP-0272: Multiparty Jingle (Muji) *v0.2*
* Alternate URL: https://demo.frenchtouch.pro/valerian.saliou/xmpp/extensions/xep-0272.html
* Alternate URL: https://demo.hakuma.holdings/valerian.saliou/xmpp/extensions/xep-0272.html
* XEP-0313: Message Archive Management *v0.3*
* Alternate URL: https://demo.frenchtouch.pro/valerian.saliou/xmpp/extensions/xep-0313.html
* Alternate URL: https://demo.hakuma.holdings/valerian.saliou/xmpp/extensions/xep-0313.html
# XMPP Extensions (Proposed)

View file

@ -6,7 +6,7 @@ Jappix is a fresh new open social platform which enables you to create your own
You can build your own Jappix installation for your own requirements: if you want to use it as a personal social client, you can download it and put it on your webserver. It's easy, fast and free.
[![build status](https://ci.frenchtouch.pro/projects/7/status.png?ref=master)](https://ci.frenchtouch.pro/projects/7?ref=master)
[![build status](https://ci.hakuma.holdings/projects/7/status.png?ref=master)](https://ci.hakuma.holdings/projects/7?ref=master)
License
@ -45,7 +45,7 @@ Mirrors
In case a master service is down (GitHub for Git access or Jappix.org for project download), here is a list of available mirrors:
* Project website mirror: https://project.jappix.com/
* Development repository mirror: https://code.frenchtouch.pro/jappix/jappix
* Development repository mirror: https://code.hakuma.holdings/jappix/jappix
MUC Links

View file

@ -1 +1 @@
Primo [1.1.0]
Primo [1.1.2]

View file

@ -29,24 +29,24 @@ var AdHoc = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Commands") + '</div>' +
'<div class="content">' +
'<div class="adhoc-head"></div>' +
'<div class="results adhoc-results"></div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
var html =
'<div class="top">' + Common._e("Commands") + '</div>' +
'<div class="content">' +
'<div class="adhoc-head"></div>' +
'<div class="results adhoc-results"></div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
'</div>';
// Create the popup
Popup.create('adhoc', html);
// Associate the events
self.launch();
} catch(e) {
@ -88,16 +88,16 @@ var AdHoc = (function () {
try {
// Open the popup
self.open();
// Add a XID marker
$('#adhoc .adhoc-head').html('<b>' + Name.getBuddy(xid).htmlEnc() + '</b> (' + xid.htmlEnc() + ')');
// Get the highest entity resource
var highest = Presence.highestPriority(xid);
if(highest)
xid = highest;
// Start a new adhoc command
DataForm.go(xid, 'command', '', '', 'adhoc');
} catch(e) {
@ -120,10 +120,10 @@ var AdHoc = (function () {
try {
// Open the popup
self.open();
// Add a XID marker
$('#adhoc .adhoc-head').html('<b>' + server.htmlEnc() + '</b>');
// Start a new adhoc command
DataForm.go(server, 'command', '', '', 'adhoc');
} catch(e) {

View file

@ -51,40 +51,40 @@ var Anonymous = (function () {
try {
Console.info('Jappix (anonymous) is now connected.');
// Connected marker
Connection.connected = true;
Connection.current_session = true;
Connection.reconnect_try = 0;
Connection.reconnect_timer = 0;
// Not resumed?
if(!Connection.resume) {
// Create the app
Talk.create();
// Send our first presence
Presence.sendFirst('');
// Set last activity stamp
DateUtils.last_activity = DateUtils.getTimeStamp();
// Create the new groupchat
Chat.checkCreate(Common.generateXID(ANONYMOUS_ROOM, 'groupchat'), 'groupchat');
// Remove some nasty elements for the anonymous mode
$('.tools-mucadmin, .tools-add').remove();
}
// Resumed
else {
// Send again our presence
Presence.sendActions();
// Change the title
Interface.updateTitle();
}
// Remove the waiting icon
Interface.removeGeneralWait();
} catch(e) {
@ -129,16 +129,16 @@ var Anonymous = (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._registerHandlers(con);
// We set the anonymous connection parameters
oArgs = {};
oArgs.domain = server;
@ -146,10 +146,10 @@ var Anonymous = (function () {
oArgs.resource = JAPPIX_RESOURCE + ' Anonymous (' + (new Date()).getTime() + ')';
oArgs.secure = true;
oArgs.xmllang = XML_LANG;
// We connect !
con.connect(oArgs);
// Change the page title
Interface.title('wait');
} catch(e) {
@ -157,7 +157,7 @@ var Anonymous = (function () {
// Reset Jappix
self.disconnected();
// Open an unknown error
Board.openThisError(2);
} finally {
@ -177,19 +177,19 @@ var Anonymous = (function () {
try {
$(document).ready(function() {
Console.info('Anonymous mode detected, connecting...');
// We add the login wait div
Interface.showGeneralWait();
// Get the vars
if(XMPPLinks.links_var.r) {
ANONYMOUS_ROOM = XMPPLinks.links_var.r;
}
if(XMPPLinks.links_var.n) {
ANONYMOUS_NICK = XMPPLinks.links_var.n;
}
// Fire the login action
self.login(HOST_ANONYMOUS);
});

View file

@ -57,36 +57,36 @@ var Audio = (function () {
// If the audio elements aren't yet in the DOM
if(!Common.exists('#audio')) {
$('body').append(
'<div id="audio">' +
'<audio id="new-chat" preload="auto" data-duration="2">' +
'<source src="' + './sounds/new-chat.mp3' + '" />' +
'<source src="' + './sounds/new-chat.oga' + '" />' +
'</audio>' +
'<audio id="receive-message" preload="auto" data-duration="2">' +
'<source src="' + './sounds/receive-message.mp3' + '" />' +
'<source src="' + './sounds/receive-message.oga' + '" />' +
'</audio>' +
'<audio id="notification" preload="auto" data-duration="2">' +
'<source src="' + './sounds/notification.mp3' + '" />' +
'<source src="' + './sounds/notification.oga' + '" />' +
'</audio>' +
'<div id="audio">' +
'<audio id="new-chat" preload="auto" data-duration="2">' +
'<source src="' + './sounds/new-chat.mp3' + '" />' +
'<source src="' + './sounds/new-chat.oga' + '" />' +
'</audio>' +
'<audio id="catch-attention" preload="auto" data-duration="3">' +
'<source src="' + './sounds/catch-attention.mp3' + '" />' +
'<source src="' + './sounds/catch-attention.oga' + '" />' +
'</audio>' +
'<audio id="incoming-call" preload="auto" data-duration="7">' +
'<source src="' + './sounds/incoming-call.mp3' + '" />' +
'<source src="' + './sounds/incoming-call.oga' + '" />' +
'</audio>' +
'<audio id="outgoing-call" preload="auto" data-duration="30">' +
'<source src="' + './sounds/outgoing-call.mp3' + '" />' +
'<source src="' + './sounds/outgoing-call.oga' + '" />' +
'</audio>' +
'<audio id="receive-message" preload="auto" data-duration="2">' +
'<source src="' + './sounds/receive-message.mp3' + '" />' +
'<source src="' + './sounds/receive-message.oga' + '" />' +
'</audio>' +
'<audio id="notification" preload="auto" data-duration="2">' +
'<source src="' + './sounds/notification.mp3' + '" />' +
'<source src="' + './sounds/notification.oga' + '" />' +
'</audio>' +
'<audio id="catch-attention" preload="auto" data-duration="3">' +
'<source src="' + './sounds/catch-attention.mp3' + '" />' +
'<source src="' + './sounds/catch-attention.oga' + '" />' +
'</audio>' +
'<audio id="incoming-call" preload="auto" data-duration="7">' +
'<source src="' + './sounds/incoming-call.mp3' + '" />' +
'<source src="' + './sounds/incoming-call.oga' + '" />' +
'</audio>' +
'<audio id="outgoing-call" preload="auto" data-duration="30">' +
'<source src="' + './sounds/outgoing-call.mp3' + '" />' +
'<source src="' + './sounds/outgoing-call.oga' + '" />' +
'</audio>' +
'</div>'
);
}
@ -112,11 +112,11 @@ var Audio = (function () {
if(!self._isSupported()) {
return false;
}
// If the sounds are enabled
if(DataStore.getDB(Connection.desktop_hash, 'options', 'sounds') === '1') {
self._appendDOM();
// We play the target sound
var audio_raw_sel = $('#audio audio').filter('#' + name);
var audio_sel = audio_raw_sel[0];
@ -133,7 +133,7 @@ var Audio = (function () {
var duration = parseInt((audio_raw_sel.attr('data-duration') || 0), 10);
self._timeout_stop = false;
audio_raw_sel.oneTime((duration + 's'), function() {
if(!self._timeout_stop) {
self.play(name, repeat);
@ -170,7 +170,7 @@ var Audio = (function () {
if(!self._isSupported()) {
return false;
}
self._timeout_stop = true;
// Check the audio container exists before doing anything...
@ -180,7 +180,7 @@ var Audio = (function () {
if(audio_parent_sel.size()) {
audio_raw_sel.stopTime();
if(audio_sel) {
if(!audio_sel.paused) {
audio_sel.pause();

View file

@ -34,7 +34,7 @@ var Autocompletion = (function () {
// Put the two strings into lower case
var sort_a = a[0].toLowerCase();
var sort_b = b[0].toLowerCase();
// Process the sort
if(sort_a > sort_b) {
return 1;
@ -192,7 +192,7 @@ var Autocompletion = (function () {
}
var query = message_area_sel.attr('data-autocompletion-query');
if(query === undefined) {
// The autocompletion has not been yet launched
query = self.getSubQueries(value);
@ -201,11 +201,11 @@ var Autocompletion = (function () {
// The autocompletion has already stored a query
query = JSON.parse(query);
}
// Get the pointer
var pointer = message_area_sel.attr('data-autocompletion-pointer');
var i = pointer ? parseInt(pointer, 10) : 0;
// We get the nickname
var nick_result = self.process(query[0], hash)[i];
var nick;
@ -213,12 +213,12 @@ var Autocompletion = (function () {
if(nick_result !== undefined) {
nick = nick_result[0];
}
// Shit, this is my nick!
if((nick !== undefined) && (nick.toLowerCase() == Name.getMUCNick(hash).toLowerCase())) {
// Increment
i++;
// Get the next nick
nick_result = self.process(query[0], hash)[i];
@ -226,7 +226,7 @@ var Autocompletion = (function () {
nick = nick_result[0];
}
}
// We quote the nick
if((nick_result !== undefined) && (nick !== undefined)) {
// Increment
@ -237,7 +237,7 @@ var Autocompletion = (function () {
nick,
query[1][nick_result[1]]
);
// Put a pointer
message_area_sel.attr('data-autocompletion-pointer', i);
}

View file

@ -42,29 +42,29 @@ var Avatar = (function () {
if(Utils.existArrayValue(self.pending, xid)) {
return false;
}
// Initialize: XML data is in one SQL entry, because some browser are sloooow with SQL requests
var xml = Common.XMLFromString(
DataStore.getPersistent('global', 'avatar', xid)
);
var forced = false;
// Retrieving forced?
if($(xml).find('forced').text() == 'true') {
forced = true;
}
// No avatar in presence
if(!photo && !forced && enabled == 'true') {
// Pending marker
self.pending.push(xid);
// Reset the avatar
self.reset(xid, hex_md5(xid));
Console.warn('No avatar for: ' + xid);
}
// Try to catch the avatar
else {
// Define some stuffs
@ -82,31 +82,31 @@ var Avatar = (function () {
if(mode == 'cache' && type && binval && checksum && updated) {
// Pending marker
self.pending.push(xid);
// Display the cache avatar
self.display(xid, hex_md5(xid), type, binval);
Console.info('Read avatar from cache: ' + xid);
}
// Else if the request has not yet been fired, we get it
else if((!updated || mode == 'force' || photo == 'forget') && enabled != 'false') {
// Pending marker
self.pending.push(xid);
// Get the latest avatar
var iq = new JSJaCIQ();
iq.setType('get');
iq.setTo(xid);
iq.appendNode('vCard', {'xmlns': NS_VCARD});
con.send(iq, self.handle);
Console.info('Get avatar from server: ' + xid);
}
}
return true;
} catch(e) {
Console.error('Avatar.get', e);
@ -127,28 +127,28 @@ var Avatar = (function () {
// Extract the XML values
var handleXML = iq.getNode();
var handleFrom = Common.fullXID(Common.getStanzaFrom(iq));
// Is this me? Remove the resource!
if(Common.bareXID(handleFrom) == Common.getXID()) {
handleFrom = Common.bareXID(handleFrom);
}
// Get some other values
var hash = hex_md5(handleFrom);
var find = $(handleXML).find('vCard');
var aChecksum = 'none';
var oChecksum = null;
// Read our own checksum
if(handleFrom == Common.getXID()) {
oChecksum = DataStore.getDB(Connection.desktop_hash, 'checksum', 1);
// Avoid the "null" value
if(!oChecksum) {
oChecksum = '';
}
}
// vCard not empty?
if(find.size()) {
// We get our profile details
@ -156,23 +156,23 @@ var Avatar = (function () {
// Get the names
var names = Name.generateBuddy(iq);
var phone_number = find.find('TEL:has(NUMBER):first NUMBER:first').text();
// Write the values to the database
DataStore.setDB(Connection.desktop_hash, 'profile', 'name', names[0]);
DataStore.setDB(Connection.desktop_hash, 'profile', 'nick', names[1]);
DataStore.setDB(Connection.desktop_hash, 'profile', 'phone', phone_number);
}
// We get the avatar
var aType = find.find('TYPE:first').text();
var aBinval = find.find('BINVAL:first').text();
// No binval?
if(!aBinval) {
aType = 'none';
aBinval = 'none';
}
// Enough data
else {
// No type?
@ -182,33 +182,33 @@ var Avatar = (function () {
aChecksum = hex_sha1(Base64.decode(aBinval));
}
}
// We display the user avatar
self.display(handleFrom, hash, aType, aBinval);
// Store the avatar
DataStore.setPersistent('global', 'avatar', handleFrom, '<avatar><type>' + aType + '</type><binval>' + aBinval + '</binval><checksum>' + aChecksum + '</checksum><forced>false</forced></avatar>');
Console.info('Avatar retrieved from server: ' + handleFrom);
}
// vCard is empty
else {
self.reset(handleFrom);
}
// We got a new checksum for us?
if(((oChecksum !== null) && (oChecksum != aChecksum)) || !Presence.first_sent) {
// Define a proper checksum
var pChecksum = aChecksum;
if(pChecksum == 'none') {
pChecksum = '';
}
// Update our temp. checksum
DataStore.setDB(Connection.desktop_hash, 'checksum', 1, pChecksum);
// Send the stanza
if(!Presence.first_sent) {
Storage.get(NS_OPTIONS);
@ -235,7 +235,7 @@ var Avatar = (function () {
try {
// Store the empty avatar
DataStore.setPersistent('global', 'avatar', xid, '<avatar><type>none</type><binval>none</binval><checksum>none</checksum><forced>false</forced></avatar>');
// Display the empty avatar
self.display(xid, hash, 'none', 'none');
} catch(e) {
@ -260,19 +260,19 @@ var Avatar = (function () {
// Initialize the vars
var container = hash + ' .avatar-container';
var code = '<img class="avatar" src="';
// If the avatar exists
if((type != 'none') && (binval != 'none')) {
code += 'data:' + type + ';base64,' + binval;
} else {
code += './images/others/default-avatar.png';
}
code += '" alt="" />';
// Replace with the new avatar (in the roster and in the chat)
$('.' + container).html(code);
// We can remove the pending marker
Utils.removeArrayValue(self.pending, xid);
} catch(e) {

View file

@ -17,12 +17,12 @@ var Base64 = (function () {
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
do {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
@ -33,14 +33,14 @@ var Base64 = (function () {
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
keyStr.charAt(enc3) + keyStr.charAt(enc4);
} while (i < input.length);
return output;
},
/**
* Decodes a base64 string.
* @param {String} input The string to decode.
@ -50,22 +50,22 @@ var Base64 = (function () {
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
do {
enc1 = keyStr.indexOf(input.charAt(i++));
enc2 = keyStr.indexOf(input.charAt(i++));
enc3 = keyStr.indexOf(input.charAt(i++));
enc4 = keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
@ -73,7 +73,7 @@ var Base64 = (function () {
output = output + String.fromCharCode(chr3);
}
} while (i < input.length);
return output;
}
};

View file

@ -39,37 +39,37 @@ var Board = (function () {
// Password change
case 1:
text = Common._e("Your password has been changed, now you can connect to your account with your new login data.");
break;
// Account deletion
case 2:
text = Common._e("Your XMPP account has been removed, bye!");
break;
// Account logout
case 3:
text = Common._e("You have been logged out of your XMPP account, have a nice day!");
break;
// Groupchat join
case 4:
text = Common._e("The room you tried to join doesn't seem to exist.");
break;
// Groupchat removal
case 5:
text = Common._e("The groupchat has been removed.");
break;
// Non-existant groupchat user
case 6:
text = Common._e("The user that you want to reach is not present in the room.");
break;
}
} catch(e) {
@ -96,25 +96,25 @@ var Board = (function () {
// Custom error
case 1:
text = '<b>' + Common._e("Error") + '</b> &raquo; <span></span>';
break;
// Network error
case 2:
text = Common._e("Jappix has been interrupted by a network issue, a bug or bad login (check that you entered the right credentials), sorry for the inconvenience.");
break;
// List retrieving error
case 3:
text = Common._e("The element list on this server could not be obtained!");
break;
// Attaching error
case 4:
text = Common.printf(Common._e("An error occured while uploading your file: maybe it is too big (%s maximum) or forbidden!"), JAPPIX_MAX_UPLOAD);
break;
}
} catch(e) {
@ -138,11 +138,11 @@ var Board = (function () {
board_sel.click(function() {
self.closeThis(this);
});
board_sel.oneTime('5s', function() {
self.closeThis(this);
});
board_sel.slideDown();
} catch(e) {
Console.error('Board._attachEvents', e);
@ -163,29 +163,29 @@ var Board = (function () {
try {
// Text var
var text = '';
// Info
if(type == 'info') {
text = self._generateBoardInfo(id);
} else {
text = self._generateBoardError(id);
}
// No text?
if(!text) {
return false;
}
// Append the content
$('#board').append(
'<div class="one-board ' + type + '" data-id="' + id + '">' + text + '</div>'
);
// Events (click and auto-hide)
self._attachEvents(
$('#board .one-board.' + type + '[data-id="' + id + '"]')
);
return true;
} catch(e) {
Console.error('Board.create', e);
@ -221,7 +221,7 @@ var Board = (function () {
try {
// In a first, we destroy other boards
self.destroy();
// Then we display the board
self.create(type, id);
} catch(e) {
@ -301,11 +301,11 @@ var Board = (function () {
if(Common.isFocused() || !content || !self.NOTIFICATION) {
return;
}
// Default icon?
if(!icon) {
icon = './images/others/default-avatar.png';
// Avatar icon?
if(xid) {
var avatar_xml = Common.XMLFromString(
@ -314,13 +314,13 @@ var Board = (function () {
var avatar_type = $(avatar_xml).find('type').text() || 'image/png';
var avatar_binval = $(avatar_xml).find('binval').text();
if(avatar_binval && avatar_type) {
icon = 'data:' + avatar_type + ';base64,' + avatar_binval;
}
}
}
// Default title?
if(!title) {
title = Common._e("New event!");
@ -342,18 +342,18 @@ var Board = (function () {
case 'chat':
Interface.switchChan(hex_md5(xid));
break;
case 'groupchat':
Interface.switchChan(hex_md5(Common.bareXID(xid)));
break;
default:
break;
}
// Focus on msg-me
window.focus();
// Remove notification
this.close();
};

View file

@ -6,12 +6,12 @@
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.version = this.searchVersion(navigator.userAgent) ||
this.searchVersion(navigator.appVersion) ||
"an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
@ -25,13 +25,13 @@ var BrowserDetect = {
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{
string: navigator.userAgent,
@ -97,7 +97,7 @@ var BrowserDetect = {
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,

View file

@ -57,29 +57,29 @@ var Bubble = (function () {
if($(selector).is(':visible')) {
return self.close();
}
// Close all the bubbles
self.close();
// Show the requested bubble
$(selector).show();
}
// Removable bubbles special things
else {
// This bubble is yet added? So abort!
if(Common.exists(selector)) {
return self.close();
}
// Close all the bubbles
self.close();
}
// Creates a new click event to close the bubble
$('body').on('click', function(evt) {
var target = evt.target;
// If this is a click away from a bubble
if(!$(target).parents('.ibubble').size()) {
self.close();

View file

@ -22,6 +22,10 @@ var Call = (function() {
/* Variables */
self._start_stamp = 0;
self.call_auto_accept = {
'from' : null,
'sid' : null
};
/**
@ -94,7 +98,7 @@ var Call = (function() {
// TODO: setting a fallback fucks up some calls...
// fallback: './server/jingle.php',
single_initiate: function(stanza) {
try {
// Already in a call?
@ -139,6 +143,123 @@ var Call = (function() {
}
},
single_propose: function(stanza, proposed_medias) {
try {
var stanza_from = stanza.getFrom() || null;
var call_id = JSJaCJingleBroadcast.get_call_id(stanza);
// Request for Jingle session to be accepted
if(stanza_from && call_id) {
var call_media_main = 'audio';
if(JSJAC_JINGLE_MEDIA_VIDEO in proposed_medias) {
call_media_main = 'video';
}
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
Common.bareXID(stanza_from),
('broadcast_' + call_media_main),
call_media_main,
null,
{
full_xid: stanza_from,
call_id: call_id,
medias: proposed_medias
}
);
Audio.play('incoming-call', true);
// Save initiator (security: don't save SID until it's accepted)
self.call_auto_accept.from = stanza_from;
self.call_auto_accept.sid = null;
}
} catch(e) {
Console.error('Call.init[single_propose]', e);
}
},
single_retract: function(stanza) {
try {
var stanza_from = stanza.getFrom() || null;
var call_id = JSJaCJingleBroadcast.get_call_id(stanza);
var call_medias = JSJaCJingleBroadcast.get_call_medias(call_id);
// Call retracted (from initiator)
if(self.call_auto_accept.from == stanza_from) {
Audio.stop('incoming-call');
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
Common.bareXID(stanza_from),
'remote_canceled'
);
}
} catch(e) {
Console.error('Call.init[single_retract]', e);
}
},
single_accept: function(stanza) {
try {
var stanza_from = stanza.getFrom() || null;
var call_id = JSJaCJingleBroadcast.get_call_id(stanza);
// Another resource accepted the call
if(self.call_auto_accept.sid == call_id &&
stanza_from && Common.getFullXID() != stanza_from) {
self._unnotify();
Audio.stop('incoming-call');
}
} catch(e) {
Console.error('Call.init[single_accept]', e);
}
},
single_reject: function(stanza) {
try {
var stanza_from = stanza.getFrom() || null;
var call_id = JSJaCJingleBroadcast.get_call_id(stanza);
// Another resource rejected the call
if(self.call_auto_accept.sid == call_id &&
stanza_from && Common.getFullXID() != stanza_from) {
self._unnotify();
Audio.stop('incoming-call');
}
} catch(e) {
Console.error('Call.init[single_reject]', e);
}
},
single_proceed: function(stanza) {
try {
// Read broadcast parameters
var call_to = stanza.getFrom() || null;
var call_id = JSJaCJingleBroadcast.get_call_id(stanza);
var call_medias = JSJaCJingleBroadcast.get_call_medias(call_id);
// Check medias to include
var has_media_video = false;
for(var i = 0; i < call_medias.length; i++) {
if(call_medias[i] === JSJAC_JINGLE_MEDIA_VIDEO) {
has_media_video = true;
break;
}
}
var call_media_picked = has_media_video ? JSJAC_JINGLE_MEDIA_VIDEO : JSJAC_JINGLE_MEDIA_AUDIO;
// Follow up Jingle call
Jingle.follow_up(call_to, call_media_picked, call_id);
} catch(e) {
Console.error('Call.init[single_proceed]', e);
}
},
// Receive a multiparty (Muji) call
muji_invite: function(stanza, args) {
try {
@ -186,13 +307,14 @@ var Call = (function() {
/**
* Stops current call
* @public
* @param {boolean} abort
* @return {boolean}
*/
self.stop = function() {
self.stop = function(abort) {
try {
Jingle.stop();
Muji.stop();
Jingle.stop(abort);
Muji.stop(abort);
} catch(e) {
Console.error('Call.stop', e);
} finally {
@ -286,7 +408,7 @@ var Call = (function() {
is_same = false;
try {
if(compare_session && session &&
if(compare_session && session &&
compare_session.get_sid() === session.get_sid()) {
is_same = true;
}
@ -464,9 +586,10 @@ var Call = (function() {
* @param {string} xid
* @param {string} type
* @param {string} mode
* @param {object} [options_arr]
* @return {boolean}
*/
self.notify = function(call_type, xid, type, mode, sender_xid) {
self.notify = function(call_type, xid, type, mode, sender_xid, options_arr) {
try {
sender_xid = sender_xid || xid;
@ -505,21 +628,21 @@ var Call = (function() {
// Append notification to DOM
call_subitem_sel.html(
'<div class="call-notify notify-' + type + ' ' + hex_md5(sender_xid) + '" data-type="' + type + '" data-xid="' + Common.encodeQuotes(xid) + '">' +
'<div class="avatar-pane">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<div class="call-notify notify-' + type + ' ' + hex_md5(sender_xid) + '" data-type="' + type + '" data-xid="' + Common.encodeQuotes(xid) + '">' +
'<div class="avatar-pane">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<span class="icon call-images"></span>' +
'</div>' +
'<span class="icon call-images"></span>' +
'</div>' +
'<div class="notification-content">' +
'<span class="fullname">' + fullname + '</span>' +
'<span class="text">' + map[type].text + '</span>' +
'<div class="notification-content">' +
'<span class="fullname">' + fullname + '</span>' +
'<span class="text">' + map[type].text + '</span>' +
'<div class="reply-buttons">' + buttons_html + '</div>' +
'</div>' +
'<div class="reply-buttons">' + buttons_html + '</div>' +
'</div>' +
'</div>'
);
@ -532,11 +655,11 @@ var Call = (function() {
call_tools_all_sel.find('a.reply-button[data-action="' + button + '"]').click(function() {
try {
// Remove notification
self._unnotify(xid);
self._unnotify();
// Execute callback, if any
if(typeof attrs.cb === 'function') {
attrs.cb(xid, mode);
attrs.cb(xid, mode, options_arr);
}
Console.info('Closed call notification drawer');
@ -750,7 +873,7 @@ var Call = (function() {
self.stop_counter();
self._start_stamp = DateUtils.getTimeStamp();
self._fire_clock();
// Fire it every second
$('#top-content .tools.call .counter').everyTime('1s', self._fire_clock);
@ -778,7 +901,7 @@ var Call = (function() {
// Reset counter
var counter_sel = $('#top-content .tools.call .counter');
var default_count = counter_sel.attr('data-default');
counter_sel.stopTime();
$('#top-content .tools.call .counter').text(default_count);
@ -807,13 +930,13 @@ var Call = (function() {
DateUtils.getTimeStamp(),
self._start_stamp
);
if(count.getHours()) {
count = count.toString('H:mm:ss');
} else {
count = count.toString('mm:ss');
}
// Display updated counter
$('#top-content .tools.call .counter').text(count);
$('#jingle, #muji').find('.elapsed').text(count);
@ -969,4 +1092,4 @@ var Call = (function() {
*/
return self;
})();
})();

View file

@ -106,7 +106,7 @@ var Caps = (function () {
cur_type = $(this).attr('type') || '';
cur_lang = $(this).attr('xml:lang') || '';
cur_name = $(this).attr('name') || '';
identities.push(cur_category + '/' + cur_type + '/' + cur_lang + '/' + cur_name);
});
} catch(e) {
@ -133,7 +133,7 @@ var Caps = (function () {
$(query).find('feature').each(function() {
cur_var = $(this).attr('var');
// Add the current value to the array
if(cur_var) {
features.push(cur_var);
@ -166,57 +166,57 @@ var Caps = (function () {
// Initialize some stuffs
cur_string = '';
cur_sort_var = [];
// Add the form type field
$(this).find('field[var="FORM_TYPE"] value').each(function() {
cur_text = $(this).text();
if(cur_text) {
cur_string += cur_text + '<';
}
});
// Add the var attributes into an array
$(this).find('field:not([var="FORM_TYPE"])').each(function() {
cur_var = $(this).attr('var');
if(cur_var) {
cur_sort_var.push(cur_var);
}
});
// Sort the var attributes
cur_sort_var = cur_sort_var.sort();
// Loop this sorted var attributes
$.each(cur_sort_var, function(i) {
// Initialize the value sorting
cur_sort_val = [];
// Append it to the string
cur_string += cur_sort_var[i] + '<';
// Add each value to the array
$(this).find('field[var=' + cur_sort_var[i] + '] value').each(function() {
cur_sort_val.push($(this).text());
});
// Sort the values
cur_sort_val = cur_sort_val.sort();
// Append the values to the string
for(var j in cur_sort_val) {
cur_string += cur_sort_val[j] + '<';
}
});
// Any string?
if(cur_string) {
// Remove the undesired double '<' from the string
if(cur_string.match(/(.+)(<)+$/)) {
cur_string = cur_string.substring(0, cur_string.length - 1);
}
// Add the current string to the array
data_forms.push(cur_string);
}
@ -249,7 +249,7 @@ var Caps = (function () {
// Remove the tooltip elements
style_sel.hide();
style_sel.find('.bubble-style').remove();
// Reset the markers
message_area_sel.removeAttr('style')
.removeAttr('data-font')
@ -341,7 +341,7 @@ var Caps = (function () {
if(iq_oob_xid || NS_XOOB in features) {
file_sel.show();
// Set a marker
file_sel.attr(
'data-oob',
@ -351,7 +351,7 @@ var Caps = (function () {
// Remove the tooltip elements
file_sel.hide();
file_sel.find('.bubble-style').remove();
// Reset the marker
file_sel.removeAttr('data-oob');
}
@ -489,7 +489,7 @@ var Caps = (function () {
var disco_jingle = JSJaCJingle.disco();
var disco_all = disco_base.concat(disco_jingle);
return Utils.uniqueArrayValues(disco_all);
} catch(e) {
Console.error('Caps.myDiscoInfos', e);
@ -511,35 +511,35 @@ var Caps = (function () {
// No CAPS
if(!caps) {
Console.warn('No CAPS: ' + to);
self.displayDiscoInfos(to, '');
return false;
}
// Get the stored disco infos
var xml = self.read(caps);
// Yet stored
if(xml) {
Console.info('CAPS from cache: ' + to);
self.displayDiscoInfos(to, xml);
return true;
}
Console.info('CAPS from the network: ' + to);
// Not stored: get the disco#infos
var iq = new JSJaCIQ();
iq.setTo(to);
iq.setType('get');
iq.setQuery(NS_DISCO_INFO);
con.send(iq, self.handleDiscoInfos);
return true;
} catch(e) {
Console.error('Caps.getDiscoInfos', e);
@ -560,34 +560,34 @@ var Caps = (function () {
if(!iq || (iq.getType() == 'error')) {
return;
}
var from = Common.fullXID(Common.getStanzaFrom(iq));
var query = iq.getQuery();
// Parse values
var identities = self._parseDiscoIdentities(query);
var features = self._parseDiscoFeatures(query);
var data_forms = self._parseDiscoDataForms(query);
// Process the CAPS
var caps = self.process(identities, features, data_forms);
// Get the XML string
var xml = Common.xmlToString(query);
// Store the disco infos
DataStore.setPersistent('global', 'caps', caps, xml);
// This is our server
if(from == Utils.getServer()) {
// Handle the features
Features.handle(xml);
Console.info('Got our server CAPS');
} else {
// Display the disco infos
self.displayDiscoInfos(from, xml);
Console.info('Got CAPS: ' + from);
}
} catch(e) {
@ -609,12 +609,12 @@ var Caps = (function () {
try {
// Generate the chat path
var xid = Common.bareXID(from);
// This comes from a private groupchat chat?
if(Utils.isPrivate(xid)) {
xid = from;
}
hash = hex_md5(xid);
// Display the supported features
@ -627,14 +627,14 @@ var Caps = (function () {
features[current] = 1;
}
});
// Paths
var path_sel = $('#' + hash);
var roster_sel = $('#roster .buddy.' + hash);
var message_area_sel = path_sel.find('.message-area');
var style_sel = path_sel.find('.chat-tools-style');
var file_sel = path_sel.find('.chat-tools-file');
// Apply Features
self._applyDiscoXHTMLIM(xid, features, style_sel, message_area_sel);
self._applyDiscoJingle(xid, path_sel, roster_sel);
@ -663,30 +663,30 @@ var Caps = (function () {
try {
// Initialize
var caps_str = '';
// Sort the arrays
identities = identities.sort();
features = features.sort();
dataforms = dataforms.sort();
// Process the sorted identity string
for(var a in identities) {
caps_str += identities[a] + '<';
}
// Process the sorted feature string
for(var b in features) {
caps_str += features[b] + '<';
}
// Process the sorted data-form string
for(var c in dataforms) {
caps_str += dataforms[c] + '<';
}
// Process the SHA-1 hash
var cHash = b64_sha1(caps_str);
return cHash;
} catch(e) {
Console.error('Caps.process', e);
@ -705,8 +705,8 @@ var Caps = (function () {
try {
return self.process(
[
self.disco_infos.identity.category + '/' +
self.disco_infos.identity.type + '//' +
self.disco_infos.identity.category + '/' +
self.disco_infos.identity.type + '//' +
self.disco_infos.identity.name
],

View file

@ -35,9 +35,9 @@ var Carbons = (function () {
var iq = new JSJaCIQ();
iq.setType('set');
iq.appendNode(type, {'xmlns': NS_URN_CARBONS});
con.send(iq, function(iq) {
self._handleConfigure(iq, type);
});

View file

@ -45,7 +45,7 @@ var Chat = (function () {
$(path + 'tools-jingle-video').click(function() {
Jingle.start(xid, 'video');
});
// Click event: user-infos
$(path + 'tools-infos').click(function() {
UserInfos.open(xid);
@ -91,11 +91,11 @@ var Chat = (function () {
input_sel.focus(function() {
// Clean notifications for this chat
Interface.chanCleanNotify(hash);
// Store focus on this chat!
Interface.chat_focus_hash = hash;
});
input_sel.blur(function() {
// Reset storage about focus on this chat!
if(Interface.chat_focus_hash == hash) {
@ -144,7 +144,7 @@ var Chat = (function () {
// Reset the composing database entry
DataStore.setDB(Connection.desktop_hash, 'chatstate', xid, 'off');
}
return false;
} else if(e.keyCode == 8) {
// Leave correction mode? (another way, by flushing input value progressively)
@ -234,9 +234,10 @@ var Chat = (function () {
* @private
* @param {string} type
* @param {string} id
* @param {string} xid
* @return {object}
*/
self._generateChatCode = function(type, id) {
self._generateChatCode = function(type, id, xid) {
var code_args = {};
@ -246,14 +247,14 @@ var Chat = (function () {
code_args.attributes = ' data-type="groupchat" data-correction="true"';
code_args.avatar = '';
code_args.name = '<p class="bc-infos"><b>' + Common._e("Subject") + '</b> <span class="muc-topic">' + Common._e("no subject defined for this room.") + '</span></p>';
code_args.code = '<div class="content groupchat-content" id="chat-content-' + id + '"></div>' +
'<div class="list"><div class="moderator role"><p class="title">' + Common._e("Moderators") + '</p></div>' +
'<div class="participant role"><p class="title">' + Common._e("Participants") + '</p></div>' +
'<div class="visitor role"><p class="title">' + Common._e("Visitors") + '</p></div>' +
code_args.code = '<div class="content groupchat-content" id="chat-content-' + id + '"></div>' +
'<div class="list"><div class="moderator role"><p class="title">' + Common._e("Moderators") + '</p></div>' +
'<div class="participant role"><p class="title">' + Common._e("Participants") + '</p></div>' +
'<div class="visitor role"><p class="title">' + Common._e("Visitors") + '</p></div>' +
'<div class="none role"><p class="title">' + Common._e("Others") + '</p></div></div>';
code_args.link = '<a href="#" class="tools-mucadmin tools-tooltip talk-images chat-tools-content" title="' + Common._e("Administration panel for this room") + '"></a>';
code_args.style = '';
// Is this a gateway?
if(xid.match(/%/)) {
code_args.disabled = '';
@ -266,31 +267,31 @@ var Chat = (function () {
code_args.avatar = '<div class="avatar-container"><img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" /></div>';
code_args.name = '<div class="bc-pep"></div><p class="bc-infos"><span class="unavailable show talk-images"></span></p>';
code_args.code = '<div class="content" id="chat-content-' + id + '">' + code_args.mam + '</div>';
code_args.link = '<a href="#" class="tools-jingle-audio tools-tooltip talk-images chat-tools-content" title="' + Common._e("Call (audio only)") + '"></a>' +
'<a href="#" class="tools-jingle-video tools-tooltip talk-images chat-tools-content" title="' + Common._e("Call (video)") + '"></a>' +
code_args.link = '<a href="#" class="tools-jingle-audio tools-tooltip talk-images chat-tools-content" title="' + Common._e("Call (audio only)") + '"></a>' +
'<a href="#" class="tools-jingle-video tools-tooltip talk-images chat-tools-content" title="' + Common._e("Call (video)") + '"></a>' +
'<a href="#" class="tools-infos tools-tooltip talk-images chat-tools-content" title="' + Common._e("Show user profile") + '"></a>';
code_args.style = ' style="display: none;"';
code_args.disabled = '';
}
// Not a groupchat private chat, we can use the buddy add icon
if((type == 'chat') || (type == 'groupchat')) {
var title;
if(type == 'chat') {
title = Common._e("Add this contact to your friends");
} else {
title = Common._e("Add this groupchat to your favorites");
}
code_args.link += '<a href="#" class="tools-add tools-tooltip talk-images chat-tools-content" title="' + title + '"></a>';
}
// IE DOM parsing bug fix
code_args.style_picker = '<div class="chat-tools-content chat-tools-style"' + code_args.style + '>' +
'<a href="#" class="tools-style tools-tooltip talk-images"></a>' +
code_args.style_picker = '<div class="chat-tools-content chat-tools-style"' + code_args.style + '>' +
'<a href="#" class="tools-style tools-tooltip talk-images"></a>' +
'</div>';
if((BrowserDetect.browser == 'Explorer') && (BrowserDetect.version < 9)) {
code_args.style_picker = '';
}
@ -320,11 +321,11 @@ var Chat = (function () {
if(!xid) {
return false;
}
// We generate some stuffs
var hash = hex_md5(xid);
var name;
// Gets the name of the user/title of the room
if(title) {
name = title;
@ -333,18 +334,18 @@ var Chat = (function () {
if(type == 'private') {
name = Common.thisResource(xid);
}
// XMPP-ID
else if(xid.indexOf('@') != -1) {
name = Name.getBuddy(xid);
}
// Gateway
else {
name = xid;
}
}
// If the target div does not exist
if(!Common.exists('#' + hash)) {
// We check the type of the chat to open
@ -358,7 +359,7 @@ var Chat = (function () {
var fNick = fData.find('nick').text();
var fPwd = fData.find('password').text();
var fName = fData.find('name').text();
// Apply the room data
if(!nickname && fNick)
nickname = fNick;
@ -367,11 +368,11 @@ var Chat = (function () {
if(!title && fName)
name = fName;
}
Groupchat.create(hash, xid, name, nickname, password);
}
}
// Switch to the newly-created chat
Interface.switchChan(hash);
} catch(e) {
@ -398,52 +399,52 @@ var Chat = (function () {
// Generate some stuffs
var path = '#' + id + ' .';
var escaped_xid = escape(xid);
// Special code
var chat_args = self._generateChatCode(type, id);
var chat_args = self._generateChatCode(type, id, xid);
// Append the chat HTML code
$('#page-engine').append(
'<div id="' + id + '" class="page-engine-chan chat one-counter"' + chat_args.attributes + ' data-xid="' + escaped_xid + '">' +
'<div class="top ' + id + '">' +
chat_args.avatar +
'<div class="name">' +
'<p class="bc-name bc-name-nick">' + nick.htmlEnc() + '</p>' +
chat_args.name +
'</div>' +
'</div>' +
chat_args.code +
'<div class="text">' +
'<div class="footer">' +
'<div class="chat-tools-content chat-tools-smileys">' +
'<a href="#" class="tools-smileys tools-tooltip talk-images"></a>' +
'</div>' +
chat_args.style_picker +
'<div class="chat-tools-content chat-tools-file">' +
'<a href="#" class="tools-file tools-tooltip talk-images"></a>' +
'</div>' +
'<div class="chat-tools-content chat-tools-save">' +
'<a href="#" class="tools-save tools-tooltip talk-images"></a>' +
'</div>' +
'<a href="#" class="tools-clear tools-tooltip talk-images chat-tools-content" title="' + Common._e("Clean current chat") + '"></a>' +
chat_args.link +
'</div>' +
'<div class="compose">' +
'<textarea class="message-area focusable" ' + chat_args.disabled + ' data-to="' + escaped_xid + '" /></textarea>' +
'</div>' +
'</div>' +
'<div id="' + id + '" class="page-engine-chan chat one-counter"' + chat_args.attributes + ' data-xid="' + escaped_xid + '">' +
'<div class="top ' + id + '">' +
chat_args.avatar +
'<div class="name">' +
'<p class="bc-name bc-name-nick">' + nick.htmlEnc() + '</p>' +
chat_args.name +
'</div>' +
'</div>' +
chat_args.code +
'<div class="text">' +
'<div class="footer">' +
'<div class="chat-tools-content chat-tools-smileys">' +
'<a href="#" class="tools-smileys tools-tooltip talk-images"></a>' +
'</div>' +
chat_args.style_picker +
'<div class="chat-tools-content chat-tools-file">' +
'<a href="#" class="tools-file tools-tooltip talk-images"></a>' +
'</div>' +
'<div class="chat-tools-content chat-tools-save">' +
'<a href="#" class="tools-save tools-tooltip talk-images"></a>' +
'</div>' +
'<a href="#" class="tools-clear tools-tooltip talk-images chat-tools-content" title="' + Common._e("Clean current chat") + '"></a>' +
chat_args.link +
'</div>' +
'<div class="compose">' +
'<textarea class="message-area focusable" ' + chat_args.disabled + ' data-to="' + escaped_xid + '" /></textarea>' +
'</div>' +
'</div>' +
'</div>'
);
self._generateEvents(path, id, xid);
} catch(e) {
Console.error('Chat.generate', e);
@ -466,38 +467,38 @@ var Chat = (function () {
try {
// Path to the element
var chat_switch = '#page-switch .';
// Special code
var special_class = ' unavailable';
var show_close = true;
// Groupchat
if(type == 'groupchat') {
special_class = ' groupchat-default';
if(Utils.isAnonymous() && (xid == Common.generateXID(ANONYMOUS_ROOM, 'groupchat'))) {
show_close = false;
}
}
// Generate the HTML code
var html = '<div class="' + id + ' switcher chan" onclick="return Interface.switchChan(\'' + Utils.encodeOnclick(id) + '\')">' +
'<div class="icon talk-images' + special_class + '"></div>' +
var html = '<div class="' + id + ' switcher chan" onclick="return Interface.switchChan(\'' + Utils.encodeOnclick(id) + '\')">' +
'<div class="icon talk-images' + special_class + '"></div>' +
'<div class="name">' + nick.htmlEnc() + '</div>';
// Show the close button if not MUC and not anonymous
if(show_close) {
html += '<div class="exit" ' +
'title="' + Common._e("Close this tab") + '" ' +
'onclick="return Interface.quitThisChat(\'' + Utils.encodeOnclick(xid) + '\', \'' + Utils.encodeOnclick(id) + '\', \'' + Utils.encodeOnclick(type) + '\');">' +
'x' +
html += '<div class="exit" ' +
'title="' + Common._e("Close this tab") + '" ' +
'onclick="return Interface.quitThisChat(\'' + Utils.encodeOnclick(xid) + '\', \'' + Utils.encodeOnclick(id) + '\', \'' + Utils.encodeOnclick(type) + '\');">' +
'x' +
'</div>';
}
// Close the HTML
html += '</div>';
// 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;
})();
})();

View file

@ -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(
'<div class="' + state + ' chatstate">' + text + '</div>'
@ -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')) {

View file

@ -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 = '<?xml version="1.0"?>' + 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;
var JappixCommon = Common;

View file

@ -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(
'<div class="info success">' +
Common._e("You have been registered, here is your XMPP address:") +
' <b>' + username.htmlEnc() + '@' + domain.htmlEnc() + '</b> - ' +
'<a href="#">' + Common._e("Login") + '</a>' +
'<div class="info success">' +
Common._e("You have been registered, here is your XMPP address:") +
' <b>' + username.htmlEnc() + '@' + domain.htmlEnc() + '</b> - ' +
'<a href="#">' + Common._e("Login") + '</a>' +
'</div>'
);
// 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 = '<div id="reconnect" class="lock">' +
'<div class="pane">' +
var html = '<div id="reconnect" class="lock">' +
'<div class="pane">' +
Common._e("Due to a network issue, you were disconnected. What do you want to do now?");
// Can we cancel reconnection?
if(mode == 'normal') {
html += '<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>';
}
html += '<a href="#" class="finish reconnect">' + Common._e("Reconnect") + '</a>' +
html += '<a href="#" class="finish reconnect">' + Common._e("Reconnect") + '</a>' +
'</div></div>';
// 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 = '<session>' +
'<stored>true</stored>' +
'<domain>' + lServer.htmlEnc() + '</domain>' +
'<username>' + lNick.htmlEnc() + '</username>' +
'<resource>' + lResource.htmlEnc() + '</resource>' +
'<password>' + lPass.htmlEnc() + '</password>' +
'<priority>' + lPriority.htmlEnc() + '</priority>' +
session_xml = '<session>' +
'<stored>true</stored>' +
'<domain>' + lServer.htmlEnc() + '</domain>' +
'<username>' + lNick.htmlEnc() + '</username>' +
'<resource>' + lResource.htmlEnc() + '</resource>' +
'<password>' + lPass.htmlEnc() + '</password>' +
'<priority>' + lPriority.htmlEnc() + '</priority>' +
'</session>';
// 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.');
}
});

View file

@ -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;

View file

@ -134,9 +134,9 @@ var Correction = (function () {
text_sel.addClass('correction-active');
text_sel.prepend(
'<div class="correction-toolbox">' +
'<span class="correction-editing">' + Common._e("Editing") + '</span>' +
'<a class="correction-cancel" href="#">' + Common._e("Cancel") + '</a>' +
'<div class="correction-toolbox">' +
'<span class="correction-editing">' + Common._e("Editing") + '</span>' +
'<a class="correction-cancel" href="#">' + Common._e("Cancel") + '</a>' +
'</div>'
);
@ -146,8 +146,8 @@ var Correction = (function () {
message_sel.find('.correction-edit').hide();
message_sel.append(
'<span class="correction-label">' +
Common._e("Being edited") +
'<span class="correction-label">' +
Common._e("Being edited") +
'</span>'
);
@ -224,14 +224,14 @@ var Correction = (function () {
// Generates the correct message depending of the choosen style
var generate_message = Message.generate(message, message_body, hash);
args.xhtml = (generate_message === 'XHTML');
// Receipt request
var receipt_request = Receipts.request(hash);
if(receipt_request) {
message.appendNode('request', {'xmlns': NS_URN_RECEIPTS});
}
// Chatstate
message.appendNode('active', {'xmlns': NS_CHATSTATES});

File diff suppressed because it is too large Load diff

View file

@ -165,7 +165,7 @@ var DataStore = (function () {
try {
return self.storageDB.getItem(dbID + '_' + type + '_' + id);
}
catch(e) {
Console.error('Error while getting a temporary database entry (' + dbID + ' -> ' + type + ' -> ' + id + ')', e);
}
@ -195,7 +195,7 @@ var DataStore = (function () {
return true;
}
catch(e) {
Console.error('Error while writing a temporary database entry (' + dbID + ' -> ' + type + ' -> ' + id + ')', e);
}
@ -221,10 +221,10 @@ var DataStore = (function () {
try {
try {
self.storageDB.removeItem(dbID + '_' + type + '_' + id);
return true;
}
catch(e) {
Console.error('Error while removing a temporary database entry (' + dbID + ' -> ' + type + ' -> ' + id + ')', e);
}
@ -266,15 +266,15 @@ var DataStore = (function () {
try {
try {
self.storageDB.clear();
Console.info('Temporary database cleared.');
return true;
}
catch(e) {
Console.error('Error while clearing temporary database', e);
return false;
}
} catch(e) {
@ -297,7 +297,7 @@ var DataStore = (function () {
// Try to write something
self.storagePersistent.setItem('haspersistent_check', 'ok');
self.storagePersistent.removeItem('haspersistent_check');
has_persistent = true;
} catch(e) {
Console.error('DataStore.hasPersistent', e);
@ -322,10 +322,10 @@ var DataStore = (function () {
try {
return self.storagePersistent.getItem(dbID + '_' + type + '_' + id);
}
catch(e) {
Console.error('Error while getting a persistent database entry (' + dbID + ' -> ' + type + ' -> ' + id + ')', e);
return null;
}
} catch(e) {
@ -349,24 +349,24 @@ var DataStore = (function () {
try {
try {
self.storagePersistent.setItem(dbID + '_' + type + '_' + id, value);
return true;
}
// Database might be full
catch(e) {
Console.warn('Retrying: could not write a persistent database entry (' + dbID + ' -> ' + type + ' -> ' + id + ')', e);
// Flush it!
self.flushPersistent();
// Set the item again
try {
self.storagePersistent.setItem(dbID + ' -> ' + type + '_' + id, value);
return true;
}
// New error!
catch(_e) {
Console.error('Aborted: error while writing a persistent database entry (' + dbID + ' -> ' + type + ' -> ' + id + ')', _e);
@ -397,7 +397,7 @@ var DataStore = (function () {
return true;
}
catch(e) {
Console.error('Error while removing a persistent database entry (' + dbID + ' -> ' + type + ' -> ' + id + ')', e);
}
@ -442,10 +442,10 @@ var DataStore = (function () {
self.storagePersistent.clear();
Console.info('Persistent database cleared.');
return true;
}
catch(e) {
Console.error('Error while clearing persistent database', e);
}
@ -470,20 +470,20 @@ var DataStore = (function () {
try {
// Get the stored session entry
var session = self.getPersistent('global', 'session', 1);
// Reset the persistent database
self.resetPersistent();
// Restaure the stored session entry
if(session) {
self.setPersistent('global', 'session', 1, session);
}
Console.info('Persistent database flushed.');
return true;
}
catch(e) {
Console.error('Error while flushing persistent database', e);
}

View file

@ -87,7 +87,7 @@ var DateUtils = (function () {
if(self.last_activity === 0) {
return 0;
}
return self.getTimeStamp() - self.last_activity;
} catch(e) {
Console.error('DateUtils.getLastActivity', e);
@ -129,7 +129,7 @@ var DateUtils = (function () {
if(self.presence_last_activity === 0) {
return 0;
}
return self.getTimeStamp() - self.presence_last_activity;
} catch(e) {
Console.error('DateUtils.getPresenceLast', e);
@ -170,7 +170,7 @@ var DateUtils = (function () {
minutes = date.getMinutes();
seconds = date.getSeconds();
}
// Generates the date string
date_string = year + '-';
date_string += Common.padZero(month + 1) + '-';
@ -178,7 +178,7 @@ var DateUtils = (function () {
date_string += Common.padZero(hours) + ':';
date_string += Common.padZero(minutes) + ':';
date_string += Common.padZero(seconds) + 'Z';
// Returns the date string
return date_string;
} catch(e) {
@ -221,7 +221,7 @@ var DateUtils = (function () {
var time = Common.padZero(init.getHours()) + ':';
time += Common.padZero(init.getMinutes()) + ':';
time += Common.padZero(init.getSeconds());
return time;
} catch(e) {
Console.error('DateUtils.getCompleteTime', e);
@ -241,26 +241,26 @@ var DateUtils = (function () {
// Get the date
var date = new Date();
var offset = date.getTimezoneOffset();
// Default vars
var sign = '';
var hours = 0;
var minutes = 0;
// Process a neutral offset
if(offset < 0) {
offset = offset * -1;
sign = '+';
}
// Get the values
var n_date = new Date(offset * 60 * 1000);
hours = n_date.getHours() - 1;
minutes = n_date.getMinutes();
// Process the TZO
tzo = sign + Common.padZero(hours) + ':' + Common.padZero(minutes);
// Return the processed value
return tzo;
} catch(e) {
@ -301,7 +301,7 @@ var DateUtils = (function () {
try {
var date = Date.jab2date(to_parse);
var parsed = date.toLocaleDateString() + ' (' + date.toLocaleTimeString() + ')';
return parsed;
} catch(e) {
Console.error('DateUtils.parse', e);
@ -321,7 +321,7 @@ var DateUtils = (function () {
try {
var date = Date.jab2date(to_parse);
var parsed = date.toLocaleDateString();
return parsed;
} catch(e) {
Console.error('DateUtils.parseDay', e);
@ -341,7 +341,7 @@ var DateUtils = (function () {
try {
var date = Date.jab2date(to_parse);
var parsed = date.toLocaleTimeString();
return parsed;
} catch(e) {
Console.error('DateUtils.parseTime', e);
@ -363,36 +363,36 @@ var DateUtils = (function () {
var current_date = Date.jab2date(self.getXMPPTime('utc'));
var current_day = current_date.getDate();
var current_stamp = current_date.getTime();
// Parse the given date
var old_date = Date.jab2date(to_parse);
var old_day = old_date.getDate();
var old_stamp = old_date.getTime();
var old_time = old_date.toLocaleTimeString();
// Get the day number between the two dates
var days = Math.round((current_stamp - old_stamp) / 86400000);
// Invalid date?
if(isNaN(old_stamp) || isNaN(days)) {
return self.getCompleteTime();
}
// Is it today?
if(current_day == old_day) {
return old_time;
}
// It is yesterday?
if(days <= 1) {
return Common._e("Yesterday") + ' - ' + old_time;
}
// Is it less than a week ago?
if(days <= 7) {
return Common.printf(Common._e("%s days ago"), days) + ' - ' + old_time;
}
// Another longer period
return old_date.toLocaleDateString() + ' - ' + old_time;
} catch(e) {
@ -406,17 +406,18 @@ var DateUtils = (function () {
* Reads a message delay
* @public
* @param {string} node
* @return {string}
* @param {boolean} return_date
* @return {string|Date}
*/
self.readMessageDelay = function(node) {
self.readMessageDelay = function(node, return_date) {
try {
// Initialize
var delay, d_delay;
// Read the delay
d_delay = jQuery(node).find('delay[xmlns="' + NS_URN_DELAY + '"]:first').attr('stamp');
// Get delay
if(d_delay) {
// New delay (valid XEP)
@ -424,11 +425,17 @@ var DateUtils = (function () {
} else {
// Old delay (obsolete XEP!)
var x_delay = jQuery(node).find('x[xmlns="' + NS_DELAY + '"]:first').attr('stamp');
if(x_delay)
if(x_delay) {
delay = x_delay.replace(/^(\w{4})(\w{2})(\w{2})T(\w{2}):(\w{2}):(\w{2})Z?(\S+)?/, '$1-$2-$3T$4:$5:$6Z$7');
}
}
// Return a date object?
if(return_date === true && delay) {
return Date.jab2date(delay);
}
return delay;
} catch(e) {
Console.error('DateUtils.readMessageDelay', e);

View file

@ -29,31 +29,31 @@ var Directory = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("User directory") + '</div>' +
'<div class="content">' +
'<div class="directory-head">' +
'<div class="directory-server-text">' + Common._e("Server to query") + '</div>' +
'<input name="directory-server-input" class="directory-server-input" value="' + Common.encodeQuotes(HOST_VJUD) + '" />' +
'</div>' +
'<div class="results directory-results"></div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
var html =
'<div class="top">' + Common._e("User directory") + '</div>' +
'<div class="content">' +
'<div class="directory-head">' +
'<div class="directory-server-text">' + Common._e("Server to query") + '</div>' +
'<input name="directory-server-input" class="directory-server-input" value="' + Common.encodeQuotes(HOST_VJUD) + '" />' +
'</div>' +
'<div class="results directory-results"></div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
'</div>';
// Create the popup
Popup.create('directory', html);
// Associate the events
self.instance();
// Start a search!
self.start();
} catch(e) {
@ -94,10 +94,10 @@ var Directory = (function () {
try {
// Get the server to query
var server = $('#directory .directory-server-input').val();
// Launch the search!
DataForm.go($('#directory .directory-server-input').val(), 'search', '', '', 'directory');
Console.log('Directory search launched: ' + server);
} catch(e) {
Console.error('Directory.start', e);
@ -118,7 +118,7 @@ var Directory = (function () {
try {
// Click event
$('#directory .bottom .finish').click(self.close);
// Keyboard event
$('#directory .directory-server-input').keyup(function(e) {
if(e.keyCode == 13) {
@ -126,10 +126,10 @@ var Directory = (function () {
if(!$(this).val()) {
$(this).val(HOST_VJUD);
}
// Start the directory search
self.start();
return false;
}
});

View file

@ -29,99 +29,99 @@ var Discovery = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Service discovery") + '</div>' +
'<div class="content">' +
'<div class="discovery-head">' +
'<div class="disco-server-text">' + Common._e("Server to query") + '</div>' +
'<input name="disco-server-input" class="disco-server-input" value="' + Common.encodeQuotes(HOST_MAIN) + '" />' +
'</div>' +
'<div class="results discovery-results">' +
'<div class="disco-category disco-account">' +
'<p class="disco-category-title">' + Common._e("Accounts") + '</p>' +
'</div>' +
'<div class="disco-category disco-auth">' +
'<p class="disco-category-title">' + Common._e("Authentications") + '</p>' +
'</div>' +
'<div class="disco-category disco-automation">' +
'<p class="disco-category-title">' + Common._e("Automation") + '</p>' +
'</div>' +
'<div class="disco-category disco-client">' +
'<p class="disco-category-title">' + Common._e("Clients") + '</p>' +
'</div>' +
'<div class="disco-category disco-collaboration">' +
'<p class="disco-category-title">' + Common._e("Collaboration") + '</p>' +
'</div>' +
'<div class="disco-category disco-component">' +
'<p class="disco-category-title">' + Common._e("Components") + '</p>' +
'</div>' +
'<div class="disco-category disco-conference">' +
'<p class="disco-category-title">' + Common._e("Rooms") + '</p>' +
'</div>' +
'<div class="disco-category disco-directory">' +
'<p class="disco-category-title">' + Common._e("Directories") + '</p>' +
'</div>' +
'<div class="disco-category disco-gateway">' +
'<p class="disco-category-title">' + Common._e("Gateways") + '</p>' +
'</div>' +
'<div class="disco-category disco-headline">' +
'<p class="disco-category-title">' + Common._e("News") + '</p>' +
'</div>' +
'<div class="disco-category disco-hierarchy">' +
'<p class="disco-category-title">' + Common._e("Hierarchy") + '</p>' +
'</div>' +
'<div class="disco-category disco-proxy">' +
'<p class="disco-category-title">' + Common._e("Proxies") + '</p>' +
'</div>' +
'<div class="disco-category disco-pubsub">' +
'<p class="disco-category-title">' + Common._e("Publication/Subscription") + '</p>' +
'</div>' +
'<div class="disco-category disco-server">' +
'<p class="disco-category-title">' + Common._e("Server") + '</p>' +
'</div>' +
'<div class="disco-category disco-store">' +
'<p class="disco-category-title">' + Common._e("Storage") + '</p>' +
'</div>' +
'<div class="disco-category disco-others">' +
'<p class="disco-category-title">' + Common._e("Others") + '</p>' +
'</div>' +
'<div class="disco-category disco-wait">' +
'<p class="disco-category-title">' + Common._e("Loading") + '</p>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
var html =
'<div class="top">' + Common._e("Service discovery") + '</div>' +
'<div class="content">' +
'<div class="discovery-head">' +
'<div class="disco-server-text">' + Common._e("Server to query") + '</div>' +
'<input name="disco-server-input" class="disco-server-input" value="' + Common.encodeQuotes(HOST_MAIN) + '" />' +
'</div>' +
'<div class="results discovery-results">' +
'<div class="disco-category disco-account">' +
'<p class="disco-category-title">' + Common._e("Accounts") + '</p>' +
'</div>' +
'<div class="disco-category disco-auth">' +
'<p class="disco-category-title">' + Common._e("Authentications") + '</p>' +
'</div>' +
'<div class="disco-category disco-automation">' +
'<p class="disco-category-title">' + Common._e("Automation") + '</p>' +
'</div>' +
'<div class="disco-category disco-client">' +
'<p class="disco-category-title">' + Common._e("Clients") + '</p>' +
'</div>' +
'<div class="disco-category disco-collaboration">' +
'<p class="disco-category-title">' + Common._e("Collaboration") + '</p>' +
'</div>' +
'<div class="disco-category disco-component">' +
'<p class="disco-category-title">' + Common._e("Components") + '</p>' +
'</div>' +
'<div class="disco-category disco-conference">' +
'<p class="disco-category-title">' + Common._e("Rooms") + '</p>' +
'</div>' +
'<div class="disco-category disco-directory">' +
'<p class="disco-category-title">' + Common._e("Directories") + '</p>' +
'</div>' +
'<div class="disco-category disco-gateway">' +
'<p class="disco-category-title">' + Common._e("Gateways") + '</p>' +
'</div>' +
'<div class="disco-category disco-headline">' +
'<p class="disco-category-title">' + Common._e("News") + '</p>' +
'</div>' +
'<div class="disco-category disco-hierarchy">' +
'<p class="disco-category-title">' + Common._e("Hierarchy") + '</p>' +
'</div>' +
'<div class="disco-category disco-proxy">' +
'<p class="disco-category-title">' + Common._e("Proxies") + '</p>' +
'</div>' +
'<div class="disco-category disco-pubsub">' +
'<p class="disco-category-title">' + Common._e("Publication/Subscription") + '</p>' +
'</div>' +
'<div class="disco-category disco-server">' +
'<p class="disco-category-title">' + Common._e("Server") + '</p>' +
'</div>' +
'<div class="disco-category disco-store">' +
'<p class="disco-category-title">' + Common._e("Storage") + '</p>' +
'</div>' +
'<div class="disco-category disco-others">' +
'<p class="disco-category-title">' + Common._e("Others") + '</p>' +
'</div>' +
'<div class="disco-category disco-wait">' +
'<p class="disco-category-title">' + Common._e("Loading") + '</p>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
'</div>';
// Create the popup
Popup.create('discovery', html);
// Associate the events
self.instance();
// We request a disco to the default server
self.start();
} catch(e) {
@ -164,10 +164,10 @@ var Discovery = (function () {
try {
// We get the server to query
var discoServer = $('#discovery .disco-server-input').val();
// We launch the items query
DataForm.go(discoServer, 'browse', '', '', 'discovery');
Console.log('Service discovery launched: ' + discoServer);
} catch(e) {
Console.error('Discovery.start', e);
@ -188,10 +188,10 @@ var Discovery = (function () {
try {
// We remove the results
$('#discovery .discovery-oneresult, #discovery .oneinstructions, #discovery .onetitle, #discovery .no-results').remove();
// We clean the user info
$('#discovery .disco-server-info').text('');
// We hide the wait icon, the no result alert and the results
$('#discovery .wait, #discovery .disco-category').hide();
} catch(e) {
@ -211,7 +211,7 @@ var Discovery = (function () {
try {
// Click event
$('#discovery .bottom .finish').click(self.close);
// Keyboard event
$('#discovery .disco-server-input').keyup(function(e) {
if(e.keyCode == 13) {
@ -219,10 +219,10 @@ var Discovery = (function () {
if(!$(this).val()) {
$(this).val(HOST_MAIN);
}
// Start the discovery
self.start();
return false;
}
});

View file

@ -35,33 +35,33 @@ var Errors = (function () {
if(condition || reason) {
// Initialize the error text
var eText = '';
// Any error condition
if(condition) {
eText += condition;
}
// Any error type
if(type && eText) {
eText += ' (' + type + ')';
}
// Any error reason
if(reason) {
if(eText) {
eText += ' - ';
}
eText += reason;
}
// We reveal the error
Board.openThisError(1);
// Create the error text
$('#board .one-board.error[data-id="1"] span').text(eText);
}
// Not enough data to output the error: output a generic board
else {
Board.openThisError(2);
@ -87,38 +87,38 @@ var Errors = (function () {
// Initialize
var type, code, reason, condition;
var node = $(packet);
// First level error (connection error)
if(node.is('error')) {
// Get the value
code = node.attr('code');
// Specific error reason
switch(code) {
case '401':
reason = Common._e("Authorization failed");
break;
case '409':
reason = Common._e("Registration failed, please choose a different username");
break;
case '503':
reason = Common._e("Service unavailable");
break;
case '500':
reason = Common._e("Internal server error, try later");
break;
default:
reason = node.find('text').text();
break;
}
// Remove the general wait item (security)
Interface.removeGeneralWait();
// Show reconnect pane
if(Connection.current_session && Connection.connected) {
// Anonymous?
@ -128,35 +128,35 @@ var Errors = (function () {
Connection.createReconnect('normal');
}
}
// Show the homepage (security)
else if(!Connection.current_session || !Connection.connected) {
$('#home').show();
Interface.title('home');
}
// Still connected? (security)
if(Common.isConnected()) {
con.disconnect();
}
Console.error('First level error received.');
}
// Second level error (another error)
else if(node.find('error').size()) {
type = node.find('error').attr('type');
reason = node.find('error text').text();
condition = packet.getElementsByTagName('error').item(0).childNodes.item(0).nodeName.replace(/-/g, ' ');
Console.error('Second level error received.');
} else {
return false;
}
// Show the error board
self.show(condition, reason, type);
// Return there's an error
return true;
} catch(e) {

View file

@ -29,103 +29,103 @@ var Favorites = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Manage favorite rooms") + '</div>' +
'<div class="content">' +
'<div class="switch-fav">' +
'<div class="room-switcher room-list">' +
'<div class="icon list-icon talk-images"></div>' +
Common._e("Change favorites") +
'</div>' +
'<div class="room-switcher room-search">' +
'<div class="icon search-icon talk-images"></div>' +
Common._e("Search a room") +
'</div>' +
'</div>' +
'<div class="static-fav">' +
'<div class="favorites-edit favorites-content">' +
'<div class="head fedit-head static-fav-head">' +
'<div class="head-text fedit-head-text">' + Common._e("Select a favorite") + '</div>' +
'<select name="fedit-head-select" class="head-select fedit-head-select"></select>' +
'</div>' +
'<div class="results fedit-results static-fav-results">' +
'<div class="fedit-line">' +
'<label>' + Common._e("Name") + '</label>' +
'<input class="fedit-title" type="text" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Nickname") + '</label>' +
'<input class="fedit-nick" type="text" value="' + Name.getNick() + '" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Room") + '</label>' +
'<input class="fedit-chan" type="text" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Server") + '</label>' +
'<input class="fedit-server" type="text" value="' + HOST_MUC + '" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Password") + '</label>' +
'<input class="fedit-password" type="password" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Automatic") + '</label>' +
'<input type="checkbox" class="fedit-autojoin" />' +
'</div>' +
'<div class="fedit-actions">' +
'<a href="#" class="fedit-terminate fedit-add add one-button talk-images">' + Common._e("Add") + '</a>' +
'<a href="#" class="fedit-terminate fedit-edit one-button talk-images">' + Common._e("Edit") + '</a>' +
'<a href="#" class="fedit-terminate fedit-remove remove one-button talk-images">' + Common._e("Remove") + '</a>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="favorites-search favorites-content">' +
'<div class="head fsearch-head static-fav-head">' +
'<div class="head-text fsearch-head-text">' + Common._e("Search a room on") + '</div>' +
'<input type="text" class="head-input fsearch-head-server" value="' + HOST_MUC + '" />' +
'</div>' +
'<div class="results fsearch-results static-fav-results">' +
'<p class="fsearch-noresults">' + Common._e("No room found on this server.") + '</p>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
var html =
'<div class="top">' + Common._e("Manage favorite rooms") + '</div>' +
'<div class="content">' +
'<div class="switch-fav">' +
'<div class="room-switcher room-list">' +
'<div class="icon list-icon talk-images"></div>' +
Common._e("Change favorites") +
'</div>' +
'<div class="room-switcher room-search">' +
'<div class="icon search-icon talk-images"></div>' +
Common._e("Search a room") +
'</div>' +
'</div>' +
'<div class="static-fav">' +
'<div class="favorites-edit favorites-content">' +
'<div class="head fedit-head static-fav-head">' +
'<div class="head-text fedit-head-text">' + Common._e("Select a favorite") + '</div>' +
'<select name="fedit-head-select" class="head-select fedit-head-select"></select>' +
'</div>' +
'<div class="results fedit-results static-fav-results">' +
'<div class="fedit-line">' +
'<label>' + Common._e("Name") + '</label>' +
'<input class="fedit-title" type="text" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Nickname") + '</label>' +
'<input class="fedit-nick" type="text" value="' + Name.getNick() + '" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Room") + '</label>' +
'<input class="fedit-chan" type="text" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Server") + '</label>' +
'<input class="fedit-server" type="text" value="' + HOST_MUC + '" required="" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Password") + '</label>' +
'<input class="fedit-password" type="password" />' +
'</div>' +
'<div class="fedit-line">' +
'<label>' + Common._e("Automatic") + '</label>' +
'<input type="checkbox" class="fedit-autojoin" />' +
'</div>' +
'<div class="fedit-actions">' +
'<a href="#" class="fedit-terminate fedit-add add one-button talk-images">' + Common._e("Add") + '</a>' +
'<a href="#" class="fedit-terminate fedit-edit one-button talk-images">' + Common._e("Edit") + '</a>' +
'<a href="#" class="fedit-terminate fedit-remove remove one-button talk-images">' + Common._e("Remove") + '</a>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="favorites-search favorites-content">' +
'<div class="head fsearch-head static-fav-head">' +
'<div class="head-text fsearch-head-text">' + Common._e("Search a room on") + '</div>' +
'<input type="text" class="head-input fsearch-head-server" value="' + HOST_MUC + '" />' +
'</div>' +
'<div class="results fsearch-results static-fav-results">' +
'<p class="fsearch-noresults">' + Common._e("No room found on this server.") + '</p>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
'</div>';
// Create the popup
Popup.create('favorites', html);
// Load the favorites
self.load();
// Associate the events
self.instance();
} catch(e) {
@ -144,7 +144,7 @@ var Favorites = (function () {
try {
var path_sel = $('#favorites');
path_sel.find('.wait');
path_sel.find('.fedit-terminate').hide();
path_sel.find('.fedit-add').show();
@ -196,26 +196,26 @@ var Favorites = (function () {
try {
// Button path
var button_sel = $('#favorites .fsearch-results div[data-xid="' + escape(room_xid) + '"] a.one-button');
// Add a remove button instead of the add one
button_sel.filter('.add').replaceWith(
'<a href="#" class="one-button remove talk-images">' + Common._e("Remove") + '</a>'
);
// Click event
button_sel.filter('.remove').click(function() {
return self.removeThis(room_xid, room_name);
});
// Hide the add button in the (opened?) groupchat
$('#' + hex_md5(room_xid) + ' .tools-add').hide();
// Add the database entry
self.display(
room_xid,
Common.explodeThis(' (', room_name, 0), Name.getNick(), '0', ''
);
// Publish the favorites
self.publish();
} catch(e) {
@ -239,21 +239,21 @@ var Favorites = (function () {
try {
// Button path
var button_sel = $('#favorites .fsearch-results div[data-xid="' + escape(room_xid) + '"] a.one-button');
// Add a remove button instead of the add one
button_sel.filter('.remove').replaceWith('<a href="#" class="one-button add talk-images">' + Common._e("Add") + '</a>');
// Click event
button_sel.filter('.add').click(function() {
return self.addThis(room_xid, room_name);
});
// Show the add button in the (opened?) groupchat
$('#' + hex_md5(room_xid) + ' .tools-add').show();
// Remove the favorite
self.remove(room_xid, true);
// Publish the favorites
self.publish();
} catch(e) {
@ -275,21 +275,21 @@ var Favorites = (function () {
try {
// Path to favorites
var favorites_sel = $('#favorites');
// Reset the favorites
self.reset();
// Show the edit/remove button, hide the others
favorites_sel.find('.fedit-terminate').hide();
favorites_sel.find('.fedit-edit').show();
favorites_sel.find('.fedit-remove').show();
// We retrieve the values
var xid = favorites_sel.find('.fedit-head-select').val();
var data_sel = $(Common.XMLFromString(
DataStore.getDB(Connection.desktop_hash, 'favorites', xid)
));
// If this is not the default room
if(xid != 'none') {
// We apply the values
@ -298,7 +298,7 @@ var Favorites = (function () {
favorites_sel.find('.fedit-chan').val(Common.getXIDNick(xid));
favorites_sel.find('.fedit-server').val(Common.getXIDHost(xid));
favorites_sel.find('.fedit-password').val(data_sel.find('password').text());
if(data_sel.find('autojoin').text() == 'true') {
favorites_sel.find('.fedit-autojoin').attr('checked', true);
}
@ -321,10 +321,10 @@ var Favorites = (function () {
try {
// Path to favorites
var favorites_sel = $('#favorites');
// We get the values of the current edited groupchat
var old_xid = favorites_sel.find('.fedit-head-select').val();
var title = favorites_sel.find('.fedit-title').val();
var nick = favorites_sel.find('.fedit-nick').val();
var room = favorites_sel.find('.fedit-chan').val();
@ -332,11 +332,11 @@ var Favorites = (function () {
var xid = room + '@' + server;
var password = favorites_sel.find('.fedit-password').val();
var autojoin = 'false';
if(favorites_sel.find('.fedit-autojoin').filter(':checked').size()) {
autojoin = 'true';
}
// We check the missing values and send this if okay
if((type == 'add') || (type == 'edit')) {
if(title && nick && room && server) {
@ -344,35 +344,35 @@ var Favorites = (function () {
if(type == 'edit') {
self.remove(old_xid, true);
}
// Display the favorites
self.display(xid, title, nick, autojoin, password);
// Reset the inputs
self.reset();
} else {
favorites_sel.find('input[required]').each(function() {
var select = $(this);
if(!select.val()) {
$(document).oneTime(10, function() {
select.addClass('please-complete').focus();
});
} else {
select.removeClass('please-complete');
select.removeClass('please-complete');
}
});
}
} else if(type == 'remove') {
self.remove(old_xid, true);
// Reset the inputs
self.reset();
}
// Publish the new favorites
self.publish();
Console.info('Action on this bookmark: ' + room + '@' + server + ' / ' + type);
} catch(e) {
Console.error('Favorites.terminateThis', e);
@ -396,7 +396,7 @@ var Favorites = (function () {
// We remove the target favorite everywhere needed
$('.buddy-conf-groupchat-select option[value="' + xid + '"]').remove();
$('.fedit-head-select option[value="' + xid + '"]').remove();
// Must remove it from database?
if(database) {
DataStore.removeDB(Connection.desktop_hash, 'favorites', xid);
@ -418,19 +418,19 @@ var Favorites = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('set');
var query = iq.setQuery(NS_PRIVATE);
var storage = query.appendChild(iq.buildNode('storage', {
'xmlns': NS_BOOKMARKS
}));
// We generate the XML
var db_regex = new RegExp(('^' + Connection.desktop_hash + '_') + 'favorites_(.+)');
for(var i = 0; i < DataStore.storageDB.length; i++) {
// Get the pointer values
var current = DataStore.storageDB.key(i);
// If the pointer is on a stored favorite
if(current.match(db_regex)) {
var data_sel = $(Common.XMLFromString(
@ -442,7 +442,7 @@ var Favorites = (function () {
var nick = data_sel.find('nick').text();
var password = data_sel.find('password').text();
var autojoin = data_sel.find('autojoin').text();
// We create the node for this groupchat
var item = storage.appendChild(
iq.buildNode('conference', {
@ -452,21 +452,21 @@ var Favorites = (function () {
xmlns: NS_BOOKMARKS
})
);
item.appendChild(iq.buildNode('nick', {
xmlns: NS_BOOKMARKS
}, nick));
if(password) {
item.appendChild(iq.buildNode('password', {
xmlns: NS_BOOKMARKS
}, password));
}
Console.info('Bookmark sent: ' + xid);
}
}
con.send(iq);
} catch(e) {
Console.error('Favorites.publish', e);
@ -485,18 +485,18 @@ var Favorites = (function () {
try {
var path_sel = $('#favorites');
var groupchat_server = $('.fsearch-head-server').val();
// We reset some things
path_sel.find('.fsearch-oneresult').remove();
path_sel.find('.fsearch-noresults').hide();
path_sel.find('.wait').show();
var iq = new JSJaCIQ();
iq.setType('get');
iq.setTo(groupchat_server);
iq.setQuery(NS_DISCO_ITEMS);
con.send(iq, self.handleGCList);
} catch(e) {
Console.error('Favorites.getGCList', e);
@ -516,69 +516,69 @@ var Favorites = (function () {
try {
var path_sel = $('#favorites');
var from = Common.fullXID(Common.getStanzaFrom(iq));
if(!iq || (iq.getType() != 'result')) {
Board.openThisError(3);
path_sel.find('.wait').hide();
Console.error('Error while retrieving the rooms: ' + from);
}
else {
var handleXML = iq.getQuery();
if($(handleXML).find('item').size()) {
// Initialize the HTML code
var html = '';
$(handleXML).find('item').each(function() {
var this_sel = $(this);
var room_xid = this_sel.attr('jid');
var room_name = this_sel.attr('name');
if(room_xid && room_name) {
// Escaped values
var escaped_xid = Utils.encodeOnclick(room_xid);
var escaped_name = Utils.encodeOnclick(room_name);
// Initialize the room HTML
html += '<div class="oneresult fsearch-oneresult" data-xid="' + escape(room_xid) + '">' +
'<div class="room-name">' + room_name.htmlEnc() + '</div>' +
html += '<div class="oneresult fsearch-oneresult" data-xid="' + escape(room_xid) + '">' +
'<div class="room-name">' + room_name.htmlEnc() + '</div>' +
'<a href="#" class="one-button join talk-images" onclick="return Favorites.join(\'' + escaped_xid + '\');">' + Common._e("Join") + '</a>';
// This room is yet a favorite
if(DataStore.existDB(Connection.desktop_hash, 'favorites', room_xid)) {
html += '<a href="#" ' +
'class="one-button remove talk-images" ' +
'onclick="return Favorites.removeThis(\'' + escaped_xid + '\', \'' + escaped_name + '\');"' +
'>' +
Common._e("Remove") +
html += '<a href="#" ' +
'class="one-button remove talk-images" ' +
'onclick="return Favorites.removeThis(\'' + escaped_xid + '\', \'' + escaped_name + '\');"' +
'>' +
Common._e("Remove") +
'</a>';
} else {
html += '<a href="#" ' +
'class="one-button add talk-images" ' +
'onclick="return Favorites.addThis(\'' + escaped_xid + '\', \'' + escaped_name + '\');"' +
'>' +
Common._e("Add") +
html += '<a href="#" ' +
'class="one-button add talk-images" ' +
'onclick="return Favorites.addThis(\'' + escaped_xid + '\', \'' + escaped_name + '\');"' +
'>' +
Common._e("Add") +
'</a>';
}
// Close the room HTML
html += '</div>';
}
});
// Append this code to the popup
path_sel.find('.fsearch-results').append(html);
} else {
path_sel.find('.fsearch-noresults').show();
}
Console.info('Rooms retrieved: ' + from);
}
path_sel.find('.wait').hide();
} catch(e) {
Console.error('Favorites.handleGCList', e);
@ -629,20 +629,20 @@ var Favorites = (function () {
try {
// Generate the HTML code
var html = '<option value="' + Common.encodeQuotes(xid) + '">' + name.htmlEnc() + '</option>';
// Remove the existing favorite
self.remove(xid, false);
// We complete the select forms
$('#roster .gc-join-first-option, #favorites .fedit-head-select-first-option').after(html);
// We store the informations
var value = '<groupchat>' +
'<xid>' + xid.htmlEnc() + '</xid>' +
'<name>' + name.htmlEnc() + '</name>' +
'<nick>' + nick.htmlEnc() + '</nick>' +
'<autojoin>' + autojoin.htmlEnc() + '</autojoin>' +
'<password>' + password.htmlEnc() + '</password>' +
var value = '<groupchat>' +
'<xid>' + xid.htmlEnc() + '</xid>' +
'<name>' + name.htmlEnc() + '</name>' +
'<nick>' + nick.htmlEnc() + '</nick>' +
'<autojoin>' + autojoin.htmlEnc() + '</autojoin>' +
'<password>' + password.htmlEnc() + '</password>' +
'</groupchat>';
DataStore.setDB(Connection.desktop_hash, 'favorites', xid, value);
@ -663,34 +663,34 @@ var Favorites = (function () {
try {
// Initialize the HTML code
var html = '';
// Read the database
var db_regex = new RegExp(('^' + Connection.desktop_hash + '_') + 'favorites_(.+)');
for(var i = 0; i < DataStore.storageDB.length; i++) {
// Get the pointer values
var current = DataStore.storageDB.key(i);
// If the pointer is on a stored favorite
if(current.match(db_regex)) {
var data = Common.XMLFromString(DataStore.storageDB.getItem(current));
// Add the current favorite to the HTML code
html += '<option value="' + Common.encodeQuotes($(data).find('xid').text()) + '">' +
$(data).find('name').text().htmlEnc() +
html += '<option value="' + Common.encodeQuotes($(data).find('xid').text()) + '">' +
$(data).find('name').text().htmlEnc() +
'</option>';
}
}
// Generate specific HTML code
var favorites_bubble = '<option value="none" class="gc-join-first-option" selected="">' +
Common._e("Select a favorite") +
var favorites_bubble = '<option value="none" class="gc-join-first-option" selected="">' +
Common._e("Select a favorite") +
'</option>' + html;
var favorites_popup = '<option value="none" class="fedit-head-select-first-option" selected="">' +
Common._e("Select a favorite") +
var favorites_popup = '<option value="none" class="fedit-head-select-first-option" selected="">' +
Common._e("Select a favorite") +
'</option>' + html;
// Append the HTML code
$('#roster .buddy-conf-groupchat-select').html(favorites_bubble);
$('#favorites .fedit-head-select').html(favorites_popup);
@ -710,22 +710,22 @@ var Favorites = (function () {
try {
var favorites_sel = $('#favorites');
// Keyboard events
favorites_sel.find('.fsearch-head-server').keyup(function(e) {
if(e.keyCode == 13) {
var this_sel = $(this);
// No value?
if(!this_sel.val()) {
this_sel.val(HOST_MUC);
}
// Get the list
self.getGCList();
}
});
favorites_sel.find('.fedit-line input').keyup(function(e) {
if(e.keyCode == 13) {
// Edit a favorite
@ -736,37 +736,37 @@ var Favorites = (function () {
}
}
});
// Change events
$('.fedit-head-select').change(self.edit);
// Click events
favorites_sel.find('.room-switcher').click(function() {
favorites_sel.find('.favorites-content').hide();
self.reset();
});
favorites_sel.find('.room-list').click(function() {
favorites_sel.find('.favorites-edit').show();
});
favorites_sel.find('.room-search').click(function() {
favorites_sel.find('.favorites-search').show();
self.getGCList();
});
favorites_sel.find('.fedit-add').click(function() {
return self.terminateThis('add');
});
favorites_sel.find('.fedit-edit').click(function() {
return self.terminateThis('edit');
});
favorites_sel.find('.fedit-remove').click(function() {
return self.terminateThis('remove');
});
favorites_sel.find('.bottom .finish').click(function() {
return self.quit();
});

View file

@ -50,29 +50,29 @@ var Features = (function () {
var to = Utils.getServer();
var caps = con.server_caps;
var xml = null;
// Try to get the stored data
if(caps) {
xml = Common.XMLFromString(
DataStore.getPersistent('global', 'caps', caps)
);
}
// Any stored data?
if(xml) {
self.handle(xml);
Console.log('Read server CAPS from cache.');
} else {
// Not stored (or no CAPS)!
var iq = new JSJaCIQ();
iq.setTo(to);
iq.setType('get');
iq.setQuery(NS_DISCO_INFO);
con.send(iq, Caps.handleDiscoInfos);
Console.log('Read server CAPS from network.');
}
} catch(e) {
@ -93,7 +93,7 @@ var Features = (function () {
try {
// Selector
var selector = $(xml);
// Functions
var check_feature_fn = function(namespace) {
// This weird selector fixes an IE8 bug...
@ -137,21 +137,21 @@ var Features = (function () {
// Get the PEP nodes to initiate
Microblog.getInit();
PEP.getInitGeoloc();
// Get the notifications
Notification.get();
// Geolocate the user
PEP.geolocate();
// Enable microblogging send tools
Microblog.wait('sync');
$('.postit.attach').css('display', 'block');
Console.info('XMPP server supports PEP.');
} else {
Microblog.wait('unsync');
Console.warn('XMPP server does not support PEP.');
}
@ -159,10 +159,10 @@ var Features = (function () {
if(features.pep === false && features[NS_URN_MAM] === false) {
$('#options fieldset.privacy').hide();
}
// Apply the features
self.apply('talk');
// Process the roster height
if(features.pep === true) {
Roster.adapt();
@ -192,12 +192,12 @@ var Features = (function () {
try {
// Path to the elements
var path = '#' + id + ' .';
// PEP features
if(self.enabledPEP()) {
$(path + 'pep-hidable').show();
}
// PubSub features
if(self.enabledPubSub()) {
$(path + 'pubsub-hidable').show();
@ -207,7 +207,7 @@ var Features = (function () {
if(self.enabledPubSubCN()) {
$(path + 'pubsub-hidable-cn').show();
}
// MAM features
if(self.enabledMAM()) {
$(path + 'mam-hidable').show();
@ -223,12 +223,12 @@ var Features = (function () {
if(self.enabledCorrection()) {
$(path + 'correction-hidable').show();
}
// Commands features
if(self.enabledCommands()) {
$(path + 'commands-hidable').show();
}
// XMPP links (browser feature)
if(navigator.registerProtocolHandler) {
$(path + 'xmpplinks-hidable').show();

View file

@ -285,7 +285,7 @@ var Filter = (function () {
'ul',
'var'
],
'attributes': [
'accesskey',
'alt',
@ -345,17 +345,17 @@ var Filter = (function () {
try {
var filtered = message;
// We encode the HTML special chars
if(html_escape) {
filtered = filtered.htmlEnc();
}
// Security: don't filter huge messages (avoids crash attacks)
if(filtered.length < 10000) {
// /me command
filtered = filtered.replace(self.message_regex.commands.me, nick + ' $7');
// We replace the smilies text into images
var cur_emote;
@ -371,7 +371,7 @@ var Filter = (function () {
)
);
}
// Text formatting
var cur_formatting;
@ -388,11 +388,11 @@ var Filter = (function () {
if(html_escape) {
filtered = Links.apply(filtered, 'desktop');
}
// Filter integratebox links
filtered = IntegrateBox.filter(filtered);
}
return filtered;
} catch(e) {
Console.error('Filter.message', e);
@ -401,6 +401,32 @@ var Filter = (function () {
};
/**
* Returns whether XHTML body exists or not
* @public
* @param {DOM} xhtml_sel
* @return {boolean}
*/
self.has_xhtml_body = function(xhtml_sel) {
var has_xhtml_body = false;
try {
xhtml_sel.find('*').each(function() {
if($(this).text()) {
has_xhtml_body = true;
return false;
}
});
} catch(e) {
Console.error('Filter.has_xhtml_body', e);
} finally {
return has_xhtml_body;
}
};
/**
* Filters a xHTML message to be displayed in Jappix
* @public
@ -411,12 +437,12 @@ var Filter = (function () {
try {
var code_sel = $(code);
// Check if Filter for XHTML-IM images is enabled
if(DataStore.getDB(Connection.desktop_hash, 'options', 'no-xhtml-images') != '1') {
self.xhtml_allow.elements.push("img");
}
// Remove forbidden elements
code_sel.find('html body *').each(function() {
// This element is not authorized
@ -424,31 +450,31 @@ var Filter = (function () {
$(this).remove();
}
});
// Remove forbidden attributes
code_sel.find('html body *').each(function() {
// Put a pointer on this element (jQuery way & normal way)
var cSelector = $(this);
var cElement = (this);
// Loop the attributes of the current element
$(cElement.attributes).each(function(index) {
// Read the current attribute
var cAttr = cElement.attributes[index];
var cName = cAttr.name;
var cVal = cAttr.value;
// This attribute is not authorized, or contains JS code
if(!Utils.existArrayValue(self.xhtml_allow.attributes, cName.toLowerCase()) ||
if(!Utils.existArrayValue(self.xhtml_allow.attributes, cName.toLowerCase()) ||
((cVal.toLowerCase()).match(/(^|"|')javascript:/))) {
cSelector.removeAttr(cName);
}
});
});
// Filter some other elements
code_sel.find('a').attr('target', '_blank');
return code_sel.find('html body').html();
} catch(e) {
Console.error('Filter.xhtml', e);

View file

@ -21,7 +21,7 @@ var Groupchat = (function () {
/* Variables */
var JOIN_SUGGEST = [];
self.join_suggest = [];
/**
@ -58,11 +58,11 @@ var Groupchat = (function () {
input_sel.focus(function() {
// Clean notifications for this chat
Interface.chanCleanNotify(hash);
// Store focus on this chat!
Interface.chat_focus_hash = hash;
});
// Blur event
input_sel.blur(function() {
// Reset storage about focus on this chat!
@ -111,12 +111,12 @@ var Groupchat = (function () {
} else {
// Send the message
Message.send(hash, 'groupchat');
// Reset the composing database entry
DataStore.setDB(Connection.desktop_hash, 'chatstate', room, 'off');
}
}
return false;
}
@ -127,14 +127,14 @@ var Groupchat = (function () {
Correction.leave(room);
}
}
// Tabulation key (without any modifiers)
else if(!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey && e.keyCode == 9) {
Autocompletion.create(hash);
return false;
}
// Reset the autocompleter
else {
Autocompletion.reset(hash);
@ -175,17 +175,17 @@ var Groupchat = (function () {
// Add/remove the active class
this_sel.toggleClass('active');
// We require at least one room to be chosen
if(Common.exists('#suggest .content a.one.active')) {
$('#suggest a.next').removeClass('disabled');
} else {
$('#suggest a.next').addClass('disabled');
}
return false;
});
$('#suggest a.next').click(function() {
var this_sel = $(this);
@ -193,18 +193,20 @@ var Groupchat = (function () {
if(this_sel.hasClass('disabled')) {
return false;
}
// Store groupchats to join?
if(this_sel.is('.continue')) {
$('#suggest .content a.one.active').each(function() {
JOIN_SUGGEST.push(this_sel.attr('data-xid'));
self.join_suggest.push(
$(this).attr('data-xid')
);
});
}
// Switch to talk UI
$('#suggest').remove();
Connection.triggerConnected();
return false;
});
} catch(e) {
@ -230,17 +232,17 @@ var Groupchat = (function () {
if(Utils.isAnonymous()) {
return;
}
// We check if the user is a room owner or administrator to give him privileges
if(affiliation == 'owner' || affiliation == 'admin') {
$('#' + id + ' .tools-mucadmin').show();
}
// We check if the room hasn't been yet created
if(statuscode == 201) {
Board.openThisInfo(4);
}
// We add the click event
$('#' + id + ' .tools-mucadmin').click(function() {
MUCAdmin.open(xid, affiliation);
@ -265,11 +267,11 @@ var Groupchat = (function () {
try {
// Room hash
var hash = hex_md5(room);
// Reset the elements
$('#' + hash + ' .muc-ask').remove();
$('#' + hash + ' .compose').show();
// No nickname?
if(!nickname) {
// Get some values
@ -278,22 +280,22 @@ var Groupchat = (function () {
} else {
nickname = ANONYMOUS_NICK;
}
// If the nickname could not be retrieved, ask it
if(!nickname) {
self.generateMUCAsk('nickname', room, hash, nickname, password);
}
}
// Got our nickname?
if(nickname) {
// Get our general presence
var show = DataStore.getDB(Connection.desktop_hash, 'presence-show', 1);
var status = DataStore.getDB(Connection.desktop_hash, 'options', 'presence-status');
// Set my nick
$('#' + hash).attr('data-nick', escape(nickname));
// Send the appropriate presence
Presence.send(room + '/' + nickname, '', show, status, '', true, password, self.handleMUC);
}
@ -322,50 +324,49 @@ var Groupchat = (function () {
var nickname = Common.thisResource(from);
var hash = hex_md5(room);
var id = presence.getID();
// No ID: must fix M-Link bug
if(id === null) {
id = 1;
presence.setID(id);
}
Console.info('First MUC presence: ' + from);
// Catch the errors
if(!Errors.handle(xml)) {
// Define some stuffs
var muc_user = $(xml).find('x[xmlns="' + NS_MUC_USER + '"]');
var affiliation = muc_user.find('item').attr('affiliation');
var statuscode = parseInt(muc_user.find('status').attr('code'));
// Handle my presence
Presence.handle(presence);
// Configure the new room
if(affiliation == 'owner' || affiliation == 'admin') {
console.debug('presence', presence.xml());
self._initialConfiguration(id, room);
}
// Check if I am a room owner
self.openAdmin(affiliation, hash, room, statuscode);
// Tell the MUC we can notify the incoming presences
$(document).oneTime('15s', function() {
$('#' + hash).attr('data-initial', 'true');
});
// Enable the chatting input
$(document).oneTime(10, function() {
$('#' + hash + ' .message-area').removeAttr('disabled').focus();
});
}
// A password is required
else if($(xml).find('error[type="auth"] not-authorized').size()) {
self.generateMUCAsk('password', room, hash, nickname);
}
// There's a nickname conflict
else if($(xml).find('error[type="cancel"] conflict').size()) {
self.generateMUCAsk('nickname', room, hash);
@ -392,34 +393,34 @@ var Groupchat = (function () {
try {
// Generate the path to the elements
var path_to = '#' + hash + ' .muc-ask';
// Define the label text
var label_text;
switch(type) {
case 'nickname':
label_text = Common._e("Nickname");
break;
case 'password':
label_text = Common._e("Password");
break;
}
// Create the HTML markup
$('#' + hash + ' .compose').hide();
$('#' + hash).append(
'<div class="muc-ask text">' +
'<label>' + label_text + '</label>' +
'<input class="focusable" type="text" />' +
'<div class="muc-ask text">' +
'<label>' + label_text + '</label>' +
'<input class="focusable" type="text" />' +
'</div>'
);
// When a key is pressed in the input
$(path_to + ' input').keyup(function(e) {
var value_input = $(this).val();
// Enter key pressed
if(e.keyCode == 13) {
// $.trim() fixes #304
@ -427,14 +428,14 @@ var Groupchat = (function () {
nickname = $.trim(value_input);
return self.getMUC(room, nickname, password);
}
if(type == 'password' && value_input) {
password = value_input;
return self.getMUC(room, nickname, password);
}
}
});
// Focus on the input
$(document).oneTime(10, function() {
$(path_to + ' input').focus();
@ -462,37 +463,37 @@ var Groupchat = (function () {
try {
Console.info('New groupchat: ' + room);
// Create the chat content
Chat.generate('groupchat', hash, room, chan);
// Create the chat switcher
Chat.generateSwitch('groupchat', hash, room, chan);
// The icons-hover functions
Tooltip.icons(room, hash);
// Click event on the add tool
$('#' + hash + ' .tools-add').click(function() {
// Hide the icon (to tell the user all is okay)
$(this).hide();
// Add the groupchat to the user favorites
Favorites.addThis(room, chan);
});
// Must show the add button?
if(!DataStore.existDB(Connection.desktop_hash, 'favorites', room)) {
$('#' + hash + ' .tools-add').show();
}
// The event handlers
var input_sel = $('#' + hash + ' .message-area');
self._createEvents(input_sel, hash, room);
// Chatstate events
ChatState.events(input_sel, room, hash, 'groupchat');
// Get the current muc informations and content
self.getMUC(room, nickname, password);
} catch(e) {
@ -513,30 +514,30 @@ var Groupchat = (function () {
// Values array
var muc_arr = [GROUPCHATS_JOIN];
var new_arr = [];
// Try to split it
if(GROUPCHATS_JOIN.indexOf(',') != -1) {
muc_arr = GROUPCHATS_JOIN.split(',');
}
for(var i in muc_arr) {
// Get the current value
var muc_current = $.trim(muc_arr[i]);
// No current value?
if(!muc_current) {
continue;
}
// Filter the current value
muc_current = Common.generateXID(muc_current, 'groupchat');
// Add the current value
if(!Utils.existArrayValue(new_arr, muc_current)) {
new_arr.push(muc_current);
}
}
return new_arr;
} catch(e) {
Console.error('Groupchat.arrayJoin', e);
@ -554,14 +555,14 @@ var Groupchat = (function () {
try {
// Nothing to join?
if(!JOIN_SUGGEST) {
if(!self.join_suggest) {
return;
}
// Join the chats
if(JOIN_SUGGEST.length) {
for(var g in JOIN_SUGGEST) {
Chat.checkCreate(JOIN_SUGGEST[g], 'groupchat');
if(self.join_suggest.length) {
for(var g in self.join_suggest) {
Chat.checkCreate(self.join_suggest[g], 'groupchat');
}
}
} catch(e) {
@ -580,17 +581,17 @@ var Groupchat = (function () {
try {
var groupchat_arr = self.arrayJoin();
// Must suggest the user?
if((GROUPCHATS_SUGGEST == 'on') && groupchat_arr.length) {
if(Common.exists('#suggest')) {
return;
}
// Create HTML code
var html = '<div id="suggest" class="removable">';
html += '<div class="title">' + Common._e("Suggested chatrooms") + '</div>';
html += '<div class="content">';
for(var g in groupchat_arr) {
html += '<a class="one" href="#" data-xid="' + Common.encodeQuotes(groupchat_arr[g]) + '">';
@ -601,21 +602,21 @@ var Groupchat = (function () {
html += '</a>';
}
html += '</div>';
html += '<div class="bottom">';
html += '<a class="next continue disabled" href="#">' + Common._e("Continue") + '</a>';
html += '<a class="next skip" href="#">' + Common._e("Skip") + '</a>';
html += '</div>';
html += '</div>';
// Append HTML code
$('body').append(html);
// Attach events
self._suggestCheckEvents();
} else {
JOIN_SUGGEST = groupchat_arr;
self.join_suggest = groupchat_arr;
Connection.triggerConnected();
}
} catch(e) {
@ -646,20 +647,20 @@ var Groupchat = (function () {
var iq = new JSJaCIQ();
iq.setTo(room_xid);
iq.setType('set');
var iqQuery = iq.setQuery(NS_MUC_ADMIN);
var item = iqQuery.appendChild(iq.buildNode('item', {
'affiliation': 'outcast',
'jid': ban_xid,
'xmlns': NS_MUC_ADMIN
}));
if(reason) {
item.appendChild(iq.buildNode('reason', {
'xmlns': NS_MUC_ADMIN
}, reason));
}
con.send(iq, Errors.handleReply);
Console.log('Banned user with XID: ' + ban_xid + ' from room: ' + room_xid);
@ -693,20 +694,20 @@ var Groupchat = (function () {
var iq = new JSJaCIQ();
iq.setTo(room_xid);
iq.setType('set');
var iqQuery = iq.setQuery(NS_MUC_ADMIN);
var item = iqQuery.appendChild(iq.buildNode('item', {
'nick': nick,
'role': 'none',
'xmlns': NS_MUC_ADMIN
}));
if(reason) {
item.appendChild(iq.buildNode('reason', {
'xmlns': NS_MUC_ADMIN
}, reason));
}
con.send(iq, Errors.handleReply);
Console.info('Kicked user "' + nick + '" from room: ' + room_xid);
@ -810,7 +811,7 @@ var Groupchat = (function () {
}
};
/**
* Sends initial configuration of the room
* @private
@ -834,7 +835,7 @@ var Groupchat = (function () {
'xmlns': NS_XDATA,
'type': 'submit'
}));
// Build a new field node
var iqField = iqX.appendChild(iq.buildNode('field', {
'var': 'FORM_TYPE',
@ -844,7 +845,7 @@ var Groupchat = (function () {
iqField.appendChild(iq.buildNode('value', {
'xmlns': NS_XDATA
}, NS_MUC_CONFIG));
}, NS_MUC_CONFIG));
con.send(iq);
@ -853,7 +854,7 @@ var Groupchat = (function () {
Console.error('Groupchat._initialConfiguration', e);
}
};
/**

View file

@ -37,26 +37,26 @@ var Home = (function () {
current_sel.find('a.to-anonymous').click(function() {
return self.change('anonymouser');
});
current_sel.find('a.advanced').click(self.showAdvanced);
current_sel.find('form').submit(self.loginForm);
break;
// Anonymous login tool
case 'anonymouser':
current_sel.find('a.to-home').click(function() {
return self.change('loginer');
});
current_sel.find('form').submit(Connection.doAnonymous);
// Keyup event on anonymous join's room input
current_sel.find('input.room').keyup(function() {
var value = $(this).val();
var report_sel = current_sel.find('.report');
var span_sel = current_sel.find('span');
if(!value) {
report_sel.hide();
span_sel.text('');
@ -65,9 +65,9 @@ var Home = (function () {
span_sel.text(JAPPIX_LOCATION + '?r=' + value);
}
});
break;
// Register tool
case 'registerer':
// Server input change
@ -80,14 +80,14 @@ var Home = (function () {
$('#home input.captcha').attr('disabled', true);
}
});
// Register input placeholder
// FIXME: breaks IE compatibility
//$('#home input[placeholder]').placeholder();
// Register form submit
current_sel.find('form').submit(self.registerForm);
break;
}
} catch(e) {
@ -109,22 +109,22 @@ var Home = (function () {
try {
// Add the code
$(locale).after(
'<div class="obsolete">' +
'<p>' + Common._e("Your browser is out of date!") + '</p>' +
'<a class="firefox browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Mozilla Firefox') + '" href="http://www.mozilla.com/firefox/"></a>' +
'<a class="chrome browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Google Chrome') + '" href="http://www.google.com/chrome"></a>' +
'<a class="safari browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Safari') + '" href="http://www.apple.com/safari/"></a>' +
'<a class="opera browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Opera') + '" href="http://www.opera.com/"></a>' +
'<a class="ie browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Internet Explorer') + '" href="http://www.microsoft.com/hk/windows/internet-explorer/"></a>' +
'<div class="obsolete">' +
'<p>' + Common._e("Your browser is out of date!") + '</p>' +
'<a class="firefox browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Mozilla Firefox') + '" href="http://www.mozilla.com/firefox/"></a>' +
'<a class="chrome browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Google Chrome') + '" href="http://www.google.com/chrome"></a>' +
'<a class="safari browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Safari') + '" href="http://www.apple.com/safari/"></a>' +
'<a class="opera browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Opera') + '" href="http://www.opera.com/"></a>' +
'<a class="ie browsers-images" title="' + Common.printf(Common._e("Last %s version is better!"), 'Internet Explorer') + '" href="http://www.microsoft.com/hk/windows/internet-explorer/"></a>' +
'</div>'
);
// Display it later
$(home + '.obsolete').oneTime('1s', function() {
$(this).slideDown();
});
Console.warn('Jappix does not support this browser!');
} catch(e) {
Console.error('Home._obsolete', e);
@ -146,19 +146,19 @@ var Home = (function () {
var home = '#home .';
var right = home + 'right ';
var current = right + '.homediv.' + div;
// We switch the div
$(right + '.homediv, ' + right + '.top').hide();
$(right + '.' + div).show();
// We reset the homedivs
$(home + 'homediv:not(.default), ' + home + 'top:not(.default)').remove();
// Get the HTML code to display
var disable_form = '';
var lock_host = '';
var code = '';
// Apply the previous link
switch(div) {
case 'loginer':
@ -167,144 +167,144 @@ var Home = (function () {
if(!Common.exists(right + '.top.sub')) {
// Append the HTML code for previous link
$(right + '.top.default').after('<h1 class="top sub loginer anonymouser registerer">&laquo; <a href="#" class="previous">' + Common._e("Previous") + '</a></h1>');
// Click event on previous link
$(home + 'top.sub a.previous').click(function() {
return self.change('default');
});
}
break;
}
// Apply the form
switch(div) {
// Login tool
case 'loginer':
lock_host = Utils.disableInput(LOCK_HOST, 'on');
code = '<p>' + Common.printf(Common._e("Login to your existing XMPP account. You can also use the %s to join a groupchat."), '<a href="#" class="to-anonymous">' + Common._e("anonymous mode") + '</a>') + '</p>' +
'<form action="#" method="post">' +
'<fieldset>' +
'<legend>' + Common._e("Required") + '</legend>' +
'<label for="lnick">' + Common._e("Address") + '</label>' +
'<input type="text" class="nick" id="lnick" pattern="[^@/]+" required="" /><span class="jid">@</span><input type="text" class="server" id="lserver" value="' + HOST_MAIN + '" ' + lock_host + ' pattern="[^@/]+" required="" list="server" />' +
'<label for="lpassword">' + Common._e("Password") + '</label>' +
'<input type="password" class="password" id="lpassword" required="" />' +
'<label for="lremember">' + Common._e("Remember me") + '</label>' +
'<input type="checkbox" class="remember" id="lremember" />' +
'</fieldset>' +
'<a href="#" class="advanced home-images">' + Common._e("Advanced") + '</a>' +
'<fieldset class="advanced">' +
'<legend>' + Common._e("Advanced") + '</legend>' +
'<label for="lresource">' + Common._e("Resource") + '</label>' +
'<input type="text" class="resource" id="lresource" value="' + JAPPIX_RESOURCE + '" />' +
'<label for="lpriority">' + Common._e("Priority") + '</label>' +
'<select class="priority" id="lpriority">' +
'<option value="1">' + Common._e("Low") + '</option>' +
'<option value="10" selected="">' + Common._e("Medium") + '</option>' +
'<option value="100">' + Common._e("High") + '</option>' +
'</select>' +
'</fieldset>' +
'<div class="submit">' +
'<input type="submit" value="' + Common._e("Here we go!") + '" />' +
code = '<p>' + Common.printf(Common._e("Login to your existing XMPP account. You can also use the %s to join a groupchat."), '<a href="#" class="to-anonymous">' + Common._e("anonymous mode") + '</a>') + '</p>' +
'<div class="clear"></div>' +
'</div>' +
'<form action="#" method="post">' +
'<fieldset>' +
'<legend>' + Common._e("Required") + '</legend>' +
'<label for="lnick">' + Common._e("Address") + '</label>' +
'<input type="text" class="nick" id="lnick" pattern="[^@/]+" required="" /><span class="jid">@</span><input type="text" class="server" id="lserver" value="' + HOST_MAIN + '" ' + lock_host + ' pattern="[^@/]+" required="" list="server" />' +
'<label for="lpassword">' + Common._e("Password") + '</label>' +
'<input type="password" class="password" id="lpassword" required="" />' +
'<label for="lremember">' + Common._e("Remember me") + '</label>' +
'<input type="checkbox" class="remember" id="lremember" />' +
'</fieldset>' +
'<a href="#" class="advanced home-images">' + Common._e("Advanced") + '</a>' +
'<fieldset class="advanced">' +
'<legend>' + Common._e("Advanced") + '</legend>' +
'<label for="lresource">' + Common._e("Resource") + '</label>' +
'<input type="text" class="resource" id="lresource" value="' + JAPPIX_RESOURCE + '" />' +
'<label for="lpriority">' + Common._e("Priority") + '</label>' +
'<select class="priority" id="lpriority">' +
'<option value="1">' + Common._e("Low") + '</option>' +
'<option value="10" selected="">' + Common._e("Medium") + '</option>' +
'<option value="100">' + Common._e("High") + '</option>' +
'</select>' +
'</fieldset>' +
'<div class="submit">' +
'<input type="submit" value="' + Common._e("Here we go!") + '" />' +
'<div class="clear"></div>' +
'</div>' +
'</form>';
break;
// Anonymous login tool
case 'anonymouser':
disable_form = Utils.disableInput(ANONYMOUS, 'off');
code = '<p>' + Common.printf(Common._e("Enter the groupchat you want to join and the nick you want to have. You can also go back to the %s."), '<a href="#" class="to-home">' + Common._e("login page") + '</a>') + '</p>';
if(LEGAL) {
code += '<p>' + Common.printf(Common._e("By using our service, you accept %s."), '<b><a href="' + Common.encodeQuotes(LEGAL) + '" target="_blank">' + Common._e("our terms of use") + '</a></b>') + '</p>';
}
code += '<form action="#" method="post">' +
'<fieldset>' +
'<legend>' + Common._e("Required") + '</legend>' +
'<label>' + Common._e("Room") + '</label>' +
'<input type="text" class="room"' + disable_form + ' pattern="[^/]+" required="" />' +
'<label>' + Common._e("Nickname") + '</label>' +
'<input type="text" class="nick"' + disable_form + ' required="" />' +
'</fieldset>' +
'<input type="submit" value="' + Common._e("Here we go!") + '"' + disable_form + ' />' +
'</form>' +
'<div class="info report">' +
Common._e("Share this link with your friends:") + ' <span></span>' +
code += '<form action="#" method="post">' +
'<fieldset>' +
'<legend>' + Common._e("Required") + '</legend>' +
'<label>' + Common._e("Room") + '</label>' +
'<input type="text" class="room"' + disable_form + ' pattern="[^/]+" required="" />' +
'<label>' + Common._e("Nickname") + '</label>' +
'<input type="text" class="nick"' + disable_form + ' required="" />' +
'</fieldset>' +
'<input type="submit" value="' + Common._e("Here we go!") + '"' + disable_form + ' />' +
'</form>' +
'<div class="info report">' +
Common._e("Share this link with your friends:") + ' <span></span>' +
'</div>';
break;
// Register tool
case 'registerer':
disable_form = Utils.disableInput(REGISTRATION, 'off');
if(!disable_form) {
lock_host = Utils.disableInput(LOCK_HOST, 'on');
}
code = '<p>' + Common._e("Register a new XMPP account to join your friends on your own social cloud. That's simple!") + '</p>';
if(LEGAL) {
code += '<p>' + Common.printf(Common._e("By using our service, you accept %s."), '<b><a href="' + Common.encodeQuotes(LEGAL) + '" target="_blank">' + Common._e("our terms of use") + '</a></b>') + '</p>';
}
code += '<form action="#" method="post">' +
'<fieldset>' +
'<legend>' + Common._e("Required") + '</legend>' +
'<label for="rnick">' + Common._e("Address") + '</label>' +
'<input type="text" class="nick" id="rnick" ' + disable_form + ' pattern="[^@/]+" required="" placeholder="' + Common._e("Username") + '" /><span class="jid">@</span><input type="text" class="server" id="rserver" value="' + HOST_MAIN + '" ' + disable_form + lock_host + ' pattern="[^@/]+" required="" list="server" placeholder="' + Common._e("Server") + '" />' +
'<label for="rpassword">' + Common._e("Password") + '</label>' +
code += '<form action="#" method="post">' +
'<fieldset>' +
'<legend>' + Common._e("Required") + '</legend>' +
'<label for="rnick">' + Common._e("Address") + '</label>' +
'<input type="text" class="nick" id="rnick" ' + disable_form + ' pattern="[^@/]+" required="" placeholder="' + Common._e("Username") + '" /><span class="jid">@</span><input type="text" class="server" id="rserver" value="' + HOST_MAIN + '" ' + disable_form + lock_host + ' pattern="[^@/]+" required="" list="server" placeholder="' + Common._e("Server") + '" />' +
'<label for="rpassword">' + Common._e("Password") + '</label>' +
'<input type="password" class="password" id="rpassword" ' + disable_form + ' required="" placeholder="' + Common._e("Enter password") + '" /><input type="password" class="spassword" id="spassword" ' + disable_form + ' required="" placeholder="' + Common._e("Once again...") + '" />';
if(REGISTER_API == 'on') {
code += '<div class="captcha_grp">' +
'<label for="captcha">' + Common._e("Code") + '</label><input type="text" class="captcha" id="captcha" ' + disable_form + ' maxlength="6" pattern="[a-zA-Z0-9]{6}" required="" placeholder="' + Common._e("Security code") + '" /><img class="captcha_img" src="./server/captcha.php?id=' + genID() + '" alt="" />' +
code += '<div class="captcha_grp">' +
'<label for="captcha">' + Common._e("Code") + '</label><input type="text" class="captcha" id="captcha" ' + disable_form + ' maxlength="6" pattern="[a-zA-Z0-9]{6}" required="" placeholder="' + Common._e("Security code") + '" /><img class="captcha_img" src="./server/captcha.php?id=' + genID() + '" alt="" />' +
'</div>';
}
code += '</fieldset>' +
'<input type="submit" value="' + Common._e("Here we go!") + '" ' + disable_form + '/>' +
code += '</fieldset>' +
'<input type="submit" value="' + Common._e("Here we go!") + '" ' + disable_form + '/>' +
'</form>';
break;
}
// Form disabled?
if(disable_form) {
code += '<div class="info fail">' +
Common._e("This tool has been disabled!") +
code += '<div class="info fail">' +
Common._e("This tool has been disabled!") +
'</div>';
}
// Create this HTML code
if(code && !Common.exists(current)) {
$(right + '.homediv.default').after(
'<div class="' + div + ' homediv">' + code + '</div>'
);
self._eventsChange(
$(current),
div
);
}
// We focus on the first input
$(document).oneTime(10, function() {
$(right + 'input:visible:first').focus();
@ -328,7 +328,7 @@ var Home = (function () {
try {
// Hide the link
$('#home a.advanced').hide();
// Show the fieldset
$('#home fieldset.advanced').show();
} catch(e) {
@ -357,20 +357,20 @@ var Home = (function () {
var lResource = path_sel.find('.resource').val();
var lPriority = path_sel.find('.priority').val();
var lRemember = path_sel.find('.remember').filter(':checked').size();
// Enough values?
if(lServer && lNick && lPass && lResource && lPriority) {
Connection.doLogin(lNick, lServer, lPass, lResource, lPriority, lRemember);
} else {
$(lPath + 'input[type="text"], ' + lPath + 'input[type="password"]').each(function() {
var select = $(this);
if(!select.val()) {
$(document).oneTime(10, function() {
select.addClass('please-complete').focus();
});
} else {
select.removeClass('please-complete');
select.removeClass('please-complete');
}
});
}
@ -393,37 +393,37 @@ var Home = (function () {
try {
var path = '#home .registerer';
var path_sel = $(path);
// Remove the success info
path_sel.find('.success').remove();
// Get the values
var username = Common.nodeprep(path_sel.find('.nick').val());
var domain = path_sel.find('.server').val();
var pass = path_sel.find('.password').val();
var spass = path_sel.find('.spassword').val();
var captcha = path_sel.find('.captcha').val();
// Enough values?
if(domain && username && pass && spass && (pass == spass) && !((REGISTER_API == 'on') && (domain == HOST_MAIN) && !captcha)) {
// We remove the not completed class to avoid problems
$('#home .registerer input').removeClass('please-complete');
// Fire the register event!
Connection.doRegister(username, domain, pass, captcha);
}
// Something is missing?
else {
$(path + ' input[type="text"], ' + path + ' input[type="password"]').each(function() {
var select = $(this);
if(!select.val() || (select.is('#spassword') && pass && (pass != spass))) {
$(document).oneTime(10, function() {
select.addClass('please-complete').focus();
});
} else {
select.removeClass('please-complete');
select.removeClass('please-complete');
}
});
}
@ -452,61 +452,61 @@ var Home = (function () {
var corp = home + '.corporation';
var aboutus = home + '.aboutus';
var locale = home + '.locale';
// Removes the <noscript /> elements to lighten the DOM
$('noscript').remove();
// Allows the user to switch the home page
$(button).click(function() {
// Login button
if($(this).is('.login')) {
return self.change('loginer');
}
// Register button
else {
return self.change('registerer');
}
});
// Allows the user to view the corporation & about infobox
$(corp + ', ' + aboutus).hover(function() {
$(this).addClass('hovered');
}, function() {
$(this).removeClass('hovered');
});
// Allows the user to switch the language
$(locale).hover(function() {
// Initialize the HTML code
var keepget = $(locale).attr('data-keepget');
var html = '<div class="list">';
// Generate each locale HTML code
for(var i in LOCALES_AVAILABLE_ID) {
html += '<a href="./?l=' + LOCALES_AVAILABLE_ID[i] + keepget + '">' + LOCALES_AVAILABLE_NAMES[i].htmlEnc() + '</a>';
}
html += '</div>';
// Append the HTML code
$(locale).append(html);
}, function() {
$(locale + ' .list').remove();
});
// Disables the browser HTTP-requests stopper
$(document).keydown(function(e) {
if((e.keyCode == 27) && !System.isDeveloper()) {
return false;
}
});
// Warns for an obsolete browser
if(Utils.isObsolete()) {
self._obsolete();
}
Console.log('Welcome to Jappix! Happy coding in developer mode!');
});
} catch(e) {

View file

@ -45,38 +45,38 @@ var HTTPAuth = (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
Connection.setupCon(con);
// Generate a resource
var random_resource = DataStore.getDB(Connection.desktop_hash, 'session', 'resource');
if(!random_resource) {
random_resource = JAPPIX_RESOURCE + ' (' + (new Date()).getTime() + ')';
}
// Generate a priority
lPriority = lPriority ? lPriority : 10;
// Store the resource (for reconnection)
DataStore.setDB(Connection.desktop_hash, 'session', 'resource', random_resource);
// Generate a session XML to be stored
session_xml = '<session><stored>true</stored><domain>' + lServer.htmlEnc() + '</domain><username>' + lNick.htmlEnc() + '</username><resource>' + random_resource + '</resource><password>' + lPass.htmlEnc() + '</password><priority>' + (lPriority + '').htmlEnc() + '</priority></session>';
// Save the session parameters (for reconnect if network issue)
Connection.current_session = session_xml;
// We store the infos of the user into the data-base
DataStore.setDB(Connection.desktop_hash, 'priority', 1, 10);
// We connect !
con.connect({
'domain': $.trim(lServer),
@ -86,17 +86,17 @@ var HTTPAuth = (function () {
'secure': true,
'xmllang': XML_LANG
});
// Change the page title
Interface.title('wait');
Console.info('Jappix is connecting...');
} catch(e) {
Console.error('HTTPAuth.go', e);
// Reset Jappix
Talk.destroy();
// Open an unknown error
Board.openThisError(2);
} finally {

View file

@ -37,11 +37,11 @@ var HTTPReply = (function () {
var id = confirm.attr('id');
var method = confirm.attr('method');
var url = confirm.attr('url');
// We generate the reply message
var aMsg = new JSJaCMessage();
aMsg.setTo(from);
// If "no"
if(value == 'no') {
aMsg.setType('error');
@ -50,7 +50,7 @@ var HTTPReply = (function () {
'type': 'auth'
});
}
// We set the confirm node
aMsg.appendNode('confirm', {
'xmlns': xmlns,
@ -58,10 +58,10 @@ var HTTPReply = (function () {
'id': id,
'method': method
});
// We send the message
con.send(aMsg, Errors.handleReply);
Console.info('Replying HTTP auth request: ' + from);
} catch(e) {
Console.error('HTTPReply.go', e);

View file

@ -29,69 +29,69 @@ var Inbox = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Your inbox") + '</div>' +
'<div class="content">' +
'<div class="head inbox-head">' +
'<div class="head-text inbox-head-text">' + Common._e("Available actions") + '</div>' +
'<div class="head-actions inbox-head-actions">' +
'<a href="#" class="a-delete-messages">' + Common._e("Clean") + '</a>' +
'<a href="#" class="a-new-message">' + Common._e("New") + '</a>' +
'<a href="#" class="a-show-messages">' + Common._e("Received") + '</a>' +
'</div>' +
'</div>' +
'<div class="inbox-results">' +
'<p class="inbox-noresults">' + Common._e("Your inbox is empty.") + '</p>' +
'<div class="inbox"></div>' +
'</div>' +
'<div class="inbox-new">' +
'<div class="inbox-new-to inbox-new-block search">' +
'<p class="inbox-new-text">' + Common._e("To") + '</p>' +
'<input name="inbox-new-to-input" class="inbox-new-input inbox-new-to-input" type="text" required="" />' +
'</div>' +
'<div class="inbox-new-topic inbox-new-block">' +
'<p class="inbox-new-text">' + Common._e("Subject") + '</p>' +
'<input name="inbox-new-subject-input" class="inbox-new-input inbox-new-subject-input" type="text" required="" />' +
'</div>' +
'<div class="inbox-new-body inbox-new-block">' +
'<p class="inbox-new-text">' + Common._e("Content") + '</p>' +
'<textarea class="inbox-new-textarea" rows="8" cols="60" required=""></textarea>' +
'</div>' +
'<form class="inbox-new-file inbox-new-block" action="./server/file-share.php" method="post" enctype="multipart/form-data">' +
'<p class="inbox-new-text">' + Common._e("File") + '</p>' +
Interface.generateFileShare() +
'</form>' +
'<div class="inbox-new-send inbox-new-block">' +
'<a href="#" class="send one-button talk-images">' + Common._e("Send message") + '</a>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
var html =
'<div class="top">' + Common._e("Your inbox") + '</div>' +
'<div class="content">' +
'<div class="head inbox-head">' +
'<div class="head-text inbox-head-text">' + Common._e("Available actions") + '</div>' +
'<div class="head-actions inbox-head-actions">' +
'<a href="#" class="a-delete-messages">' + Common._e("Clean") + '</a>' +
'<a href="#" class="a-new-message">' + Common._e("New") + '</a>' +
'<a href="#" class="a-show-messages">' + Common._e("Received") + '</a>' +
'</div>' +
'</div>' +
'<div class="inbox-results">' +
'<p class="inbox-noresults">' + Common._e("Your inbox is empty.") + '</p>' +
'<div class="inbox"></div>' +
'</div>' +
'<div class="inbox-new">' +
'<div class="inbox-new-to inbox-new-block search">' +
'<p class="inbox-new-text">' + Common._e("To") + '</p>' +
'<input name="inbox-new-to-input" class="inbox-new-input inbox-new-to-input" type="text" required="" />' +
'</div>' +
'<div class="inbox-new-topic inbox-new-block">' +
'<p class="inbox-new-text">' + Common._e("Subject") + '</p>' +
'<input name="inbox-new-subject-input" class="inbox-new-input inbox-new-subject-input" type="text" required="" />' +
'</div>' +
'<div class="inbox-new-body inbox-new-block">' +
'<p class="inbox-new-text">' + Common._e("Content") + '</p>' +
'<textarea class="inbox-new-textarea" rows="8" cols="60" required=""></textarea>' +
'</div>' +
'<form class="inbox-new-file inbox-new-block" action="./server/file-share.php" method="post" enctype="multipart/form-data">' +
'<p class="inbox-new-text">' + Common._e("File") + '</p>' +
Interface.generateFileShare() +
'</form>' +
'<div class="inbox-new-send inbox-new-block">' +
'<a href="#" class="send one-button talk-images">' + Common._e("Send message") + '</a>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
'</div>';
// Create the popup
Popup.create('inbox', html);
// Associate the events
self.instance();
// Load the messages
self.load();
} catch(e) {
@ -134,10 +134,10 @@ var Inbox = (function () {
// Open things
self.open();
self.newMessage();
// Apply XID
$('#inbox .inbox-new-to-input').val(xid);
// Focus to the next item
$(document).oneTime(10, function() {
$('#inbox .inbox-new-subject-input').focus();
@ -163,18 +163,18 @@ var Inbox = (function () {
iq.setType('set');
var query = iq.setQuery(NS_PRIVATE);
var storage = query.appendChild(iq.buildNode('storage', {'xmlns': NS_INBOX}));
var db_regex = new RegExp(('^' + Connection.desktop_hash + '_') + 'inbox' + ('_(.+)'));
for(var i = 0; i < DataStore.storageDB.length; i++) {
// Get the pointer values
var current = DataStore.storageDB.key(i);
// If the pointer is on a stored message
if(current.match(db_regex)) {
// Get the values
var value = $(Common.XMLFromString(DataStore.storageDB.getItem(current)));
// Create the storage node
storage.appendChild(
iq.buildNode('message', {
@ -188,7 +188,7 @@ var Inbox = (function () {
));
}
}
con.send(iq);
} catch(e) {
Console.error('Inbox.store', e);
@ -207,19 +207,19 @@ var Inbox = (function () {
try {
// Init
var inbox_sel = $('#inbox');
// Reset the previous buddy search
Search.resetBuddy('#inbox .inbox-new-to');
// We switch the divs
inbox_sel.find('.inbox-results, .a-new-message, .a-delete-messages').hide();
inbox_sel.find('.inbox-new, .a-show-messages').show();
// We focus on the first input
$(document).oneTime(10, function() {
inbox_sel.find('.inbox-new-to-input').focus();
});
// We reset some stuffs
self.cleanNewMessage();
} catch(e) {
@ -229,7 +229,7 @@ var Inbox = (function () {
}
};
/**
* Cleans the inbox
@ -241,12 +241,12 @@ var Inbox = (function () {
try {
// Init
var inbox_sel = $('#inbox');
// We reset the forms
inbox_sel.find('.inbox-new-block:not(form) input, .inbox-new textarea').val('').removeClass('please-complete');
inbox_sel.find('.inbox-new-file a').remove();
inbox_sel.find('.inbox-new-file input').show();
// We close an eventual opened message
inbox_sel.find('.message-content').remove();
inbox_sel.find('.one-message').removeClass('message-reading');
@ -270,24 +270,24 @@ var Inbox = (function () {
try {
// We send the message
var message = new JSJaCMessage();
// Main attributes
message.setTo(to);
message.setSubject(subject);
message.setType('normal');
// Any file to attach?
var attached = '#inbox .inbox-new-file a.file';
if(Common.exists(attached)) {
body += '\n' +
'\n' +
body += '\n' +
'\n' +
$(attached).attr('data-attachedtitle') + ' - ' + $(attached).attr('data-attachedhref');
}
// Set body
message.setBody(body);
con.send(message, Errors.handleReply);
} catch(e) {
Console.error('Inbox.sendMessage', e);
@ -309,50 +309,50 @@ var Inbox = (function () {
var to = inbox_sel.find('.inbox-new-to-input').val();
var body = inbox_sel.find('.inbox-new-textarea').val();
var subject = inbox_sel.find('.inbox-new-subject-input').val();
if(to && body && subject) {
// New array of XID
var xid = new Array(to);
// More than one XID
if(to.indexOf(',') != -1) {
xid = to.split(',');
}
for(var i in xid) {
var current = xid[i];
// No current value?
if(!current || current.match(/^(\s+)$/))
continue;
// Edit the XID if needed
current = current.replace(/ /g, '');
current = Common.generateXID(current, 'chat');
// We send the message
self.sendMessage(current, subject, body);
// We clean the inputs
self.cleanNewMessage();
Console.info('Inbox message sent: ' + current);
}
// Close the inbox
self.close();
}
else {
inbox_sel.find('input[type="text"], textarea').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');
}
});
}
@ -374,16 +374,16 @@ var Inbox = (function () {
try {
var inbox_sel = $('#inbox');
// We switch the divs
inbox_sel.find('.inbox-new').hide();
inbox_sel.find('.inbox-results').show();
// We show a new link in the menu
inbox_sel.find('.a-show-messages').hide();
inbox_sel.find('.a-delete-messages').show();
inbox_sel.find('.a-new-message').show();
// We reset some stuffs
self.cleanNewMessage();
} catch(e) {
@ -412,50 +412,50 @@ var Inbox = (function () {
// Generate some paths
var inbox = '#inbox .';
var one_message = inbox + 'one-message.' + id;
// Message yet displayed!
if(Common.exists(one_message)) {
return false;
}
// Get the nearest element
var stamp = DateUtils.extractStamp(Date.jab2date(date));
var nearest = Search.sortElementByStamp(stamp, '#inbox .one-message');
// Get the buddy name
var name = Name.getBuddy(from).htmlEnc();
// We generate the html code
var nContent = '<div class="one-message message-' + status + ' ' + id + ' ' + hex_md5(from) + '" data-stamp="' + stamp + '">' +
'<div class="message-head">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<div class="message-jid">' + name + '</div>' +
'<div class="message-subject">' + subject.htmlEnc() + '</div>' +
'<div class="message-truncated">' + Utils.truncate(Utils.noLines(content), 90).htmlEnc() + '</div>' +
'</div>' +
var nContent = '<div class="one-message message-' + status + ' ' + id + ' ' + hex_md5(from) + '" data-stamp="' + stamp + '">' +
'<div class="message-head">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<div class="message-jid">' + name + '</div>' +
'<div class="message-subject">' + subject.htmlEnc() + '</div>' +
'<div class="message-truncated">' + Utils.truncate(Utils.noLines(content), 90).htmlEnc() + '</div>' +
'</div>' +
'</div>';
// Display the message
if(nearest === 0) {
$(inbox + 'inbox-results .inbox').append(nContent);
} else {
$('#inbox .one-message[data-stamp="' + nearest + '"]:first').before(nContent);
}
// Click events
$(one_message + ' .message-head').click(function() {
if(!Common.exists(one_message + ' .message-content'))
self.revealMessage(id, from, subject, content, name, date, status);
else
self.hideMessage(id);
return false;
});
// Get the user avatar
Avatar.get(from, 'cache', 'true', 'forget');
@ -482,15 +482,15 @@ var Inbox = (function () {
try {
// Initialize the XML data
var xml = '<message>' +
'<id>' + id.htmlEnc().htmlEnc() + '</id>' +
'<date>' + date.htmlEnc().htmlEnc() + '</date>' +
'<from>' + from.htmlEnc().htmlEnc() + '</from>' +
'<subject>' + subject.htmlEnc().htmlEnc() + '</subject>' +
'<status>' + status.htmlEnc().htmlEnc() + '</status>' +
'<content>' + content.htmlEnc().htmlEnc() + '</content>' +
var xml = '<message>' +
'<id>' + id.htmlEnc().htmlEnc() + '</id>' +
'<date>' + date.htmlEnc().htmlEnc() + '</date>' +
'<from>' + from.htmlEnc().htmlEnc() + '</from>' +
'<subject>' + subject.htmlEnc().htmlEnc() + '</subject>' +
'<status>' + status.htmlEnc().htmlEnc() + '</status>' +
'<content>' + content.htmlEnc().htmlEnc() + '</content>' +
'</message>';
// Store this message!
DataStore.setDB(Connection.desktop_hash, 'inbox', id, xml);
} catch(e) {
@ -511,13 +511,13 @@ var Inbox = (function () {
try {
// Remove the message from the inbox
$('#inbox .one-message.' + id).remove();
// Remove the message from the database
DataStore.removeDB(Connection.desktop_hash, 'inbox', id);
// Check the unread messages
self.checkMessages();
// Store the new inbox
self.store();
} catch(e) {
@ -543,21 +543,21 @@ var Inbox = (function () {
for(var i = 0; i < DataStore.storageDB.length; i++) {
// Get the pointer values
var current = DataStore.storageDB.key(i);
// If the pointer is on a stored message
if(current.match(db_regex)) {
DataStore.removeDB(Connection.desktop_hash, 'inbox', RegExp.$1);
}
}
// Prevent the database lag
$(document).oneTime(100, function() {
// Store the new inbox
self.store();
// Remove all the messages from the inbox
$('#inbox .one-message').remove();
// Reload the inbox
self.load();
});
@ -581,56 +581,56 @@ var Inbox = (function () {
// Selectors
var inbox_link = '#top-content a.inbox-hidable';
var no_results = '#inbox .inbox-noresults';
// Marker
var has_messages = false;
// Read the number of unread messages
var unread = 0;
// Read the local inbox database
var db_regex = new RegExp(('^' + Connection.desktop_hash + '_') + 'inbox' + ('_(.+)'));
for(var i = 0; i < DataStore.storageDB.length; i++) {
// Database pointer
var current = DataStore.storageDB.key(i);
// Check inbox messages
if(current.match(db_regex)) {
// Read the current status
var status = $(Common.XMLFromString(DataStore.storageDB.getItem(current))).find('status').text();
// Found an unread message
if(status == 'unread') {
unread++;
}
// Update the marker
has_messages = true;
}
}
// No message?
if(!has_messages) {
$(no_results).show();
} else {
$(no_results).hide();
}
// Reset notifications
$(inbox_link + ' .notify').remove();
// Any unread message?
if(unread) {
// Notify the user
$(inbox_link).prepend('<div class="notify one-counter" data-counter="' + unread + '">' + unread + '</div>');
// Update the title
Interface.updateTitle();
return true;
}
// Anyway, update the title
Interface.updateTitle();
} catch(e) {
@ -661,53 +661,53 @@ var Inbox = (function () {
var all_message = '#inbox .one-message';
var one_message = all_message + '.' + id;
var one_content = one_message + ' .message-content';
// We reset all the other messages
$(all_message + ' .message-content').remove();
$(all_message).removeClass('message-reading');
// Message content
var html =
'<div class="message-content">' +
'<div class="message-body">' + Filter.message(content, name, true) + '</div>' +
'<div class="message-meta">' +
'<span class="date">' + DateUtils.parse(date) + '</span>' +
'<a href="#" class="reply one-button talk-images">' + Common._e("Reply") + '</a>' +
'<a href="#" class="remove one-button talk-images">' + Common._e("Delete") + '</a>' +
'<div class="clear">' +
'</div>' +
var html =
'<div class="message-content">' +
'<div class="message-body">' + Filter.message(content, name, true) + '</div>' +
'<div class="message-meta">' +
'<span class="date">' + DateUtils.parse(date) + '</span>' +
'<a href="#" class="reply one-button talk-images">' + Common._e("Reply") + '</a>' +
'<a href="#" class="remove one-button talk-images">' + Common._e("Delete") + '</a>' +
'<div class="clear">' +
'</div>' +
'</div>';
// Message content
html += '</div>';
$(one_message).append(html).addClass('message-reading');
// Click events
$(one_content + ' a.reply').click(function() {
return self.replyMessage(id, from, subject, content);
});
$(one_content + ' a.remove').click(function() {
return self.deleteMessage(id);
});
// Unread message
if(status == 'unread') {
// Update our database
var xml = DataStore.getDB(Connection.desktop_hash, 'inbox', id).replace(/<status>unread<\/status>/i,'<status>read</status>');
DataStore.setDB(Connection.desktop_hash, 'inbox', id, xml);
// Remove the unread class
$(one_message).removeClass('message-unread');
// Send it to the server!
self.store();
}
// Check the unread messages
self.checkMessages();
} catch(e) {
@ -729,7 +729,7 @@ var Inbox = (function () {
// Define the paths
var inbox = '#inbox .';
var one_message = inbox + 'one-message.' + id;
// Reset this message
$(one_message).removeClass('message-reading');
$(one_message + ' .message-content').remove();
@ -751,17 +751,17 @@ var Inbox = (function () {
try {
// We switch to the writing div
self.newMessage();
// Inbox path
var inbox = '#inbox .';
// Generate the body
body = '\n' + '____________' + '\n\n' + Utils.truncate(body, 120);
// We apply the generated values to the form
$(inbox + 'inbox-new-to-input').val(from);
$(inbox + 'inbox-new-subject-input').val(subject);
$(document).oneTime(10, function() {
$(inbox + 'inbox-new-textarea').val(body).focus().selectRange(1, 0);
});
@ -788,12 +788,12 @@ var Inbox = (function () {
for(var i = 0; i < DataStore.storageDB.length; i++) {
// Get the pointer values
var current = DataStore.storageDB.key(i);
// If the pointer is on a stored message
if(current.match(db_regex)) {
// Get the current value
var value = $(Common.XMLFromString(DataStore.storageDB.getItem(current)));
// Display the current message
self.displayMessage(
value.find('from').text().revertHtmlEnc(),
@ -805,7 +805,7 @@ var Inbox = (function () {
);
}
}
// Check new messages
self.checkMessages();
} catch(e) {
@ -842,51 +842,51 @@ var Inbox = (function () {
try {
// Data selector
var dData = $(responseXML).find('jappix');
// Process the returned data
if(dData.find('error').size()) {
Board.openThisError(4);
Console.error('Error while attaching the file', dData.find('error').text());
} else {
// Get the file values
var fName = dData.find('title').text();
var fType = dData.find('type').text();
var fURL = dData.find('href').text();
// Hide the attach link, show the unattach one
$('#inbox .inbox-new-file input').hide();
$('#inbox .inbox-new-file').append(
'<a class="file ' + Common.encodeQuotes(Utils.fileCategory(Common.explodeThis('/', fType, 1))) + ' talk-images" ' +
'href="' + Common.encodeQuotes(fURL) + '" ' +
'target="_blank">' +
fName.htmlEnc() +
'</a>' +
'<a class="file ' + Common.encodeQuotes(Utils.fileCategory(Common.explodeThis('/', fType, 1))) + ' talk-images" ' +
'href="' + Common.encodeQuotes(fURL) + '" ' +
'target="_blank">' +
fName.htmlEnc() +
'</a>' +
'<a href="#" class="remove one-button talk-images">' +
Common._e("Remove") +
'<a href="#" class="remove one-button talk-images">' +
Common._e("Remove") +
'</a>'
);
// Set values to the file link
var inbox_file_sel = $('#inbox .inbox-new-file a.file');
inbox_file_sel.attr('data-attachedtitle', fName);
inbox_file_sel.attr('data-attachedhref', fURL);
// Click events
var inbox_new_file_sel = $('#inbox .inbox-new-file');
inbox_new_file_sel.find('a.remove').click(function() {
inbox_new_file_sel.find('a').remove();
inbox_new_file_sel.find('input').show();
return false;
});
Console.info('File attached.');
}
// Reset the attach bubble
$('#inbox .inbox-new-file input[type="file"]').val('');
$('#inbox .wait').hide();
@ -907,11 +907,11 @@ var Inbox = (function () {
try {
// Define the pats
var inbox = '#inbox .';
// Define the buddy search vars
var destination = inbox + 'inbox-new-to';
var dHovered = destination + ' ul li.hovered:first';
// Send the message when enter pressend
$(inbox + 'inbox-new input').keyup(function(e) {
if(e.keyCode == 13) {
@ -922,7 +922,7 @@ var Inbox = (function () {
}
}
});
// Buddy search
$(inbox + 'inbox-new-to-input').keyup(function(e) {
if(e.keyCode != 13) {
@ -930,61 +930,61 @@ var Inbox = (function () {
if((e.keyCode != 40) && (e.keyCode != 38)) {
Search.createBuddy(destination);
}
// Navigating with keyboard in the results
Search.arrowsBuddy(e, destination);
}
})
// Buddy search lost focus
.blur(function() {
if(!$(destination + ' ul').attr('mouse-hover')) {
Search.resetBuddy(destination);
}
})
// Buddy search got focus
.focus(function() {
var value = $(this).val();
// Add a comma at the end
if(value && !value.match(/^(.+)((,)(\s)?)$/)) {
$(this).val(value + ', ');
}
});
// Click events
$(inbox + 'a-delete-messages').click(self.purge);
$(inbox + 'a-new-message').click(self.newMessage);
$(inbox + 'a-show-messages').click(self.showMessage);
$(inbox + 'inbox-new-send a').click(self.checkMessage);
$(inbox + 'bottom .finish').click(function() {
return self.close();
});
// File upload
var attach_options = {
dataType: 'xml',
beforeSubmit: self.waitAttach,
success: self.handleAttach
};
// Upload form submit event
$('#inbox .inbox-new-file').submit(function() {
if($('#inbox .wait').is(':hidden') && $('#inbox .inbox-new-file input[type="file"]').val()) {
$(this).ajaxSubmit(attach_options);
}
return false;
});
// Upload input change event
$('#inbox .inbox-new-file input[type="file"]').change(function() {
if($('#inbox .wait').is(':hidden') && $(this).val()) {
$('#inbox .inbox-new-file').ajaxSubmit(attach_options);
}
return false;
});
} catch(e) {

View file

@ -29,22 +29,22 @@ var IntegrateBox = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Media viewer") + '</div>' +
'<div class="content"></div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish close">' + Common._e("Close") + '</a>' +
'<a href="#" class="finish next disabled" title="' + Common._e("Next") + '">&gt;</a>' +
'<a href="#" class="finish previous disabled" title="' + Common._e("Previous") + '">&lt;</a>' +
var html =
'<div class="top">' + Common._e("Media viewer") + '</div>' +
'<div class="content"></div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish close">' + Common._e("Close") + '</a>' +
'<a href="#" class="finish next disabled" title="' + Common._e("Next") + '">&gt;</a>' +
'<a href="#" class="finish previous disabled" title="' + Common._e("Previous") + '">&lt;</a>' +
'</div>';
// Create the popup
Popup.create('integratebox', html);
// Associate the events
self.instance();
} catch(e) {
@ -84,17 +84,17 @@ var IntegrateBox = (function () {
try {
var code = '';
// Protocol to use
var protocol = Utils.isHTTPS() ? 'https' : 'http';
// Legacy browser
var legacy = false;
if((BrowserDetect.browser == 'Explorer') && (BrowserDetect.version < 9)) {
legacy = true;
}
// Switch to get the good DOM code
switch(serv) {
case 'youtube':
@ -103,37 +103,37 @@ var IntegrateBox = (function () {
} else {
code = '<object width="640" height="385" data="' + Common.encodeQuotes(protocol) + '://www.youtube.com/embed/' + Common.encodeQuotes(url) + '?autoplay=1" type="text/html"><a href="http://www.youtube.com/watch?v=' + Common.encodeQuotes(url) + '" target="_blank">http://www.youtube.com/watch?v=' + Common.encodeQuotes(url) + '</a></object>';
}
break;
case 'dailymotion':
code = '<object width="640" height="385"><param name="movie" value="http://www.dailymotion.com/swf/video/' + url + '&amp;autoplay=1"></param><param name="allowFullScreen" value="false"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/' + Common.encodeQuotes(url) + '&amp;autoplay=1" width="640" height="385" allowfullscreen="true" allowscriptaccess="always"></embed></object>';
break;
case 'vimeo':
code = '<object width="640" height="385"><param name="allowfullscreen" value="true" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + Common.encodeQuotes(url) + '&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1&amp;autoplay=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=' + Common.encodeQuotes(url) + '&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1&amp;autoplay=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="640" height="385"></embed></object>';
break;
case 'theora':
case 'video':
code = '<video width="640" height="385" src="' + Common.encodeQuotes(url) + '" controls autoplay><a href="' + Common.encodeQuotes(url) + '" target="_blank">' + Common.encodeQuotes(url) + '</a></video>';
break;
case 'vorbis':
case 'audio':
code = '<audio src="' + Common.encodeQuotes(url) + '" controls autoplay><a href="' + Common.encodeQuotes(url) + '" target="_blank">' + Common.encodeQuotes(url) + '</a></audio>';
break;
case 'image':
code = '<a href="' + Common.encodeQuotes(url) + '" target="_blank"><img alt="" src="' + Common.encodeQuotes(url) + '" /></a>';
break;
}
return code;
} catch(e) {
Console.error('IntegrateBox.code', e);
@ -159,65 +159,65 @@ var IntegrateBox = (function () {
try {
// Close the integratebox
self.close();
// Media integration not wanted?
if(DataStore.getDB(Connection.desktop_hash, 'options', 'integratemedias') == '0') {
return true;
}
// Apply the HTML code
var dom_code = self.code(service, url);
// Any code: apply it!
if(dom_code) {
// We show the integratebox
self.open();
// We add the code to the DOM
$('#integratebox .content').prepend('<div class="one-media">' + dom_code + '</div>');
// Image waiting icon
if(service == 'image') {
var waitItem = $('#integratebox .wait');
// Show it while it is loading
waitItem.show();
// Hide it when it is loaded
$('#integratebox img').load(function() {
waitItem.hide();
// Center the image vertically
$(this).oneTime(10, function() {
$(this).css('margin-top', (($('#integratebox .content').height() - $(this).height()) / 2));
});
});
}
// Large style?
var comments_id = genID();
if(width_style == 'large') {
// Make the popup large
$('#integratebox .popup').addClass('large');
// Add the right content
$('#integratebox .content').after(
'<div class="comments" data-id="' + Common.encodeQuotes(comments_id) + '">' +
'<div class="comments-content">' +
'<div class="one-comment loading"><span class="icon talk-images"></span>' + Common._e("Loading comments...") + '</div>' +
'</div>' +
'<div class="comments" data-id="' + Common.encodeQuotes(comments_id) + '">' +
'<div class="comments-content">' +
'<div class="one-comment loading"><span class="icon talk-images"></span>' + Common._e("Loading comments...") + '</div>' +
'</div>' +
'</div>'
);
}
// Previous and next items?
var url_array = Utils.stringToArray(url_list);
var services_array = Utils.stringToArray(services_list);
var comments_e_array = Utils.stringToArray(comments_e_list);
var comments_n_array = Utils.stringToArray(comments_n_list);
var index = Utils.indexArrayValue(url_array, url);
// Any comments?
if(Common.exists('#integratebox .comments')) {
if(comments_e_array[index] && comments_n_array[index]) {
@ -226,57 +226,57 @@ var IntegrateBox = (function () {
$('#integratebox .comments .comments-content').html('<div class="one-comment loading"><span class="icon talk-images"></span>' + Common._e("Comments locked!") + '</div>');
}
}
// Get the previous values
var previous_url = url_array[index - 1];
var previous_services = services_array[index - 1];
// Get the next values
var next_url = url_array[index + 1];
var next_services = services_array[index + 1];
// Enable/disable buttons
if(previous_url && previous_services) {
$('#integratebox .bottom .finish.previous').removeClass('disabled');
} else {
$('#integratebox .bottom .finish.previous').addClass('disabled');
}
if(next_url && next_services) {
$('#integratebox .bottom .finish.next').removeClass('disabled');
} else {
$('#integratebox .bottom .finish.next').addClass('disabled');
}
// Click events
$('#integratebox .bottom .finish.previous, #integratebox .bottom .finish.next').click(function() {
// Not acceptable?
if($(this).is('.disabled')) {
return false;
}
// Apply the event!
if($(this).is('.previous')) {
self.apply(previous_url, previous_services, url_list, services_list, comments_e_list, comments_n_list, width_style);
} else {
self.apply(next_url, next_services, url_list, services_list, comments_e_list, comments_n_list, width_style);
}
return false;
});
if(width_style == 'large')
$('#integratebox .content a:has(img)').click(function() {
if(next_url && next_services) {
self.apply(next_url, next_services, url_list, services_list, comments_e_list, comments_n_list, width_style);
}
return false;
});
return false;
}
// Nothing: return true to be able to open the URL in a new tab
return true;
} catch(e) {
@ -321,90 +321,90 @@ var IntegrateBox = (function () {
try {
// Encapsulates the string into two <div /> elements
var xml = $('<div><div>' + data + '</div></div>').contents();
// Loop the <a /> elements
$(xml).find('a').each(function() {
// Initialize this element
var href = $(this).attr('href');
var to, url, service, event;
// XMPP ID
if(href.match(/^xmpp:(.+)/i)) {
to = RegExp.$1;
}
// YouTube video box
else if(href.match(/(\w{3,5})(:)(\S+)((\.youtube\.com\/watch(\?v|\?\S+v|\#\!v|\#\!\S+v)\=)|(youtu\.be\/))([^& ]+)((&amp;\S)|(&\S)|\s|$)/gim)) {
url = RegExp.$8;
service = 'youtube';
}
// Dailymotion video box
else if(href.match(/(\w{3,5})(:)(\S+)\.dailymotion\.com\/video\/([\w\-]+)((\#[\w\-]+)|\s|$)/gim)) {
url = RegExp.$4;
service = 'dailymotion';
}
// Vimeo video box
else if(href.match(/((\w{3,5})(:)(\S+)(vimeo|www\.vimeo)\.com\/([\w\-]+))/gim)) {
url = RegExp.$6;
service = 'vimeo';
}
// Theora video box
else if(href.match(/((\w{3,5})(:)(\S+)(\.)(ogv|ogg))/gim)) {
url = RegExp.$1;
service = 'theora';
}
// Vorbis audio box
else if(href.match(/((\w{3,5})(:)(\S+)(\.oga))/gim)) {
url = RegExp.$1;
service = 'vorbis';
}
// Image box
else if(href.match(/((\w{3,5})(:)(\S+)(\.)(jpg|jpeg|png|gif|tif|bmp))/gim)) {
url = RegExp.$1;
service = 'image';
}
// Define the good event
if(to) {
event = 'XMPPLinks.go(\'' + Utils.encodeOnclick(to) + '\')';
} else if(url && service) {
event = 'IntegrateBox.apply(\'' + Utils.encodeOnclick(url) + '\', \'' + Utils.encodeOnclick(service) + '\')';
}
// Any click event to apply?
if(event) {
// Regenerate the link element (for onclick)
var new_a = '<a';
var element_a = (this);
// Attributes
$(element_a.attributes).each(function(index) {
// Read the current attribute
var current_attr = element_a.attributes[index];
// Apply the current attribute
new_a += ' ' + Common.encodeQuotes(current_attr.name) + '="' + Common.encodeQuotes(current_attr.value) + '"';
});
// Add onclick attribute
new_a += ' onclick="return ' + event + ';"';
// Value
new_a += '>' + $(this).html() + '</a>';
// Replace it!
$(this).replaceWith(new_a);
}
});
// Regenerate the HTML code (include string into a div to be readable)
var string = $(xml).html();
return string;
} catch(e) {
Console.error('IntegrateBox.filter', e);
@ -442,14 +442,14 @@ var IntegrateBox = (function () {
// Previous item?
if((Common.exists('#integratebox .bottom .finish.previous:not(.disabled)')) && (e.keyCode == 37)) {
$('#integratebox .bottom .finish.previous').click();
return false;
}
// Next item?
if((Common.exists('#integratebox .bottom .finish.next:not(.disabled)')) && (e.keyCode == 39)) {
$('#integratebox .bottom .finish.next').click();
return false;
}
});

View file

@ -35,25 +35,25 @@ var Interface = (function () {
try {
// Anonymous mode?
var head_name = Name.get();
if(Utils.isAnonymous()) {
head_name = ANONYMOUS_ROOM + ' (' + Common._e("anonymous mode") + ')';
}
// We change the title to give essential informations
switch(title_type) {
case 'home':
document.title = SERVICE_NAME + ' • ' + SERVICE_DESC;
break;
case 'talk':
document.title = SERVICE_NAME + ' • ' + head_name;
break;
case 'new':
document.title = '[' + self.pendingEvents() + '] ' + SERVICE_NAME + ' • ' + head_name;
break;
case 'wait':
document.title = SERVICE_NAME + ' • ' + Common._e("Please wait...");
break;
@ -77,16 +77,16 @@ var Interface = (function () {
if(Common.exists('#general-wait')) {
return false;
}
// Generate the HTML code
var html =
'<div id="general-wait" class="removable">' +
'<div class="general-wait-content wait-big"></div>' +
var html =
'<div id="general-wait" class="removable">' +
'<div class="general-wait-content wait-big"></div>' +
'</div>';
// Append the HTML code
$('body').append(html);
return true;
} catch(e) {
Console.error('Interface.showGeneralWait', e);
@ -119,11 +119,11 @@ var Interface = (function () {
self.generateFileShare = function() {
try {
return '<input type="hidden" name="MAX_FILE_SIZE" value="' + Common.encodeQuotes(JAPPIX_MAX_FILE_SIZE) + '">' +
'<input type="hidden" name="user" value="' + Common.encodeQuotes(Common.getXID()) + '" />' +
'<input type="hidden" name="location" value="' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" />' +
'<input type="hidden" name="id" value="' + (new Date()).getTime() + '" />' +
'<input type="file" name="file" required="" />' +
return '<input type="hidden" name="MAX_FILE_SIZE" value="' + Common.encodeQuotes(JAPPIX_MAX_FILE_SIZE) + '">' +
'<input type="hidden" name="user" value="' + Common.encodeQuotes(Common.getXID()) + '" />' +
'<input type="hidden" name="location" value="' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" />' +
'<input type="hidden" name="id" value="' + (new Date()).getTime() + '" />' +
'<input type="file" name="file" required="" />' +
'<input type="submit" value="' + Common._e("Send") + '" />';
} catch(e) {
Console.error('Interface.generateFileShare', e);
@ -145,16 +145,16 @@ var Interface = (function () {
// We show the page-engine content
$('.page-engine-chan').hide();
$('#' + id).show();
// We edit the tab switcher
$('#page-switch .switcher').removeClass('activechan').addClass('chan');
$('#page-switch .' + id).addClass('activechan').removeClass('chan');
// Scroll down to the last message
if(id != 'channel') {
self.autoScroll(id);
}
// Manage input focus
self.inputFocus();
}
@ -177,19 +177,19 @@ var Interface = (function () {
try {
// Path
var more_content = '#page-switch .more-content';
// Yet displayed?
if(Common.exists(more_content)) {
return Bubble.close();
}
// Add the bubble
Bubble.show(more_content);
// Append the content
$('#page-switch .more').append(
'<div class="more-content bubble removable">' +
$('#page-switch .chans').html() +
'<div class="more-content bubble removable">' +
$('#page-switch .chans').html() +
'</div>'
);
} catch(e) {
@ -212,18 +212,18 @@ var Interface = (function () {
// Path
var join_content = '#page-switch .join-content';
var join_sel = $('#page-switch .join');
// Yet displayed?
if(Common.exists(join_content))
return Bubble.close();
// Add the bubble
Bubble.show(join_content);
// Append the content
join_sel.append(
'<div class="join-content bubble removable">' +
'<input type="text" class="join-groupchat-xid" required="" placeholder="' + Common._e("Groupchat name") + '" />' +
'<div class="join-content bubble removable">' +
'<input type="text" class="join-groupchat-xid" required="" placeholder="' + Common._e("Groupchat name") + '" />' +
'</div>'
);
@ -234,11 +234,11 @@ var Interface = (function () {
if(e.keyCode == 13) {
var this_sel = $(this);
var xid = $.trim(this_sel.val());
if(xid) {
// Generate a correct XID
xid = Common.generateXID(xid, 'groupchat');
Bubble.close();
Chat.checkCreate(xid, 'groupchat');
} else {
@ -274,14 +274,14 @@ var Interface = (function () {
// We define the variables
var selector = $('#' + hash + ' .message-area');
var oValue = selector.val();
// Any old value?
if(oValue && !oValue.match(/^(.+)(\s)+$/)) {
oValue += ' ';
}
var nValue = oValue + smiley + ' ';
// Put the new value and focus on it
$(document).oneTime(10, function() {
selector.val(nValue).focus();
@ -324,7 +324,7 @@ var Interface = (function () {
if(type == 'groupchat') {
// Send our unavailable presence
Presence.send(xid + '/' + Name.getMUCNick(hash), 'unavailable');
// Remove all presence database entries for this groupchat
var db_regex = new RegExp(('^' + Connection.desktop_hash + '_') + 'presence' + ('_(.+)'));
@ -334,15 +334,15 @@ var Interface = (function () {
if(current.match(db_regex)) {
var cXID = RegExp.$1;
// If the pointer is on a presence from this groupchat
if(Common.bareXID(cXID) == xid) {
// Generate the hash for the current XID
var cHash = hex_md5(cXID);
// Disable the message textarea
$('#' + cHash + ' .message-area').attr('disabled', true);
// Remove the presence for this XID
DataStore.removeDB(Connection.desktop_hash, 'presence-stanza', cXID);
DataStore.removeDB(Connection.desktop_hash, 'presence-resources', cXID);
@ -358,18 +358,18 @@ var Interface = (function () {
if(xid in MAM.map_states) {
delete MAM.map_states[xid];
}
// Get the chat ID which is before
var previous = $('#' + hash).prev().attr('id');
// Remove the chat
self.deleteThisChat(hash);
// Reset the switcher
if(!Common.exists('#page-switch .switcher.activechan')) {
self.switchChan(previous);
}
// Reset the notifications
self.chanCleanNotify(hash);
} catch(e) {
@ -401,32 +401,32 @@ var Interface = (function () {
var direction = $('html').attr('dir') || 'ltr';
var content_sel = $(content);
// Filter the content smileys
content_sel.find('img.emoticon').each(function() {
$(this).replaceWith($(this).attr('alt'));
});
// Remove the useless attributes
content_sel.removeAttr('data-type').removeAttr('data-stamp');
// Remove the content avatars
content_sel.find('.avatar-container').remove();
// Remove the content info
content_sel.find('.correction-edit, .message-marker, .corrected-info, .correction-label').remove();
// Remove the content click events
content_sel.find('a').removeAttr('onclick');
// Extract the content HTML code
content = content_sel.parent().html();
// No avatar?
if(!avatar || !avatar.match(/data:/)) {
avatar = 'none';
}
// POST the values to the server
$.post('./server/generate-chat.php', {
'content': content,
@ -462,8 +462,8 @@ var Interface = (function () {
var has_focus = true;
try {
if(!$('#page-switch .' + hash).hasClass('activechan') ||
!Common.isFocused() ||
if(!$('#page-switch .' + hash).hasClass('activechan') ||
!Common.isFocused() ||
(self.chat_focus_hash != hash)) {
has_focus = false;
}
@ -490,7 +490,7 @@ var Interface = (function () {
var chat_switch = '#page-switch .';
var tested = chat_switch + hash;
var active = $(tested).hasClass('activechan');
// We notify the user if he has not the focus on the chat
if(self.hasChanFocus(hash) === false) {
if(!active) {
@ -500,17 +500,17 @@ var Interface = (function () {
$(tested).addClass('chan-unread');
}
}
// Count the number of pending messages
var pending = 1;
if(Common.exists('#' + hash + '[data-counter]')) {
pending = parseInt($('#' + hash).attr('data-counter')) + 1;
}
$('#' + hash).attr('data-counter', pending);
}
// Update the page title
self.updateTitle();
} catch(e) {
@ -530,11 +530,11 @@ var Interface = (function () {
try {
// Count the number of notifications
var number = 0;
$('.one-counter[data-counter]').each(function() {
number = number + parseInt($(this).attr('data-counter'));
});
return number;
} catch(e) {
Console.error('Interface.pendingEvents', e);
@ -576,15 +576,15 @@ var Interface = (function () {
// We remove the class that tell the user of a new message
var chat_switch = '#page-switch .';
$(chat_switch + hash).removeClass('chan-newmessage chan-unread');
// We reset the global notifications if no more unread messages
if(!$(chat_switch + 'chans .chan-newmessage').size()) {
$(chat_switch + 'more-button').removeClass('chan-newmessage');
}
// We reset the chat counter
$('#' + hash).removeAttr('data-counter');
// Update the page title
self.updateTitle();
} catch(e) {
@ -606,7 +606,7 @@ var Interface = (function () {
// Avoid a JS error
if(Common.exists('#' + hash)) {
var container = document.getElementById('chat-content-' + hash);
// Scroll down!
container.scrollTop = container.scrollHeight;
}
@ -628,25 +628,25 @@ var Interface = (function () {
try {
// Put a marker
Roster.blist_all = true;
// We switch the two modes
$('.buddy-conf-more-display-unavailable').hide();
$('.buddy-conf-more-display-available').show();
// Security: reset all the groups toggle event
$('#roster .group-buddies').show();
$('#roster .group span').text('-');
// We show the disconnected buddies
$('.hidden-buddy').show();
// We show all the groups
$('#roster .one-group').show();
if(Search.search_filtered) {
Search.funnelFilterBuddy();
}
// Store this in the options
if((from == 'roster') && Options.loaded()) {
DataStore.setDB(Connection.desktop_hash, 'options', 'roster-showall', '1');
@ -670,25 +670,25 @@ var Interface = (function () {
try {
// Remove the marker
Roster.blist_all = false;
// We switch the two modes
$('.buddy-conf-more-display-available').hide();
$('.buddy-conf-more-display-unavailable').show();
// Security: reset all the groups toggle event
$('#roster .group-buddies').show();
$('#roster .group span').text('-');
// We hide the disconnected buddies
$('.hidden-buddy').hide();
// We check the groups to hide
Roster.updateGroups();
if(Search.search_filtered) {
Search.funnelFilterBuddy();
}
// Store this in the options
if((from == 'roster') && Options.loaded()) {
DataStore.setDB(Connection.desktop_hash, 'options', 'roster-showall', '0');
@ -748,7 +748,7 @@ var Interface = (function () {
// Get key value
var key_value = $.trim(String.fromCharCode(evt.which));
// Re-focus on opened chat?
if(key_value) {
// Get input values

View file

@ -140,7 +140,7 @@ var addToHome = (function (w) {
options.message = '';
}
if ( options.message === '' ) { // We look for a suitable language (defaulted to en_us)
options.message = language in intl ? intl[language] : intl['en_us'];
options.message = language in intl ? intl[language] : intl.en_us;
}
if ( options.touchIcon ) {

View file

@ -32,9 +32,9 @@ var IQ = (function () {
try {
/* REF: http://xmpp.org/extensions/xep-0066.html */
OOB.handle(iqFrom, iqID, 'iq', iqNode);
Console.log('Received IQ OOB request: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleOOBRequest', e);
@ -60,7 +60,7 @@ var IQ = (function () {
var oob_url = DataStore.getDB(Connection.desktop_hash, 'send/url', iqID);
var oob_desc = DataStore.getDB(Connection.desktop_hash, 'send/desc', iqID);
var notif_id = hex_md5(oob_url + oob_desc + iqType + iqFrom + iqID);
if($(iqNode).find('error').size()) {
// Error?
if($(iqNode).find('error not-acceptable').size()) {
@ -70,7 +70,7 @@ var IQ = (function () {
// Failed?
Notification.create('send_fail', iqFrom, [iqFrom, oob_url, 'iq', iqID, iqNode], oob_desc, notif_id);
}
// Remove the file
$.get(oob_url + '&action=remove');
} else if(iqType == 'result') {
@ -95,15 +95,15 @@ var IQ = (function () {
try {
/* REF: http://xmpp.org/extensions/xep-0092.html */
iqQuery = iqResponse.setQuery(NS_VERSION);
iqQuery.appendChild(iqResponse.buildNode('name', {'xmlns': NS_VERSION}, Caps.disco_infos.identity.name));
iqQuery.appendChild(iqResponse.buildNode('version', {'xmlns': NS_VERSION}, JAPPIX_VERSION));
iqQuery.appendChild(iqResponse.buildNode('os', {'xmlns': NS_VERSION}, BrowserDetect.OS));
con.send(iqResponse);
Console.log('Received software version query: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleSoftwareVersion', e);
@ -123,12 +123,12 @@ var IQ = (function () {
try {
/* REF: http://xmpp.org/extensions/xep-0012.html */
iqQuery = iqResponse.setQuery(NS_LAST);
iqQuery.setAttribute('seconds', DateUtils.getLastActivity());
con.send(iqResponse);
Console.log('Received last activity query: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleLastActivity', e);
@ -149,15 +149,15 @@ var IQ = (function () {
try {
// REF : http://xmpp.org/extensions/xep-0016.html
// Roster push
con.send(iqResponse);
// Get the lists
$(iqQuery).find('list').each(function() {
Privacy.get($(this).attr('name'));
});
Console.log('Received privacy lists push: ' + iqFrom);
} catch(e) {
Console.error('IQ._handlePrivacyLists', e);
@ -178,15 +178,15 @@ var IQ = (function () {
try {
// REF : http://xmpp.org/extensions/xep-0092.html
// Roster push
con.send(iqResponse);
// Get the values
$(iqQuery).find('item').each(function() {
Roster.parse($(this), 'presence');
});
Console.log('Received roster push: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleRosterPush', e);
@ -207,7 +207,7 @@ var IQ = (function () {
try {
// Open a new notification
Notification.create('rosterx', iqFrom, [iqNode], '');
Console.log('Roster Item Exchange from: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleRosterItemExchange', e);
@ -227,9 +227,9 @@ var IQ = (function () {
try {
/* REF: http://xmpp.org/extensions/xep-0030.html */
iqQuery = iqResponse.setQuery(NS_DISCO_INFO);
// We set the name of the client
iqQuery.appendChild(iqResponse.buildNode('identity', {
'category': Caps.disco_infos.identity.category,
@ -237,16 +237,16 @@ var IQ = (function () {
'name': Caps.disco_infos.identity.name,
'xmlns': NS_DISCO_INFO
}));
// We set all the supported features
var disco_infos = Caps.myDiscoInfos();
$.each(disco_infos, function(i, disco_info) {
iqQuery.appendChild(iqResponse.buildNode('feature', {'var': disco_info, 'xmlns': NS_DISCO_INFO}));
});
con.send(iqResponse);
Console.log('Received disco#infos query: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleDiscoInfo', e);
@ -266,7 +266,7 @@ var IQ = (function () {
try {
/* REF: http://xmpp.org/extensions/xep-0202.html */
var iqTime = iqResponse.appendNode('time', {
'xmlns': NS_URN_TIME
});
@ -278,9 +278,9 @@ var IQ = (function () {
iqTime.appendChild(iqResponse.buildNode('utc', {
'xmlns': NS_URN_TIME
}, DateUtils.getXMPPTime('utc')));
con.send(iqResponse);
Console.log('Received local time query: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleUserTime', e);
@ -300,9 +300,9 @@ var IQ = (function () {
try {
/* REF: http://xmpp.org/extensions/xep-0199.html */
con.send(iqResponse);
Console.log('Received a ping: ' + iqFrom);
} catch(e) {
Console.error('IQ._handlePing', e);
@ -321,9 +321,9 @@ var IQ = (function () {
try {
/* REF: http://xmpp.org/extensions/xep-0166.html */
// Handled via JSJaCJingle.route() (see above)
Console.log('Received a Jingle packet: ' + iqFrom);
} catch(e) {
Console.error('IQ._handleJingle', e);
@ -345,19 +345,19 @@ var IQ = (function () {
try {
// Change IQ type
iqResponse.setType('error');
// Append stanza content
for(var c = 0; c < iqNode.childNodes.length; c++) {
iqResponse.getNode().appendChild(iqNode.childNodes.item(c).cloneNode(true));
}
// Append error content
var iqError = iqResponse.appendNode('error', {'xmlns': NS_CLIENT, 'code': '501', 'type': 'cancel'});
iqError.appendChild(iqResponse.buildNode('feature-not-implemented', {'xmlns': NS_STANZAS}));
iqError.appendChild(iqResponse.buildNode('text', {'xmlns': NS_STANZAS}, Common._e("The feature requested is not implemented by the recipient or server and therefore cannot be processed.")));
con.send(iqResponse);
Console.log('Received an unsupported IQ query from: ' + iqFrom);
} catch(e) {
Console.error('IQ._raiseNotImplemented', e);
@ -385,56 +385,56 @@ var IQ = (function () {
// Build the response
var iqResponse = new JSJaCIQ();
iqResponse.setID(iqID);
iqResponse.setTo(iqFrom);
iqResponse.setType('result');
// OOB request
if((iqQueryXMLNS == NS_IQOOB) && (iqType == 'set')) {
self._handleOOBRequest(iqFrom, iqID, iqNode);
}
// OOB reply
else if(DataStore.getDB(Connection.desktop_hash, 'send/url', iqID)) {
self._handleOOBReply(iqResponse, iqFrom, iqType, iqID, iqNode);
}
// Software version query
else if((iqQueryXMLNS == NS_VERSION) && (iqType == 'get')) {
self._handleSoftwareVersion(iqResponse, iqFrom);
}
// Last activity query
else if((iqQueryXMLNS == NS_LAST) && (iqType == 'get')) {
self._handleLastActivity(iqResponse, iqFrom);
}
// Privacy lists push
else if((iqQueryXMLNS == NS_PRIVACY) && (iqType == 'set') && Common.isSafeStanza(iq)) {
self._handlePrivacyLists(iqResponse, iqFrom, iqQuery);
}
// Roster push
else if((iqQueryXMLNS == NS_ROSTER) && (iqType == 'set') && Common.isSafeStanza(iq)) {
self._handleRosterPush(iqResponse, iqFrom, iqQuery);
}
// Roster Item Exchange query
else if($(iqNode).find('x[xmlns="' + NS_ROSTERX + '"]').size()) {
self._handleRosterItemExchange(iqNode, iqFrom);
}
// Disco info query
else if((iqQueryXMLNS == NS_DISCO_INFO) && (iqType == 'get')) {
self._handleDiscoInfo(iqResponse, iqFrom);
}
// User time query
else if($(iqNode).find('time').size() && (iqType == 'get')) {
self._handleUserTime(iqResponse, iqFrom);
}
// Ping
else if($(iqNode).find('ping').size() && (iqType == 'get')) {
self._handlePing(iqResponse, iqFrom);
@ -444,7 +444,7 @@ var IQ = (function () {
else if($(iqNode).find('jingle').size()) {
self._handleJingle(iqFrom);
}
// Not implemented
else if(!$(iqNode).find('error').size() && ((iqType == 'get') || (iqType == 'set'))) {
self._raiseNotImplemented(iqResponse, iqNode, iqFrom);

View file

@ -63,9 +63,10 @@ var Jingle = (function() {
* @param hash
* @param local_view
* @param remote_view
* @param [sid]
* @return {object}
*/
self._args = function(connection, xid, hash, media, local_view, remote_view) {
self._args = function(connection, xid, hash, media, local_view, remote_view, sid) {
args = {};
@ -107,19 +108,30 @@ var Jingle = (function() {
} else {
// Incoming call?
if(jingle.is_responder()) {
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
Common.bareXID(jingle.get_to()),
('call_' + jingle.get_media()),
jingle.get_media()
);
// Auto-accept (we previously accepted the associated broadcast request)
if(Call.call_auto_accept.from == jingle.get_to() && Call.call_auto_accept.sid == jingle.get_sid()) {
Call.call_auto_accept.from = null;
Call.call_auto_accept.sid = null;
// Play ringtone
// Hard-fix: avoids the JSJaC packets group timer (that will delay success reply)
setTimeout(function() {
Audio.play('incoming-call', true);
jingle.info(JSJAC_JINGLE_SESSION_INFO_RINGING);
}, 250);
// Delay acceptance (status change is delayed)
setTimeout(function() {
jingle.accept();
}, 250);
} else {
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
Common.bareXID(jingle.get_to()),
('call_' + jingle.get_media()),
jingle.get_media()
);
// Play ringtone
// Hard-fix: avoids the JSJaC packets group timer (that will delay success reply)
setTimeout(function() {
Audio.play('incoming-call', true);
jingle.info(JSJAC_JINGLE_SESSION_INFO_RINGING);
}, 250);
}
} else {
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
@ -132,7 +144,7 @@ var Jingle = (function() {
Audio.play('outgoing-call', true);
}
}
Console.log('Jingle._args', 'session_initiate_success');
},
@ -258,7 +270,11 @@ var Jingle = (function() {
},
session_terminate_error: function(jingle, stanza) {
// Ensure we this is the same call session ID (SID)
if(typeof jingle.parent != 'undefined') {
jingle = jingle.parent;
}
// Ensure we this is the same call session ID (SID)
if(self._session.get_sid() == jingle.get_sid()) {
if(self._bypass_termination_notify !== true) {
self._reset();
@ -317,6 +333,10 @@ var Jingle = (function() {
Console.log('Jingle._args', 'session_terminate_request');
}
};
if(sid && typeof sid == 'string') {
args.sid = sid;
}
} catch(e) {
Console.error('Jingle._args', e);
} finally {
@ -333,9 +353,10 @@ var Jingle = (function() {
* @param mode
* @param is_callee
* @param stanza
* @param [sid]
* @return {boolean}
*/
self._new = function(xid, mode, is_callee, stanza) {
self._new = function(xid, mode, is_callee, stanza, sid) {
var status = false;
@ -379,7 +400,8 @@ var Jingle = (function() {
bare_hash,
media,
jingle_sel.find('.local_video video')[0],
jingle_sel.find('.remote_video video')[0]
jingle_sel.find('.remote_video video')[0],
sid
);
self._session = new JSJaCJingle.session(JSJAC_JINGLE_SESSION_SINGLE, args);
@ -462,8 +484,11 @@ var Jingle = (function() {
self.start = function(xid, mode) {
try {
if(!Call.is_ongoing()) {
self._new(xid, mode);
// Remote user supports XEP-0353
if(Caps.getFeatureResource(xid, NS_JINGLE_MESSAGE)) {
Jingle.propose(xid, mode);
} else {
Jingle.initialize(xid, mode);
}
} catch(e) {
Console.error('Jingle.start', e);
@ -474,6 +499,115 @@ var Jingle = (function() {
};
/**
* Initializes a Jingle call
* @public
* @param {string} xid
* @param {string} mode
* @return {boolean}
*/
self.initialize = function(xid, mode) {
try {
if(!Call.is_ongoing()) {
Console.info('Jingle.initialize', 'Initiating call with: ' + xid);
self._new(xid, mode);
}
} catch(e) {
Console.error('Jingle.initialize', e);
} finally {
return false;
}
};
/**
* Proposes a Jingle call
* @public
* @param {string} xid
* @param {string} mode
* @return {boolean}
*/
self.propose = function(xid, mode) {
try {
if(!Call.is_ongoing()) {
Console.info('Jingle.propose', 'Proposing call to: ' + xid);
var medias = [JSJAC_JINGLE_MEDIA_AUDIO];
if(mode == 'video') {
medias.push(JSJAC_JINGLE_MEDIA_VIDEO);
}
var call_id = JSJaCJingleBroadcast.propose(
xid, medias,
function(id) {
// Timeout
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
xid,
'broadcast_timeout',
mode
);
// Retract
JSJaCJingleBroadcast.retract(xid, id);
}
);
// Send directed presence? (for CAPS, XEP-compliant)
if(!Common.exists('#roster .buddy[data-xid="' + escape(xid) + '"]')) {
Presence.send(xid);
}
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
xid,
'broadcast_proposing',
mode,
null,
{
call_id: call_id
}
);
}
} catch(e) {
Console.error('Jingle.propose', e);
} finally {
return false;
}
};
/**
* Follows up a Jingle call (from broadcast)
* @public
* @param {string} xid
* @param {string} mode
* @param {string} sid
* @return {boolean}
*/
self.follow_up = function(xid, mode, sid) {
try {
if(!Call.is_ongoing()) {
self._new(xid, mode, false, null, sid);
}
} catch(e) {
Console.error('Jingle.follow_up', e);
} finally {
return false;
}
};
/**
* Reset current Jingle call
* @public
@ -503,9 +637,10 @@ var Jingle = (function() {
/**
* Stops current Jingle call
* @public
* @param {boolean} abort
* @return {boolean}
*/
self.stop = function() {
self.stop = function(abort) {
try {
// Reset interface
@ -514,7 +649,13 @@ var Jingle = (function() {
// Stop Jingle session
if(self._session !== null) {
self._call_ender = 'local';
self._session.terminate();
if(abort === true) {
self._session.abort();
self._session.get_session_terminate_error(self._session, null);
} else {
self._session.terminate();
}
Console.debug('Stopping current Jingle call...');
} else {
@ -577,10 +718,10 @@ var Jingle = (function() {
in_call = false;
try {
if(self._session &&
(self._session.get_status() === JSJAC_JINGLE_STATUS_INITIATING ||
self._session.get_status() === JSJAC_JINGLE_STATUS_INITIATED ||
self._session.get_status() === JSJAC_JINGLE_STATUS_ACCEPTING ||
if(self._session &&
(self._session.get_status() === JSJAC_JINGLE_STATUS_INITIATING ||
self._session.get_status() === JSJAC_JINGLE_STATUS_INITIATED ||
self._session.get_status() === JSJAC_JINGLE_STATUS_ACCEPTING ||
self._session.get_status() === JSJAC_JINGLE_STATUS_ACCEPTED ||
self._session.get_status() === JSJAC_JINGLE_STATUS_TERMINATING)) {
in_call = true;
@ -651,6 +792,55 @@ var Jingle = (function() {
self._notify_map = function() {
try {
var broadcast_media_fn = function(xid, mode, attrs) {
JSJaCJingleBroadcast.accept(
attrs.full_xid, attrs.call_id, attrs.medias
);
// Send directed presence? (for CAPS, XEP-compliant)
if(!Common.exists('#roster .buddy[data-xid="' + escape(xid) + '"]')) {
Presence.send(attrs.full_xid);
}
// Marker to auto-accept call later
Call.call_auto_accept.from = attrs.full_xid;
Call.call_auto_accept.sid = attrs.call_id;
var medias_arr = [];
for(var cur_media in attrs.medias) {
medias_arr.push(cur_media);
}
Audio.stop('incoming-call');
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
xid,
'broadcast_wait',
medias_arr
);
// Schedule timeout (in case we don't receive the Jingle initialization stanza)
setTimeout(function() {
if(self._session !== null &&
Call.call_auto_accept.sid == self._session.get_sid() &&
self._session.get_status() !== JSJAC_JINGLE_STATUS_INACTIVE) {
// Call received
Call.call_auto_accept.from = null;
Call.call_auto_accept.sid = null;
} else {
// Reset UI (timeout)
Call.notify(
JSJAC_JINGLE_SESSION_SINGLE,
xid,
'broadcast_error',
medias_arr
);
}
}, (JSJAC_JINGLE_BROADCAST_TIMEOUT * 1000));
};
return {
'call_audio': {
'text': Common._e("Is calling you"),
@ -700,6 +890,104 @@ var Jingle = (function() {
}
},
'broadcast_audio': {
'text': Common._e("Is calling you"),
'buttons': {
'accept': {
'text': Common._e("Accept"),
'color': 'green',
'cb': broadcast_media_fn
},
'decline': {
'text': Common._e("Decline"),
'color': 'red',
'cb': function(xid, mode, attrs) {
JSJaCJingleBroadcast.reject(
attrs.full_xid, attrs.call_id, attrs.medias
);
Audio.stop('incoming-call');
}
}
}
},
'broadcast_video': {
'text': Common._e("Is calling you"),
'buttons': {
'accept': {
'text': Common._e("Accept"),
'color': 'green',
'cb': broadcast_media_fn
},
'decline': {
'text': Common._e("Decline"),
'color': 'red',
'cb': function(xid, mode, attrs) {
JSJaCJingleBroadcast.reject(
attrs.full_xid, attrs.call_id, attrs.medias
);
Audio.stop('incoming-call');
}
}
}
},
'broadcast_wait': {
'text': Common._e("Waiting...")
},
'broadcast_proposing': {
'text': Common._e("Proposing call..."),
'buttons': {
'cancel': {
'text': Common._e("Cancel"),
'color': 'red',
'cb': function(xid, mode, attrs) {
// Retract from call
JSJaCJingleBroadcast.retract(
xid,
attrs.call_id
);
}
}
}
},
'broadcast_timeout': {
'text': Common._e("No answer"),
'buttons': {
'okay': {
'text': Common._e("Okay"),
'color': 'blue',
'cb': function(xid, mode) {
self._reset();
}
}
}
},
'broadcast_error': {
'text': Common._e("Call error"),
'buttons': {
'cancel': {
'text': Common._e("Cancel"),
'color': 'red',
'cb': function(xid, mode) {
self._reset();
}
}
}
},
'initiating': {
'text': Common._e("Initiating call"),
@ -892,43 +1180,43 @@ var Jingle = (function() {
// Create DOM
$('body').append(
'<div id="jingle" class="videochat_box lock removable ' + hex_md5(xid) + '" data-xid="' + Common.encodeQuotes(xid) + '" data-mode="' + Common.encodeQuotes(mode) + '">' +
'<div class="videobox videochat_items">' +
'<div class="topbar">' +
'<div class="card">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<div id="jingle" class="videochat_box lock removable ' + hex_md5(xid) + '" data-xid="' + Common.encodeQuotes(xid) + '" data-mode="' + Common.encodeQuotes(mode) + '">' +
'<div class="videobox videochat_items">' +
'<div class="topbar">' +
'<div class="card">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<div class="identity">' +
'<span class="name">' + Name.getBuddy(xid).htmlEnc() + '</span>' +
'<span class="xid">' + xid.htmlEnc() + '</span>' +
'</div>' +
'</div>' +
'<div class="identity">' +
'<span class="name">' + Name.getBuddy(xid).htmlEnc() + '</span>' +
'<span class="xid">' + xid.htmlEnc() + '</span>' +
'</div>' +
'</div>' +
'<div class="controls">' +
'<a href="#" class="stop control-button" data-type="stop"><span class="icon call-images"></span>' + Common._e("Stop") + '</a>' +
'<a href="#" class="mute control-button" data-type="mute"><span class="icon call-images"></span>' + Common._e("Mute") + '</a>' +
'<a href="#" class="unmute control-button" data-type="unmute"><span class="icon call-images"></span>' + Common._e("Unmute") + '</a>' +
'</div>' +
'<div class="controls">' +
'<a href="#" class="stop control-button" data-type="stop"><span class="icon call-images"></span>' + Common._e("Stop") + '</a>' +
'<a href="#" class="mute control-button" data-type="mute"><span class="icon call-images"></span>' + Common._e("Mute") + '</a>' +
'<a href="#" class="unmute control-button" data-type="unmute"><span class="icon call-images"></span>' + Common._e("Unmute") + '</a>' +
'</div>' +
'<div class="elapsed">00:00:00</div>' +
'<div class="elapsed">00:00:00</div>' +
'<div class="actions">' +
'<a href="#" class="close action-button call-images" data-type="close"></a>' +
'</div>' +
'</div>' +
'<div class="actions">' +
'<a href="#" class="close action-button call-images" data-type="close"></a>' +
'</div>' +
'</div>' +
'<div class="local_video">' +
'<video src="" alt="" poster="' + './images/placeholders/jingle_video_local.png' + '"></video>' +
'</div>' +
'<div class="local_video">' +
'<video src="" alt="" poster="' + './images/placeholders/jingle_video_local.png' + '"></video>' +
'</div>' +
'<div class="remote_video">' +
'<video src="" alt="" poster="' + './images/placeholders/jingle_video_remote.png' + '"></video>' +
'</div>' +
'<div class="remote_video">' +
'<video src="" alt="" poster="' + './images/placeholders/jingle_video_remote.png' + '"></video>' +
'</div>' +
'<div class="branding call-images"></div>' +
'</div>' +
'<div class="branding call-images"></div>' +
'</div>' +
'</div>'
);
@ -1044,7 +1332,7 @@ var Jingle = (function() {
} catch(e) {
Console.error('Jingle.launch', e);
}
};
@ -1055,4 +1343,4 @@ var Jingle = (function() {
})();
Jingle.launch();
Jingle.launch();

View file

@ -72,7 +72,7 @@ feature.formdata = window.FormData !== undefined;
var hasProp = !!$.fn.prop;
// attr2 uses prop when it can but checks the return type for
// an expected string. this accounts for the case where a form
// an expected string. this accounts for the case where a form
// contains inputs with names like "action" or "method"; in those
// cases "prop" returns the element
$.fn.attr2 = function() {
@ -461,7 +461,7 @@ $.fn.ajaxSubmit = function(options) {
var CLIENT_TIMEOUT_ABORT = 1;
var SERVER_ABORT = 2;
function getDoc(frame) {
/* it looks like contentWindow or contentDocument do not
* carry the protocol property in ie8, when running under ssl
@ -469,9 +469,9 @@ $.fn.ajaxSubmit = function(options) {
* the protocol is know but not on the other two objects. strange?
* "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
*/
var doc = null;
// IE8 cascading access check
try {
if (frame.contentWindow) {
@ -507,8 +507,8 @@ $.fn.ajaxSubmit = function(options) {
// take a breath so that pending repaints get some cpu time before the upload starts
function doSubmit() {
// make sure form attrs are set
var t = $form.attr2('target'),
a = $form.attr2('action'),
var t = $form.attr2('target'),
a = $form.attr2('action'),
mp = 'multipart/form-data',
et = $form.attr('enctype') || $form.attr('encoding') || mp;
@ -619,7 +619,7 @@ $.fn.ajaxSubmit = function(options) {
if (xhr.aborted || callbackProcessed) {
return;
}
doc = getDoc(io);
if(!doc) {
log('cannot access response document');

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@ Authors: Stefan Strigler, Valérian Saliou, Zash, Maranda
/**
* @fileoverview Magic dependency loading. Taken from script.aculo.us
* and modified to break it.
* @author Stefan Strigler steve@zeank.in-berlin.de
* @author Stefan Strigler steve@zeank.in-berlin.de
* @version 1.3
*/
@ -68,18 +68,18 @@ XmlHttp.create = function () {
// Able to use CORS?
if (window.XMLHttpRequest) {
var req = new XMLHttpRequest();
if (req.withCredentials !== undefined)
return req;
}
// Fallback on JSONP
return new jXHR();
}
// Might be local-domain?
if (window.XMLHttpRequest) {
var req = new XMLHttpRequest();
// some versions of Moz do not support the readyState property
// and the onreadystate event so we patch it!
if (req.readyState == null) {
@ -90,7 +90,7 @@ XmlHttp.create = function () {
req.onreadystatechange();
}, false);
}
return req;
}
if (window.ActiveXObject) {
@ -109,7 +109,7 @@ XmlHttp.create = function () {
XmlHttp.getPrefix = function() {
if (XmlHttp.prefix) // I know what you did last summer
return XmlHttp.prefix;
var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
var o;
for (var i = 0; i < prefixes.length; i++) {
@ -120,7 +120,7 @@ XmlHttp.getPrefix = function() {
}
catch (ex) {};
}
throw new Error("Could not find an installed XML parser");
};
@ -153,7 +153,7 @@ XmlDocument.create = function (name,ns) {
} else if (window.ActiveXObject) {
doc = new ActiveXObject(XmlDocument.getPrefix() + ".DomDocument");
}
if (!doc.documentElement || doc.documentElement.tagName != name ||
(doc.documentElement.namespaceURI &&
doc.documentElement.namespaceURI != ns)) {
@ -165,7 +165,7 @@ XmlDocument.create = function (name,ns) {
doc.appendChild(doc.createElement(name));
} catch (dex) {
doc = document.implementation.createDocument(ns,name,null);
if (doc.documentElement == null)
doc.appendChild(doc.createElement(name));
@ -176,7 +176,7 @@ XmlDocument.create = function (name,ns) {
}
}
}
return doc;
}
catch (ex) { }
@ -201,7 +201,7 @@ XmlDocument.getPrefix = function() {
}
catch (ex) {};
}
throw new Error("Could not find an installed XML parser");
};
@ -215,14 +215,14 @@ if (typeof(Document) != 'undefined' && window.DOMParser) {
* @private
*/
Document.prototype.loadXML = function (s) {
// parse the string to a new doc
var doc2 = (new DOMParser()).parseFromString(s, "text/xml");
// remove all initial children
while (this.hasChildNodes())
this.removeChild(this.lastChild);
// insert and import nodes
for (var i = 0; i < doc2.childNodes.length; i++) {
this.appendChild(this.importNode(doc2.childNodes[i], true));
@ -331,10 +331,10 @@ Date.jab2date = function(ts) {
// Timestamp
if(!isNaN(ts))
return new Date(ts * 1000);
// Get the UTC date
var date = new Date(Date.UTC(ts.substr(0,4),ts.substr(5,2)-1,ts.substr(8,2),ts.substr(11,2),ts.substr(14,2),ts.substr(17,2)));
if (ts.substr(ts.length-6,1) != 'Z') { // there's an offset
var date_offset = date.getTimezoneOffset() * 60 * 1000;
var offset = new Date();
@ -367,7 +367,7 @@ Date.hrTime = function(ts) {
if (!Date.now) {
Date.now = function() { return new Date().getTime(); }
}
/**
* somewhat opposit to {@link #hrTime}
* expects a javascript Date object as parameter and returns a jabber
@ -1085,7 +1085,7 @@ function utf8t2d(t)
}
return d;
}
// returns plaintext from an array of bytesrepresenting dezimal numbers, which
// represent an UTF-8 encoded text; browser which does not understand unicode
// like NN401 will show "?"-signs instead
@ -1203,7 +1203,7 @@ function cnonce(size) {
JSJAC_HAVEKEYS = true; // whether to use keys
JSJAC_NKEYS = 16; // number of keys to generate
JSJAC_INACTIVITY = 300; // qnd hack to make suspend/resume
JSJAC_INACTIVITY = 300; // qnd hack to make suspend/resume
// work more smoothly with polling
JSJAC_ERR_COUNT = 10; // number of retries in case of connection
// errors
@ -1227,7 +1227,7 @@ JSJAC_REGID_TIMEOUT = 20000; // time in msec until registered
JSJACHBC_MAX_HOLD = 1; // default for number of connctions
// held by connection manager
JSJACHBC_MAX_WAIT = 300; // default 'wait' param - how long an
JSJACHBC_MAX_WAIT = 20; // default 'wait' param - how long an
// idle connection should be held by
// connection manager
@ -1290,7 +1290,7 @@ JSJaCJSON.toString = function (obj) {
a[a.length] = v;
b = true;
}
} catch(e) {
} catch(e) {
}
}
}
@ -1331,7 +1331,7 @@ JSJaCJSON.toString = function (obj) {
}
}
}
a[a.length] = '}';
return a.join('');
}
@ -1359,7 +1359,7 @@ switch (typeof(obj)) {
return s.object(obj);
case 'array':
return s.array(obj);
}
};
@ -2499,7 +2499,7 @@ function JSJaCError(code,type,condition) {
* @constructor
* @param {Function} func The hash function to be used for creating the keys
* @param {Debugger} oDbg Reference to debugger implementation [optional]
*/
*/
function JSJaCKeys(func,oDbg) {
var seed = Math.random();
@ -2748,30 +2748,30 @@ JSJaCConnection.prototype.connected = function() { return this._connected; };
*/
JSJaCConnection.prototype.disconnect = function() {
this._setStatus('disconnecting');
if (!this.connected())
return;
this._connected = false;
clearInterval(this._interval);
clearInterval(this._inQto);
if (this._timeout)
clearTimeout(this._timeout); // remove timer
var slot = this._getFreeSlot();
// Intentionally synchronous
this._req[slot] = this._setupRequest(false);
request = this._getRequestString(false, true);
this.oDbg.log("Disconnecting: " + request,4);
this._req[slot].r.send(request);
try {
DataStore.removeDB(MINI_HASH, 'jsjac', 'state');
} catch (e) {}
this.oDbg.log("Disconnected: "+this._req[slot].r.responseText,2);
this._handleEvent('ondisconnect');
};
@ -3116,7 +3116,7 @@ JSJaCConnection.prototype.status = function() { return this._status; };
*/
JSJaCConnection.prototype.suspend = function(has_pause) {
var data = this.suspendToData(has_pause);
try {
var c = DataStore.setDB(MINI_HASH, 'jsjac', 'state', JSJaCJSON.toString(data));
return c;
@ -3133,7 +3133,7 @@ JSJaCConnection.prototype.suspend = function(has_pause) {
* @type Object
*/
JSJaCConnection.prototype.suspendToData = function(has_pause) {
// remove timers
if(has_pause) {
clearTimeout(this._timeout);
@ -3142,7 +3142,7 @@ JSJaCConnection.prototype.suspendToData = function(has_pause) {
this._suspend();
}
var u = ('_connected,_keys,_ID,_inQ,_pQueue,_regIDs,_errcnt,_inactivity,domain,username,resource,jid,fulljid,_sid,_httpbase,_timerval,_is_polling').split(',');
u = u.concat(this._getSuspendVars());
var s = new Object();
@ -3159,12 +3159,12 @@ JSJaCConnection.prototype.suspendToData = function(has_pause) {
s[u[i]] = o;
}
if(has_pause) {
this._connected = false;
this._setStatus('suspending');
}
return s;
};
@ -3680,7 +3680,7 @@ JSJaCConnection.prototype._parseStreamFeatures = function(doc) {
this._handleEvent('ondisconnect');
return false;
}
this.mechs = new Object();
var lMec1 = doc.getElementsByTagName("mechanisms");
this.has_sasl = false;
@ -3699,7 +3699,7 @@ JSJaCConnection.prototype._parseStreamFeatures = function(doc) {
this.oDbg.log("No support for SASL detected",2);
return false;
}
// Get the server CAPS (if available)
this.server_caps=null;
var sCaps = doc.getElementsByTagName("c");
@ -3707,7 +3707,7 @@ JSJaCConnection.prototype._parseStreamFeatures = function(doc) {
var c_sCaps=sCaps.item(i);
var x_sCaps=c_sCaps.getAttribute("xmlns");
var v_sCaps=c_sCaps.getAttribute("ver");
if ((x_sCaps == NS_CAPS) && v_sCaps) {
this.server_caps=v_sCaps;
break;
@ -3719,7 +3719,7 @@ JSJaCConnection.prototype._parseStreamFeatures = function(doc) {
if (doc.getElementsByTagName("session")) {
this.legacy_sessions=true;
}
return true;
};
@ -4162,13 +4162,13 @@ JSJaCHttpBindingConnection.prototype._getStreamID = function(req) {
return;
}
var body = req.responseXML.documentElement;
// any session error?
if(body.getAttribute('type') == 'terminate') {
this._handleEvent('onerror',JSJaCError('503','cancel','service-unavailable'));
return;
}
// extract stream id used for non-SASL authentication
if (body.getAttribute('authid')) {
this.streamid = body.getAttribute('authid');
@ -4444,7 +4444,7 @@ JSJaCHttpBindingConnection.prototype._reInitStreamWait = function(req, cb) {
var featuresNL = doc.getElementsByTagName('stream:features');
for (var i=0, l=featuresNL.length; i<l; i++) {
if (featuresNL.item(i).namespaceURI == 'http://etherx.jabber.org/streams' ||
featuresNL.item(i).getAttribute('xmlns') ==
featuresNL.item(i).getAttribute('xmlns') ==
'http://etherx.jabber.org/streams') {
var features = featuresNL.item(i);
break;
@ -4454,7 +4454,7 @@ JSJaCHttpBindingConnection.prototype._reInitStreamWait = function(req, cb) {
var bind = features.getElementsByTagName('bind');
for (var i=0, l=bind.length; i<l; i++) {
if (bind.item(i).namespaceURI == 'urn:ietf:params:xml:ns:xmpp-bind' ||
bind.item(i).getAttribute('xmlns') ==
bind.item(i).getAttribute('xmlns') ==
'urn:ietf:params:xml:ns:xmpp-bind') {
bind = bind.item(i);
break;
@ -4464,7 +4464,7 @@ JSJaCHttpBindingConnection.prototype._reInitStreamWait = function(req, cb) {
}
this.oDbg.log(features);
this.oDbg.log(bind);
if (features) {
if (bind) {
cb();

View file

@ -8,16 +8,16 @@
var SETTIMEOUT = global.setTimeout, // for better compression
doc = global.document,
callback_counter = 0;
global.jXHR = function() {
var script_url,
script_loaded,
jsonp_callback,
scriptElem,
publicAPI = null;
function removeScript() { try { scriptElem.parentNode.removeChild(scriptElem); } catch (err) { } }
function reset() {
script_loaded = false;
script_url = "";
@ -25,12 +25,12 @@
scriptElem = null;
fireReadyStateChange(0);
}
function ThrowError(msg) {
try {
publicAPI.onerror.call(publicAPI,msg,script_url);
} catch (err) {
//throw new Error(msg);
try {
publicAPI.onerror.call(publicAPI,msg,script_url);
} catch (err) {
//throw new Error(msg);
}
}
@ -41,7 +41,7 @@
if (publicAPI.readyState !== 4) ThrowError("handleScriptLoad: Script failed to load ["+script_url+"].");
removeScript();
}
function parseXMLString(xmlStr) {
var xmlDoc = null;
if(window.DOMParser) {
@ -49,15 +49,15 @@
xmlDoc = parser.parseFromString(xmlStr,"text/xml");
}
else {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xmlStr);
}
return xmlDoc;
}
function fireReadyStateChange(rs,args) {
args = args || [];
publicAPI.readyState = rs;
if (rs == 4) {
@ -66,7 +66,7 @@
}
if (typeof publicAPI.onreadystatechange === "function") publicAPI.onreadystatechange.apply(publicAPI,args);
}
publicAPI = {
onerror:null,
onreadystatechange:null,
@ -80,10 +80,10 @@
var internal_callback = "cb"+(callback_counter++);
(function(icb){
global.jXHR[icb] = function() {
try { fireReadyStateChange.call(publicAPI,4,arguments); }
catch(err) {
try { fireReadyStateChange.call(publicAPI,4,arguments); }
catch(err) {
publicAPI.readyState = -1;
ThrowError("Script failed to run ["+script_url+"].");
ThrowError("Script failed to run ["+script_url+"].");
}
global.jXHR[icb] = null;
};
@ -110,7 +110,7 @@
};
reset();
return publicAPI;
};
})(window);

View file

@ -32,33 +32,33 @@ var Links = (function () {
try {
var target;
// Links style
if(!style) {
style = '';
} else {
style = ' style="' + style + '"';
}
// Open in new tabs
if(mode != 'xhtml-im') {
target = ' target="_blank"';
} else {
target = '';
}
// XMPP address
string = string.replace(
/(\s|<br \/>|^)(([a-zA-Z0-9\._-]+)@([a-zA-Z0-9\.\/_-]+))(,|\s|$)/gi,
'$1<a href="xmpp:$2" target="_blank"' + style + '>$2</a>$5'
);
// Simple link
string = string.replace(
/(\s|<br \/>|^|\()((https?|ftp|file|xmpp|irc|mailto|vnc|webcal|ssh|ldap|smb|magnet|spotify)(:)([^<>'"\s\)]+))/gim,
'$1<a href="$2"' + target + style + '>$2</a>'
);
return string;
} catch(e) {
Console.error('Links.apply', e);

View file

@ -49,7 +49,7 @@ var MAM = (function () {
try {
// Lock the archiving options
$('#archiving').attr('disabled', true);
// Get the archiving configuration
var iq = new JSJaCIQ();
iq.setType('get');
@ -146,7 +146,7 @@ var MAM = (function () {
for(var c in args) {
if(args[c]) purge.appendChild(iq.buildNode(c, {'xmlns': NS_METRONOME_MAM_PURGE}, args[c]));
}
con.send(iq, function(iq) {
if(iq.getType() == 'result') {
Console.info('Archives purged (MAM).');
@ -253,7 +253,7 @@ var MAM = (function () {
// Create MAM messages target
var target_html = '<div class="mam-chunk" data-start="' + Common.encodeQuotes(start_stamp) + '" data-end="' + Common.encodeQuotes(start_end) + '"></div>';
var target_content_sel = $('#' + hex_md5(res_with) + ' .content');
var target_wait_sel = target_content_sel.find('.wait-mam');
@ -347,7 +347,7 @@ var MAM = (function () {
time = DateUtils.relative(delay);
stamp = DateUtils.extractStamp(Date.jab2date(delay));
}
// Last-minute checks before display
if(time && stamp) {
var mam_chunk_path = '#' + hash + ' .mam-chunk';

View file

@ -242,13 +242,13 @@ var Markers = (function () {
* @public
* @param {string} from
* @param {object} message
* @param {boolean} is_mam_marker
* @param {boolean} is_mam_marker
* @return {undefined}
*/
self.handle = function(from, message, is_mam_marker) {
self.handle = function(from, message, is_mam_marker, is_groupchat_user) {
try {
var xid = Common.bareXID(from);
var xid = ((is_groupchat_user !== true && Common.bareXID(from)) || from);
var marker_sel = $(message).find('[xmlns="' + NS_URN_MARKERS + '"]');
if(marker_sel.size()) {
@ -319,7 +319,7 @@ var Markers = (function () {
if(target.is(':disabled')) {
return;
}
// Send displayed message marker?
if(type == 'chat' && self.hasSupport(xid) === true) {
var last_message = $('#' + hash + ' .content .one-line.user-message[data-markable="true"]:last');

View file

@ -18,7 +18,7 @@ var Me = (function () {
* @private
*/
var self = {};
/**
* Opens the Me tools
@ -29,32 +29,32 @@ var Me = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Public profile") + '</div>' +
'<div class="content">' +
'<a class="me-images logo" href="https://me.jappix.com/" target="_blank"></a>' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Your profile anywhere on the Web.") + '</p>' +
'<p>' + Common.printf(Common._e("%s is a Jappix.com service which makes your XMPP profile public. It is easier to share it. No XMPP account is required to view your social channel, your current position and your contact details."), '<a href="https://me.jappix.com/" target="_blank">Jappix Me</a>') + '</p>' +
'<p>' + Common._e("Furthermore, every picture you post in your social channel is added to a beautiful picture timeline. You can now view the pictures you shared year by year.") + '</p>' +
'<p>' + Common._e("You can also use your XMPP avatar as a single avatar for every website, blog and forum you use. When you change it on XMPP, the new avatar appears everywhere. What a genius improvement!") + '</p>' +
'</div>' +
'<a class="go one-button" href="https://me.jappix.com/new" target="_blank">' + Common._e("Yay, let's create your public profile!") + '</a>' +
'</div>' +
'<div class="bottom">' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
var html =
'<div class="top">' + Common._e("Public profile") + '</div>' +
'<div class="content">' +
'<a class="me-images logo" href="https://me.jappix.com/" target="_blank"></a>' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Your profile anywhere on the Web.") + '</p>' +
'<p>' + Common.printf(Common._e("%s is a Jappix.com service which makes your XMPP profile public. It is easier to share it. No XMPP account is required to view your social channel, your current position and your contact details."), '<a href="https://me.jappix.com/" target="_blank">Jappix Me</a>') + '</p>' +
'<p>' + Common._e("Furthermore, every picture you post in your social channel is added to a beautiful picture timeline. You can now view the pictures you shared year by year.") + '</p>' +
'<p>' + Common._e("You can also use your XMPP avatar as a single avatar for every website, blog and forum you use. When you change it on XMPP, the new avatar appears everywhere. What a genius improvement!") + '</p>' +
'</div>' +
'<a class="go one-button" href="https://me.jappix.com/new" target="_blank">' + Common._e("Yay, let's create your public profile!") + '</a>' +
'</div>' +
'<div class="bottom">' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
'</div>';
// Create the popup
Popup.create('me', html);
// Associate the events
self.instance();
Console.log('Public profile tool opened.');
} catch(e) {
Console.error('Me.open', e);
@ -73,7 +73,7 @@ var Me = (function () {
try {
// Destroy the popup
Popup.destroy('me');
// We finished
Welcome.is_done = false;
} catch(e) {
@ -99,7 +99,7 @@ var Me = (function () {
me_sel.find('.content a.go').click(function() {
self.close();
});
me_sel.find('.bottom .finish').click(self.close);
} catch(e) {
Console.error('Me.instance', e);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -31,20 +31,20 @@ var Mobile = (function () {
try {
// Reset the panels
self.resetPanel();
// Get the values
var xid = aForm.xid.value;
var username, domain;
// A domain is specified
if(xid.indexOf('@') != -1) {
username = self.getXIDNick(xid);
domain = self.getXIDHost(xid);
// Domain is locked and not the same
if((LOCK_HOST == 'on') && (domain != HOST_MAIN)) {
self.showThis('error');
return false;
}
} else {
@ -52,19 +52,19 @@ var Mobile = (function () {
username = xid;
domain = HOST_MAIN;
}
var pwd = aForm.pwd.value;
var reg = false;
if(aForm.reg) {
reg = aForm.reg.checked;
}
// Enough parameters
if(username && domain && pwd) {
// Show the info notification
self.showThis('info');
if(HOST_WEBSOCKET && typeof window.WebSocket != 'undefined') {
// WebSocket supported & configured
con = new JSJaCWebSocketConnection({
@ -72,16 +72,16 @@ var Mobile = (function () {
});
} else {
var httpbase = (HOST_BOSH_MAIN || HOST_BOSH);
// 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
con.registerHandler('message', self.handleMessage);
con.registerHandler('presence', self.handlePresence);
@ -89,7 +89,7 @@ var Mobile = (function () {
con.registerHandler('onconnect', self.handleConnected);
con.registerHandler('onerror', self.handleError);
con.registerHandler('ondisconnect', self.handleDisconnected);
// We retrieve what the user typed in the login inputs
oArgs = {};
oArgs.username = username;
@ -103,11 +103,11 @@ var Mobile = (function () {
if(reg) {
oArgs.register = true;
}
// We connect !
con.connect(oArgs);
}
// Not enough parameters
else {
self.showThis('error');
@ -148,7 +148,7 @@ var Mobile = (function () {
self.doInitialize = function() {
try {
if(typeof HTTP_AUTH === 'object' &&
if(typeof HTTP_AUTH === 'object' &&
HTTP_AUTH.user && HTTP_AUTH.password && HTTP_AUTH.host) {
var form_sel = document.forms['login-form'];
@ -218,7 +218,7 @@ var Mobile = (function () {
// Hide the opened panels
self.hideThis('info');
self.hideThis('error');
//Show the target panel
if(id) {
self.showThis(id);
@ -240,7 +240,7 @@ var Mobile = (function () {
try {
// Reset the "secret" input values
document.getElementById('pwd').value = '';
// Remove the useless DOM elements
var body = document.getElementsByTagName('body')[0];
body.removeChild(document.getElementById('talk'));
@ -319,25 +319,25 @@ var Mobile = (function () {
try {
var type = msg.getType();
if(type == 'chat' || type == 'normal') {
// Get the body
var body = msg.getBody();
if(body) {
// Get the values
var xid = self.cutResource(msg.getFrom());
var hash = hex_md5(xid);
var nick = self.getNick(xid, hash);
// No nickname?
if(!nick) {
nick = xid;
}
// Create the chat if it does not exist
self.chat(xid, nick);
// Display the message
self.displayMessage(xid, body, nick, hash);
}
@ -363,7 +363,7 @@ var Mobile = (function () {
var hash = hex_md5(xid);
var type = pre.getType();
var show = pre.getShow();
// Online buddy
if(!type) {
// Display the correct presence
@ -371,19 +371,19 @@ var Mobile = (function () {
case 'chat':
self.displayPresence(hash, show);
break;
case 'away':
self.displayPresence(hash, show);
break;
case 'xa':
self.displayPresence(hash, show);
break;
case 'dnd':
self.displayPresence(hash, show);
break;
default:
self.displayPresence(hash, 'available');
break;
@ -411,7 +411,7 @@ var Mobile = (function () {
var iqQueryXMLNS = iq.getQueryXMLNS();
var iqType = iq.getType();
var iqQuery;
// Create the response
var iqResponse = new JSJaCIQ();
@ -420,43 +420,43 @@ var Mobile = (function () {
iqResponse.setTo(iqFrom);
iqResponse.setType('result');
}
// Disco#infos query
if((iqQueryXMLNS == NS_DISCO_INFO) && (iqType == 'get')) {
/* REF: http://xmpp.org/extensions/xep-0030.html */
iqQuery = iqResponse.setQuery(NS_DISCO_INFO);
// We set the name of the client
iqQuery.appendChild(iq.appendNode('identity', {
'category': 'client',
'type': 'mobile',
'name': 'Jappix Mobile'
}));
// We set all the supported features
var fArray = new Array(
NS_DISCO_INFO,
NS_VERSION
);
for(var i in fArray) {
iqQuery.appendChild(iq.buildNode('feature', {'var': fArray[i]}));
}
con.send(iqResponse);
}
// Software version query
else if((iqQueryXMLNS == NS_VERSION) && (iqType == 'get')) {
/* REF: http://xmpp.org/extensions/xep-0092.html */
iqQuery = iqResponse.setQuery(NS_VERSION);
iqQuery.appendChild(iq.buildNode('name', 'Jappix Mobile'));
iqQuery.appendChild(iq.buildNode('version', JAPPIX_VERSION));
iqQuery.appendChild(iq.buildNode('os', BrowserDetect.OS));
con.send(iqResponse);
}
} catch(e) {
@ -477,27 +477,27 @@ var Mobile = (function () {
// Reset the elements
self.hideThis('home');
self.resetPanel();
// Create the talk page
document.getElementsByTagName('body')[0].innerHTML +=
'<div id="talk">' +
'<div class="header">' +
'<div class="mobile-images"></div>' +
'<button onclick="Mobile.doLogout();">' + self._e("Disconnect") + '</button>' +
'</div>' +
'<div id="roster"></div>' +
'</div>' +
'<div id="chat">' +
'<div class="header">' +
'<div class="mobile-images"></div>' +
'<button onclick="Mobile.returnToRoster();">' + self._e("Previous") + '</button>' +
'</div>' +
'<div id="chans"></div>' +
'<div id="talk">' +
'<div class="header">' +
'<div class="mobile-images"></div>' +
'<button onclick="Mobile.doLogout();">' + self._e("Disconnect") + '</button>' +
'</div>' +
'<div id="roster"></div>' +
'</div>' +
'<div id="chat">' +
'<div class="header">' +
'<div class="mobile-images"></div>' +
'<button onclick="Mobile.returnToRoster();">' + self._e("Previous") + '</button>' +
'</div>' +
'<div id="chans"></div>' +
'</div>';
// Get the roster items
self.getRoster();
} catch(e) {
@ -534,7 +534,7 @@ var Mobile = (function () {
try {
// Reset the elements
self.resetDOM();
// Show the home page
self.showThis('home');
} catch(e) {
@ -556,17 +556,17 @@ var Mobile = (function () {
// Error: send presence anyway
if(!iq || (iq.getType() != 'result'))
return self.sendPresence('', 'available', 1);
// Define some pre-vars
var current, xid, nick, oneBuddy, oneID, hash, cur_buddy;
var roster_buddies = [];
var roster = document.getElementById('roster');
// Get roster items
var iqNode = iq.getNode();
var bItems = iqNode.getElementsByTagName('item');
// Display each elements from the roster
for(var i = 0; i < bItems.length; i++) {
// Get the values
@ -574,7 +574,7 @@ var Mobile = (function () {
xid = current.getAttribute('jid').htmlEnc();
nick = current.getAttribute('name');
hash = hex_md5(xid);
// No defined nick?
if(!nick) {
nick = self.getDirectNick(xid);
@ -601,7 +601,7 @@ var Mobile = (function () {
cur_buddy.nick
);
}
// Start handling buddies presence
self.sendPresence('', 'available', 1);
} catch(e) {
@ -623,7 +623,7 @@ var Mobile = (function () {
var body = aForm.body.value;
var xid = aForm.xid.value;
var hash = hex_md5(xid);
if(body && xid) {
// Send the message
var aMsg = new JSJaCMessage();
@ -631,10 +631,10 @@ var Mobile = (function () {
aMsg.setType('chat');
aMsg.setBody(body);
con.send(aMsg);
// Clear our input
aForm.body.value = '';
// Display the message we sent
self.displayMessage(xid, body, 'me', hash);
}
@ -660,7 +660,7 @@ var Mobile = (function () {
try {
var presence = new JSJaCPresence();
if(type)
presence.setType(type);
if(show)
@ -669,7 +669,7 @@ var Mobile = (function () {
presence.setPriority(priority);
if(status)
presence.setStatus(status);
con.send(presence);
} catch(e) {
Console.error('Mobile.sendPresence', e);
@ -689,7 +689,7 @@ var Mobile = (function () {
iq = new JSJaCIQ();
iq.setType('get');
iq.setQuery(NS_ROSTER);
con.send(iq, self.handleRoster);
} catch(e) {
Console.error('Mobile.getRoster', e);
@ -726,7 +726,7 @@ var Mobile = (function () {
try {
var path = 'buddy-' + hash;
if(self.exists(path)) {
return document.getElementById(path).innerHTML;
} else {
@ -752,7 +752,7 @@ var Mobile = (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) {
@ -761,7 +761,7 @@ var Mobile = (function () {
toStr = toStr.substr(index + 1);
}
}
// We return the value
return toStr;
} catch(e) {
@ -833,13 +833,13 @@ var Mobile = (function () {
try {
// Encode in HTML
msg = msg.htmlEnc();
// Highlighted text
msg = msg.replace(/(\s|^)\*(.+)\*(\s|$)/gi,'$1<em>$2</em>$3');
// Links
msg = Links.apply(msg, 'mini');
return msg;
} catch(e) {
Console.error('Mobile.filter', e);
@ -862,20 +862,20 @@ var Mobile = (function () {
try {
// Get the path
var path = 'content-' + hash;
// Display the message
html = '<span><b';
if(nick == 'me') {
html += ' class="me">' + self._e("You");
} else {
html += ' class="him">' + nick;
}
html += '</b> ' + self.filter(body) + '</span>';
document.getElementById(path).innerHTML += html;
// Scroll to the last element
document.getElementById(path).lastChild.scrollIntoView();
} catch(e) {
@ -928,7 +928,7 @@ var Mobile = (function () {
roster_buddies.sort(function(one, two) {
one_nick = (one.nick + '').toLowerCase();
two_nick = (two.nick + '').toLowerCase();
return one_nick < two_nick ? -1 : (one_nick > two_nick ? 1 : 0);
});
} catch(e) {
@ -950,7 +950,7 @@ var Mobile = (function () {
try {
// Hide the chats
self.hideThis('chat');
// Show the roster
self.showThis('talk');
} catch(e) {
@ -971,16 +971,16 @@ var Mobile = (function () {
try {
// Hide the roster page
self.hideThis('talk');
// Hide the other chats
var divs = document.getElementsByTagName('div');
for(var i = 0; i < divs.length; i++) {
if(divs.item(i).getAttribute('class') == 'one-chat') {
divs.item(i).style.display = 'none';
}
}
// Show the chat
self.showThis('chat');
self.showThis(hash);
@ -1005,7 +1005,7 @@ var Mobile = (function () {
// Define the variables
var chat = document.getElementById('chans');
var oneChat = document.createElement('div');
// Apply the DOM modification
oneChat.setAttribute('id', 'chat-' + hash);
oneChat.setAttribute('class', 'one-chat');
@ -1029,18 +1029,18 @@ var Mobile = (function () {
try {
var hash = hex_md5(xid);
// If the chat was not yet opened
if(!self.exists('chat-' + hash)) {
// No nick?
if(!nick) {
nick = self.getNick(xid, hash);
}
// Create the chat
self.createChat(xid, nick, hash);
}
// Switch to the chat
self.chatSwitch('chat-' + hash);
} catch(e) {

View file

@ -31,123 +31,123 @@ var MUCAdmin = (function () {
try {
// Popup HTML content
var html_full =
'<div class="top">' + Common._e("MUC administration") + '</div>' +
'<div class="content">' +
'<div class="head mucadmin-head">' +
'<div class="head-text mucadmin-head-text">' + Common._e("You administrate this room") + '</div>' +
'<div class="mucadmin-head-jid">' + xid + '</div>' +
'</div>' +
'<div class="mucadmin-forms">' +
'<div class="mucadmin-topic">' +
'<fieldset>' +
'<legend>' + Common._e("Subject") + '</legend>' +
'<label for="topic-text">' + Common._e("Enter new subject") + '</label>' +
'<textarea id="topic-text" name="room-topic" rows="8" cols="60" ></textarea>' +
'</fieldset>' +
'</div>' +
'<div class="mucadmin-conf">' +
'<fieldset>' +
'<legend>' + Common._e("Configuration") + '</legend>' +
'<div class="results mucadmin-results"></div>' +
'</fieldset>' +
'</div>' +
'<div class="mucadmin-aut">' +
'<fieldset>' +
'<legend>' + Common._e("Authorizations") + '</legend>' +
'<label>' + Common._e("Member list") + '</label>' +
'<div class="aut-member aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'member\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Owner list") + '</label>' +
'<div class="aut-owner aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'owner\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Administrator list") + '</label>' +
'<div class="aut-admin aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'admin\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Outcast list") + '</label>' +
'<div class="aut-outcast aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'outcast\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'</fieldset>' +
'</div>' +
'<div class="mucadmin-others">' +
'<fieldset>' +
'<legend>' + Common._e("Others") + '</legend>' +
'<label>' + Common._e("Destroy this MUC") + '</label>' +
'<a href="#" onclick="return MUCAdmin.destroy();">' + Common._e("Yes, let's do it!") + '</a>' +
'</fieldset>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
var html_full =
'<div class="top">' + Common._e("MUC administration") + '</div>' +
'<div class="content">' +
'<div class="head mucadmin-head">' +
'<div class="head-text mucadmin-head-text">' + Common._e("You administrate this room") + '</div>' +
'<div class="mucadmin-head-jid">' + xid + '</div>' +
'</div>' +
'<div class="mucadmin-forms">' +
'<div class="mucadmin-topic">' +
'<fieldset>' +
'<legend>' + Common._e("Subject") + '</legend>' +
'<label for="topic-text">' + Common._e("Enter new subject") + '</label>' +
'<textarea id="topic-text" name="room-topic" rows="8" cols="60" ></textarea>' +
'</fieldset>' +
'</div>' +
'<div class="mucadmin-conf">' +
'<fieldset>' +
'<legend>' + Common._e("Configuration") + '</legend>' +
'<div class="results mucadmin-results"></div>' +
'</fieldset>' +
'</div>' +
'<div class="mucadmin-aut">' +
'<fieldset>' +
'<legend>' + Common._e("Authorizations") + '</legend>' +
'<label>' + Common._e("Member list") + '</label>' +
'<div class="aut-member aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'member\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Owner list") + '</label>' +
'<div class="aut-owner aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'owner\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Administrator list") + '</label>' +
'<div class="aut-admin aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'admin\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Outcast list") + '</label>' +
'<div class="aut-outcast aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'outcast\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'</fieldset>' +
'</div>' +
'<div class="mucadmin-others">' +
'<fieldset>' +
'<legend>' + Common._e("Others") + '</legend>' +
'<label>' + Common._e("Destroy this MUC") + '</label>' +
'<a href="#" onclick="return MUCAdmin.destroy();">' + Common._e("Yes, let's do it!") + '</a>' +
'</fieldset>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'</div>';
var html_partial =
'<div class="top">' + Common._e("MUC administration") + '</div>' +
'<div class="content">' +
'<div class="head mucadmin-head">' +
'<div class="head-text mucadmin-head-text">' + Common._e("You administrate this room") + '</div>' +
'<div class="mucadmin-head-jid">' + xid + '</div>' +
'</div>' +
'<div class="mucadmin-forms">' +
'<div class="mucadmin-aut">' +
'<fieldset>' +
'<legend>' + Common._e("Authorizations") + '</legend>' +
'<label>' + Common._e("Member list") + '</label>' +
'<div class="aut-member aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'member\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Outcast list") + '</label>' +
'<div class="aut-outcast aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'outcast\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'</fieldset>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'</div>';
var html_partial =
'<div class="top">' + Common._e("MUC administration") + '</div>' +
'<div class="content">' +
'<div class="head mucadmin-head">' +
'<div class="head-text mucadmin-head-text">' + Common._e("You administrate this room") + '</div>' +
'<div class="mucadmin-head-jid">' + xid + '</div>' +
'</div>' +
'<div class="mucadmin-forms">' +
'<div class="mucadmin-aut">' +
'<fieldset>' +
'<legend>' + Common._e("Authorizations") + '</legend>' +
'<label>' + Common._e("Member list") + '</label>' +
'<div class="aut-member aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'member\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'<label>' + Common._e("Outcast list") + '</label>' +
'<div class="aut-outcast aut-group">' +
'<a href="#" class="aut-add" onclick="return MUCAdmin.addInput(\'\', \'outcast\');">' + Common._e("Add an input") + '</a>' +
'</div>' +
'</fieldset>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'</div>';
// Create the popup
if(aff == 'owner')
Popup.create('mucadmin', html_full);
if(aff == 'admin')
Popup.create('mucadmin', html_partial);
// Associate the events
self.instance();
// We get the affiliated user's privileges
if(aff == 'owner') {
self.query(xid, 'member');
@ -197,10 +197,10 @@ var MUCAdmin = (function () {
try {
var path = $(element).parent();
// We first hide the container of the input
path.hide();
// Then, we add a special class to the input
path.find('input').addClass('aut-dustbin');
} catch(e) {
@ -223,20 +223,20 @@ var MUCAdmin = (function () {
try {
var hash = hex_md5(xid + affiliation);
// Add the HTML code
$('#mucadmin .aut-' + affiliation + ' .aut-add').after(
'<div class="one-aut ' + hash + '">' +
'<input id="aut-' + affiliation + '" name="' + affiliation + '" type="text" class="mucadmin-i" value="' + xid + '" />' +
'<a href="#" class="aut-remove">[-]</a>' +
'<div class="one-aut ' + hash + '">' +
'<input id="aut-' + affiliation + '" name="' + affiliation + '" type="text" class="mucadmin-i" value="' + xid + '" />' +
'<a href="#" class="aut-remove">[-]</a>' +
'</div>'
);
// Click event
$('#mucadmin .' + hash + ' .aut-remove').click(function() {
return self.removeInput(this);
});
// Focus on the input we added
if(!xid) {
$(document).oneTime(10, function() {
@ -266,14 +266,14 @@ var MUCAdmin = (function () {
// We parse the received xml
var xid = $(this).attr('jid');
var affiliation = $(this).attr('affiliation');
// We create one input for one XID
self.addInput(xid, affiliation);
});
// Hide the wait icon
$('#mucadmin .wait').hide();
Console.log('MUC admin items received: ' + Common.fullXID(Common.getStanzaFrom(iq)));
} catch(e) {
Console.error('MUCAdmin.handleAuth', e);
@ -294,16 +294,16 @@ var MUCAdmin = (function () {
try {
// Show the wait icon
$('#mucadmin .wait').show();
// New IQ
var iq = new JSJaCIQ();
iq.setTo(xid);
iq.setType('get');
var iqQuery = iq.setQuery(NS_MUC_ADMIN);
iqQuery.appendChild(iq.buildNode('item', {'affiliation': type, 'xmlns': NS_MUC_ADMIN}));
con.send(iq, self.handleAuth);
} catch(e) {
Console.error('MUCAdmin.query', e);
@ -323,7 +323,7 @@ var MUCAdmin = (function () {
try {
// We get the new topic
var topic = $('.mucadmin-topic textarea').val();
// We send the new topic if not blank
if(topic) {
var m = new JSJaCMessage();
@ -331,7 +331,7 @@ var MUCAdmin = (function () {
m.setType('groupchat');
m.setSubject(topic);
con.send(m);
Console.info('MUC admin topic sent: ' + topic);
}
} catch(e) {
@ -356,7 +356,7 @@ var MUCAdmin = (function () {
$.each(types, function(i) {
// We get the current type
var tType = types[i];
// We loop for all the elements
$('.mucadmin-aut .aut-' + tType + ' input').each(function() {
// We get the needed values
@ -369,7 +369,7 @@ var MUCAdmin = (function () {
}
});
});
Console.info('MUC admin authorizations form sent: ' + xid);
} catch(e) {
Console.error('MUCAdmin.sendAuth', e);
@ -398,13 +398,13 @@ var MUCAdmin = (function () {
iq.setType('set');
var iqQuery = iq.setQuery(NS_MUC_ADMIN);
var item = iqQuery.appendChild(iq.buildNode('item', {
'jid': user_xid,
'affiliation': affiliation,
'xmlns': NS_MUC_ADMIN
}));
con.send(iq, Errors.handleReply);
} catch(e) {
Console.error('MUCAdmin.setAffiliation', e);
@ -427,21 +427,21 @@ var MUCAdmin = (function () {
var room = Common.fullXID(Common.getStanzaFrom(iq));
var hash = hex_md5(room);
Interface.quitThisChat(room, hash, 'groupchat');
// We close the muc admin popup
self.close();
// We tell the user that all is okay
Board.openThisInfo(5);
// We remove the user's favorite
if(DataStore.existDB(Connection.desktop_hash, 'favorites', room)) {
Favorites.removeThis(room, Common.explodeThis('@', room, 0));
}
Console.info('MUC admin destroyed: ' + room);
}
// We hide the wait icon
$('#mucadmin .wait').hide();
} catch(e) {
@ -462,14 +462,14 @@ var MUCAdmin = (function () {
try {
// We ask the server to delete the room
var iq = new JSJaCIQ();
iq.setTo(xid);
iq.setType('set');
var iqQuery = iq.setQuery(NS_MUC_OWNER);
iqQuery.appendChild(iq.buildNode('destroy', {'xmlns': NS_MUC_OWNER}));
con.send(iq, self.handleDestroyIQ);
Console.info('MUC admin destroy sent: ' + xid);
} catch(e) {
Console.error('MUCAdmin.destroyIQ', e);
@ -490,10 +490,10 @@ var MUCAdmin = (function () {
try {
// We get the XID of the current room
var xid = $('#mucadmin .mucadmin-head-jid').text();
// We show the wait icon
$('#mucadmin .wait').show();
// We send the iq
self.destroyIQ(xid);
} catch(e) {
@ -513,10 +513,10 @@ var MUCAdmin = (function () {
try {
// We get the XID of the current room
var xid = $('#mucadmin .mucadmin-head-jid').text();
// We change the room topic
self.sendTopic(xid);
// We send the needed queries
DataForm.send('x', 'submit', 'submit', $('#mucadmin .mucadmin-results').attr('data-session'), xid, '', '', 'mucadmin');
self.sendAuth(xid);
@ -537,7 +537,7 @@ var MUCAdmin = (function () {
try {
// We send the new options
self.send();
// And we quit the popup
return self.close();
} catch(e) {
@ -560,7 +560,7 @@ var MUCAdmin = (function () {
if($(this).is('.cancel')) {
return self.close();
}
if($(this).is('.save')) {
return self.save();
}

View file

@ -20,6 +20,10 @@ var Muji = (function() {
var self = {};
/* Constants */
self.INVITE_MAX_DELAY = 60;
/* Variables */
self._session = null;
self._caller_xid = null;
@ -98,22 +102,22 @@ var Muji = (function() {
var avatar_html = '';
if(mode === 'him') {
avatar_html =
'<div class="message_avatar avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
avatar_html =
'<div class="message_avatar avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>';
}
muji_sel.find('.chatroom .chatroom_view').append(
'<div class="room_message ' + mode + ' ' + hex_md5(from) + '">' +
avatar_html +
'<div class="room_message ' + mode + ' ' + hex_md5(from) + '">' +
avatar_html +
'<div class="message_content">' +
'<span class="message_bubble">' + body.htmlEnc() + '</span>' +
'<span class="message_author">' + username.htmlEnc() + '</span>' +
'</div>' +
'<div class="message_content">' +
'<span class="message_bubble">' + body.htmlEnc() + '</span>' +
'<span class="message_author">' + username.htmlEnc() + '</span>' +
'</div>' +
'<div class="clear"></div>' +
'<div class="clear"></div>' +
'</div>'
);
@ -140,7 +144,7 @@ var Muji = (function() {
room_presence_out: function(muji, stanza) {
Console.log('Muji._args', 'room_presence_out');
},
session_prepare_pending: function(muji, stanza) {
// Temporary username
$('#muji').attr('data-username', muji.get_username());
@ -156,14 +160,14 @@ var Muji = (function() {
Console.log('Muji._args', 'session_prepare_pending');
},
session_prepare_success: function(muji, stanza) {
// Final username
$('#muji').attr('data-username', muji.get_username());
Console.log('Muji._args', 'session_prepare_success');
},
session_prepare_error: function(muji, stanza) {
self._reset();
@ -177,7 +181,7 @@ var Muji = (function() {
Console.log('Muji._args', 'session_prepare_error');
},
session_initiate_pending: function(muji) {
Call.notify(
JSJAC_JINGLE_SESSION_MUJI,
@ -189,7 +193,7 @@ var Muji = (function() {
Console.log('Muji._args', 'session_initiate_pending');
},
session_initiate_success: function(muji, stanza) {
Call._unnotify();
@ -200,7 +204,7 @@ var Muji = (function() {
Console.log('Muji._args', 'session_initiate_success');
},
session_initiate_error: function(muji, stanza) {
self._reset();
@ -214,7 +218,7 @@ var Muji = (function() {
Console.log('Muji._args', 'session_initiate_error');
},
session_leave_pending: function(muji) {
self._reset();
@ -228,7 +232,7 @@ var Muji = (function() {
Console.log('Muji._args', 'session_leave_pending');
},
session_leave_success: function(muji, stanza) {
self._reset();
@ -242,7 +246,7 @@ var Muji = (function() {
Console.log('Muji._args', 'session_leave_success');
},
session_leave_error: function(muji, stanza) {
self._reset();
@ -260,83 +264,83 @@ var Muji = (function() {
Console.log('Muji._args', 'session_leave_error');
},
participant_prepare: function(muji, stanza) {
Console.log('Muji._args', 'participant_prepare');
},
participant_initiate: function(muji, stanza) {
Console.log('Muji._args', 'participant_initiate');
},
participant_leave: function(muji, stanza) {
Console.log('Muji._args', 'participant_leave');
},
participant_session_initiate_pending: function(muji, session) {
Console.log('Muji._args', 'participant_session_initiate_pending');
},
participant_session_initiate_success: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_initiate_success');
},
participant_session_initiate_error: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_initiate_error');
},
participant_session_initiate_request: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_initiate_request');
},
participant_session_accept_pending: function(muji, session) {
Console.log('Muji._args', 'participant_session_accept_pending');
},
participant_session_accept_success: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_accept_success');
},
participant_session_accept_error: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_accept_error');
},
participant_session_accept_request: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_accept_request');
},
participant_session_info_pending: function(muji, session) {
Console.log('Muji._args', 'participant_session_info_pending');
},
participant_session_info_success: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_info_success');
},
participant_session_info_error: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_info_error');
},
participant_session_info_request: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_info_request');
},
participant_session_terminate_pending: function(muji, session) {
Console.log('Muji._args', 'participant_session_terminate_pending');
},
participant_session_terminate_success: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_terminate_success');
},
participant_session_terminate_error: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_terminate_error');
},
participant_session_terminate_request: function(muji, session, stanza) {
Console.log('Muji._args', 'participant_session_terminate_request');
},
add_remote_view: function(muji, username, media) {
Console.log('Muji._args', 'add_remote_view');
@ -396,7 +400,7 @@ var Muji = (function() {
// IMPORTANT: return view selector
return (view_sel !== null) ? view_sel[0] : view_sel;
},
remove_remote_view: function(muji, username) {
Console.log('Muji._args', 'remove_remote_view');
@ -676,16 +680,16 @@ var Muji = (function() {
cur_name_bolded = cur_name.htmlEnc().replace(bold_regex, '<b>$&</b>');
// Generate result HTML
results_html +=
'<a class="participant_search_one ' + cur_support_class + ' ' + cur_hash + '" href="#" title="' + Common.encodeQuotes(cur_title) + '" data-xid="' + Common.encodeQuotes(cur_full_xid || cur_xid) + '" data-support="' + Common.encodeQuotes(cur_support) + '">' +
'<span class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</span>' +
results_html +=
'<a class="participant_search_one ' + cur_support_class + ' ' + cur_hash + '" href="#" title="' + Common.encodeQuotes(cur_title) + '" data-xid="' + Common.encodeQuotes(cur_full_xid || cur_xid) + '" data-support="' + Common.encodeQuotes(cur_support) + '">' +
'<span class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</span>' +
'<span class="details">' +
'<span class="name">' + cur_name_bolded + '</span>' +
'<span class="feature call-images"></span>' +
'</span>' +
'<span class="details">' +
'<span class="name">' + cur_name_bolded + '</span>' +
'<span class="feature call-images"></span>' +
'</span>' +
'</a>';
}
}
@ -850,18 +854,18 @@ var Muji = (function() {
if(participant_search_one_sel.size()) {
var hover_index = participant_search_one_sel.index($('.hover'));
// Up (decrement) or down (increment)?
if(direction === 'up') {
hover_index--;
} else {
hover_index++;
}
if(!hover_index) {
hover_index = 0;
}
// Nobody before/after?
if(participant_search_one_sel.eq(hover_index).size() === 0) {
if(direction === 'up') {
@ -870,7 +874,7 @@ var Muji = (function() {
hover_index = 0;
}
}
// Hover the previous/next user
participant_search_one_sel.removeClass('hover');
participant_search_one_sel.eq(hover_index).addClass('hover');
@ -1020,6 +1024,16 @@ var Muji = (function() {
try {
if(!Call.is_ongoing()) {
// Outdated invite?
var invite_delay = DateUtils.readMessageDelay(stanza.getNode(), true);
var date_now = DateUtils.getTimeStamp();
if(invite_delay &&
(date_now - DateUtils.extractStamp(invite_delay)) >= self.INVITE_MAX_DELAY) {
Console.warn('Muji.receive', 'Discarded outdated invite from: ' + Common.getStanzaFrom(stanza));
return;
}
// Create call session
self._new(
args.jid,
@ -1036,7 +1050,7 @@ var Muji = (function() {
args.media,
Common.bareXID(args.from)
);
Audio.play('incoming-call', true);
}
} catch(e) {
@ -1102,9 +1116,10 @@ var Muji = (function() {
/**
* Stops current Muji call
* @public
* @param {boolean} abort
* @return {boolean}
*/
self.stop = function() {
self.stop = function(abort) {
try {
// Reset interface
@ -1112,7 +1127,12 @@ var Muji = (function() {
// Stop Muji session
if(self._session !== null) {
self._session.leave();
if(abort === true) {
self._session.abort();
self._session.get_session_leave_error(self._session, null);
} else {
self._session.leave();
}
Console.debug('Stopping current Muji call...');
} else {
@ -1218,10 +1238,10 @@ var Muji = (function() {
in_call = false;
try {
if(self._session &&
(self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_PREPARING ||
self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_PREPARED ||
self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_INITIATING ||
if(self._session &&
(self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_PREPARING ||
self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_PREPARED ||
self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_INITIATING ||
self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_INITIATED ||
self._session.get_status() === JSJAC_JINGLE_MUJI_STATUS_LEAVING)) {
in_call = true;
@ -1326,7 +1346,7 @@ var Muji = (function() {
'text': Common._e("Decline"),
'color': 'red',
'cb': function(xid, mode) {
self._session.abort();
self.stop(true);
Audio.stop('incoming-call');
}
}
@ -1350,7 +1370,7 @@ var Muji = (function() {
'text': Common._e("Decline"),
'color': 'red',
'cb': function(xid, mode) {
self._session.abort();
self.stop(true);
Audio.stop('incoming-call');
}
}
@ -1365,7 +1385,7 @@ var Muji = (function() {
'text': Common._e("Cancel"),
'color': 'red',
'cb': function(xid, mode) {
self._session.abort();
self.stop(true);
}
}
}
@ -1472,80 +1492,81 @@ var Muji = (function() {
// Create DOM
$('body').append(
'<div id="muji" class="videochat_box lock removable ' + hex_md5(room) + '" data-room="' + Common.encodeQuotes(room) + '" data-mode="' + Common.encodeQuotes(mode) + '">' +
'<div class="videochat_items">' +
'<div class="videoroom">' +
'<div class="topbar">' +
'<div class="controls">' +
'<a href="#" class="leave control-button" data-type="leave"><span class="icon call-images"></span>' + Common._e("Leave") + '</a>' +
'<a href="#" class="mute control-button" data-type="mute"><span class="icon call-images"></span>' + Common._e("Mute") + '</a>' +
'<a href="#" class="unmute control-button" data-type="unmute"><span class="icon call-images"></span>' + Common._e("Unmute") + '</a>' +
'</div>' +
'<div id="muji" class="videochat_box lock removable ' + hex_md5(room) + '" data-room="' + Common.encodeQuotes(room) + '" data-mode="' + Common.encodeQuotes(mode) + '">' +
'<div class="videochat_items">' +
'<div class="videoroom">' +
'<div class="topbar">' +
'<div class="controls">' +
'<a href="#" class="leave control-button" data-type="leave"><span class="icon call-images"></span>' + Common._e("Leave") + '</a>' +
'<a href="#" class="mute control-button" data-type="mute"><span class="icon call-images"></span>' + Common._e("Mute") + '</a>' +
'<a href="#" class="unmute control-button" data-type="unmute"><span class="icon call-images"></span>' + Common._e("Unmute") + '</a>' +
'</div>' +
'<div class="elapsed">00:00:00</div>' +
'<div class="elapsed">00:00:00</div>' +
'<div class="actions">' +
'<a href="#" class="close action-button call-images" data-type="close"></a>' +
'</div>' +
'</div>' +
'<div class="actions">' +
'<a href="#" class="close action-button call-images" data-type="close"></a>' +
'</div>' +
'</div>' +
'<div class="local_video">' +
'<video src="" alt="" poster="' + local_poster + '"></video>' +
'</div>' +
'<div class="local_video">' +
'<video src="" alt="" poster="' + local_poster + '"></video>' +
'</div>' +
'<div class="remote_container">' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'</div>' +
'<div class="remote_container">' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'<div class="remote_video_shaper remote_video"></div>' +
'</div>' +
'<div class="empty_message">' +
'<span class="text">' + Common._e("Nobody there. Invite some people!") + '</span>' +
'</div>' +
'</div>' +
'<div class="empty_message">' +
'<span class="text">' + Common._e("Nobody there. Invite some people!") + '</span>' +
'</div>' +
'</div>' +
'<div class="chatroom">' +
'<div class="chatroom_participants">' +
'<div class="participants_default_view">' +
'<span class="participants_counter">' + Common.printf(Common._e("%s participants"), 0) + '</span>' +
'<span class="participants_full">' + Common._e("(full)") + '</span>' +
'<div class="chatroom">' +
'<div class="chatroom_participants">' +
'<div class="participants_default_view">' +
'<div class="participants_default_details">' +
'<span class="participants_counter">' + Common.printf(Common._e("%s participants"), 0) + '</span>' +
'<span class="participants_full">' + Common._e("(full)") + '</span>' +
'</div>' +
'<a class="participants_invite call-images" href="#" title="' + Common._e("Invite people...") + '"></a>' +
'</div>' +
'<a class="participants_invite call-images" href="#" title="' + Common._e("Invite people...") + '"></a>' +
'</div>' +
'<div class="participants_invite_box">' +
'<div class="participants_invite_list"></div>' +
'<div class="participants_invite_box">' +
'<div class="participants_invite_list"></div>' +
'<form class="participants_invite_form" action="#" method="post">' +
'<div class="invite_input_container">' +
'<input class="invite_xid input-reset" name="xid" type="text" placeholder="' + Common._e("Enter people names...") + '" autocomplete="off" />' +
'</div>' +
'<form class="participants_invite_form" action="#" method="post">' +
'<div class="invite_input_container">' +
'<input class="invite_xid input-reset" name="xid" type="text" placeholder="' + Common._e("Enter people names...") + '" autocomplete="off" />' +
'</div>' +
'<span class="invite_validate">' +
'<span class="invite_separator"></span>' +
'<a class="invite_go call-images" href="#"></a>' +
'</span>' +
'</form>' +
'<a class="invite_validate" href="#">' +
'<span class="invite_validate_icon call-images"></span>' +
'</a>' +
'</form>' +
'<div class="participants_invite_search"></div>' +
'</div>' +
'</div>' +
'<div class="participants_invite_search"></div>' +
'</div>' +
'</div>' +
'<div class="chatroom_view"></div>' +
'<div class="chatroom_view"></div>' +
'<form class="chatroom_form" action="#" method="post">' +
'<span class="message_icon call-images"></span>' +
'<span class="message_separator"></span>' +
'<form class="chatroom_form" action="#" method="post">' +
'<span class="message_icon call-images"></span>' +
'<span class="message_separator"></span>' +
'<div class="message_input_container">' +
'<input class="message_input input-reset" name="message" type="text" placeholder="' + Common._e("Send a message...") + '" autocomplete="off" />' +
'</div>' +
'</form>' +
'</div>' +
'</div>' +
'<div class="message_input_container">' +
'<input class="message_input input-reset" name="message" type="text" placeholder="' + Common._e("Send a message...") + '" autocomplete="off" />' +
'</div>' +
'</form>' +
'</div>' +
'</div>' +
'</div>'
);
@ -1759,7 +1780,7 @@ var Muji = (function() {
});
// Invite form validate event
participants_invite_validate.find('.invite_go').click(function() {
participants_invite_validate.click(function() {
try {
participants_invite_form.submit();
} catch(_e) {
@ -1810,7 +1831,7 @@ var Muji = (function() {
} catch(e) {
Console.error('Muji.launch', e);
}
};

View file

@ -29,10 +29,10 @@ var Music = (function () {
try {
var path = '.music-content';
// Show the music bubble
Bubble.show(path);
$(document).oneTime(10, function() {
$(path + ' input').focus();
});
@ -58,18 +58,18 @@ var Music = (function () {
var path = '.music-content ';
var content = path + '.list';
var path_type = content + ' .' + type;
// Create the result container
if(!Common.exists(path_type)) {
var code = '<div class="' + type + '"></div>';
if(type == 'local') {
$(content).prepend(code);
} else {
$(content).append(code);
}
}
// Fill the results
$(xml).find('track').each(function() {
// Parse the XML
@ -82,42 +82,42 @@ var Music = (function () {
var duration = this_sel.find('duration').text();
var uri = this_sel.find('url').text();
var mime = this_sel.find('type').text() || 'audio/ogg';
// Local URL?
if(type == 'local') {
uri = Utils.generateURL(uri);
}
// Append the HTML code
$(path_type).append('<a href="#" class="song" data-id="' + id + '">' + title + '</a>');
// Current playing song?
var current_song = $(path_type + ' a[data-id="' + id + '"]');
if(Common.exists('.music-audio[data-id="' + id + '"]')) {
current_song.addClass('playing');
}
// Click event
current_song.click(function() {
return self.add(id, title, artist, source, duration, uri, mime, type);
});
});
// The search is finished
if(Common.exists(content + ' .jamendo') && Common.exists(content + ' .local')) {
// Get the result values
var jamendo = $(content + ' .jamendo').text();
var local = $(content + ' .local').text();
// Enable the input
$(path + 'input').val('').removeAttr('disabled');
// No result
if(!jamendo && !local) {
$(path + '.no-results').show();
}
// We must put a separator between the categories
if(jamendo && local) {
$(content + ' .local').addClass('special');
@ -139,22 +139,22 @@ var Music = (function () {
try {
var path = '.music-content ';
// We get the input string
var string = $(path + 'input').val();
// We lock the search input
$(path + 'input').attr('disabled', true);
// We reset the results
$(path + '.list div').remove();
$(path + '.no-results').hide();
// Get the Jamendo results
$.get('./server/music-search.php', {searchquery: string, location: 'jamendo'}, function(data) {
self.parse(data, 'jamendo');
});
// Get the local results
$.get('./server/music-search.php', {
searchquery: string,
@ -180,14 +180,14 @@ var Music = (function () {
try {
// Initialize
var audio_sel = document.getElementById('top-content').getElementsByTagName('audio')[0];
// Nothing to play, exit
if(!audio_sel) {
return false;
}
var stopButton = $('#top-content a.stop');
// User play a song
if(action == 'play') {
stopButton.show();
@ -196,8 +196,8 @@ var Music = (function () {
audio_sel.addEventListener('ended', function() {
self.action('stop');
}, true);
}, true);
Console.log('Music is now playing.');
} else if(action == 'stop') {
// User stop the song / end of song
@ -209,7 +209,7 @@ var Music = (function () {
$('.music-audio').remove();
self.publish();
Console.log('Music is now stopped.');
}
} catch(e) {
@ -240,13 +240,13 @@ var Music = (function () {
if(Features.enabledPEP()) {
var iq = new JSJaCIQ();
iq.setType('set');
// Create the main PubSub nodes
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB});
var publish = pubsub.appendChild(iq.buildNode('publish', {'node': NS_TUNE, 'xmlns': NS_PUBSUB}));
var item = publish.appendChild(iq.buildNode('item', {'xmlns': NS_PUBSUB}));
var tune = item.appendChild(iq.buildNode('tune', {'xmlns': NS_TUNE}));
// Enough data?
if(title || artist || source || uri) {
var music_data = {
@ -256,13 +256,13 @@ var Music = (function () {
'length': length,
'uri': uri
};
// Create the children nodes
var cur_value;
for(var cur_name in music_data) {
cur_value = music_data[cur_name];
if(cur_value) {
tune.appendChild(iq.buildNode(cur_name, {
'xmlns': NS_TUNE
@ -270,9 +270,9 @@ var Music = (function () {
}
}
}
con.send(iq);
Console.info('New tune sent: ' + title);
}
} catch(e) {
@ -300,28 +300,28 @@ var Music = (function () {
try {
var path = '.music-content ';
var music_audio_sel = $('.music-audio');
// We remove & create a new audio tag
music_audio_sel.remove();
$(path + '.player').prepend('<audio class="music-audio" type="' + mime + '" data-id="' + id + '" />');
// We apply the new source to the player
if(type == 'jamendo') {
music_audio_sel.attr('src', 'http://api.jamendo.com/get2/stream/track/redirect/?id=' + id + '&streamencoding=ogg2');
} else {
music_audio_sel.attr('src', uri);
}
// We play the target sound
self.action('play');
// We set the actived class
$('#top-content .music').addClass('actived');
// We set a current played track indicator
$(path + '.list a').removeClass('playing');
$(path + 'a[data-id="' + id + '"]').addClass('playing');
// We publish what we listen
self.publish(title, artist, source, duration, uri);
} catch(e) {
@ -348,7 +348,7 @@ var Music = (function () {
if(e.keyCode == 13 && $(this).val()) {
self.search();
}
// Escape : quit
if(e.keyCode == 27) {
Bubble.close();

View file

@ -32,9 +32,9 @@ var Name = (function () {
var iq = new JSJaCIQ();
iq.setType('get');
iq.setTo(xid);
iq.appendNode('vCard', {'xmlns': NS_VCARD});
con.send(iq, self.handleAddUser);
} catch(e) {
Console.error('Name.getAddUser', e);
@ -56,14 +56,14 @@ var Name = (function () {
if(!Common.exists('.add-contact-name-get[data-for="' + escape(Common.bareXID(Common.getStanzaFrom(iq))) + '"]')) {
return false;
}
// Reset the waiting item
$('.add-contact-name-get').hide().removeAttr('data-for');
// Get the names
if(iq.getType() == 'result') {
var full_name = self.generateBuddy(iq)[0];
if(full_name) {
$('.add-contact-name').val(full_name);
}
@ -88,29 +88,29 @@ var Name = (function () {
try {
// Get the IQ content
var vcard_sel = $(iq.getNode()).find('vCard');
// Get the full name & the nickname
var pFull = vcard_sel.find('FN:first').text();
var pNick = vcard_sel.find('NICKNAME:first').text();
// No full name?
if(!pFull) {
// Get the given name
var pN = vcard_sel.find('N:first');
var pGiven = pN.find('GIVEN:first').text();
if(pGiven) {
pFull = pGiven;
// Get the family name (optional)
var pFamily = pN.find('FAMILY:first').text();
if(pFamily) {
pFull += ' ' + pFamily;
}
}
}
return [pFull, pNick];
} catch(e) {
Console.error('Name.generateBuddy', e);
@ -130,21 +130,21 @@ var Name = (function () {
try {
// Initialize
var cname, bname;
// Cut the XID resource
xid = Common.bareXID(xid);
// This is me?
if(Utils.isAnonymous() && !xid) {
bname = Common._e("You");
} else if(xid == Common.getXID()) {
bname = self.get();
}
// Not me!
else {
cname = $('#roster .buddy[data-xid="' + escape(xid) + '"]:first .buddy-name').html();
// Complete name exists?
if(cname) {
bname = cname.revertHtmlEnc();
@ -152,7 +152,7 @@ var Name = (function () {
bname = Common.getXIDNick(xid);
}
}
return bname;
} catch(e) {
Console.error('Name.getBuddy', e);
@ -171,12 +171,12 @@ var Name = (function () {
try {
// Try to read the user nickname
var nick = DataStore.getDB(Connection.desktop_hash, 'profile', 'nick');
// No nick?
if(!nick) {
nick = con.username;
}
return nick;
} catch(e) {
Console.error('Name.getNick', e);
@ -195,12 +195,12 @@ var Name = (function () {
try {
// Try to read the user name
var name = DataStore.getDB(Connection.desktop_hash, 'profile', 'name');
// No name? Use the nickname instead
if(!name) {
name = self.getNick();
}
return name;
} catch(e) {
Console.error('Name.get', e);

View file

@ -50,13 +50,13 @@ var Notification = (function () {
var notif = '#top-content .notifications';
var nothing = '.notifications-content .nothing';
var empty = '.notifications-content .empty';
// Get the notifications number
var number = $('.one-notification').size();
// Remove the red notify bubble
$(notif + ' .notify').remove();
// Any notification?
if(number) {
$(notif).prepend('<div class="notify one-counter" data-counter="' + number + '">' + number + '</div>');
@ -65,11 +65,11 @@ var Notification = (function () {
} else {
$(empty).hide();
$(nothing).show();
// Purge the social inbox node
self.purge();
}
// Update the page title
Interface.updateTitle();
} catch(e) {
@ -96,141 +96,141 @@ var Notification = (function () {
if(!type || !from) {
return;
}
// Generate an ID hash
if(!id) {
id = hex_md5(type + from);
}
// Generate the text to be displayed
var text, action, code;
var yes_path = 'href="#"';
// User things
from = Common.bareXID(from);
var hash = hex_md5(from);
switch(type) {
case 'subscribe':
// Get the name to display
var display_name = data[1];
if(!display_name)
display_name = data[0];
text = '<b>' + display_name.htmlEnc() + '</b> ' + Common._e("would like to add you as a friend.") + ' ' + Common._e("Do you accept?");
break;
case 'invite_room':
text = '<b>' + Name.getBuddy(from).htmlEnc() + '</b> ' + Common._e("would like you to join this chatroom:") + ' <em>' + data[0].htmlEnc() + '</em> ' + Common._e("Do you accept?");
break;
case 'request':
text = '<b>' + from.htmlEnc() + '</b> ' + Common._e("would like to get authorization.") + ' ' + Common._e("Do you accept?");
break;
case 'send':
yes_path = 'href="' + Common.encodeQuotes(data[1]) + '" target="_blank"';
text = '<b>' + Name.getBuddy(from).htmlEnc() + '</b> ' + Common.printf(Common._e("would like to send you a file: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>') + ' ' + Common._e("Do you accept?");
break;
case 'send_pending':
text = '<b>' + Name.getBuddy(from).htmlEnc() + '</b> ' + Common.printf(Common._e("has received a file exchange request: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'send_accept':
text = '<b>' + Name.getBuddy(from).htmlEnc() + '</b> ' + Common.printf(Common._e("has accepted to receive your file: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'send_reject':
text = '<b>' + Name.getBuddy(from).htmlEnc() + '</b> ' + Common.printf(Common._e("has rejected to receive your file: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'send_fail':
text = '<b>' + Name.getBuddy(from).htmlEnc() + '</b> ' + Common.printf(Common._e("could not receive your file: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'rosterx':
text = Common.printf(Common._e("Do you want to see the friends %s suggests you?").htmlEnc(), '<b>' + Name.getBuddy(from).htmlEnc() + '</b>');
break;
case 'comment':
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common.printf(Common._e("commented an item you follow: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'like':
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common.printf(Common._e("liked your post: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'quote':
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common.printf(Common._e("quoted you somewhere: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'wall':
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common.printf(Common._e("published on your wall: “%s”.").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'photo':
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common.printf(Common._e("tagged you in a photo (%s).").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'video':
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common.printf(Common._e("tagged you in a video (%s).").htmlEnc(), '<em>' + Utils.truncate(body, 25).htmlEnc() + '</em>');
break;
case 'me_profile_new_success':
yes_path = 'href="' + Common.encodeQuotes(data[1]) + '" target="_blank"';
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common._e("validated your account. Your public profile will be available in a few moments.").htmlEnc();
break;
case 'me_profile_remove_success':
yes_path = 'href="' + Common.encodeQuotes(data[1]) + '" target="_blank"';
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common._e("has removed your public profile after your request. We will miss you!").htmlEnc();
break;
case 'me_profile_update_success':
yes_path = 'href="' + Common.encodeQuotes(data[1]) + '" target="_blank"';
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common._e("has saved your new public profile settings. They will be applied in a few moments.").htmlEnc();
break;
case 'me_profile_check_error':
yes_path = 'href="' + Common.encodeQuotes(data[1]) + '" target="_blank"';
text = '<b>' + data[0].htmlEnc() + '</b> ' + Common._e("could not validate your account to create or update your public profile. Check your credentials.").htmlEnc();
break;
default:
break;
}
// No text?
if(!text) {
return;
}
// Action links?
switch(type) {
// Hide/Show actions
@ -266,55 +266,55 @@ var Notification = (function () {
default:
action = '<a ' + yes_path + ' class="yes">' + Common._e("Yes") + '</a><a href="#" class="no">' + Common._e("No") + '</a>';
}
if(text) {
// We display the notification
if(!Common.exists('.notifications-content .' + id)) {
// We create the html markup depending of the notification type
code = '<div class="one-notification ' + id + ' ' + hash + '" title="' + Common.encodeQuotes(body) + ' - ' + Common._e("This notification is only informative, maybe the data it links to have been removed.") + '" data-type="' + Common.encodeQuotes(type) + '">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<p class="notification-text">' + text + '</p>' +
'<p class="notification-actions">' +
'<span class="talk-images" />' +
action +
'</p>' +
code = '<div class="one-notification ' + id + ' ' + hash + '" title="' + Common.encodeQuotes(body) + ' - ' + Common._e("This notification is only informative, maybe the data it links to have been removed.") + '" data-type="' + Common.encodeQuotes(type) + '">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<p class="notification-text">' + text + '</p>' +
'<p class="notification-actions">' +
'<span class="talk-images" />' +
action +
'</p>' +
'</div>';
// Add the HTML code
if(inverse) {
$('.notifications-content .nothing').before(code);
} else {
$('.notifications-content .empty').after(code);
}
// Play a sound to alert the user
Audio.play('notification');
// The yes click function
$('.' + id + ' a.yes').click(function() {
self.action(type, data, 'yes', id);
if(($(this).attr('href') == '#') && ($(this).attr('target') != '_blank')) {
return false;
}
});
// The no click function
$('.' + id + ' a.no').click(function() {
return self.action(type, data, 'no', id);
});
// Get the user avatar
Avatar.get(from, 'cache', 'true', 'forget');
}
}
// We tell the user he has a new pending notification
self.check();
Console.info('New notification: ' + from);
} catch(e) {
Console.error('Notification.new', e);
@ -345,7 +345,7 @@ var Notification = (function () {
} else if(type == 'request') {
HTTPReply.go(value, data[0]);
}
if((type == 'send') && (value == 'yes')) {
OOB.reply(data[0], data[3], 'accept', data[2], data[4]);
} else if((type == 'send') && (value == 'no')) {
@ -356,17 +356,17 @@ var Notification = (function () {
if(value == 'yes') {
// Get the microblog item
Microblog.fromInfos(data[2]);
// Append the marker
$('#channel .top.individual').append('<input type="hidden" name="comments" value="' + Common.encodeQuotes(data[1]) + '" />');
}
self.remove(data[3]);
}
// We remove the notification
$('.notifications-content .' + id).remove();
// We check if there's any other pending notification
self.closeEmpty();
self.check();
@ -389,7 +389,7 @@ var Notification = (function () {
try {
// Remove notifications
$('.one-notification').remove();
// Refresh
self.closeEmpty();
self.check();
@ -412,12 +412,12 @@ var Notification = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('get');
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB});
pubsub.appendChild(iq.buildNode('items', {'node': NS_URN_INBOX, 'xmlns': NS_PUBSUB}));
con.send(iq, self.handle);
Console.log('Getting social notifications...');
} catch(e) {
Console.error('Notification.get', e);
@ -439,24 +439,24 @@ var Notification = (function () {
if((stanza.getType() == 'error') && $(stanza.getNode()).find('item-not-found').size()) {
// The node may not exist, create it!
Pubsub.setup('', NS_URN_INBOX, '1', '1000000', 'whitelist', 'open', true);
Console.warn('Error while getting social notifications, trying to reconfigure the Pubsub node!');
}
// Selector
var items = $(stanza.getNode()).find('item');
// Should we inverse?
var inverse = true;
if(items.size() == 1) {
inverse = false;
}
// Parse notifications
items.each(function() {
var this_sel = $(this);
// Parse the current item
var current_item = this_sel.attr('id');
var current_type = this_sel.find('link[rel="via"]:first').attr('title');
@ -467,16 +467,16 @@ var Notification = (function () {
var current_text = this_sel.find('content[type="text"]:first').text();
var current_bname = Name.getBuddy(current_xid);
var current_id = hex_md5(current_type + current_xid + current_href + current_text);
// Choose the good name!
if(!current_name || (current_bname != Common.getXIDNick(current_xid))) {
current_name = current_bname;
}
// Create it!
self.create(current_type, current_xid, [current_name, current_href, current_parent_href, current_item], current_text, current_id, inverse);
});
Console.info(items.size() + ' social notification(s) got!');
} catch(e) {
Console.error('Notification.handle', e);
@ -500,38 +500,38 @@ var Notification = (function () {
try {
// Notification ID
var id = hex_md5(xid + text + DateUtils.getTimeStamp());
// IQ
var iq = new JSJaCIQ();
iq.setType('set');
iq.setTo(xid);
// ATOM content
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB});
var publish = pubsub.appendChild(iq.buildNode('publish', {'node': NS_URN_INBOX, 'xmlns': NS_PUBSUB}));
var item = publish.appendChild(iq.buildNode('item', {'id': id, 'xmlns': NS_PUBSUB}));
var entry = item.appendChild(iq.buildNode('entry', {'xmlns': NS_ATOM}));
// Notification author (us)
var author = entry.appendChild(iq.buildNode('author', {'xmlns': NS_ATOM}));
author.appendChild(iq.buildNode('name', {'xmlns': NS_ATOM}, Name.get()));
author.appendChild(iq.buildNode('uri', {'xmlns': NS_ATOM}, 'xmpp:' + Common.getXID()));
// Notification content
entry.appendChild(iq.buildNode('published', {'xmlns': NS_ATOM}, DateUtils.getXMPPTime('utc')));
entry.appendChild(iq.buildNode('content', {'type': 'text', 'xmlns': NS_ATOM}, text));
entry.appendChild(iq.buildNode('link', {'rel': 'via', 'title': type, 'href': href, 'xmlns': NS_ATOM}));
// Any parent item?
if(parent && parent[0] && parent[1] && parent[2]) {
// Generate the parent XMPP URI
var parent_href = 'xmpp:' + parent[0] + '?;node=' + encodeURIComponent(parent[1]) + ';item=' + encodeURIComponent(parent[2]);
entry.appendChild(iq.buildNode('link', {'rel': 'related', 'href': parent_href, 'xmlns': NS_ATOM}));
}
con.send(iq);
Console.log('Sending a social notification to ' + xid + ' (type: ' + type + ')...');
} catch(e) {
Console.error('Notification.send', e);
@ -551,11 +551,11 @@ var Notification = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('set');
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB});
var retract = pubsub.appendChild(iq.buildNode('retract', {'node': NS_URN_INBOX, 'xmlns': NS_PUBSUB}));
retract.appendChild(iq.buildNode('item', {'id': id, 'xmlns': NS_PUBSUB}));
con.send(iq);
} catch(e) {
Console.error('Notification.remove', e);
@ -575,10 +575,10 @@ var Notification = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('set');
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB_OWNER});
pubsub.appendChild(iq.buildNode('purge', {'node': NS_URN_INBOX, 'xmlns': NS_PUBSUB_OWNER}));
con.send(iq);
} catch(e) {
Console.error('Notification.purge', e);
@ -599,12 +599,12 @@ var Notification = (function () {
try {
// Process the new height
var max_height = $('#right-content').height() - 22;
// New height too small
if(max_height < 250) {
max_height = 250;
}
// Apply the new height
$('.notifications-content .tools-content-subitem').css('max-height', max_height);
} catch(e) {

View file

@ -37,42 +37,42 @@ var OOB = (function () {
// Get some values
var id = hex_md5(genID() + to + url + desc);
to = Caps.getFeatureResource(to, NS_IQOOB);
// IQs cannot be sent to offline users
if(!to) {
return;
}
// Register the ID
DataStore.setDB(Connection.desktop_hash, 'send/url', id, url);
DataStore.setDB(Connection.desktop_hash, 'send/desc', id, desc);
var aIQ = new JSJaCIQ();
aIQ.setTo(Common.fullXID(to));
aIQ.setType('set');
aIQ.setID(id);
// Append the query content
var aQuery = aIQ.setQuery(NS_IQOOB);
aQuery.appendChild(aIQ.buildNode('url', {'xmlns': NS_IQOOB}, url));
aQuery.appendChild(aIQ.buildNode('desc', {'xmlns': NS_IQOOB}, desc));
con.send(aIQ);
}
// Message stanza?
else {
var aMsg = new JSJaCMessage();
aMsg.setTo(Common.bareXID(to));
// Append the content
aMsg.setBody(desc);
var aX = aMsg.appendNode('x', {'xmlns': NS_XOOB});
aX.appendChild(aMsg.buildNode('url', {'xmlns': NS_XOOB}, url));
con.send(aMsg);
}
Console.log('Sent OOB request to: ' + to + ' (' + desc + ')');
} catch(e) {
Console.error('OOB.send', e);
@ -94,7 +94,7 @@ var OOB = (function () {
try {
var xid = '', url = '', desc = '';
if(type == 'iq') {
// IQ stanza
xid = Common.fullXID(from);
@ -106,12 +106,12 @@ var OOB = (function () {
url = $(node).find('url').text();
desc = $(node).find('body').text();
}
// No desc?
if(!desc) {
desc = url;
}
// Open a new notification
if(type && xid && url && desc) {
Notification.create('send', xid, [xid, url, type, id, node], desc, hex_md5(xid + url + desc + id));
@ -140,28 +140,28 @@ var OOB = (function () {
if(type != 'iq') {
return;
}
// New IQ
var aIQ = new JSJaCIQ();
aIQ.setTo(to);
aIQ.setID(id);
// OOB request accepted
if(choice == 'accept') {
aIQ.setType('result');
Console.info('Accepted file request from: ' + to);
}
// OOB request rejected
else {
aIQ.setType('error');
// Append stanza content
for(var i = 0; i < node.childNodes.length; i++) {
aIQ.getNode().appendChild(node.childNodes.item(i).cloneNode(true));
}
// Append error content
var aError = aIQ.appendNode('error', {
'xmlns': NS_CLIENT,
@ -170,10 +170,10 @@ var OOB = (function () {
});
aError.appendChild(aIQ.buildNode('not-acceptable', {'xmlns': NS_STANZAS}));
Console.info('Rejected file request from: ' + to);
}
con.send(aIQ);
} catch(e) {
Console.error('OOB.reply', e);
@ -198,7 +198,7 @@ var OOB = (function () {
subitem_sel.append(
'<div class="wait wait-medium"></div>'
);
// Lock the bubble
chat_tools_file_sel.addClass('mini');
} catch(e) {
@ -221,51 +221,51 @@ var OOB = (function () {
// Data selector
var dData = $(responseXML).find('jappix');
// Get the values
var fID = dData.find('id').text();
var fURL = dData.find('url').text();
var fDesc = dData.find('desc').text();
// Get the OOB values
var oob_has;
// No ID provided?
if(!fID) {
oob_has = ':has(.wait)';
} else {
oob_has = ':has(#oob-upload input[value="' + fID + '"])';
}
var xid = page_engine_sel.find('.page-engine-chan' + oob_has).attr('data-xid');
var oob_type = page_engine_sel.find('.chat-tools-file' + oob_has).attr('data-oob');
// Reset the file send tool
page_engine_sel.find('.chat-tools-file' + oob_has).removeClass('mini');
page_engine_sel.find('.bubble-file' + oob_has).remove();
// Not available?
if(page_engine_sel.find('.chat-tools-file' + oob_has).is(':hidden') && (oob_type == 'iq')) {
Board.openThisError(4);
// Remove the file we sent
if(fURL) {
$.get(fURL + '&action=remove');
}
}
// Everything okay?
else if(fURL && fDesc && !dData.find('error').size()) {
// Send the OOB request
self.send(xid, oob_type, fURL, fDesc);
// Notify the sender
Notification.create('send_pending', xid, [xid, fURL, oob_type, '', ''], fDesc, hex_md5(fURL + fDesc + fID));
Console.info('File request sent.');
} else {
Board.openThisError(4);
Console.error('Error while sending the file', dData.find('error').text());
}
} catch(e) {

View file

@ -29,191 +29,191 @@ var Options = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Edit options") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-general tab-active" data-key="1">' + Common._e("General") + '</a>' +
'<a href="#" class="tab-channel pubsub-hidable pubsub-hidable-cn" data-key="2">' + Common._e("Channel") + '</a>' +
'<a href="#" class="tab-account" data-key="3">' + Common._e("Account") + '</a>' +
'</div>' +
'<div class="content">' +
'<div id="conf1" class="lap-active one-lap forms">' +
'<fieldset class="privacy">' +
'<legend>' + Common._e("Privacy") + '</legend>' +
var html =
'<div class="top">' + Common._e("Edit options") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-general tab-active" data-key="1">' + Common._e("General") + '</a>' +
'<a href="#" class="tab-channel pubsub-hidable pubsub-hidable-cn" data-key="2">' + Common._e("Channel") + '</a>' +
'<a href="#" class="tab-account" data-key="3">' + Common._e("Account") + '</a>' +
'</div>' +
'<div class="content">' +
'<div id="conf1" class="lap-active one-lap forms">' +
'<fieldset class="privacy">' +
'<legend>' + Common._e("Privacy") + '</legend>' +
'<div class="geolocation">' +
'<label for="geolocation" class="pep-hidable">' + Common._e("Geolocation") + '</label>' +
'<input id="geolocation" type="checkbox" class="pep-hidable" />' +
'<label for="geolocation" class="pep-hidable">' + Common._e("Geolocation") + '</label>' +
'<input id="geolocation" type="checkbox" class="pep-hidable" />' +
'</div>' +
'<div class="archiving">' +
'<label for="archiving" class="mam-hidable">' + Common._e("Message archiving") + '</label>' +
'<select id="archiving" class="mam-hidable">' +
'<option value="never">' + Common._e("Disabled") + '</option>' +
'<option value="roster">' + Common._e("Store friend chats") + '</option>' +
'<option value="always">' + Common._e("Store all chats") + '</option>' +
'</select>' +
'<a href="#" class="linked empty-archives mam-purge-hidable">' + Common._e("Remove all archives") + '</a>' +
'<label for="archiving" class="mam-hidable">' + Common._e("Message archiving") + '</label>' +
'<select id="archiving" class="mam-hidable">' +
'<option value="never">' + Common._e("Disabled") + '</option>' +
'<option value="roster">' + Common._e("Store friend chats") + '</option>' +
'<option value="always">' + Common._e("Store all chats") + '</option>' +
'</select>' +
'<a href="#" class="linked empty-archives mam-purge-hidable">' + Common._e("Remove all archives") + '</a>' +
'</div>' +
'</fieldset>' +
'<fieldset class="application">' +
'<legend>' + Common._e("Application") + '</legend>' +
'</fieldset>' +
'<fieldset class="application">' +
'<legend>' + Common._e("Application") + '</legend>' +
'<div class="sounds">' +
'<label for="sounds">' + Common._e("Sounds") + '</label>' +
'<input id="sounds" type="checkbox" />' +
'<label for="sounds">' + Common._e("Sounds") + '</label>' +
'<input id="sounds" type="checkbox" />' +
'</div>' +
'<div class="showall">' +
'<label for="showall">' + Common._e("Show all friends") + '</label>' +
'<input id="showall" type="checkbox" />' +
'<label for="showall">' + Common._e("Show all friends") + '</label>' +
'<input id="showall" type="checkbox" />' +
'</div>' +
'<div class="groupchatpresence">' +
'<label for="groupchatpresence">' + Common._e("Groupchat presence messages") + '</label>' +
'<input id="groupchatpresence" type="checkbox" />' +
'<label for="groupchatpresence">' + Common._e("Groupchat presence messages") + '</label>' +
'<input id="groupchatpresence" type="checkbox" />' +
'</div>' +
'<div class="noxhtmlimg">' +
'<label for="noxhtmlimg">' + Common._e("No chat images auto-load") + '</label>' +
'<input id="noxhtmlimg" type="checkbox" />' +
'<label for="noxhtmlimg">' + Common._e("No chat images auto-load") + '</label>' +
'<input id="noxhtmlimg" type="checkbox" />' +
'</div>' +
'<div class="integratemedias">' +
'<label for="integratemedias">' + Common._e("Media integration") + '</label>' +
'<input id="integratemedias" type="checkbox" />' +
'<label for="integratemedias">' + Common._e("Media integration") + '</label>' +
'<input id="integratemedias" type="checkbox" />' +
'</div>' +
'<div class="localarchives mam-showable">' +
'<label for="localarchives">' + Common._e("Keep local chat archives") + '</label>' +
'<input id="localarchives" type="checkbox" />' +
'<label for="localarchives">' + Common._e("Keep local chat archives") + '</label>' +
'<input id="localarchives" type="checkbox" />' +
'</div>' +
'<div class="xmpplinks">' +
'<label class="xmpplinks-hidable">' + Common._e("XMPP links") + '</label>' +
'<a href="#" class="linked xmpp-links xmpplinks-hidable">' + Common._e("Open XMPP links with Jappix") + '</a>' +
'<label class="xmpplinks-hidable">' + Common._e("XMPP links") + '</label>' +
'<a href="#" class="linked xmpp-links xmpplinks-hidable">' + Common._e("Open XMPP links with Jappix") + '</a>' +
'</div>' +
'</fieldset>' +
'</fieldset>' +
'<div class="sub-ask sub-ask-mam sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Remove all archives") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Password") + '</label>' +
'<input type="password" class="purge-archives check-mam" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Remove") + ' &raquo;</a>' +
'</div>' +
'</div>' +
'<div id="conf2" class="one-lap forms">' +
'<fieldset class="channel">' +
'<legend>' + Common._e("Channel") + '</legend>' +
'<div class="sub-ask sub-ask-mam sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Remove all archives") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Password") + '</label>' +
'<input type="password" class="purge-archives check-mam" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Remove") + ' &raquo;</a>' +
'</div>' +
'</div>' +
'<div id="conf2" class="one-lap forms">' +
'<fieldset class="channel">' +
'<legend>' + Common._e("Channel") + '</legend>' +
'<div class="empty-channel">' +
'<label>' + Common._e("Empty") + '</label>' +
'<a href="#" class="linked empty-channel">' + Common._e("Empty channel") + '</a>' +
'</div>' +
'<div class="persistent">' +
'<label>' + Common._e("Persistent") + '</label>' +
'<input id="persistent" type="checkbox" />' +
'</div>' +
'<div class="maxnotices">' +
'<label>' + Common._e("Maximum notices") + '</label>' +
'<select id="maxnotices">' +
'<option value="1">1</option>' +
'<option value="100">100</option>' +
'<option value="1000">1000</option>' +
'<option value="10000">10000</option>' +
'<option value="100000">100000</option>' +
'<option value="1000000">1000000</option>' +
'</select>' +
'<label>' + Common._e("Empty") + '</label>' +
'<a href="#" class="linked empty-channel">' + Common._e("Empty channel") + '</a>' +
'</div>' +
'</fieldset>' +
'<div class="sub-ask sub-ask-empty sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Empty channel") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Password") + '</label>' +
'<input type="password" class="purge-microblog check-empty" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Empty") + ' &raquo;</a>' +
'</div>' +
'</div>' +
'<div id="conf3" class="one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("Account") + '</legend>' +
'<label>' + Common._e("Password") + '</label>' +
'<a href="#" class="linked change-password">' + Common._e("Change password") + '</a>' +
'<label>' + Common._e("Delete") + '</label>' +
'<a href="#" class="linked delete-account">' + Common._e("Delete account") + '</a>' +
'</fieldset>' +
'<div class="sub-ask sub-ask-pass sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Change password") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Old") + '</label>' +
'<input type="password" class="password-change old" required="" />' +
'<label>' + Common._e("New (2 times)") + '</label>' +
'<input type="password" class="password-change new1" required="" />' +
'<input type="password" class="password-change new2" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Continue") + ' &raquo;</a>' +
'</div>' +
'<div class="sub-ask sub-ask-delete sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Delete account") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Password") + '</label>' +
'<input type="password" class="delete-account check-password" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Delete") + ' &raquo;</a>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'<div class="persistent">' +
'<label>' + Common._e("Persistent") + '</label>' +
'<input id="persistent" type="checkbox" />' +
'</div>' +
'<div class="maxnotices">' +
'<label>' + Common._e("Maximum notices") + '</label>' +
'<select id="maxnotices">' +
'<option value="1">1</option>' +
'<option value="100">100</option>' +
'<option value="1000">1000</option>' +
'<option value="10000">10000</option>' +
'<option value="100000">100000</option>' +
'<option value="1000000">1000000</option>' +
'</select>' +
'</div>' +
'</fieldset>' +
'<div class="sub-ask sub-ask-empty sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Empty channel") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Password") + '</label>' +
'<input type="password" class="purge-microblog check-empty" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Empty") + ' &raquo;</a>' +
'</div>' +
'</div>' +
'<div id="conf3" class="one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("Account") + '</legend>' +
'<label>' + Common._e("Password") + '</label>' +
'<a href="#" class="linked change-password">' + Common._e("Change password") + '</a>' +
'<label>' + Common._e("Delete") + '</label>' +
'<a href="#" class="linked delete-account">' + Common._e("Delete account") + '</a>' +
'</fieldset>' +
'<div class="sub-ask sub-ask-pass sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Change password") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Old") + '</label>' +
'<input type="password" class="password-change old" required="" />' +
'<label>' + Common._e("New (2 times)") + '</label>' +
'<input type="password" class="password-change new1" required="" />' +
'<input type="password" class="password-change new2" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Continue") + ' &raquo;</a>' +
'</div>' +
'<div class="sub-ask sub-ask-delete sub-ask-element">' +
'<div class="sub-ask-top">' +
'<div class="sub-ask-title">' + Common._e("Delete account") + '</div>' +
'<a href="#" class="sub-ask-close">X</a>' +
'</div>' +
'<div class="sub-ask-content">' +
'<label>' + Common._e("Password") + '</label>' +
'<input type="password" class="delete-account check-password" required="" />' +
'</div>' +
'<a href="#" class="sub-ask-bottom">' + Common._e("Delete") + ' &raquo;</a>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'</div>';
// Create the popup
Popup.create('options', html);
// Apply the features
Features.apply('options');
// Associate the events
self.instance();
} catch(e) {
@ -302,10 +302,10 @@ var Options = (function () {
try {
var options_sel = $('#options');
var content_sel = options_sel.find('.content');
// Remove the current item class
content_sel.removeClass(id);
// Hide the waiting items if all was received
if(!content_sel.hasClass('microblog') && !content_sel.hasClass('mam')) {
options_sel.find('.wait').hide();
@ -335,25 +335,25 @@ var Options = (function () {
var integratemedias = DataStore.getDB(Connection.desktop_hash, 'options', 'integratemedias');
var localarchives = DataStore.getDB(Connection.desktop_hash, 'options', 'localarchives');
var status = DataStore.getDB(Connection.desktop_hash, 'options', 'presence-status');
// Create an array to be looped
var oType = ['sounds', 'geolocation', 'roster-showall', 'no-xhtml-images', 'groupchatpresence', 'integratemedias', 'localarchives', 'presence-status'];
var oContent = [sounds, geolocation, showall, noxhtmlimg, groupchatpresence, integratemedias, localarchives, status];
// New IQ
var iq = new JSJaCIQ();
iq.setType('set');
var query = iq.setQuery(NS_PRIVATE);
var storage = query.appendChild(iq.buildNode('storage', {'xmlns': NS_OPTIONS}));
// Loop the array
for(var i in oType) {
storage.appendChild(iq.buildNode('option', {'type': oType[i], 'xmlns': NS_OPTIONS}, oContent[i]));
}
con.send(iq, self.handleStore);
Console.info('Storing options...');
} catch(e) {
Console.error('Options.store', e);
@ -393,27 +393,27 @@ var Options = (function () {
try {
// We apply the sounds
var sounds = '0';
if($('#sounds').filter(':checked').size()) {
sounds = '1';
}
DataStore.setDB(Connection.desktop_hash, 'options', 'sounds', sounds);
// We apply the geolocation
if($('#geolocation').filter(':checked').size()) {
DataStore.setDB(Connection.desktop_hash, 'options', 'geolocation', '1');
// We geolocate the user on the go
PEP.geolocate();
} else {
DataStore.setDB(Connection.desktop_hash, 'options', 'geolocation', '0');
// We delete the geolocation informations
PEP.sendPosition();
DataStore.removeDB(Connection.desktop_hash, 'geolocation', 'now');
}
// We apply the roster show all
if($('#showall').filter(':checked').size()) {
DataStore.setDB(Connection.desktop_hash, 'options', 'roster-showall', '1');
@ -422,11 +422,11 @@ var Options = (function () {
DataStore.setDB(Connection.desktop_hash, 'options', 'roster-showall', '0');
Interface.showOnlineBuddies('options');
}
// We apply the XHTML-IM images filter
var noxhtmlimg = '1' ? $('#noxhtmlimg').filter(':checked').size() : '0';
DataStore.setDB(Connection.desktop_hash, 'options', 'no-xhtml-images', noxhtmlimg);
// We apply the groupchat presence messages configuration
var groupchatpresence = '1' ? $('#groupchatpresence').filter(':checked').size() : '0';
DataStore.setDB(Connection.desktop_hash, 'options', 'groupchatpresence', groupchatpresence);
@ -443,23 +443,23 @@ var Options = (function () {
if(localarchives === '0') {
Message.flushLocalArchive();
}
// We apply the message archiving
if(Features.enabledMAM()) {
MAM.setConfig($('#archiving').val() || 'never');
}
// We apply the microblog configuration
var persist = '1' ? $('#persist').filter(':checked').size() : '0';
var maximum = $('#maxnotices').val();
if(Features.enabledPEP() && (Features.enabledPubSub() || Features.enabledPubSubCN())) {
Pubsub.setup('', NS_URN_MBLOG, persist, maximum, '', '', false);
}
// We send the options to the database
self.store();
// Close the options
self.close();
} catch(e) {
@ -482,13 +482,13 @@ var Options = (function () {
try {
// Remove the general wait item
Interface.removeGeneralWait();
// If no errors
if(!Errors.handleReply(iq)) {
Connection.clearLastSession();
Connection.quit();
Board.openThisInfo(1);
Console.info('Password changed.');
} else {
Console.warn('Password not changed.');
@ -513,38 +513,38 @@ var Options = (function () {
var password0 = $('#options .old').val();
var password1 = $('#options .new1').val();
var password2 = $('#options .new2').val();
if ((password1 == password2) && (password0 == Utils.getPassword())) {
// We show the waiting image
Interface.showGeneralWait();
// We send the IQ
var iq = new JSJaCIQ();
iq.setTo(Utils.getServer());
iq.setType('set');
var iqQuery = iq.setQuery(NS_REGISTER);
iqQuery.appendChild(iq.buildNode('username', {'xmlns': NS_REGISTER}, con.username));
iqQuery.appendChild(iq.buildNode('password', {'xmlns': NS_REGISTER}, password1));
con.send(iq, self.handlePwdChange);
Console.info('Password change sent.');
} else {
$('.sub-ask-pass input').each(function() {
var select = $(this);
if(!select.val()) {
$(document).oneTime(10, function() {
select.addClass('please-complete').focus();
});
} else {
select.removeClass('please-complete');
select.removeClass('please-complete');
}
});
if(password0 != Utils.getPassword()) {
$(document).oneTime(10, function() {
$('#options .old').addClass('please-complete').focus();
@ -577,14 +577,14 @@ var Options = (function () {
try {
// Remove the general wait item
Interface.removeGeneralWait();
// If no errors
if(!Errors.handleReply(iq)) {
Connection.clearLastSession();
Talk.destroy();
Board.openThisInfo(2);
Connection.logout();
Console.info('Account deleted.');
} else {
Console.warn('Account not deleted.');
@ -606,7 +606,7 @@ var Options = (function () {
try {
var pwd_input_sel = $('#options .check-mam');
var password = pwd_input_sel.val();
if(password == Utils.getPassword()) {
MAM.purgeArchives();
@ -618,7 +618,7 @@ var Options = (function () {
$('#options .sub-ask-mam .sub-ask-close').click();
} else {
var selector = $('#options .check-mam');
if(password != Utils.getPassword()) {
$(document).oneTime(10, function() {
selector.addClass('please-complete').focus();
@ -648,25 +648,25 @@ var Options = (function () {
try {
var pwd_input_sel = $('#options .check-empty');
var password = pwd_input_sel.val();
if(password == Utils.getPassword()) {
// Send the IQ to remove the item (and get eventual error callback)
var iq = new JSJaCIQ();
iq.setType('set');
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB_OWNER});
pubsub.appendChild(iq.buildNode('purge', {'node': NS_URN_MBLOG, 'xmlns': NS_PUBSUB_OWNER}));
con.send(iq, self.handleMicroblogPurge);
// Hide the tool
pwd_input_sel.val('');
$('#options .sub-ask-empty .sub-ask-close').click();
Console.info('Microblog purge sent.');
} else {
var selector = $('#options .check-empty');
if(password != Utils.getPassword()) {
$(document).oneTime(10, function() {
selector.addClass('please-complete').focus();
@ -697,7 +697,7 @@ var Options = (function () {
if(!Errors.handleReply(iq)) {
// Remove the microblog items
$('.one-update.update_' + hex_md5(Common.getXID())).remove();
Console.info('Microblog purged.');
} else {
Console.warn('Microblog not purged.');
@ -720,24 +720,24 @@ var Options = (function () {
try {
var password = $('#options .check-password').val();
if(password == Utils.getPassword()) {
// We show the waiting image
Interface.showGeneralWait();
// We send the IQ
var iq = new JSJaCIQ();
iq.setType('set');
var iqQuery = iq.setQuery(NS_REGISTER);
iqQuery.appendChild(iq.buildNode('remove', {'xmlns': NS_REGISTER}));
con.send(iq, self.handleAccDeletion);
Console.info('Delete account sent.');
} else {
var selector = $('#options .check-password');
if(password != Utils.getPassword()) {
$(document).oneTime(10, function() {
selector.addClass('please-complete').focus();
@ -769,58 +769,58 @@ var Options = (function () {
var enabled_pubsub_cn = Features.enabledPubSubCN();
var enabled_pep = Features.enabledPEP();
var sWait = $('#options .content');
// Show the waiting items if necessary
if(enabled_mam || (enabled_pep && (enabled_pubsub || enabled_pubsub_cn))) {
$('#options .wait').show();
$('#options .finish:first').addClass('disabled');
}
// We get the archiving configuration
if(enabled_mam) {
sWait.addClass('mam');
MAM.getConfig();
}
// We get the microblog configuration
if((enabled_pubsub || enabled_pubsub_cn) && enabled_pep) {
sWait.addClass('microblog');
Microblog.getConfig();
}
// We show the "privacy" form if something is visible into it
if(enabled_mam || enabled_pep) {
$('#options fieldset.privacy').show();
}
// We get the values of the forms for the sounds
if(DataStore.getDB(Connection.desktop_hash, 'options', 'sounds') == '0') {
$('#sounds').attr('checked', false);
} else {
$('#sounds').attr('checked', true);
}
// We get the values of the forms for the geolocation
if(DataStore.getDB(Connection.desktop_hash, 'options', 'geolocation') == '1') {
$('#geolocation').attr('checked', true);
} else {
$('#geolocation').attr('checked', false);
}
// We get the values of the forms for the roster show all
if(DataStore.getDB(Connection.desktop_hash, 'options', 'roster-showall') == '1') {
$('#showall').attr('checked', true);
} else {
$('#showall').attr('checked', false);
}
// We get the values of the forms for the XHTML-IM images filter
if(DataStore.getDB(Connection.desktop_hash, 'options', 'no-xhtml-images') == '1') {
$('#noxhtmlimg').attr('checked', true);
} else {
$('#noxhtmlimg').attr('checked', false);
}
// We get the values of the forms for the integratemedias
if(DataStore.getDB(Connection.desktop_hash, 'options', 'integratemedias') == '0') {
$('#integratemedias').attr('checked', false);
@ -861,80 +861,80 @@ var Options = (function () {
// Yet active?
if($(this).hasClass('tab-active'))
return false;
// Switch to the good tab
var key = parseInt($(this).attr('data-key'));
return self.switchTab(key);
});
$('#options .linked').click(function() {
$('#options .sub-ask').hide();
$('#options .forms').removeClass('in_background');
});
$('#options .xmpp-links').click(function() {
Utils.xmppLinksHandler();
return false;
});
$('#options .empty-archives').click(function() {
var selector = '#options .sub-ask-mam';
$(selector).show();
$('#options .forms').addClass('in_background');
$(document).oneTime(10, function() {
$(selector + ' input').focus();
});
return false;
});
$('#options .empty-channel').click(function() {
var selector = '#options .sub-ask-empty';
$(selector).show();
$('#options .forms').addClass('in_background');
$(document).oneTime(10, function() {
$(selector + ' input').focus();
});
return false;
});
$('#options .change-password').click(function() {
var selector = '#options .sub-ask-pass';
$(selector).show();
$('#options .forms').addClass('in_background');
$(document).oneTime(10, function() {
$(selector + ' input:first').focus();
});
return false;
});
$('#options .delete-account').click(function() {
var selector = '#options .sub-ask-delete';
$(selector).show();
$('#options .forms').addClass('in_background');
$(document).oneTime(10, function() {
$(selector + ' input').focus();
});
return false;
});
$('#options .sub-ask-pass .sub-ask-bottom').click(function() {
return self.sendNewPassword();
});
$('#options .sub-ask-mam .sub-ask-bottom').click(function() {
return self.purgeMyArchives();
});
@ -942,18 +942,18 @@ var Options = (function () {
$('#options .sub-ask-empty .sub-ask-bottom').click(function() {
return self.purgeMyMicroblog();
});
$('#options .sub-ask-delete .sub-ask-bottom').click(function() {
return self.deleteMyAccount();
});
$('#options .sub-ask-close').click(function() {
$('#options .sub-ask').hide();
$('#options .forms').removeClass('in_background');
return false;
});
$('#options .bottom .finish').click(function() {
if($(this).is('.save') && !$(this).hasClass('disabled')) {
return self.save();
@ -962,10 +962,10 @@ var Options = (function () {
if($(this).is('.cancel')) {
return self.close();
}
return false;
});
// The keyup events
$('#options .sub-ask input').keyup(function(e) {
if(e.keyCode == 13) {
@ -978,19 +978,19 @@ var Options = (function () {
else if($(this).is('.purge-microblog')) {
return self.purgeMyMicroblog();
}
// Password change
else if($(this).is('.password-change')) {
return self.sendNewPassword();
}
// Account deletion
else if($(this).is('.delete-account')) {
return self.deleteMyAccount();
}
}
});
// Load the options
self.load();
} catch(e) {

View file

@ -63,14 +63,14 @@ var PEP = (function () {
if(node_sel) {
display_args.pep_value = node_sel.find('value').text() || 'none';
display_args.pep_text = node_sel.find('text').text();
display_args.style_value = icon_fn(display_args.pep_value);
display_args.style_text = display_args.pep_text ? display_args.pep_text : Common._e("unknown");
} else {
display_args.style_value = icon_fn('undefined');
display_args.style_text = Common._e("unknown");
}
display_args.display_text = display_args.style_text;
display_args.style_text = display_args.style_text.htmlEnc();
} catch(e) {
@ -142,14 +142,14 @@ var PEP = (function () {
try {
tune_args.style_value = 'tune-note';
if(node_sel) {
// Parse the tune XML
var tune_artist = node_sel.find('artist').text();
var tune_title = node_sel.find('title').text();
var tune_album = node_sel.find('album').text();
var tune_uri = node_sel.find('uri').text();
// Apply the good values
if(!tune_artist && !tune_album && !tune_title) {
tune_args.style_text = Common._e("unknown");
@ -157,13 +157,13 @@ var PEP = (function () {
} else {
tune_args.final_uri = tune_uri ||
'http://grooveshark.com/search?q=' + encodeURIComponent(tune_artist + ' ' + tune_title + ' ' + tune_album);
var final_artist = tune_artist || Common._e("unknown");
var final_title = tune_title || Common._e("unknown");
var final_album = tune_album || Common._e("unknown");
tune_args.final_link = ' href="' + tune_args.final_uri + '" target="_blank"';
// Generate the text to be displayed
tune_args.display_text = final_artist + ' - ' + final_title + ' (' + final_album + ')';
tune_args.style_text = '<a' + tune_args.final_link + '>' + tune_args.display_text + '</a>';
@ -193,11 +193,11 @@ var PEP = (function () {
try {
geolocation_args.style_value = 'location-world';
if(node_sel) {
geolocation_args.geoloc_lat = node_sel.find('lat').text();
geolocation_args.geoloc_lon = node_sel.find('lon').text();
geolocation_args.geoloc_human = node_sel.find('human').text() ||
geolocation_args.geoloc_human = node_sel.find('human').text() ||
Common._e("See his/her position on the globe");
geolocation_args.geoloc_real = geolocation_args.geoloc_human;
@ -205,11 +205,11 @@ var PEP = (function () {
if(geolocation_args.geoloc_lat && geolocation_args.geoloc_lon) {
geolocation_args.final_uri = 'http://maps.google.com/?q=' + Common.encodeQuotes(geolocation_args.geoloc_lat) + ',' + Common.encodeQuotes(geolocation_args.geoloc_lon);
geolocation_args.final_link = ' href="' + geolocation_args.final_uri + '" target="_blank"';
geolocation_args.style_text = '<a' + geolocation_args.final_link + '>' +
geolocation_args.geoloc_human.htmlEnc() +
geolocation_args.style_text = '<a' + geolocation_args.final_link + '>' +
geolocation_args.geoloc_human.htmlEnc() +
'</a>';
geolocation_args.display_text = geolocation_args.geoloc_real ||
geolocation_args.display_text = geolocation_args.geoloc_real ||
(geolocation_args.geoloc_lat + '; ' + geolocation_args.geoloc_lon);
} else {
geolocation_args.style_text = Common._e("unknown");
@ -241,21 +241,21 @@ var PEP = (function () {
try {
var this_buddy = '#roster .buddy[data-xid="' + escape(xid) + '"]';
if(Common.exists(this_buddy)) {
$(this_buddy + ' .bi-' + type).replaceWith(
'<p class="bi-' + type + ' talk-images ' + display_args.style_value + '" title="' + Common.encodeQuotes(display_args.display_text) + '">' + display_args.style_text + '</p>'
);
}
// Apply the text to the buddy chat
if(Common.exists('#' + hash)) {
// Selector
var bc_pep = $('#' + hash + ' .bc-pep');
// We remove the old PEP item
bc_pep.find('a.bi-' + type).remove();
// If the new PEP item is not null, create a new one
if(display_args.style_text != Common._e("unknown")) {
bc_pep.prepend(
@ -288,7 +288,7 @@ var PEP = (function () {
// Change the input value
var display_value = '';
var display_attribute = display_args.pep_value;
// Must apply default values?
if(display_args.pep_value == 'none') {
if(type == 'mood') {
@ -297,16 +297,16 @@ var PEP = (function () {
display_attribute = 'exercising';
}
}
// No text?
if(display_args.display_text != Common._e("unknown")) {
display_value = display_args.display_text;
}
// Store this user event in our database
DataStore.setDB(Connection.desktop_hash, type + '-value', 1, display_attribute);
DataStore.setDB(Connection.desktop_hash, type + '-text', 1, display_value);
// Apply this PEP event
$('#my-infos .f-' + type + ' a.picker').attr('data-value', display_attribute);
$('#my-infos .f-' + type + ' input').val(display_value);
@ -314,12 +314,12 @@ var PEP = (function () {
} else if((type == 'tune') || (type == 'geoloc')) {
// Reset the values
$('#my-infos .f-others a.' + type).remove();
// Not empty?
if(display_args.display_text != Common._e("unknown")) {
// Specific stuffs
var href, title, icon_class;
if(type == 'tune') {
href = display_args.final_uri;
title = display_args.display_text;
@ -329,25 +329,25 @@ var PEP = (function () {
title = Common._e("Where are you?") + ' (' + display_args.display_text + ')';
icon_class = 'location-world';
}
// Must create the container?
if(!Common.exists('#my-infos .f-others')) {
$('#my-infos .content').append('<div class="element f-others"></div>');
}
// Create the element
$('#my-infos .f-others').prepend(
'<a class="icon ' + type + '" href="' + Common.encodeQuotes(href) + '" target="_blank" title="' + Common.encodeQuotes(title) + '">' +
'<span class="talk-images ' + icon_class + '"></span>' +
'<a class="icon ' + type + '" href="' + Common.encodeQuotes(href) + '" target="_blank" title="' + Common.encodeQuotes(title) + '">' +
'<span class="talk-images ' + icon_class + '"></span>' +
'</a>'
);
}
// Empty?
else if(!Common.exists('#my-infos .f-others a.icon')) {
$('#my-infos .f-others').remove();
}
// Process the roster height again
Roster.adapt();
}
@ -372,8 +372,8 @@ var PEP = (function () {
var cur_value;
for(var cur_arg in args) {
storage_data += '<' + cur_arg + '>' +
(args[cur_arg] || '').htmlEnc() +
storage_data += '<' + cur_arg + '>' +
(args[cur_arg] || '').htmlEnc() +
'</' + cur_arg + '>';
}
} catch(e) {
@ -409,17 +409,17 @@ var PEP = (function () {
'amorous': Common._e("Amorous"),
'confident': Common._e("Confident")
};
// Yet displayed?
var can_append = !Common.exists(path);
// Add this bubble!
Bubble.show(path);
if(!can_append) {
return false;
}
// Generate the HTML code
var html = '<div class="bubble removable">';
@ -428,15 +428,15 @@ var PEP = (function () {
if(cur_mood_name == mood_val) {
continue;
}
html += '<a href="#" class="talk-images" data-value="' + cur_mood_name + '" title="' + moods_obj[cur_mood_name] + '"></a>';
}
html += '</div>';
// Append the HTML code
$('#my-infos .f-mood').append(html);
// Click event
$(path + ' a').click(function() {
// Update the mood marker
@ -444,15 +444,15 @@ var PEP = (function () {
'data-value',
$(this).attr('data-value')
);
// Close the bubble
Bubble.close();
// Focus on the status input
$(document).oneTime(10, function() {
$('#mood-text').focus();
});
return;
});
} catch(e) {
@ -492,44 +492,44 @@ var PEP = (function () {
};
var can_append = !Common.exists(path);
// Add this bubble!
Bubble.show(path);
if(!can_append) {
return false;
}
// Generate the HTML code
var html = '<div class="bubble removable">';
for(var cur_activity_name in activities_obj) {
// Yet in use: no need to display it!
if(cur_activity_name == activity_val) {
continue;
}
html += '<a href="#" class="talk-images" data-value="' + cur_activity_name + '" title="' + activities_obj[cur_activity_name] + '"></a>';
}
html += '</div>';
// Append the HTML code
$('#my-infos .f-activity').append(html);
// Click event
$(path + ' a').click(function() {
// Update the activity marker
picker_sel.attr('data-value', $(this).attr('data-value'));
// Close the bubble
Bubble.close();
// Focus on the status input
$(document).oneTime(10, function() {
$('#activity-text').focus();
});
return false;
});
} catch(e) {
@ -557,7 +557,7 @@ var PEP = (function () {
element_text_sel.keyup(function(e) {
if(e.keyCode == 13) {
$(this).blur();
return false;
}
});
@ -567,18 +567,18 @@ var PEP = (function () {
// Read the parameters
var value = $('#my-infos .f-' + name + ' a.picker').attr('data-value');
var text = $(this).val();
// Must send?
if((value != DataStore.getDB(Connection.desktop_hash, name + '-value', 1)) || (text != DataStore.getDB(Connection.desktop_hash, name + '-text', 1))) {
// Update the local stored values
DataStore.setDB(Connection.desktop_hash, name + '-value', 1, value);
DataStore.setDB(Connection.desktop_hash, name + '-text', 1, text);
// Send it!
send_fn(value, undefined, text);
}
});
// Input focus handler
element_text_sel.focus(function() {
Bubble.close();
@ -648,7 +648,7 @@ var PEP = (function () {
try {
if(value1 || value2 || value3 || value4) {
var xml = '<pep type="' + type + '">';
// Generate the subnodes
switch(type) {
case 'tune':
@ -674,16 +674,16 @@ var PEP = (function () {
'text': value2
});
}
// End the XML node
xml += '</pep>';
// Update the input with the new value
DataStore.setDB(Connection.desktop_hash, 'pep-' + type, xid, xml);
} else {
DataStore.removeDB(Connection.desktop_hash, 'pep-' + type, xid);
}
// Display the PEP event
self.display(xid, type);
} catch(e) {
@ -707,7 +707,7 @@ var PEP = (function () {
var value = $(Common.XMLFromString(
DataStore.getDB(Connection.desktop_hash, 'pep-' + type, xid))
);
// If the PEP element exists
if(type) {
// Get the user hash
@ -735,7 +735,7 @@ var PEP = (function () {
// Append foreign PEP user values
self._appendForeignDisplayObject(xid, hash, type, display_args);
// PEP values of the logged in user?
if(xid == Common.getXID()) {
self._appendOwnDisplayObject(type, display_args);
@ -759,7 +759,7 @@ var PEP = (function () {
try {
// The main var
var icon;
// Switch the values
switch(value) {
case 'angry':
@ -772,13 +772,13 @@ var PEP = (function () {
case 'strong':
icon = 'mood-one';
break;
case 'contemplative':
case 'happy':
case 'playful':
icon = 'mood-two';
break;
case 'aroused':
case 'envious':
case 'excited':
@ -790,7 +790,7 @@ var PEP = (function () {
case 'shy':
icon = 'mood-three';
break;
case 'calm':
case 'cautious':
case 'contented':
@ -801,7 +801,7 @@ var PEP = (function () {
case 'none':
icon = 'mood-four';
break;
case 'afraid':
case 'amazed':
case 'confused':
@ -819,7 +819,7 @@ var PEP = (function () {
case 'impressed':
icon = 'mood-five';
break;
case 'crazy':
case 'distracted':
case 'neutral':
@ -827,7 +827,7 @@ var PEP = (function () {
case 'thirsty':
icon = 'mood-six';
break;
case 'amorous':
case 'curious':
case 'in_love':
@ -835,7 +835,7 @@ var PEP = (function () {
case 'sarcastic':
icon = 'mood-eight';
break;
case 'brave':
case 'confident':
case 'hopeful':
@ -844,12 +844,12 @@ var PEP = (function () {
case 'thankful':
icon = 'mood-nine';
break;
default:
icon = 'mood-seven';
break;
}
// Return the good icon name
return icon;
} catch(e) {
@ -870,45 +870,45 @@ var PEP = (function () {
try {
// The main var
var icon;
// Switch the values
switch(value) {
case 'doing_chores':
icon = 'activity-doing_chores';
break;
case 'drinking':
icon = 'activity-drinking';
break;
case 'eating':
icon = 'activity-eating';
break;
case 'grooming':
icon = 'activity-grooming';
break;
case 'having_appointment':
icon = 'activity-having_appointment';
break;
case 'inactive':
icon = 'activity-inactive';
break;
case 'relaxing':
icon = 'activity-relaxing';
break;
case 'talking':
icon = 'activity-talking';
break;
case 'traveling':
icon = 'activity-traveling';
break;
case 'working':
icon = 'activity-working';
break;
@ -916,7 +916,7 @@ var PEP = (function () {
icon = 'activity-exercising';
break;
}
// Return the good icon name
return icon;
} catch(e) {
@ -941,21 +941,21 @@ var PEP = (function () {
// We propagate the mood on the xmpp network
var iq = new JSJaCIQ();
iq.setType('set');
// We create the XML document
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB});
var publish = pubsub.appendChild(iq.buildNode('publish', {'node': NS_MOOD, 'xmlns': NS_PUBSUB}));
var item = publish.appendChild(iq.buildNode('item', {'xmlns': NS_PUBSUB}));
var mood = item.appendChild(iq.buildNode('mood', {'xmlns': NS_MOOD}));
if(value != 'none') {
mood.appendChild(iq.buildNode(value, {'xmlns': NS_MOOD}));
mood.appendChild(iq.buildNode('text', {'xmlns': NS_MOOD}, text));
}
// And finally we send the mood that is set
con.send(iq);
Console.info('New mood sent: ' + value + ' (' + text + ')');
} catch(e) {
Console.error('PEP.sendMood', e);
@ -978,7 +978,7 @@ var PEP = (function () {
// We propagate the mood on the xmpp network
var iq = new JSJaCIQ();
iq.setType('set');
// We create the XML document
var pubsub = iq.appendNode('pubsub', {
'xmlns': NS_PUBSUB
@ -996,12 +996,12 @@ var PEP = (function () {
var activity = item.appendChild(iq.buildNode('activity', {
'xmlns': NS_ACTIVITY
}));
if(main != 'none') {
var mainType = activity.appendChild(iq.buildNode(main, {
'xmlns': NS_ACTIVITY
}));
// Child nodes
if(sub) {
mainType.appendChild(iq.buildNode(sub, {
@ -1015,10 +1015,10 @@ var PEP = (function () {
}, text));
}
}
// And finally we send the mood that is set
con.send(iq);
Console.info('New activity sent: ' + main + ' (' + text + ')');
} catch(e) {
Console.error('PEP.sendActivity', e);
@ -1051,7 +1051,7 @@ var PEP = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('set');
// Create XML nodes
var pubsub = iq.appendNode('pubsub', {
'xmlns': NS_PUBSUB
@ -1069,7 +1069,7 @@ var PEP = (function () {
var geoloc = item.appendChild(iq.buildNode('geoloc', {
'xmlns': NS_GEOLOC
}));
// Position object
var position_obj = {
'lat': lat,
@ -1101,10 +1101,10 @@ var PEP = (function () {
);
}
}
// And finally we send the XML
con.send(iq);
// For logger
if(lat && lon) {
Console.info('Geolocated.');
@ -1128,7 +1128,7 @@ var PEP = (function () {
try {
var result = $(data).find('result:first');
// Get latitude and longitude
var geometry_sel = result.find('geometry:first location:first');
@ -1136,7 +1136,7 @@ var PEP = (function () {
var lng = geometry_sel.find('lng').text();
var addr_comp_sel = result.find('address_component');
var array = [
lat,
lng,
@ -1150,7 +1150,7 @@ var PEP = (function () {
result.find('formatted_address:first').text(),
'http://maps.google.com/?q=' + Common.encodeQuotes(lat) + ',' + Common.encodeQuotes(lng)
];
return array;
} catch(e) {
Console.error('PEP.parsePosition', e);
@ -1175,18 +1175,18 @@ var PEP = (function () {
if(locality) {
// Any locality
human_value += locality;
if(region) {
human_value += ', ' + region;
}
if(country) {
human_value += ', ' + country;
}
} else if(region) {
// Any region
human_value += region;
if(country) {
human_value += ', ' + country;
}
@ -1216,7 +1216,7 @@ var PEP = (function () {
var lat = '' + position.coords.latitude;
var lon = '' + position.coords.longitude;
var alt = '' + position.coords.altitude;
// Get full position (from Google Maps API)
$.get('./server/geolocation.php', {
latitude: lat,
@ -1226,7 +1226,7 @@ var PEP = (function () {
// Still connected?
if(Common.isConnected()) {
var results = self.parsePosition(data);
self.sendPosition(
(Utils.isNumber(lat) ? lat : null),
(Utils.isNumber(lon) ? lon : null),
@ -1241,14 +1241,14 @@ var PEP = (function () {
results[9],
results[10]
);
// Store data
DataStore.setDB(Connection.desktop_hash, 'geolocation', 'now', Common.xmlToString(data));
Console.log('Position details got from Google Maps API.');
}
});
Console.log('Position got: latitude > ' + lat + ' / longitude > ' + lon + ' / altitude > ' + alt);
} catch(e) {
Console.error('PEP.getPosition', e);
@ -1266,19 +1266,19 @@ var PEP = (function () {
try {
// Don't fire it until options & features are not retrieved!
if(!DataStore.getDB(Connection.desktop_hash, 'options', 'geolocation') ||
(DataStore.getDB(Connection.desktop_hash, 'options', 'geolocation') == '0') ||
if(!DataStore.getDB(Connection.desktop_hash, 'options', 'geolocation') ||
(DataStore.getDB(Connection.desktop_hash, 'options', 'geolocation') == '0') ||
!Features.enabledPEP()) {
return;
}
// We publish the user location if allowed
if(navigator.geolocation) {
// Wait a bit... (to fix a bug)
$('#my-infos').stopTime().oneTime('1s', function() {
navigator.geolocation.getCurrentPosition(self.getPosition);
});
Console.info('Geolocating...');
} else {
Console.error('Not geolocated: browser does not support it.');
@ -1300,7 +1300,7 @@ var PEP = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('get');
var pubsub = iq.appendNode('pubsub', {
'xmlns': NS_PUBSUB
});
@ -1309,9 +1309,9 @@ var PEP = (function () {
'node': NS_GEOLOC,
'xmlns': NS_PUBSUB
}));
ps_items.setAttribute('max_items', '0');
con.send(iq, self.handleInitGeoloc);
} catch(e) {
Console.error('PEP.getInitGeoloc', e);
@ -1333,7 +1333,7 @@ var PEP = (function () {
if((iq.getType() == 'error') && $(iq.getNode()).find('item-not-found').size()) {
// The node may not exist, create it!
Pubsub.setup('', NS_GEOLOC, '1', '1', '', '', true);
Console.warn('Error while getting geoloc, trying to reconfigure the PubSub node!');
}
} catch(e) {
@ -1375,21 +1375,21 @@ var PEP = (function () {
DataStore.setDB(Connection.desktop_hash, 'mood-text', 1, '');
DataStore.setDB(Connection.desktop_hash, 'activity-value', 1, '');
DataStore.setDB(Connection.desktop_hash, 'activity-text', 1, '');
// Click event for user mood
$('#my-infos .f-mood a.picker').click(function() {
return PEP._callbackMoodPicker(
$(this)
);
});
// Click event for user activity
$('#my-infos .f-activity a.picker').click(function() {
return PEP._callbackActivityPicker(
$(this)
);
});
// Attach events
self._eventsMoodText(
$('#mood-text')

View file

@ -34,27 +34,27 @@ var Popup = (function () {
if(Common.exists('#' + id)) {
return false;
}
// Popop on top of another one?
var top_of = Common.exists('div.lock:has(div.popup)');
// Append the popup code
$('body').append(
'<div id="' + id + '" class="lock removable">' +
'<div class="popup">' +
content +
'</div>' +
'<div id="' + id + '" class="lock removable">' +
'<div class="popup">' +
content +
'</div>' +
'</div>'
);
// Avoids darker popup background (if on top of another popup)
if(top_of) {
$('#' + id).css('background', 'transparent');
}
// Attach popup events
self.instance(id);
return true;
} catch(e) {
Console.error('Popup.create', e);
@ -74,10 +74,10 @@ var Popup = (function () {
try {
// Stop the popup timers
$('#' + id + ' *').stopTime();
// Remove the popup
$('#' + id).remove();
// Manage input focus
Interface.inputFocus();
} catch(e) {
@ -102,7 +102,7 @@ var Popup = (function () {
if($(evt.target).is('.lock:not(.unavoidable)')) {
// Destroy the popup
self.destroy(id);
return false;
}
});

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,12 @@ var Pubsub = (function () {
// Create the PubSub node
var iq = new JSJaCIQ();
iq.setType('set');
// Any external entity?
if(entity) {
iq.setTo(entity);
}
// Create it?
var pubsub;
@ -55,38 +55,38 @@ var Pubsub = (function () {
} else {
pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB_OWNER});
}
// Configure it!
var configure = pubsub.appendChild(iq.buildNode('configure', {'node': node, 'xmlns': NS_PUBSUB}));
var x = configure.appendChild(iq.buildNode('x', {'xmlns': NS_XDATA, 'type': 'submit'}));
var field1 = x.appendChild(iq.buildNode('field', {'var': 'FORM_TYPE', 'type': 'hidden', 'xmlns': NS_XDATA}));
field1.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, NS_PUBSUB_NC));
// Persist items?
if(persist) {
var field2 = x.appendChild(iq.buildNode('field', {'var': 'pubsub#persist_items', 'xmlns': NS_XDATA}));
field2.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, persist));
}
// Maximum items?
if(maximum) {
var field3 = x.appendChild(iq.buildNode('field', {'var': 'pubsub#max_items', 'xmlns': NS_XDATA}));
field3.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, maximum));
}
// Access rights?
if(access) {
var field4 = x.appendChild(iq.buildNode('field', {'var': 'pubsub#access_model', 'xmlns': NS_XDATA}));
field4.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, access));
}
// Publish rights?
if(publish) {
var field5 = x.appendChild(iq.buildNode('field', {'var': 'pubsub#publish_model', 'xmlns': NS_XDATA}));
field5.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, publish));
}
con.send(iq);
} catch(e) {
Console.error('Pubsub.setup', e);

View file

@ -106,17 +106,17 @@ var Receipts = (function () {
var aMsg = new JSJaCMessage();
aMsg.setTo(to);
aMsg.setID(id);
// Any type?
if(type) {
aMsg.setType(type);
}
// Append the received node
aMsg.appendNode('received', {'xmlns': NS_URN_RECEIPTS, 'id': id});
con.send(aMsg);
Console.log('Sent received to: ' + to);
} catch(e) {
Console.error('Receipts.sendReceived', e);
@ -137,14 +137,14 @@ var Receipts = (function () {
try {
// Line selector
var path = $('#' + hash + ' .one-line[data-id="' + id + '"]');
// Add a received marker
path.attr('data-received', 'true')
.removeAttr('data-lost');
// Group selector
var group = path.parent();
// Remove the group marker
if(!group.find('.one-line[data-lost]').size()) {
group.find('b.name').removeClass('talk-images')
@ -177,7 +177,7 @@ var Receipts = (function () {
if(this_sel.attr('data-received') != 'true') {
// Add a "lost" marker
this_sel.attr('data-lost', 'true');
// Add a warn on the buddy-name
this_sel.parent().find('b.name').addClass('talk-images')
.attr(

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@ var RosterX = (function () {
* @private
*/
var self = {};
/**
* Opens the rosterx tools
@ -30,32 +30,32 @@ var RosterX = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Suggested friends") + '</div>' +
'<div class="content">' +
'<div class="rosterx-head">' +
'<a href="#" class="uncheck">' + Common._e("Uncheck all") + '</a>' +
'<a href="#" class="check">' + Common._e("Check all") + '</a>' +
'</div>' +
'<div class="results"></div>' +
'</div>' +
'<div class="bottom">' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
var html =
'<div class="top">' + Common._e("Suggested friends") + '</div>' +
'<div class="content">' +
'<div class="rosterx-head">' +
'<a href="#" class="uncheck">' + Common._e("Uncheck all") + '</a>' +
'<a href="#" class="check">' + Common._e("Check all") + '</a>' +
'</div>' +
'<div class="results"></div>' +
'</div>' +
'<div class="bottom">' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'</div>';
// Create the popup
Popup.create('rosterx', html);
// Associate the events
self.instance();
// Parse the data
self.parse(data);
Console.log('Roster Item Exchange popup opened.');
} catch(e) {
Console.error('RosterX.open', e);
@ -94,22 +94,22 @@ var RosterX = (function () {
try {
// Main selector
var x = $(data).find('x[xmlns="' + NS_ROSTERX + '"]:first');
// Parse data
x.find('item').each(function() {
var this_sel = $(this);
// Generate group XML
var group = '';
this_sel.find('group').each(function() {
group += '<group>' + this_sel.text().htmlEnc() + '</group>';
});
if(group) {
group = '<groups>' + group + '</groups>';
}
// Display it!
self.display(
this_sel.attr('jid'),
@ -118,17 +118,17 @@ var RosterX = (function () {
this_sel.attr('action')
);
});
// Click to check/uncheck
$('#rosterx .oneresult').click(function(evt) {
// No need to apply when click on input
if($(evt.target).is('input[type="checkbox"]')) {
return;
}
// Input selector
var checkbox = $(this).find('input[type="checkbox"]');
// Check or uncheck?
if(checkbox.filter(':checked').size()) {
checkbox.removeAttr('checked');
@ -159,24 +159,24 @@ var RosterX = (function () {
if(!xid) {
return false;
}
// Set up a default action if no one
if(!action || (action != 'modify') || (action != 'delete')) {
action = 'add';
}
// Override "undefined" for nickname
if(!nick) {
nick = '';
}
// Display it
$('#rosterx .results').append(
'<div class="oneresult">' +
'<input type="checkbox" checked="" data-name="' + Common.encodeQuotes(nick) + '" data-xid="' + Common.encodeQuotes(xid) + '" data-action="' + Common.encodeQuotes(action) + '" data-group="' + Common.encodeQuotes(group) + '" />' +
'<span class="name">' + nick.htmlEnc() + '</span>' +
'<span class="xid">' + xid.htmlEnc() + '</span>' +
'<span class="action ' + action + ' talk-images"></span>' +
'<div class="oneresult">' +
'<input type="checkbox" checked="" data-name="' + Common.encodeQuotes(nick) + '" data-xid="' + Common.encodeQuotes(xid) + '" data-action="' + Common.encodeQuotes(action) + '" data-group="' + Common.encodeQuotes(group) + '" />' +
'<span class="name">' + nick.htmlEnc() + '</span>' +
'<span class="xid">' + xid.htmlEnc() + '</span>' +
'<span class="action ' + action + ' talk-images"></span>' +
'</div>'
);
@ -205,19 +205,19 @@ var RosterX = (function () {
var xid = this_sel.attr('data-xid');
var action = this_sel.attr('data-action');
var group = this_sel.attr('data-group');
// Parse groups XML
var group_arr = [];
if(group) {
$(group).find('group').each(function() {
group_arr.push(this_sel.text().revertHtmlEnc());
});
}
// Process the asked action
var roster_item = $('#roster .' + hex_md5(xid));
switch(action) {
// Buddy add
case 'add':
@ -225,25 +225,25 @@ var RosterX = (function () {
Presence.sendSubscribe(xid, 'subscribe');
Roster.send(xid, '', nick, group_arr);
}
break;
// Buddy edit
case 'modify':
if(Common.exists(roster_item))
Roster.send(xid, '', nick, group_arr);
break;
// Buddy delete
case 'delete':
if(Common.exists(roster_item))
Roster.send(xid, 'remove');
break;
}
});
// Close the popup
self.close();
} catch(e) {
@ -275,16 +275,16 @@ var RosterX = (function () {
return self.close();
}
});
$('#rosterx .rosterx-head a').click(function() {
var this_sel = $(this);
if(this_sel.is('.check')) {
$('#rosterx .results input[type="checkbox"]').attr('checked', true);
} else if(this_sel.is('.uncheck')) {
$('#rosterx .results input[type="checkbox"]').removeAttr('checked');
}
return false;
});
} catch(e) {

View file

@ -37,34 +37,34 @@ var Search = (function () {
if(!query) {
return;
}
// Wildcard (*) submitted
if(query == '*') {
query = '';
}
// Replace forbidden characters in regex
query = Common.escapeRegex(query);
// Create an empty array
var results = [];
// Search regex
var regex = new RegExp('((^)|( ))' + query, 'gi');
// Search in the roster
var buddies = Roster.getAllBuddies();
for(var i in buddies) {
var xid = buddies[i];
var nick = Name.getBuddy(xid);
// Buddy match our search, and not yet in the array
if(nick.match(regex) && !Utils.existArrayValue(results, xid)) {
results.push(xid);
}
}
// Return the results array
return results;
} catch(e) {
@ -104,18 +104,18 @@ var Search = (function () {
try {
// Remove the search tool
self.resetBuddy(destination);
// Define a selector
var input = $(destination + ' input');
var value = input.val();
// Get the old value (if there's another value)
var old = '';
if(value.match(/(^(.+)(,)(\s)?)(\w+)$/)) {
old = RegExp.$1;
}
// Add the XID to the "to" input and focus on it
$(document).oneTime(10, function() {
input.val(old + xid).focus();
@ -140,57 +140,57 @@ var Search = (function () {
try {
// Reset the search engine
self.resetBuddy(destination);
// Get the entered value
var value = $(destination + ' input').val();
// Separation with a comma?
if(value.match(/^(.+)((,)(\s)?)(\w+)$/)) {
value = RegExp.$5;
}
// Get the result array
var entered = self.processBuddy(value);
// Display each result (if any)
if(entered && entered.length) {
// Set a special class to the search input
$(destination + ' input').addClass('suggested');
// Append each found buddy in the container
// Append each found buddy in the container
var regex = new RegExp('((^)|( ))' + value, 'gi');
// Initialize the code generation
var code = '<ul>';
for(var b in entered) {
// Get some values from the XID
var current = Name.getBuddy(entered[b]).htmlEnc();
current = current.replace(regex, '<b>$&</b>');
// Add the current element to the global code
code += '<li onclick="return Search.addBuddy(\'' + Utils.encodeOnclick(destination) + '\', \'' + Utils.encodeOnclick(entered[b]) + '\');" data-xid="' + Common.encodeQuotes(entered[b]) + '">' + current + '</li>';
}
// Finish the code generation
code += '</ul>';
// Creates the code in the DOM
$(destination).append(code);
// Put the hover on the first element
$(destination + ' ul li:first').addClass('hovered');
// Hover event, to not to remove this onblur and loose the click event
$(destination + ' ul li').hover(function() {
$(destination + ' ul li').removeClass('hovered');
$(this).addClass('hovered');
// Add a marker for the blur event
$(destination + ' ul').attr('mouse-hover', 'true');
}, function() {
$(this).removeClass('hovered');
// Remove the mouse over marker
$(destination + ' ul').removeAttr('mouse-hover');
});
@ -214,33 +214,33 @@ var Search = (function () {
try {
// Down arrow: 40
// Up arrown: 38
// Initialize
var code = evt.keyCode;
// Not the key we want here
if((code != 40) && (code != 38)) {
return;
}
// Remove the eventual mouse hover marker
$(destination + ' ul').removeAttr('mouse-hover');
// Create the path & get its size
var path = destination + ' ul li';
var pSize = $(path).size();
// Define the i value
var i = 0;
// Switching yet launched
if(Common.exists(path + '.hovered')) {
var index = $(path).attr('data-hovered');
if(index) {
i = parseInt(index);
}
if(code == 40) {
i++;
} else {
@ -249,18 +249,18 @@ var Search = (function () {
} else if(code == 38) {
i = pSize - 1;
}
// We must not override the maximum i limit
if(i >= pSize) {
i = 0;
} else if(i < 0) {
i = pSize - 1;
}
// Modify the list
$(path + '.hovered').removeClass('hovered');
$(path).eq(i).addClass('hovered');
// Store the i index
$(path).attr('data-hovered', i);
} catch(e) {
@ -283,13 +283,13 @@ var Search = (function () {
try {
// Put a marker
self.search_filtered = true;
// Show the buddies that match the search string
var rFilter = self.processBuddy(vFilter);
// Hide all the buddies
$('#roster .buddy').hide();
// Only show the buddies which match the search
if(!Roster.blist_all) {
for(var i in rFilter) {
@ -317,15 +317,15 @@ var Search = (function () {
try {
// Remove the marker
self.search_filtered = false;
// Show all the buddies
$('#roster .buddy').show();
// Only show available buddies
if(!Roster.blist_all) {
$('#roster .buddy.hidden-buddy').hide();
}
// Update the groups
Roster.updateGroups();
} catch(e) {
@ -348,24 +348,24 @@ var Search = (function () {
var input = $('#roster .filter input');
var cancel = $('#roster .filter a');
var value = input.val();
// Security: reset all the groups, empty or not, deployed or not
$('#roster .one-group, #roster .group-buddies').show();
$('#roster .group span').text('-');
// Nothing is entered, or escape pressed
if(!value || (keycode == 27)) {
if(keycode == 27) {
input.val('');
}
self.resetFilterBuddy();
cancel.hide();
} else {
cancel.show();
self.goFilterBuddy(value);
}
// Update the groups
Roster.updateGroups();
} catch(e) {
@ -388,25 +388,25 @@ var Search = (function () {
var array = [];
var i = 0;
var nearest = 0;
// Add the stamp values to the array
$(element).each(function() {
var current_stamp = parseInt($(this).attr('data-stamp'));
// Push it!
array.push(current_stamp);
});
// Sort the array
array.sort();
// Get the nearest stamp value
while(stamp > array[i]) {
nearest = array[i];
i++;
}
return nearest;
} catch(e) {
Console.error('Search.sortElementByStamp', e);

View file

@ -102,7 +102,7 @@ var Smileys = (function () {
hash
);
}
return links;
} catch(e) {
Console.error('Smileys.links', e);

View file

@ -33,10 +33,10 @@ var Storage = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('get');
var iqQuery = iq.setQuery(NS_PRIVATE);
iqQuery.appendChild(iq.buildNode('storage', {'xmlns': type}));
con.send(iq, self.handle);
} catch(e) {
Console.error('Storage.get', e);
@ -56,18 +56,18 @@ var Storage = (function () {
try {
var handleXML = iq.getQuery();
var handleFrom = Common.fullXID(Common.getStanzaFrom(iq));
// Define some vars
var options = $(handleXML).find('storage[xmlns="' + NS_OPTIONS + '"]');
var inbox = $(handleXML).find('storage[xmlns="' + NS_INBOX + '"]');
var bookmarks = $(handleXML).find('storage[xmlns="' + NS_BOOKMARKS + '"]');
var rosternotes = $(handleXML).find('storage[xmlns="' + NS_ROSTERNOTES + '"]');
// No options and node not yet configured
if(options.size() && !options.find('option').size() && (iq.getType() != 'error')) {
Welcome.open();
}
// Parse the options xml
options.find('option').each(function() {
var this_sel = $(this);
@ -75,16 +75,16 @@ var Storage = (function () {
// We retrieve the informations
var type = this_sel.attr('type');
var value = this_sel.text();
// We display the storage
DataStore.setDB(Connection.desktop_hash, 'options', type, value);
// If this is the buddy list show status
if((type == 'roster-showall') && (value == '1')) {
Interface.showAllBuddies('storage');
}
});
// Parse the inbox xml
inbox.find('message').each(function() {
var this_sel = $(this);
@ -104,7 +104,7 @@ var Storage = (function () {
]
);
});
// Parse the bookmarks xml
bookmarks.find('conference').each(function() {
var this_sel = $(this);
@ -115,19 +115,19 @@ var Storage = (function () {
var autojoin = this_sel.attr('autojoin');
var password = this_sel.find('password').text();
var nick = this_sel.find('nick').text();
// Filter autojoin (compatibility)
autojoin = ((autojoin == 'true') || (autojoin == '1')) ? 'true' : 'false';
// We display the storage
Favorites.display(xid, name, nick, autojoin, password);
// Join the chat if autojoin is enabled
if(autojoin == 'true') {
Chat.checkCreate(xid, 'groupchat', nick, password, name);
}
});
// Parse the roster notes xml
rosternotes.find('note').each(function() {
var this_sel = $(this);
@ -139,43 +139,43 @@ var Storage = (function () {
this_sel.text()
);
});
// Options received
if(options.size()) {
Console.log('Options received.');
// Now, get the inbox
self.get(NS_INBOX);
// Geolocate the user
PEP.geolocate();
$('.options-hidable').show();
}
// Inbox received
else if(inbox.size()) {
Console.log('Inbox received.');
// Send the first presence!
Presence.sendFirst(DataStore.getDB(Connection.desktop_hash, 'checksum', 1));
// Check we have new messages (play a sound if any unread messages)
if(Inbox.checkMessages()) {
Audio.play('notification');
}
$('.inbox-hidable').show();
}
// Bookmarks received
else if(bookmarks.size()) {
// Join the groupchats the admin defined (if any)
Groupchat.joinConf();
Console.log('Bookmarks received.');
}
// Roster notes received (for logger)
else if(rosternotes.size()) {
Console.log('Roster notes received.');

View file

@ -29,7 +29,7 @@ var System = (function () {
try {
var url = window.location.href;
// If the URL has variables, remove them
if(url.indexOf('?') != -1) {
url = url.split('?')[0];
@ -38,12 +38,12 @@ var System = (function () {
if(url.indexOf('#') != -1) {
url = url.split('#')[0];
}
// No "/" at the end
if(!url.match(/(.+)\/$/)) {
url += '/';
}
return url;
} catch(e) {
Console.error('System.location', e);

View file

@ -54,238 +54,238 @@ var Talk = (function () {
if(Common.exists('#talk')) {
return false;
}
// Anonymous detector
var anonymous = Utils.isAnonymous();
// Generate the HTML code
var html =
'<div id="talk" class="removable">' +
'<div id="top-content">' +
'<div class="tools tools-logo talk-images"></div>' +
var html =
'<div id="talk" class="removable">' +
'<div id="top-content">' +
'<div class="tools tools-logo talk-images"></div>' +
'<div class="tools tools-all">';
if(!anonymous) html +=
'<a href="#" onclick="return Inbox.open();" class="inbox-hidable">' + Common._e("Messages") + '</a>' +
'<a href="#" onclick="return vCard.open();" class="vcard">' + Common._e("Profile") + '</a>' +
'<a href="#" onclick="return Options.open();" class="options-hidable">' + Common._e("Options") + '</a>' +
if(!anonymous) html +=
'<a href="#" onclick="return Inbox.open();" class="inbox-hidable">' + Common._e("Messages") + '</a>' +
'<a href="#" onclick="return vCard.open();" class="vcard">' + Common._e("Profile") + '</a>' +
'<a href="#" onclick="return Options.open();" class="options-hidable">' + Common._e("Options") + '</a>' +
'<a href="#" onclick="return Connection.normalQuit();" class="quit">' + Common._e("Disconnect") + '</a>';
else html +=
'<a href="./">' + Common._e("Disconnect") + '</a>';
html +=
'</div>';
if(!anonymous && document.createElement('audio').canPlayType) html +=
'<div class="tools-all ibubble">' +
'<div class="tools music talk-images" onclick="return Music.open();"></div>' +
'<div class="music-content tools-content bubble hidable">' +
'<div class="tools-content-subarrow talk-images"></div>' +
'<div class="tools-content-subitem">' +
'<div class="player">' +
'<a href="#" class="stop talk-images" onclick="return Music.action(\'stop\');"></a>' +
'</div>' +
'<div class="list">' +
'<p class="no-results">' + Common._e("No result!") + '</p>' +
'</div>' +
'<div class="search">' +
'<input type="text" />' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
if(!anonymous) html +=
'<div class="tools-all ibubble">' +
'<div class="tools notifications talk-images" onclick="return Bubble.show(\'.notifications-content\');"></div>' +
'<div class="notifications-content tools-content bubble hidable">' +
'<div class="tools-content-subarrow talk-images"></div>' +
'<div class="tools-content-subitem">' +
'<a class="empty" href="#" onclick="return Notification.clear();">' + Common._e("Empty") + '</a>' +
'<p class="nothing">' + Common._e("No notifications.") + '</p>' +
'</div>' +
'</div>' +
if(!anonymous && document.createElement('audio').canPlayType) html +=
'<div class="tools-all ibubble">' +
'<div class="tools music talk-images" onclick="return Music.open();"></div>' +
'<div class="music-content tools-content bubble hidable">' +
'<div class="tools-content-subarrow talk-images"></div>' +
'<div class="tools-content-subitem">' +
'<div class="player">' +
'<a href="#" class="stop talk-images" onclick="return Music.action(\'stop\');"></a>' +
'</div>' +
'<div class="list">' +
'<p class="no-results">' + Common._e("No result!") + '</p>' +
'</div>' +
'<div class="search">' +
'<input type="text" />' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
if(!anonymous) html +=
'<div class="tools-all">' +
'<div class="tools call talk-images" onclick="return Call.open();">' +
'<span class="streaming-items">' +
'<span class="counter" data-default="00:00:00">00:00:00</span>' +
'<a class="stop" href="#" onclick="return Call.stop();">' + Common._e("Stop") + '</a>' +
'</span>' +
'</div>' +
if(!anonymous) html +=
'<div class="tools-all ibubble">' +
'<div class="tools notifications talk-images" onclick="return Bubble.show(\'.notifications-content\');"></div>' +
'<div class="call-content tools-content">' +
'<div class="tools-content-subarrow talk-images"></div>' +
'<div class="tools-content-subitem"></div>' +
'</div>' +
'<div class="notifications-content tools-content bubble hidable">' +
'<div class="tools-content-subarrow talk-images"></div>' +
'<div class="tools-content-subitem">' +
'<a class="empty" href="#" onclick="return Notification.clear();">' + Common._e("Empty") + '</a>' +
'<p class="nothing">' + Common._e("No notifications.") + '</p>' +
'</div>' +
'</div>' +
'</div>';
if(!anonymous) html +=
'<div class="tools-all">' +
'<div class="tools call talk-images" onclick="return Call.open();">' +
'<span class="streaming-items">' +
'<span class="counter" data-default="00:00:00">00:00:00</span>' +
'<a class="stop" href="#" onclick="return Call.stop();">' + Common._e("Stop") + '</a>' +
'</span>' +
'</div>' +
'<div class="call-content tools-content">' +
'<div class="tools-content-subarrow talk-images"></div>' +
'<div class="tools-content-subitem"></div>' +
'</div>' +
'</div>';
html +=
'</div>' +
'<div id="main-content">' +
'</div>' +
'<div id="main-content">' +
'<div id="left-content">';
if(!anonymous) html +=
'<div id="roster">' +
'<div class="content"></div>' +
'<div class="filter">' +
'<input type="text" placeholder="' + Common._e("Filter") + '" />' +
'<a href="#">x</a>' +
'</div>' +
'<div class="foot ibubble">' +
'<div class="roster-add roster-icon">' +
'<a href="#" class="add talk-images" title="' + Common._e("Add a friend") + '"></a>' +
'</div>' +
'<div class="roster-join roster-icon">' +
'<a href="#" class="join talk-images" title="' + Common._e("Join a chat") + '"></a>' +
'</div>' +
'<div class="roster-groupchat roster-icon">' +
'<a href="#" class="groupchat talk-images" title="' + Common._e("Your groupchats") + '"></a>' +
'</div>' +
'<div class="roster-muji roster-icon muji-hidable">' +
'<a href="#" class="muji talk-images" title="' + Common._e("Audio/video conference") + '"></a>' +
'</div>' +
'<div class="roster-more roster-icon">' +
'<a href="#" class="more talk-images" title="' + Common._e("More stuff") + '"></a>' +
'</div>' +
'<div style="clear: both;"></div>' +
'</div>' +
if(!anonymous) html +=
'<div id="roster">' +
'<div class="content"></div>' +
'<div class="filter">' +
'<input type="text" placeholder="' + Common._e("Filter") + '" />' +
'<a href="#">x</a>' +
'</div>' +
'<div class="foot ibubble">' +
'<div class="roster-add roster-icon">' +
'<a href="#" class="add talk-images" title="' + Common._e("Add a friend") + '"></a>' +
'</div>' +
'<div class="roster-join roster-icon">' +
'<a href="#" class="join talk-images" title="' + Common._e("Join a chat") + '"></a>' +
'</div>' +
'<div class="roster-groupchat roster-icon">' +
'<a href="#" class="groupchat talk-images" title="' + Common._e("Your groupchats") + '"></a>' +
'</div>' +
'<div class="roster-muji roster-icon muji-hidable">' +
'<a href="#" class="muji talk-images" title="' + Common._e("Audio/video conference") + '"></a>' +
'</div>' +
'<div class="roster-more roster-icon">' +
'<a href="#" class="more talk-images" title="' + Common._e("More stuff") + '"></a>' +
'</div>' +
'<div style="clear: both;"></div>' +
'</div>' +
'</div>';
html +=
'<div id="my-infos">' +
'<div class="content">' +
'<div class="element f-presence ibubble">' +
'<a href="#" class="icon picker disabled" data-value="available">' +
'<span class="talk-images"></span>' +
'</a>' +
'<input id="presence-status" type="text" placeholder="' + Common._e("Status") + '" disabled="" />' +
'<div id="my-infos">' +
'<div class="content">' +
'<div class="element f-presence ibubble">' +
'<a href="#" class="icon picker disabled" data-value="available">' +
'<span class="talk-images"></span>' +
'</a>' +
'<input id="presence-status" type="text" placeholder="' + Common._e("Status") + '" disabled="" />' +
'</div>';
if(!anonymous) html +=
'<div class="element f-mood pep-hidable ibubble">' +
'<a href="#" class="icon picker" data-value="happy">' +
'<span class="talk-images"></span>' +
'</a>' +
'<input id="mood-text" type="text" placeholder="' + Common._e("Mood") + '" />' +
'</div>' +
'<div class="element f-activity pep-hidable ibubble">' +
'<a href="#" class="icon picker" data-value="exercising">' +
'<span class="talk-images activity-exercising"></span>' +
'</a>' +
'<input id="activity-text" type="text" placeholder="' + Common._e("Activity") + '" />' +
if(!anonymous) html +=
'<div class="element f-mood pep-hidable ibubble">' +
'<a href="#" class="icon picker" data-value="happy">' +
'<span class="talk-images"></span>' +
'</a>' +
'<input id="mood-text" type="text" placeholder="' + Common._e("Mood") + '" />' +
'</div>' +
'<div class="element f-activity pep-hidable ibubble">' +
'<a href="#" class="icon picker" data-value="exercising">' +
'<span class="talk-images activity-exercising"></span>' +
'</a>' +
'<input id="activity-text" type="text" placeholder="' + Common._e("Activity") + '" />' +
'</div>';
html +=
'</div>' +
'</div>' +
'</div>' +
'<div id="right-content">' +
'<div id="page-switch">' +
'</div>' +
'</div>' +
'</div>' +
'<div id="right-content">' +
'<div id="page-switch">' +
'<div class="chans">';
if(!anonymous) html +=
'<div class="channel switcher activechan" onclick="return Interface.switchChan(\'channel\');">' +
'<div class="icon talk-images"></div>' +
'<div class="name">' + Common._e("Channel") + '</div>' +
if(!anonymous) html +=
'<div class="channel switcher activechan" onclick="return Interface.switchChan(\'channel\');">' +
'<div class="icon talk-images"></div>' +
'<div class="name">' + Common._e("Channel") + '</div>' +
'</div>';
html +=
'</div>';
if(anonymous) html +=
'<div class="join ibubble">' +
'<div class="join-button talk-images" onclick="return Interface.loadJoinGroupchat();" title="' + Common._e("Join groupchat") + '"></div>' +
'<div class="join ibubble">' +
'<div class="join-button talk-images" onclick="return Interface.loadJoinGroupchat();" title="' + Common._e("Join groupchat") + '"></div>' +
'</div>';
html +=
'<div class="more ibubble">' +
'<div class="more-button talk-images" onclick="return Interface.loadChatSwitch();" title="' + Common._e("All tabs") + '"></div>' +
'</div>' +
'</div>' +
'<div class="more ibubble">' +
'<div class="more-button talk-images" onclick="return Interface.loadChatSwitch();" title="' + Common._e("All tabs") + '"></div>' +
'</div>' +
'</div>' +
'<div id="page-engine">';
if(!anonymous) html +=
'<div id="channel" class="page-engine-chan" style="display: block;">' +
'<div class="top mixed ' + hex_md5(Common.getXID()) + '">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<div class="update">' +
'<p>' + Common._e("What\'s up with you?") + '</p>' +
'<div class="microblog-body">' +
'<input class="focusable" type="text" name="microblog_body" placeholder="' + Common._e("Type something you want to share with your friends...") + '" disabled="" />' +
'</div>' +
'<div class="one-microblog-icon ibubble">' +
'<a href="#" onclick="return Bubble.show(\'#attach\');" title="' + Common._e("Attach a file") + '" class="postit attach talk-images"></a>' +
'<form id="attach" class="bubble hidable" action="./server/file-share.php" method="post" enctype="multipart/form-data">' +
'<div class="attach-subarrow talk-images"></div>' +
'<div class="attach-subitem">' +
'<p class="attach-p">' + Common._e("Attach a file") + '</p>' +
Interface.generateFileShare() +
'</div>' +
'</form>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="content mixed"></div>' +
'<div class="footer">' +
'<div class="sync talk-images">' + Common._e("You are synchronized with your network.") + '</div>' +
'<div class="unsync talk-images">' + Common._e("Cannot send anything: you can only receive notices!") + '</div>' +
'<div class="fetch wait-small">' + Common._e("Fetching the social channel...") + '</div>' +
'</div>' +
if(!anonymous) html +=
'<div id="channel" class="page-engine-chan" style="display: block;">' +
'<div class="top mixed ' + hex_md5(Common.getXID()) + '">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<div class="update">' +
'<p>' + Common._e("What\'s up with you?") + '</p>' +
'<div class="microblog-body">' +
'<input class="focusable" type="text" name="microblog_body" placeholder="' + Common._e("Type something you want to share with your friends...") + '" disabled="" />' +
'</div>' +
'<div class="one-microblog-icon ibubble">' +
'<a href="#" onclick="return Bubble.show(\'#attach\');" title="' + Common._e("Attach a file") + '" class="postit attach talk-images"></a>' +
'<form id="attach" class="bubble hidable" action="./server/file-share.php" method="post" enctype="multipart/form-data">' +
'<div class="attach-subarrow talk-images"></div>' +
'<div class="attach-subitem">' +
'<p class="attach-p">' + Common._e("Attach a file") + '</p>' +
Interface.generateFileShare() +
'</div>' +
'</form>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="content mixed"></div>' +
'<div class="footer">' +
'<div class="sync talk-images">' + Common._e("You are synchronized with your network.") + '</div>' +
'<div class="unsync talk-images">' + Common._e("Cannot send anything: you can only receive notices!") + '</div>' +
'<div class="fetch wait-small">' + Common._e("Fetching the social channel...") + '</div>' +
'</div>' +
'</div>';
html +=
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
// Create the HTML code
$('body').prepend(html);
// Adapt the roster size
Roster.adapt();
// Create JS events
self.events();
// Start the auto idle functions
Presence.liveIdle();
return true;
} catch(e) {
Console.error('Talk.create', e);
@ -304,25 +304,25 @@ var Talk = (function () {
try {
// Reset our database
DataStore.resetDB();
// Reset some vars
STANZA_ID = 1;
Roster.blist_all = false;
Presence.first_sent = false;
Search.search_filtered = false;
Avatar.pending = [];
JOIN_SUGGEST = [];
Groupchat.join_suggest = [];
// Kill all timers, exept the board ones
$('*:not(#board .one-board)').stopTime();
// Kill the auto idle functions
Presence.dieIdle();
// We renitalise the html markup as its initiale look
$('.removable').remove();
Interface.title('home');
// Finally we show the homepage
$('#home').show();
} catch(e) {

View file

@ -35,28 +35,28 @@ var Tooltip = (function () {
var path = '#' + hash;
var path_tooltip = path + ' .chat-tools-' + type;
var path_bubble = path_tooltip + ' .bubble-' + type;
// Yet exists?
if(Common.exists(path_bubble)) {
return false;
}
// Generates special tooltip HTML code
var title = '';
var content = '';
switch(type) {
// Smileys
case 'smileys':
title = Common._e("Smiley insertion");
content = Smileys.links(hash);
break;
// Style
case 'style':
title = Common._e("Change style");
// Generate fonts list
var fonts = {
'arial': 'Arial, Helvetica, sans-serif',
@ -81,106 +81,106 @@ var Tooltip = (function () {
'webdings': 'Webdings, sans-serif',
'wingdings': 'Wingdings, \'Zapf Dingbats\', sans-serif'
};
var fonts_html = '<div class="font-list">';
// No fonts
fonts_html += '<a href="#">' + Common._e("None") + '</a>';
// Available fonts
$.each(fonts, function(id_name, full_name) {
// Generate short name
var short_name = full_name;
if(short_name.match(/,/)) {
var name_split = short_name.split(',');
short_name = $.trim(name_split[0]);
}
short_name = short_name.replace(/([^a-z0-9\s]+)/gi, '');
// Add this to the HTML
fonts_html += '<a href="#" data-value="' + Common.encodeQuotes(id_name) + '" data-font="' + Common.encodeQuotes(full_name) + '" style="font-family: ' + Common.encodeQuotes(full_name) + ';">' + short_name.htmlEnc() + '</a>';
});
fonts_html += '</div>';
content =
'<label class="font">' +
'<div class="font-icon talk-images"></div>' +
'<div class="fontsize-change">' +
'<a class="fontsize-current" href="#">12</a>' +
'<div class="fontsize-list">' +
'<a href="#" class="reset talk-images"></a>' +
'<a href="#" data-value="10" style="font-size: 10px;">10</a>' +
'<a href="#" data-value="12" style="font-size: 12px;">12</a>' +
'<a href="#" data-value="14" style="font-size: 14px;">14</a>' +
'<a href="#" data-value="16" style="font-size: 16px;">16</a>' +
'<a href="#" data-value="18" style="font-size: 18px;">18</a>' +
'</div>' +
'</div>' +
'<div class="font-change">' +
'<a class="font-current" href="#">' + Common._e("None") + '</a>' +
fonts_html +
'</div>' +
'</label>' +
'<label class="bold"><input type="checkbox" class="bold" />' + Common._e("Text in bold") + '</label>' +
'<label class="italic"><input type="checkbox" class="italic" />' + Common._e("Text in italic") + '</label>' +
'<label class="underline"><input type="checkbox" class="underline" />' + Common._e("Underlined text") + '</label>' +
'<a href="#" class="color" style="background-color: #b10808; clear: both;" data-color="b10808"></a>' +
'<a href="#" class="color" style="background-color: #e5860c;" data-color="e5860c"></a>' +
'<a href="#" class="color" style="background-color: #f0f30e;" data-color="f0f30e"></a>' +
'<a href="#" class="color" style="background-color: #009a04;" data-color="009a04"></a>' +
'<a href="#" class="color" style="background-color: #0ba9a0;" data-color="0ba9a0"></a>' +
'<a href="#" class="color" style="background-color: #04228f;" data-color="04228f"></a>' +
'<a href="#" class="color" style="background-color: #9d0ab7;" data-color="9d0ab7"></a>' +
'<div class="color-picker">' +
'<a href="#" class="color-more talk-images"></a>' +
'<div class="color-hex">' +
'<span class="hex-begin">#</span>' +
'<input class="hex-value" type="text" maxlength="6" placeholder="e1e1e1" />' +
'</div>' +
content =
'<label class="font">' +
'<div class="font-icon talk-images"></div>' +
'<div class="fontsize-change">' +
'<a class="fontsize-current" href="#">12</a>' +
'<div class="fontsize-list">' +
'<a href="#" class="reset talk-images"></a>' +
'<a href="#" data-value="10" style="font-size: 10px;">10</a>' +
'<a href="#" data-value="12" style="font-size: 12px;">12</a>' +
'<a href="#" data-value="14" style="font-size: 14px;">14</a>' +
'<a href="#" data-value="16" style="font-size: 16px;">16</a>' +
'<a href="#" data-value="18" style="font-size: 18px;">18</a>' +
'</div>' +
'</div>' +
'<div class="font-change">' +
'<a class="font-current" href="#">' + Common._e("None") + '</a>' +
fonts_html +
'</div>' +
'</label>' +
'<label class="bold"><input type="checkbox" class="bold" />' + Common._e("Text in bold") + '</label>' +
'<label class="italic"><input type="checkbox" class="italic" />' + Common._e("Text in italic") + '</label>' +
'<label class="underline"><input type="checkbox" class="underline" />' + Common._e("Underlined text") + '</label>' +
'<a href="#" class="color" style="background-color: #b10808; clear: both;" data-color="b10808"></a>' +
'<a href="#" class="color" style="background-color: #e5860c;" data-color="e5860c"></a>' +
'<a href="#" class="color" style="background-color: #f0f30e;" data-color="f0f30e"></a>' +
'<a href="#" class="color" style="background-color: #009a04;" data-color="009a04"></a>' +
'<a href="#" class="color" style="background-color: #0ba9a0;" data-color="0ba9a0"></a>' +
'<a href="#" class="color" style="background-color: #04228f;" data-color="04228f"></a>' +
'<a href="#" class="color" style="background-color: #9d0ab7;" data-color="9d0ab7"></a>' +
'<div class="color-picker">' +
'<a href="#" class="color-more talk-images"></a>' +
'<div class="color-hex">' +
'<span class="hex-begin">#</span>' +
'<input class="hex-value" type="text" maxlength="6" placeholder="e1e1e1" />' +
'</div>' +
'</div>';
break;
// File send
case 'file':
title = Common._e("Send a file");
content = '<p style="margin-bottom: 8px;">' + Common._e("Once uploaded, your friend will be prompted to download the file you sent.") + '</p>';
content += '<form id="oob-upload" action="./server/send.php" method="post" enctype="multipart/form-data">' + Interface.generateFileShare() + '</form>';
break;
// Chat log
case 'save':
title = Common._e("Save chat");
content = '<p style="margin-bottom: 8px;">' + Common._e("Click on the following link to get the chat log, and wait. Then click again to get the file.") + '</p>';
// Possible to generate any log?
if($(path + ' .one-line').size())
content += '<a href="#" class="tooltip-actionlog">' + Common._e("Generate file!") + '</a>';
else
content += '<span class="tooltip-nolog">' + Common._e("This chat is empty!") + '</span>';
break;
}
// Generates general tooltip HTML code
var html =
'<div class="tooltip bubble-' + type + '">' +
'<div class="tooltip-subitem">' +
'<p class="tooltip-top">' + title + '</p>' +
content +
'</div>' +
'<div class="tooltip-subarrow talk-images"></div>' +
var html =
'<div class="tooltip bubble-' + type + '">' +
'<div class="tooltip-subitem">' +
'<p class="tooltip-top">' + title + '</p>' +
content +
'</div>' +
'<div class="tooltip-subarrow talk-images"></div>' +
'</div>';
// Append the HTML code
$(path_tooltip).append(html);
// Special events
switch(type) {
// Smileys
@ -189,9 +189,9 @@ var Tooltip = (function () {
$(path_tooltip + ' a.emoticon').click(function() {
return Interface.insertSmiley($(this).attr('data-smiley'), hash);
});
break;
// Style
case 'style':
// Paths to items
@ -208,25 +208,25 @@ var Tooltip = (function () {
var color = bubble_style + ' div.color-picker';
var color_more = color + ' a.color-more';
var color_hex = color + ' div.color-hex';
// Click event on style bubble
$(bubble_style).click(function() {
// Hide font selector if opened
if($(font_list).is(':visible')) {
$(font_current).click();
}
// Hide font-size selector if opened
if($(fontsize_list).is(':visible')) {
$(fontsize_current).click();
}
// Hide color selector if opened
if($(color_hex).is(':visible')) {
$(color_more).click();
}
});
// Click event on font picker
$(font_current).click(function() {
var this_sel = $(this);
@ -237,10 +237,10 @@ var Tooltip = (function () {
} else {
this_sel.parent().addClass('listed');
}
return false;
});
// Click event on a new font in the picker
$(font_select).click(function() {
var this_sel = $(this);
@ -250,19 +250,19 @@ var Tooltip = (function () {
$(font_current).removeAttr('data-font')
.removeAttr('data-value')
.text(Common._e("None"));
$(message_area).removeAttr('data-font');
} else {
$(font_current).attr('data-font', this_sel.attr('data-font'))
.attr('data-value', this_sel.attr('data-value'))
.text($(font_list).find('a[data-value="' + this_sel.attr('data-value') + '"]').text());
$(message_area).attr('data-font', this_sel.attr('data-value'));
}
return false;
});
// Click event on font-size picker
$(fontsize_current).click(function() {
var this_sel = $(this);
@ -273,10 +273,10 @@ var Tooltip = (function () {
} else {
this_sel.parent().addClass('listed');
}
return false;
});
// Click event on a new font-size in the picker
$(fontsize_select).click(function() {
var this_sel = $(this);
@ -286,39 +286,39 @@ var Tooltip = (function () {
$(fontsize_current).removeAttr('data-value').text(Common._e("16"));
$(message_area).removeAttr('data-fontsize');
}
// A font-size is defined
else {
$(fontsize_current).attr('data-value', this_sel.attr('data-value'))
.text(this_sel.attr('data-value'));
$(message_area).attr('data-fontsize', this_sel.attr('data-value'));
}
return false;
});
// Click event on color picker
$(colors).click(function() {
var this_sel = $(this);
// Reset the manual picker
$(color_hex).find('input').val('');
// The clicked color is yet selected
if(this_sel.hasClass('selected')) {
$(message_area).removeAttr('data-color');
this_sel.removeClass('selected');
}
else {
$(message_area).attr('data-color', this_sel.attr('data-color'));
$(colors).removeClass('selected');
this_sel.addClass('selected');
}
return false;
});
// Click event on color picker
$(color_more).click(function() {
var this_sel = $(this);
@ -328,21 +328,21 @@ var Tooltip = (function () {
this_sel.parent().removeClass('opened');
} else {
this_sel.parent().addClass('opened');
// Focus
$(document).oneTime(10, function() {
$(color_hex).find('input').focus();
});
}
return false;
});
// Click event on color hex
$(color_hex).click(function() {
return false;
});
// Keyup event on color picker
$(color_hex).find('input').keyup(function(e) {
var this_sel = $(this);
@ -351,31 +351,31 @@ var Tooltip = (function () {
if(e.keyCode == 13) {
if($(color_hex).is(':visible')) {
$(color_more).click();
// Focus again on the message textarea
$(document).oneTime(10, function() {
$(message_area).focus();
});
}
return false;
}
// Reset current color
$(message_area).removeAttr('data-color');
$(colors).removeClass('selected');
// Change value
var new_value = this_sel.val().replace(/([^a-z0-9]+)/gi, '');
this_sel.val(new_value);
if(new_value) {
$(message_area).attr('data-color', new_value);
}
// Regenerate style
var style = Message.generateStyle(hash);
// Any style to apply?
if(style) {
$(message_area).attr('style', style);
@ -383,14 +383,14 @@ var Tooltip = (function () {
$(message_area).removeAttr('style');
}
}).placeholder();
// Change event on text style checkboxes
$(style).change(function() {
var this_sel = $(this);
// Get current type
var style_data = 'data-' + this_sel.attr('class');
// Checked checkbox?
if(this_sel.filter(':checked').size()) {
$(message_area).attr(style_data, true);
@ -398,29 +398,29 @@ var Tooltip = (function () {
$(message_area).removeAttr(style_data);
}
});
// Update the textarea style when it is changed
$(style + ', ' + colors + ', ' + font_select + ', ' + fontsize_select).click(function() {
var style = Message.generateStyle(hash);
// Any style to apply?
if(style) {
$(message_area).attr('style', style);
} else {
$(message_area).removeAttr('style');
}
// Focus again on the message textarea
$(document).oneTime(10, function() {
$(message_area).focus();
});
});
// Load current style
self.loadStyleSelector(hash);
break;
// File send
case 'file':
// File upload vars
@ -429,7 +429,7 @@ var Tooltip = (function () {
beforeSubmit: OOB.waitUpload,
success: OOB.handleUpload
};
// Upload form submit event
$(path_tooltip + ' #oob-upload').submit(function() {
var this_sel = $(this);
@ -437,10 +437,10 @@ var Tooltip = (function () {
if($(path_tooltip + ' #oob-upload input[type="file"]').val()) {
this_sel.ajaxSubmit(oob_upload_options);
}
return false;
});
// Upload input change event
$(path_tooltip + ' #oob-upload input[type="file"]').change(function() {
var this_sel = $(this);
@ -448,22 +448,22 @@ var Tooltip = (function () {
if(this_sel.val()) {
$(path_tooltip + ' #oob-upload').ajaxSubmit(oob_upload_options);
}
return false;
});
// Input click event
$(path_tooltip + ' #oob-upload input[type="file"], ' + path_tooltip + ' #oob-upload input[type="submit"]').click(function() {
if(Common.exists(path_tooltip + ' #oob-upload input[type="reset"]')) {
return;
}
// Lock the bubble
$(path_bubble).addClass('locked');
// Add a cancel button
$(this).after('<input type="reset" value="' + Common._e("Cancel") + '" />');
// Cancel button click event
$(path_tooltip + ' #oob-upload input[type="reset"]').click(function() {
// Remove the bubble
@ -471,24 +471,24 @@ var Tooltip = (function () {
self.destroy(hash, 'file');
});
});
break;
// Chat log
case 'save':
// Chat log generation click event
$(path_tooltip + ' .tooltip-actionlog').click(function() {
// Replace it with a waiting notice
$(this).replaceWith('<span class="tooltip-waitlog">' + Common._e("Please wait...") + '</span>');
Interface.generateChatLog(xid, hash);
return false;
});
break;
}
return true;
} catch(e) {
Console.error('Tooltip.create', e);
@ -553,7 +553,7 @@ var Tooltip = (function () {
self.hover(xid, hash, 'style');
self.hover(xid, hash, 'file');
self.hover(xid, hash, 'save');
// Click events
$('#' + hash + ' a.chat-tools-content, #' + hash + ' .chat-tools-content a').click(function() {
return false;
@ -582,20 +582,20 @@ var Tooltip = (function () {
var font_select = $(bubble_style + ' div.font-list').find('a[data-value="' + font + '"]');
var fontsize = message_area.attr('data-fontsize');
var color = message_area.attr('data-color');
// Apply message font
if(font) {
$(bubble_style + ' a.font-current').attr('data-value', font)
.attr('data-font', font_select.attr('data-font'))
.text(font_select.text());
}
// Apply message font-size
if(fontsize) {
$(bubble_style + ' a.fontsize-current').attr('data-value', fontsize)
.text(fontsize);
}
// Apply the options to the style selector
$(bubble_style + ' input[type="checkbox"]').each(function() {
var this_sel = $(this);
@ -605,7 +605,7 @@ var Tooltip = (function () {
this_sel.attr('checked', true);
}
});
// Apply message color
if(color) {
if($(bubble_style + ' a.color[data-color="' + color + '"]').size()) {

View file

@ -31,91 +31,91 @@ var UserInfos = (function () {
try {
// Can show shortcuts?
var shortcuts = '';
if(xid != Common.getXID()) {
shortcuts = '<div class="shortcuts">' +
'<a href="#" class="message talk-images" title="' + Common._e("Send him/her a message") + '" onclick="UserInfos.close(); return Inbox.composeMessage(\'' + Utils.encodeOnclick(xid) + '\');"></a>' +
'<a href="#" class="chat talk-images" title="' + Common._e("Start a chat with him/her") + '" onclick="UserInfos.close(); return Chat.checkCreate(\'' + Utils.encodeOnclick(xid) + '\', \'chat\');"></a>' +
'<a href="#" class="command talk-images" title="' + Common._e("Command") + '" onclick="UserInfos.close(); return AdHoc.retrieve(\'' + Utils.encodeOnclick(xid) + '\');"></a>' +
shortcuts = '<div class="shortcuts">' +
'<a href="#" class="message talk-images" title="' + Common._e("Send him/her a message") + '" onclick="UserInfos.close(); return Inbox.composeMessage(\'' + Utils.encodeOnclick(xid) + '\');"></a>' +
'<a href="#" class="chat talk-images" title="' + Common._e("Start a chat with him/her") + '" onclick="UserInfos.close(); return Chat.checkCreate(\'' + Utils.encodeOnclick(xid) + '\', \'chat\');"></a>' +
'<a href="#" class="command talk-images" title="' + Common._e("Command") + '" onclick="UserInfos.close(); return AdHoc.retrieve(\'' + Utils.encodeOnclick(xid) + '\');"></a>' +
'</div>';
}
// Popup HTML content
var html =
'<div class="top">' + Common._e("User profile") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-active" data-key="1">' + Common._e("General") + '</a>' +
'<a href="#" data-key="2">' + Common._e("Advanced") + '</a>' +
'<a href="#" data-key="3">' + Common._e("Comments") + '</a>' +
'</div>' +
'<div class="content">' +
'<div class="lap-active one-lap info1">' +
'<div class="main-infos">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<h1 id="BUDDY-FN" class="reset-info">' + Common._e("unknown") + '</h1>' +
'<h2 class="buddy-xid" class="reset-info">' + Common._e("unknown") + '</h2>' +
'<h3 class="buddy-last" class="reset-info">' + Common._e("unknown") + '</h3>' +
shortcuts +
'</div>' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Date of birth") + '</b><span id="BUDDY-BDAY" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("E-mail") + '</b><span id="BUDDY-EMAIL-USERID" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Phone") + '</b><span id="BUDDY-TEL-NUMBER" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Website") + '</b><span id="BUDDY-URL" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Client") + '</b><span id="BUDDY-CLIENT" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("System") + '</b><span id="BUDDY-SYSTEM" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Local time") + '</b><span id="BUDDY-TIME" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'</div>' +
'<div class="one-lap info2">' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Street") + '</b><span id="BUDDY-ADR-STREET" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("City") + '</b><span id="BUDDY-ADR-LOCALITY" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Postal code") + '</b><span id="BUDDY-ADR-PCODE" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Country") + '</b><span id="BUDDY-ADR-CTRY" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Biography") + '</b><span id="BUDDY-DESC" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'</div>' +
'<div class="one-lap info3">' +
'<textarea class="rosternotes" rows="8" cols="60"></textarea>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
var html =
'<div class="top">' + Common._e("User profile") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-active" data-key="1">' + Common._e("General") + '</a>' +
'<a href="#" data-key="2">' + Common._e("Advanced") + '</a>' +
'<a href="#" data-key="3">' + Common._e("Comments") + '</a>' +
'</div>' +
'<div class="content">' +
'<div class="lap-active one-lap info1">' +
'<div class="main-infos">' +
'<div class="avatar-container">' +
'<img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" />' +
'</div>' +
'<h1 id="BUDDY-FN" class="reset-info">' + Common._e("unknown") + '</h1>' +
'<h2 class="buddy-xid" class="reset-info">' + Common._e("unknown") + '</h2>' +
'<h3 class="buddy-last" class="reset-info">' + Common._e("unknown") + '</h3>' +
shortcuts +
'</div>' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Date of birth") + '</b><span id="BUDDY-BDAY" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("E-mail") + '</b><span id="BUDDY-EMAIL-USERID" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Phone") + '</b><span id="BUDDY-TEL-NUMBER" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Website") + '</b><span id="BUDDY-URL" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Client") + '</b><span id="BUDDY-CLIENT" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("System") + '</b><span id="BUDDY-SYSTEM" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Local time") + '</b><span id="BUDDY-TIME" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'</div>' +
'<div class="one-lap info2">' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Street") + '</b><span id="BUDDY-ADR-STREET" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("City") + '</b><span id="BUDDY-ADR-LOCALITY" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Postal code") + '</b><span id="BUDDY-ADR-PCODE" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'<div class="one-line"><b class="line-label">' + Common._e("Country") + '</b><span id="BUDDY-ADR-CTRY" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'<div class="block-infos">' +
'<div class="one-line"><b class="line-label">' + Common._e("Biography") + '</b><span id="BUDDY-DESC" class="reset-info">' + Common._e("unknown") + '</span></div>' +
'</div>' +
'</div>' +
'<div class="one-lap info3">' +
'<textarea class="rosternotes" rows="8" cols="60"></textarea>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish">' + Common._e("Close") + '</a>' +
'</div>';
// Create the popup
Popup.create('userinfos', html);
// Associate the events
UserInfos.instance();
// We retrieve the user's vcard
self.retrieve(xid);
} catch(e) {
@ -137,7 +137,7 @@ var UserInfos = (function () {
try {
// Send the buddy comments
self.sendBuddyComments();
// Destroy the popup
Popup.destroy('userinfos');
} catch(e) {
@ -160,38 +160,38 @@ var UserInfos = (function () {
try {
// We setup the waiting indicator
markers = 'vcard last';
// We put the user's XID
$('#userinfos .buddy-xid').text(xid);
// We get the vCard
vCard.get(xid, 'buddy');
// Get the highest resource for this XID
var cXID = Presence.highestPriority(xid);
var pXID = xid;
// If the user is logged in
if(cXID) {
// Change the XID
pXID = cXID;
// We request the user's system infos
self.query(cXID, 'version');
// We request the user's local time
self.query(cXID, 'time');
// Add these to the markers
markers += ' version time';
}
// We request the user's last activity
self.query(pXID, 'last');
// Add the markers
$('#userinfos .content').addClass(markers);
// We request all the user's comments
self.displayBuddyComments(xid);
} catch(e) {
@ -214,26 +214,26 @@ var UserInfos = (function () {
// Generate a session ID
var id = genID();
$('#userinfos').attr('data-' + mode, id);
// New IQ
var iq = new JSJaCIQ();
iq.setID(id);
iq.setType('get');
iq.setTo(xid);
// Last activity query
if(mode == 'last') {
iq.setQuery(NS_LAST);
con.send(iq, self.lastActivityUserInfos);
}
// Time query
else if(mode == 'time') {
iq.appendNode('time', {'xmlns': NS_URN_TIME});
con.send(iq, self.localTime);
}
// Version query
else if(mode == 'version') {
iq.setQuery(NS_VERSION);
@ -273,7 +273,7 @@ var UserInfos = (function () {
try {
var value = DataStore.getDB(Connection.desktop_hash, 'rosternotes', xid);
if(value) {
$('#userinfos .rosternotes').val(value);
}
@ -296,28 +296,28 @@ var UserInfos = (function () {
// Extract the request ID
var id = iq.getID();
var path = '#userinfos[data-last="' + id + '"]';
// End if session does not exist
if(!Common.exists(path)) {
return;
}
if(iq && (iq.getType() == 'result')) {
// Get the values
var from = Common.fullXID(Common.getStanzaFrom(iq));
var seconds = $(iq.getNode()).find('query').attr('seconds');
// Any seconds?
if(seconds !== undefined) {
// Initialize the parsing
var last;
seconds = parseInt(seconds);
// Active user
if(seconds <= 60) {
last = Common._e("User currently active");
}
// Inactive user
else {
// Parse the date
@ -325,25 +325,25 @@ var UserInfos = (function () {
var time_now = date_now.getTime();
var date_last = new Date(date_now - (seconds * 1000));
var date = date_last.toLocaleString();
// Offline user
if(from.indexOf('/') == -1) {
last = Common.printf(Common._e("Last seen: %s"), date);
}
// Online user
else {
last = Common.printf(Common._e("Inactive since: %s"), date);
}
}
// Append this text
$('#userinfos .buddy-last').text(last);
}
Console.log('Last activity received: ' + from);
}
$('#userinfos .content').removeClass('last');
self.wait();
} catch(e) {
@ -365,12 +365,12 @@ var UserInfos = (function () {
// Extract the request ID
var id = iq.getID();
var path = '#userinfos[data-version="' + id + '"]';
// End if session does not exist
if(!Common.exists(path)) {
return;
}
// Extract the reply data
if(iq && (iq.getType() == 'result')) {
// Get the values
@ -378,24 +378,24 @@ var UserInfos = (function () {
var name = $(xml).find('name').text();
var version = $(xml).find('version').text();
var os = $(xml).find('os').text();
// Put the values together
if(name && version) {
name = name + ' ' + version;
}
// Display the values
if(name) {
$(path + ' #BUDDY-CLIENT').text(name);
}
if(os) {
$(path + ' #BUDDY-SYSTEM').text(os);
}
Console.log('Software version received: ' + Common.fullXID(Common.getStanzaFrom(iq)));
}
$('#userinfos .content').removeClass('version');
self.wait();
} catch(e) {
@ -417,35 +417,35 @@ var UserInfos = (function () {
// Extract the request ID
var id = iq.getID();
var path = '#userinfos[data-time="' + id + '"]';
// End if session does not exist
if(!Common.exists(path)) {
return;
}
if(iq && (iq.getType() == 'result')) {
// Get the values
var xml = iq.getNode();
var tzo = $(xml).find('tzo').text();
var utc = $(xml).find('utc').text();
// Any UTC?
if(utc) {
// Add the TZO if there's no one
if(tzo && utc.match(/^(.+)Z$/)) {
utc = RegExp.$1 + tzo;
}
// Get the local date string
var local_string = Date.hrTime(utc);
// Then display it
$(path + ' #BUDDY-TIME').text(local_string);
}
Console.log('Local time received: ' + Common.fullXID(Common.getStanzaFrom(iq)));
}
$('#userinfos .content').removeClass('time');
self.wait();
} catch(e) {
@ -464,7 +464,7 @@ var UserInfos = (function () {
try {
var selector = $('#userinfos .content');
if(!selector.hasClass('vcard') && !selector.hasClass('last') && !selector.hasClass('version') && !selector.hasClass('time')) {
$('#userinfos .wait').hide();
}
@ -486,43 +486,43 @@ var UserInfos = (function () {
// Update the current value
var value = $('#userinfos .rosternotes').val();
var xid = $('#userinfos .buddy-xid').text();
// Necessary to update?
var old_value = DataStore.getDB(Connection.desktop_hash, 'rosternotes', xid);
if((old_value == value) || (!old_value && !value)) {
return false;
}
// Update the database
DataStore.setDB(Connection.desktop_hash, 'rosternotes', xid, value);
// Send the new buddy storage values
var iq = new JSJaCIQ();
iq.setType('set');
var query = iq.setQuery(NS_PRIVATE);
var storage = query.appendChild(iq.buildNode('storage', {'xmlns': NS_ROSTERNOTES}));
// We regenerate the XML
var db_regex = new RegExp(('^' + Connection.desktop_hash + '_') + 'rosternotes' + ('_(.+)'));
for(var i = 0; i < DataStore.storageDB.length; i++) {
// Get the pointer values
var current = DataStore.storageDB.key(i);
// If the pointer is on a stored rosternote
if(current.match(db_regex)) {
var cur_xid = RegExp.$1;
var cur_value = DataStore.storageDB.getItem(current);
if(cur_xid && cur_value) {
storage.appendChild(iq.buildNode('note', {'jid': cur_xid, 'xmlns': NS_ROSTERNOTES}, cur_value));
}
}
}
con.send(iq);
return false;
} catch(e) {
Console.error('UserInfos.sendBuddyComments', e);
@ -577,11 +577,11 @@ var UserInfos = (function () {
$('#' + hash + ' .top .name .bc-name').text(nick);
$('#page-switch .' + hash + ' .name').text(nick);
}
// Get the buddy PEP informations
PEP.displayAll(xid);
}
// Display the buddy presence
Presence.funnel(xid, hash);
} catch(e) {
@ -602,18 +602,18 @@ var UserInfos = (function () {
// Click events
$('#userinfos .tab a').click(function() {
var this_sel = $(this);
// Yet active?
if(this_sel.hasClass('tab-active')) {
return false;
}
// Switch to the good tab
var key = parseInt(this_sel.attr('data-key'));
return self.switchTab(key);
});
$('#userinfos .bottom .finish').click(function() {
return self.close();
});

View file

@ -55,7 +55,7 @@ var Utils = (function () {
if((HTTPS_STORAGE != 'on') && url.match(/^https(.+)/)) {
url = 'http' + RegExp.$1;
}
return url;
} catch(e) {
Console.error('Utils.generateURL', e);
@ -77,7 +77,7 @@ var Utils = (function () {
if(value == condition) {
return ' disabled=""';
}
return '';
} catch(e) {
Console.error('Utils.disableInput', e);
@ -100,7 +100,7 @@ var Utils = (function () {
if(string.length > limit) {
string = string.substr(0, limit) + '...';
}
return string;
} catch(e) {
Console.error('Utils.truncate', e);
@ -216,37 +216,37 @@ var Utils = (function () {
// Get browser name & version
var browser_name = BrowserDetect.browser;
var browser_version = BrowserDetect.version;
// No DOM storage
if(!DataStore.hasDB() || !DataStore.hasPersistent()) {
return true;
}
// Obsolete IE
if((browser_name == 'Explorer') && (browser_version < 8)) {
return true;
}
// Obsolete Chrome
if((browser_name == 'Chrome') && (browser_version < 7)) {
return true;
}
// Obsolete Safari
if((browser_name == 'Safari') && (browser_version < 4)) {
return true;
}
// Obsolete Firefox
if((browser_name == 'Firefox') && (browser_version < 3.5)) {
return true;
}
// Obsolete Opera
if((browser_name == 'Opera') && (browser_version < 9)) {
return true;
}
return false;
} catch(e) {
Console.error('Utils.isObsolete', e);
@ -348,7 +348,7 @@ var Utils = (function () {
} catch(e) {
Console.error('Utils.quoteMyNick', e);
}
};
@ -362,7 +362,7 @@ var Utils = (function () {
try {
var cat;
switch(ext) {
// Images
case 'jpg':
@ -378,9 +378,9 @@ var Utils = (function () {
case 'psb':
case 'xcf':
cat = 'image';
break;
// Videos
case 'ogv':
case 'ogg':
@ -402,9 +402,9 @@ var Utils = (function () {
case '3gp':
case 'avc':
cat = 'video';
break;
// Sounds
case 'oga':
case 'mka':
@ -429,9 +429,9 @@ var Utils = (function () {
case 'snd':
case 'voc':
cat = 'audio';
break;
// Documents
case 'pdf':
case 'odt':
@ -470,9 +470,9 @@ var Utils = (function () {
case 'dhtml':
case 'mshtml':
cat = 'document';
break;
// Packages
case 'tgz':
case 'gz':
@ -497,16 +497,16 @@ var Utils = (function () {
case 'arj':
case 'msi':
cat = 'package';
break;
// Others
default:
cat = 'other';
break;
}
return cat;
} catch(e) {
Console.error('Utils.fileCategory', e);
@ -524,7 +524,7 @@ var Utils = (function () {
try {
navigator.registerProtocolHandler('xmpp', JAPPIX_LOCATION + '?x=%s', SERVICE_NAME);
return true;
} catch(e) {
Console.error('Utils.xmppLinksHandler', e);
@ -629,13 +629,13 @@ var Utils = (function () {
try {
var array = [];
// Any string to convert?
if(string) {
// More than one item
if(string.match(/,/gi)) {
var string_split = string.split(',');
for(var i in string_split) {
if(string_split[i]) {
array.push(string_split[i]);
@ -644,12 +644,12 @@ var Utils = (function () {
}
}
}
// Only one item
else
array.push(string);
}
return array;
} catch(e) {
Console.error('Utils.stringToArray', e);
@ -672,18 +672,18 @@ var Utils = (function () {
if(!array || !array.length) {
return 0;
}
// Read the index of the value
var index = 0;
for(var i = 0; i < array.length; i++) {
if(array[i] == value) {
index = i;
break;
}
}
return index;
} catch(e) {
Console.error('Utils.indexArrayValue', e);

View file

@ -30,122 +30,122 @@ var vCard = (function () {
try {
// Popup HTML content
var html =
'<div class="top">' + Common._e("Your profile") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-active" data-key="1">' + Common._e("Identity") + '</a>' +
'<a href="#" data-key="2">' + Common._e("Profile image") + '</a>' +
'<a href="#" data-key="3">' + Common._e("Others") + '</a>' +
'</div>' +
'<div class="content">' +
'<div id="lap1" class="lap-active one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("Personal") + '</legend>' +
'<label for="USER-FN">' + Common._e("Complete name") + '</label>' +
'<input type="text" id="USER-FN" data-vcard4="fn-text" class="vcard-item" placeholder="John Locke" />' +
'<label for="USER-NICKNAME">' + Common._e("Nickname") + '</label>' +
'<input type="text" id="USER-NICKNAME" data-vcard4="nickname-text" class="vcard-item" placeholder="Jo" />' +
'<label for="USER-N-GIVEN">' + Common._e("First name") + '</label>' +
'<input type="text" id="USER-N-GIVEN" data-vcard4="n-given" class="vcard-item" placeholder="John" />' +
'<label for="USER-N-FAMILY">' + Common._e("Last name") + '</label>' +
'<input type="text" id="USER-N-FAMILY" data-vcard4="n-surname" class="vcard-item" placeholder="Locke" />' +
'<label for="USER-BDAY">' + Common._e("Date of birth") + '</label>' +
'<input type="text" id="USER-BDAY" data-vcard4="bday-date" class="vcard-item" pattern="^[0-9]{2}-[0-9]{2}-[0-9]{4}$" placeholder="16-02-1974" />' +
'</fieldset>' +
'<fieldset>' +
'<legend>' + Common._e("Contact") + '</legend>' +
'<label for="USER-EMAIL-USERID">' + Common._e("E-mail") + '</label>' +
'<input type="text" id="USER-EMAIL-USERID" data-vcard4="email-text" class="vcard-item" placeholder="john@locke.fam" />' +
'<label for="USER-TEL-NUMBER">' + Common._e("Phone") + '</label>' +
'<input type="text" id="USER-TEL-NUMBER" data-vcard4="tel-uri" class="vcard-item" placeholder="John" placeholder="+1-292-321-0812" />' +
'<label for="USER-URL">' + Common._e("Website") + '</label>' +
'<input type="text" id="USER-URL" data-vcard4="url-uri" class="vcard-item" placeholder="john.locke.fam" />' +
'</fieldset>' +
'</div>' +
'<div id="lap2" class="one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("New") + '</legend>' +
'<input type="hidden" id="USER-PHOTO-TYPE" class="vcard-item" />' +
'<input type="hidden" id="USER-PHOTO-BINVAL" class="vcard-item" />' +
'<form id="vcard-avatar" action="./server/avatar-upload.php" method="post" enctype="multipart/form-data">' +
Interface.generateFileShare() +
'</form>' +
'</fieldset>' +
'<fieldset>' +
'<legend>' + Common._e("Current") + '</legend>' +
'<div class="avatar-container"></div>' +
'<a href="#" class="one-button avatar-delete talk-images">' + Common._e("Delete") + '</a>' +
'<div class="no-avatar">' + Common._e("What a pity! You have no profile image defined in your identity card!") + '</div>' +
'</fieldset>' +
'<div class="avatar-wait avatar-info">' + Common._e("Please wait while your avatar is uploaded...") + '</div>' +
'<div class="avatar-ok avatar-info">' + Common._e("Here it is! A new beautiful profile image!") + '</div>' +
'<div class="avatar-error avatar-info">' + Common._e("The image file is not supported or has a bad size.") + '</div>' +
'</div>' +
'<div id="lap3" class="one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("Address") + '</legend>' +
'<label for="USER-ADR-STREET">' + Common._e("Street") + '</label>' +
'<input type="text" id="USER-ADR-STREET" data-vcard4="adr-street" class="vcard-item" placeholder="Manhattan" />' +
'<label for="USER-ADR-LOCALITY">' + Common._e("City") + '</label>' +
'<input type="text" id="USER-ADR-LOCALITY" data-vcard4="adr-locality" class="vcard-item" placeholder="New-York" />' +
'<label for="USER-ADR-PCODE">' + Common._e("Postal code") + '</label>' +
'<input type="text" id="USER-ADR-PCODE" data-vcard4="adr-code" class="vcard-item" placeholder="10002" />' +
'<label for="USER-ADR-CTRY">' + Common._e("Country") + '</label>' +
'<input type="text" id="USER-ADR-CTRY" data-vcard4="adr-country" class="vcard-item" placeholder="USA" />' +
'</fieldset>' +
'<fieldset>' +
'<legend>' + Common._e("Biography") + '</legend>' +
'<textarea id="USER-DESC" data-vcard4="note-text" rows="8" cols="60" class="vcard-item"></textarea>' +
'</fieldset>' +
'</div>' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Important notice") + '</p>' +
'<p>' + Common._e("Be careful with the information you store into your profile, because it might be accessible by everyone (even someone you don't want to).") + '</p>' +
'<p>' + Common._e("Not everything is private on XMPP; this is one of those things, your public profile (vCard).") + '</p>' +
'<p>' + Common.printf(Common._e("It is strongly recommended to upload a profile image (%s maximum), like a picture of yourself, because that makes you easily recognizable by your friends."), JAPPIX_MAX_UPLOAD) + '</p>' +
'<p><b><a href="https://me.jappix.com/new" target="_blank">' + Common._e("Enable my public profile") + ' »</a></b></p>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save disabled">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'<div class="top">' + Common._e("Your profile") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-active" data-key="1">' + Common._e("Identity") + '</a>' +
'<a href="#" data-key="2">' + Common._e("Profile image") + '</a>' +
'<a href="#" data-key="3">' + Common._e("Others") + '</a>' +
'</div>' +
'<div class="content">' +
'<div id="lap1" class="lap-active one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("Personal") + '</legend>' +
'<label for="USER-FN">' + Common._e("Complete name") + '</label>' +
'<input type="text" id="USER-FN" data-vcard4="fn-text" class="vcard-item" placeholder="John Locke" />' +
'<label for="USER-NICKNAME">' + Common._e("Nickname") + '</label>' +
'<input type="text" id="USER-NICKNAME" data-vcard4="nickname-text" class="vcard-item" placeholder="Jo" />' +
'<label for="USER-N-GIVEN">' + Common._e("First name") + '</label>' +
'<input type="text" id="USER-N-GIVEN" data-vcard4="n-given" class="vcard-item" placeholder="John" />' +
'<label for="USER-N-FAMILY">' + Common._e("Last name") + '</label>' +
'<input type="text" id="USER-N-FAMILY" data-vcard4="n-surname" class="vcard-item" placeholder="Locke" />' +
'<label for="USER-BDAY">' + Common._e("Date of birth") + '</label>' +
'<input type="text" id="USER-BDAY" data-vcard4="bday-date" class="vcard-item" pattern="^[0-9]{2}-[0-9]{2}-[0-9]{4}$" placeholder="16-02-1974" />' +
'</fieldset>' +
'<fieldset>' +
'<legend>' + Common._e("Contact") + '</legend>' +
'<label for="USER-EMAIL-USERID">' + Common._e("E-mail") + '</label>' +
'<input type="text" id="USER-EMAIL-USERID" data-vcard4="email-text" class="vcard-item" placeholder="john@locke.fam" />' +
'<label for="USER-TEL-NUMBER">' + Common._e("Phone") + '</label>' +
'<input type="text" id="USER-TEL-NUMBER" data-vcard4="tel-uri" class="vcard-item" placeholder="John" placeholder="+1-292-321-0812" />' +
'<label for="USER-URL">' + Common._e("Website") + '</label>' +
'<input type="text" id="USER-URL" data-vcard4="url-uri" class="vcard-item" placeholder="john.locke.fam" />' +
'</fieldset>' +
'</div>' +
'<div id="lap2" class="one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("New") + '</legend>' +
'<input type="hidden" id="USER-PHOTO-TYPE" class="vcard-item" />' +
'<input type="hidden" id="USER-PHOTO-BINVAL" class="vcard-item" />' +
'<form id="vcard-avatar" action="./server/avatar-upload.php" method="post" enctype="multipart/form-data">' +
Interface.generateFileShare() +
'</form>' +
'</fieldset>' +
'<fieldset>' +
'<legend>' + Common._e("Current") + '</legend>' +
'<div class="avatar-container"></div>' +
'<a href="#" class="one-button avatar-delete talk-images">' + Common._e("Delete") + '</a>' +
'<div class="no-avatar">' + Common._e("What a pity! You have no profile image defined in your identity card!") + '</div>' +
'</fieldset>' +
'<div class="avatar-wait avatar-info">' + Common._e("Please wait while your avatar is uploaded...") + '</div>' +
'<div class="avatar-ok avatar-info">' + Common._e("Here it is! A new beautiful profile image!") + '</div>' +
'<div class="avatar-error avatar-info">' + Common._e("The image file is not supported or has a bad size.") + '</div>' +
'</div>' +
'<div id="lap3" class="one-lap forms">' +
'<fieldset>' +
'<legend>' + Common._e("Address") + '</legend>' +
'<label for="USER-ADR-STREET">' + Common._e("Street") + '</label>' +
'<input type="text" id="USER-ADR-STREET" data-vcard4="adr-street" class="vcard-item" placeholder="Manhattan" />' +
'<label for="USER-ADR-LOCALITY">' + Common._e("City") + '</label>' +
'<input type="text" id="USER-ADR-LOCALITY" data-vcard4="adr-locality" class="vcard-item" placeholder="New-York" />' +
'<label for="USER-ADR-PCODE">' + Common._e("Postal code") + '</label>' +
'<input type="text" id="USER-ADR-PCODE" data-vcard4="adr-code" class="vcard-item" placeholder="10002" />' +
'<label for="USER-ADR-CTRY">' + Common._e("Country") + '</label>' +
'<input type="text" id="USER-ADR-CTRY" data-vcard4="adr-country" class="vcard-item" placeholder="USA" />' +
'</fieldset>' +
'<fieldset>' +
'<legend>' + Common._e("Biography") + '</legend>' +
'<textarea id="USER-DESC" data-vcard4="note-text" rows="8" cols="60" class="vcard-item"></textarea>' +
'</fieldset>' +
'</div>' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Important notice") + '</p>' +
'<p>' + Common._e("Be careful with the information you store into your profile, because it might be accessible by everyone (even someone you don't want to).") + '</p>' +
'<p>' + Common._e("Not everything is private on XMPP; this is one of those things, your public profile (vCard).") + '</p>' +
'<p>' + Common.printf(Common._e("It is strongly recommended to upload a profile image (%s maximum), like a picture of yourself, because that makes you easily recognizable by your friends."), JAPPIX_MAX_UPLOAD) + '</p>' +
'<p><b><a href="https://me.jappix.com/new" target="_blank">' + Common._e("Enable my public profile") + ' »</a></b></p>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish save disabled">' + Common._e("Save") + '</a>' +
'<a href="#" class="finish cancel">' + Common._e("Cancel") + '</a>' +
'</div>';
// Create the popup
Popup.create('vcard', html);
// Associate the events
self.instance();
// We get the VCard informations
self.get(Common.getXID(), 'user');
} catch(e) {
@ -167,12 +167,12 @@ var vCard = (function () {
try {
// Destroy the popup
Popup.destroy('vcard');
// Create the welcome end popup?
if(Welcome.is_done) {
// Open popup
Me.open();
// Unavoidable popup
$('#me').addClass('unavoidable');
}
@ -217,7 +217,7 @@ var vCard = (function () {
try {
// Reset the avatar info
$('#vcard .avatar-info').hide().stopTime();
// Show the wait info
$('#vcard .avatar-wait').show();
} catch(e) {
@ -238,53 +238,53 @@ var vCard = (function () {
try {
// Data selector
var dData = $(responseXML).find('jappix');
// Not current upload session?
if(parseInt(dData.attr('id')) != parseInt($('#vcard-avatar input[name="id"]').val())) {
return;
}
// Reset the avatar info
$('#vcard .avatar-info').hide().stopTime();
// Process the returned data
if(!dData.find('error').size()) {
// Read the values
var aType = dData.find('type').text();
var aBinval = dData.find('binval').text();
// We remove everything that isn't useful right here
$('#vcard .no-avatar').hide();
$('#vcard .avatar').remove();
// We display the delete button
$('#vcard .avatar-delete').show();
// We tell the user it's okay
$('#vcard .avatar-ok').show();
// Timer
$('#vcard .avatar-info').oneTime('10s', function() {
$(this).hide();
});
// We put the base64 values in a hidden input to be sent
$('#USER-PHOTO-TYPE').val(aType);
$('#USER-PHOTO-BINVAL').val(aBinval);
// We display the avatar!
$('#vcard .avatar-container').replaceWith('<div class="avatar-container"><img class="avatar" src="data:' + aType + ';base64,' + aBinval + '" alt="" /></div>');
}
// Any error?
else {
$('#vcard .avatar-error').show();
// Timer
$('#vcard .avatar-info').oneTime('10s', function() {
$(this).hide();
});
Console.error('Error while uploading the avatar', dData.find('error').text());
}
} catch(e) {
@ -306,10 +306,10 @@ var vCard = (function () {
$('#vcard .avatar-info').stopTime();
$('#vcard .avatar-info, #vcard .avatar-wait, #vcard .avatar-error, #vcard .avatar-ok, #vcard .avatar-delete').hide();
$('#vcard .avatar').remove();
// We reset the input value
$('#USER-PHOTO-TYPE, #USER-PHOTO-BINVAL').val('');
// We show the avatar-uploading request
$('#vcard .no-avatar').show();
} catch(e) {
@ -333,7 +333,7 @@ var vCard = (function () {
try {
// Generate the new ID
id = 'USER-' + id;
// Can append the content
if((type == 'user') && !Common.exists('#vcard #' + id)) {
$('#vcard .content').append('<input id="' + id + '" class="vcard-item" type="hidden" />');
@ -357,30 +357,30 @@ var vCard = (function () {
try {
// Generate a special ID
var id = genID();
// New IQ
var iq = new JSJaCIQ();
iq.setID(id);
iq.setType('get');
iq.appendNode('vCard', {'xmlns': NS_VCARD});
// Send the IQ to the good user
if(type == 'user') {
// Show the wait icon
$('#vcard .wait').show();
// Apply the session ID
$('#vcard').attr('data-vcard', id);
// Send the IQ
con.send(iq, self.handleUser);
} else {
// Show the wait icon
$('#userinfos .wait').show();
// Apply the session ID
$('#userinfos').attr('data-vcard', id);
// Send the IQ
iq.setTo(to);
con.send(iq, self.handleBuddy);
@ -444,7 +444,7 @@ var vCard = (function () {
// Define some paths
var path_vcard = '#vcard[data-vcard="' + iqID + '"]';
var path_userInfos = '#userinfos[data-vcard="' + iqID + '"]';
// End if the session does not exist
if(((type == 'user') && !Common.exists(path_vcard)) || ((type == 'buddy') && !Common.exists(path_userInfos))) {
return;
@ -452,25 +452,25 @@ var vCard = (function () {
// We retrieve main values
var values_yet = [];
$(iqNode).find('vCard').children().each(function() {
var this_sel = $(this);
// Read the current parent node name
var tokenname = (this).nodeName.toUpperCase();
// Node with a parent
if(this_sel.children().size()) {
this_sel.children().each(function() {
// Get the node values
var currentID = tokenname + '-' + (this).nodeName.toUpperCase();
var currentText = $(this).text();
// Not yet added?
if(!Utils.existArrayValue(values_yet, currentID)) {
// Create an input if it does not exist
self.createInput(values_yet, type);
// Userinfos viewer popup
if((type == 'buddy') && currentText) {
if(currentID == 'EMAIL-USERID') {
@ -479,28 +479,28 @@ var vCard = (function () {
$(path_userInfos + ' #BUDDY-' + currentID).text(currentText.htmlEnc());
}
}
// Profile editor popup
else if(type == 'user') {
$(path_vcard + ' #USER-' + currentID).val(currentText);
}
// Avoid duplicating the value
values_yet.push(currentID);
}
});
}
// Node without any parent
else {
// Get the node values
var currentText = $(this).text();
// Not yet added?
if(!Utils.existArrayValue(values_yet, tokenname)) {
// Create an input if it does not exist
self.createInput(tokenname, type);
// Userinfos viewer popup
if((type == 'buddy') && currentText) {
// URL modification
@ -509,28 +509,28 @@ var vCard = (function () {
if(!currentText.match(/^https?:\/\/(.+)/)) {
currentText = 'http://' + currentText;
}
currentText = '<a href="' + currentText + '" target="_blank">' + currentText.htmlEnc() + '</a>';
}
// Description modification
else if(tokenname == 'DESC') {
currentText = Filter.message(currentText, Name.getBuddy(iqFrom).htmlEnc(), true);
}
// Other stuffs
else {
currentText = currentText.htmlEnc();
}
$(path_userInfos + ' #BUDDY-' + tokenname).html(currentText);
}
// Profile editor popup
else if(type == 'user') {
$(path_vcard + ' #USER-' + tokenname).val(currentText);
}
// Avoid duplicating the value
values_yet.push(tokenname);
}
@ -541,20 +541,20 @@ var vCard = (function () {
if(type == 'buddy') {
// Get the avatar XML
var xml = DataStore.getPersistent('global', 'avatar', iqFrom);
// If there were no stored avatar previously
if($(Common.XMLFromString(xml)).find('type').text() == 'none') {
xml = xml.replace(/<forced>false<\/forced>/gi, '<forced>true</forced>');
DataStore.setPersistent(Common.getXID(), 'avatar', iqFrom, xml);
}
// Handle the user avatar
Avatar.handle(iq);
}
// The avatar values targets
var aBinval, aType, aContainer;
if(type == 'user') {
aBinval = $('#USER-PHOTO-BINVAL').val();
aType = $('#USER-PHOTO-TYPE').val();
@ -571,20 +571,20 @@ var vCard = (function () {
if(!aType) {
aType = 'image/png';
}
if(type == 'user') {
// We move all the things that we don't need in that case
$(path_vcard + ' .no-avatar').hide();
$(path_vcard + ' .avatar-delete').show();
$(path_vcard + ' .avatar').remove();
}
var avatar_src = ('data:' + aType + ';base64,' + aBinval);
// We display the avatar we have just received
$(aContainer).replaceWith('<div class="avatar-container"><img class="avatar" src="' + avatar_src + '" alt="" /></div>');
}
else if(type == 'buddy') {
$(aContainer).replaceWith('<div class="avatar-container"><img class="avatar" src="' + './images/others/default-avatar.png' + '" alt="" /></div>');
}
@ -596,7 +596,7 @@ var vCard = (function () {
} else {
UserInfos.vCard();
}
Console.log('vCard received: ' + iqFrom);
} catch(e) {
Console.error('vCard.handle', e);
@ -616,18 +616,18 @@ var vCard = (function () {
// Send both vcard-temp + vCard4
self._sendLegacy();
self._sendForward();
// Send the user nickname & avatar over PEP
if(Features.enabledPEP()) {
self._sendPubsub();
}
// Close the vCard stuffs
self.close();
// Get our new avatar
Avatar.get(Common.getXID(), 'force', 'true', 'forget');
Console.log('vCard sent.');
} catch(e) {
Console.error('vCard.send', e);
@ -676,7 +676,7 @@ var vCard = (function () {
} else {
cur_node = node.appendChild(stanza.buildNode(tagname, {'xmlns': namespace}));
}
cur_node.appendChild(
stanza.buildNode(
Common.explodeThis('-', item_id, 1),
@ -727,13 +727,13 @@ var vCard = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('set');
var vCard = iq.appendNode('vCard', {
'xmlns': NS_VCARD
});
self._generateTree(NS_VCARD, iq, vCard);
con.send(iq);
} catch(e) {
Console.error('vCard._sendLegacy', e);
@ -752,7 +752,7 @@ var vCard = (function () {
try {
var iq = new JSJaCIQ();
iq.setType('set');
// Build Pubsub headers
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB});
@ -770,9 +770,9 @@ var vCard = (function () {
var vcard = item.appendChild(iq.buildNode('vcard', {
'xmlns': NS_IETF_VCARD4
}));
self._generateTree(NS_IETF_VCARD4, iq, vcard);
con.send(iq);
// Make it publicly-viewable
@ -795,7 +795,7 @@ var vCard = (function () {
// Generate some values
var photo_bin = $('#USER-PHOTO-BINVAL').val();
var photo_data = Base64.decode(photo_bin) || '';
// Data to be sent
var send_data = {};
send_data[NS_NICK] = $('#USER-NICKNAME').val();
@ -805,12 +805,12 @@ var vCard = (function () {
'id': (hex_sha1(photo_data) || ''),
'bytes': (photo_data.length || '')
};
// Generate the XML
$.each(send_data, function(namespace, data) {
var iq = new JSJaCIQ();
iq.setType('set');
var pubsub = iq.appendNode('pubsub', {'xmlns': NS_PUBSUB});
var publish = pubsub.appendChild(iq.buildNode('publish', {'node': namespace, 'xmlns': NS_PUBSUB}));
@ -819,26 +819,26 @@ var vCard = (function () {
if(namespace === NS_NICK) {
item = publish.appendChild(iq.buildNode('item', {'xmlns': NS_PUBSUB}));
// Nickname element
item.appendChild(iq.buildNode('nick', {'xmlns': NS_NICK}, data));
} else if(namespace === NS_URN_ADATA || namespace === NS_URN_AMETA) {
item = publish.appendChild(iq.buildNode('item', {'xmlns': NS_PUBSUB}));
// Apply the SHA-1 hash
if(send_data[NS_URN_AMETA].id) {
item.setAttribute('id', send_data[NS_URN_AMETA].id);
}
// Append XML nodes depending on namespace
if(namespace === NS_URN_ADATA) {
item.appendChild(iq.buildNode('data', {'xmlns': NS_URN_ADATA}, data));
} else if(namespace === NS_URN_AMETA) {
var metadata = item.appendChild(iq.buildNode('metadata', {'xmlns': NS_URN_AMETA}));
if(data) {
var meta_info = metadata.appendChild(iq.buildNode('info', {'xmlns': NS_URN_AMETA}));
if(data.type)
meta_info.setAttribute('type', data.type);
if(data.id)
@ -874,7 +874,7 @@ var vCard = (function () {
$(document).oneTime(10, function() {
$('#vcard input:first').focus();
});
// Keyboard events
$('#vcard input[type="text"]').keyup(function(e) {
// Enter pressed: send the vCard
@ -882,7 +882,7 @@ var vCard = (function () {
return self.send();
}
});
// Click events
$('#vcard .tab a').click(function() {
var this_sel = $(this);
@ -891,17 +891,17 @@ var vCard = (function () {
if(this_sel.hasClass('tab-active')) {
return false;
}
// Switch to the good tab
var key = parseInt(this_sel.attr('data-key'));
return self.switchTab(key);
});
$('#vcard .avatar-delete').click(function() {
return self.deleteAvatar();
});
$('#vcard .bottom .finish').click(function() {
var this_sel = $(this);
@ -912,39 +912,39 @@ var vCard = (function () {
if(this_sel.is('.save') && !this_sel.hasClass('disabled')) {
return self.send();
}
return false;
});
// Avatar upload vars
var avatar_options = {
dataType: 'xml',
beforeSubmit: self.waitAvatarUpload,
success: self.handleAvatarUpload
};
// Avatar upload form submit event
$('#vcard-avatar').submit(function() {
if($('#vcard .wait').is(':hidden') &&
$('#vcard .avatar-info.avatar-wait').is(':hidden') &&
if($('#vcard .wait').is(':hidden') &&
$('#vcard .avatar-info.avatar-wait').is(':hidden') &&
$('#vcard-avatar input[type="file"]').val()) {
$(this).ajaxSubmit(avatar_options);
}
return false;
});
// Avatar upload input change event
$('#vcard-avatar input[type="file"]').change(function() {
if($('#vcard .wait').is(':hidden') &&
$('#vcard .avatar-info.avatar-wait').is(':hidden') &&
if($('#vcard .wait').is(':hidden') &&
$('#vcard .avatar-info.avatar-wait').is(':hidden') &&
$(this).val()) {
$('#vcard-avatar').ajaxSubmit(avatar_options);
}
return false;
});
// Placeholders
$('#vcard-avatar input[type="text"]').placeholder();
} catch(e) {

View file

@ -23,7 +23,7 @@ var Welcome = (function () {
/* Variables */
self.is_done = false;
/**
* Opens the welcome tools
* @public
@ -34,125 +34,125 @@ var Welcome = (function () {
try {
// Share message
var share_msg = Common.printf(Common._e("Using Jappix, an open social platform. I am %s!"), Common.getXID());
// Popup HTML content
var html =
'<div class="top">' + Common._e("Welcome!") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-active" data-step="1">' + Common._e("Options") + '</a>' +
'<a href="#" class="tab-missing" data-step="2">' + Common._e("Friends") + '</a>' +
'<a href="#" class="tab-missing" data-step="3">' + Common._e("Share") + '</a>' +
'</div>' +
'<div class="content">' +
'<div class="lap-active one-lap welcome1">' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Welcome on Jappix, your own social cloud!") + '</p>' +
'<p>' + Common._e("Before you start using it, you will have to change some settings, search for friends and complete your profile.") + '</p>' +
'</div>' +
'<a href="#" class="box enabled" title="' + Common._e("Click to disable") + '">' +
'<span class="option">' + Common._e("Sounds") + '</span>' +
'<span class="description">' + Common._e("Enable notification sounds") + '</span>' +
'<span class="image sound talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box enabled pep-hidable" title="' + Common._e("Click to disable") + '">' +
'<span class="option">' + Common._e("Geolocation") + '</span>' +
'<span class="description">' + Common._e("Share your position on the globe") + '</span>' +
'<span class="image geolocation talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box xmpplinks-hidable" title="' + Common._e("Click to enable") + '">' +
'<span class="option">' + Common._e("XMPP links") + '</span>' +
'<span class="description">' + Common._e("Open XMPP links with Jappix") + '</span>' +
'<span class="image xmpp talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box mam-hidable pref" title="' + Common._e("Click to enable") + '">' +
'<span class="option">' + Common._e("Message archiving") + '</span>' +
'<span class="description">' + Common._e("Store a history of your chats") + '</span>' +
'<span class="image mam talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box" title="' + Common._e("Click to enable") + '">' +
'<span class="option">' + Common._e("Offline friends") + '</span>' +
'<span class="description">' + Common._e("Don\'t hide offline friends") + '</span>' +
'<span class="image offline talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'</div>' +
'<div class="one-lap welcome2">' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Friends") + '</p>' +
'<p>' + Common._e("Use this tool to find your friends on the server you are using right now, or add them later.") + '</p>' +
'</div>' +
'<div class="results welcome-results"></div>' +
'</div>' +
'<div class="one-lap welcome3">' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Share") + '</p>' +
'<p>' + Common._e("Good job! Now, you can share Jappix with your friends!") + '</p>' +
'<p>' + Common._e("When you will press the save button, the profile editor will be opened. Happy socializing!") + '</p>' +
'</div>' +
'<a class="box share first" href="http://www.facebook.com/sharer/sharer.php?u=' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" target="_blank">' +
'<span class="logo facebook welcome-images"></span>' +
'<span class="name">Facebook</span>' +
'<span class="description">' + Common.printf(Common._e("Share Jappix on %s"), 'Facebook') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'<a class="box share" href="http://twitter.com/intent/tweet?text=' + Common.encodeQuotes(share_msg) + '&amp;url=' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" target="_blank">' +
'<span class="logo twitter welcome-images"></span>' +
'<span class="name">Twitter</span>' +
'<span class="description">' + Common.printf(Common._e("Share Jappix on %s"), 'Twitter') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'<a class="box share" href="https://plus.google.com/share?url=' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" target="_blank">' +
'<span class="logo plus welcome-images"></span>' +
'<span class="name">Google+</span>' +
'<span class="description">' + Common.printf(Common._e("Share Jappix on %s"), 'Google+') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'<a class="box share" href="https://waaave.com/spot/jappix/" target="_blank">' +
'<span class="logo waaave welcome-images"></span>' +
'<span class="name">Waaave</span>' +
'<span class="description">' + Common.printf(Common._e("Follow Jappix topic on %s"), 'Waaave') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish next">' + Common._e("Next") + ' »</a>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
var html =
'<div class="top">' + Common._e("Welcome!") + '</div>' +
'<div class="tab">' +
'<a href="#" class="tab-active" data-step="1">' + Common._e("Options") + '</a>' +
'<a href="#" class="tab-missing" data-step="2">' + Common._e("Friends") + '</a>' +
'<a href="#" class="tab-missing" data-step="3">' + Common._e("Share") + '</a>' +
'</div>' +
'<div class="content">' +
'<div class="lap-active one-lap welcome1">' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Welcome on Jappix, your own social cloud!") + '</p>' +
'<p>' + Common._e("Before you start using it, you will have to change some settings, search for friends and complete your profile.") + '</p>' +
'</div>' +
'<a href="#" class="box enabled" title="' + Common._e("Click to disable") + '">' +
'<span class="option">' + Common._e("Sounds") + '</span>' +
'<span class="description">' + Common._e("Enable notification sounds") + '</span>' +
'<span class="image sound talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box enabled pep-hidable" title="' + Common._e("Click to disable") + '">' +
'<span class="option">' + Common._e("Geolocation") + '</span>' +
'<span class="description">' + Common._e("Share your position on the globe") + '</span>' +
'<span class="image geolocation talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box xmpplinks-hidable" title="' + Common._e("Click to enable") + '">' +
'<span class="option">' + Common._e("XMPP links") + '</span>' +
'<span class="description">' + Common._e("Open XMPP links with Jappix") + '</span>' +
'<span class="image xmpp talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box mam-hidable pref" title="' + Common._e("Click to enable") + '">' +
'<span class="option">' + Common._e("Message archiving") + '</span>' +
'<span class="description">' + Common._e("Store a history of your chats") + '</span>' +
'<span class="image mam talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'<a href="#" class="box" title="' + Common._e("Click to enable") + '">' +
'<span class="option">' + Common._e("Offline friends") + '</span>' +
'<span class="description">' + Common._e("Don\'t hide offline friends") + '</span>' +
'<span class="image offline talk-images"></span>' +
'<span class="tick talk-images"></span>' +
'</a>' +
'</div>' +
'<div class="one-lap welcome2">' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Friends") + '</p>' +
'<p>' + Common._e("Use this tool to find your friends on the server you are using right now, or add them later.") + '</p>' +
'</div>' +
'<div class="results welcome-results"></div>' +
'</div>' +
'<div class="one-lap welcome3">' +
'<div class="infos">' +
'<p class="infos-title">' + Common._e("Share") + '</p>' +
'<p>' + Common._e("Good job! Now, you can share Jappix with your friends!") + '</p>' +
'<p>' + Common._e("When you will press the save button, the profile editor will be opened. Happy socializing!") + '</p>' +
'</div>' +
'<a class="box share first" href="http://www.facebook.com/sharer/sharer.php?u=' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" target="_blank">' +
'<span class="logo facebook welcome-images"></span>' +
'<span class="name">Facebook</span>' +
'<span class="description">' + Common.printf(Common._e("Share Jappix on %s"), 'Facebook') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'<a class="box share" href="http://twitter.com/intent/tweet?text=' + Common.encodeQuotes(share_msg) + '&amp;url=' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" target="_blank">' +
'<span class="logo twitter welcome-images"></span>' +
'<span class="name">Twitter</span>' +
'<span class="description">' + Common.printf(Common._e("Share Jappix on %s"), 'Twitter') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'<a class="box share" href="https://plus.google.com/share?url=' + Common.encodeQuotes(Utils.generateURL(JAPPIX_LOCATION)) + '" target="_blank">' +
'<span class="logo plus welcome-images"></span>' +
'<span class="name">Google+</span>' +
'<span class="description">' + Common.printf(Common._e("Share Jappix on %s"), 'Google+') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'<a class="box share" href="https://waaave.com/spot/jappix/" target="_blank">' +
'<span class="logo waaave welcome-images"></span>' +
'<span class="name">Waaave</span>' +
'<span class="description">' + Common.printf(Common._e("Follow Jappix topic on %s"), 'Waaave') + '</span>' +
'<span class="go talk-images"></span>' +
'</a>' +
'</div>' +
'</div>' +
'<div class="bottom">' +
'<div class="wait wait-medium"></div>' +
'<a href="#" class="finish next">' + Common._e("Next") + ' »</a>' +
'<a href="#" class="finish save">' + Common._e("Save") + '</a>' +
'</div>';
// Create the popup
Popup.create('welcome', html);
// Unavoidable popup
$('#welcome').addClass('unavoidable');
// Apply the features
Features.apply('welcome');
// Associate the events
self.instance();
Console.log('Welcome assistant opened.');
} catch(e) {
Console.error('Welcome.open', e);
@ -194,12 +194,12 @@ var Welcome = (function () {
var content = welcome + '.content .';
var tab = welcome + '.tab ';
var wait = $(welcome + '.wait');
$(content + 'one-lap').hide();
$(content + 'welcome' + id).show();
$(tab + 'a').removeClass('tab-active');
$(tab + 'a[data-step="' + id + '"]').addClass('tab-active').removeClass('tab-missing');
// Update the "save" button if all is okay
if(!Common.exists(tab + '.tab-missing')) {
var finish = welcome + '.finish.';
@ -207,7 +207,7 @@ var Welcome = (function () {
$(finish + 'save').show();
$(finish + 'next').hide();
}
// If this is ID 2: vJUD search
if(id == 2) {
wait.show();
@ -236,26 +236,26 @@ var Welcome = (function () {
// Sends the options
var iq = new JSJaCIQ();
iq.setType('set');
var query = iq.setQuery(NS_PRIVATE);
var storage = query.appendChild(iq.buildNode('storage', {'xmlns': NS_OPTIONS}));
// Value array
var tags = ['sounds', 'geolocation', '', '', 'roster-showall'];
// Build the XML with the array
for(var i in array) {
var value = array[i];
var tag = tags[i];
if((i != 2) && (i != 3) && tag && value) {
storage.appendChild(iq.buildNode('option', {'type': tag, 'xmlns': NS_OPTIONS}, value));
DataStore.setDB(Connection.desktop_hash, 'options', tag, value);
}
}
con.send(iq);
// If geolocation is enabled
if(array[1] == '1') {
PEP.geolocate();
@ -277,27 +277,27 @@ var Welcome = (function () {
try {
// Get the new options
var array = [];
$('#welcome a.box').each(function() {
var current = '0';
if($(this).hasClass('enabled')) {
current = '1';
}
array.push(current);
});
// If XMPP links is enabled
if(array[2] == '1') {
Utils.xmppLinksHandler();
}
// If offline buddies showing is enabled
if(array[4] == '1') {
Interface.showAllBuddies('welcome');
}
// If archiving is supported by the server
if(Features.enabledMAM()) {
// If archiving is enabled
@ -305,19 +305,19 @@ var Welcome = (function () {
MAM.setConfig('roster');
}
}
// Send the new options
self.send(array);
// Close the welcome tool
self.close();
// Open the profile editor
vCard.open();
// Unavoidable popup
$('#vcard').addClass('unavoidable');
self.is_done = true;
} catch(e) {
Console.error('Welcome.save', e);
@ -339,11 +339,11 @@ var Welcome = (function () {
// Check the next step to go to
var next = 1;
var missing = '#welcome .tab a.tab-missing';
if(Common.exists(missing)) {
next = parseInt($(missing + ':first').attr('data-step'));
}
// Switch to the next step
self.switchTab(next);
} catch(e) {
@ -369,10 +369,10 @@ var Welcome = (function () {
// Switch to the good tab
var key = parseInt(this_sel.attr('data-step'));
return self.switchTab(key);
});
$('#welcome a.box:not(.share)').click(function() {
var this_sel = $(this);
@ -381,21 +381,21 @@ var Welcome = (function () {
} else {
this_sel.addClass('enabled').attr('title', Common._e("Click to disable"));
}
return false;
});
$('#welcome .bottom .finish').click(function() {
var this_sel = $(this);
if(this_sel.is('.next')) {
return self.next();
}
if(this_sel.is('.save')) {
return self.save();
}
return false;
});
} catch(e) {

View file

@ -33,43 +33,43 @@ var XMPPLinks = (function () {
try {
// Remove the "xmpp:" string
link = Common.explodeThis(':', link, 1);
// The XMPP URI has no "?"
if(link.indexOf('?') == -1) {
Chat.checkCreate(link, 'chat');
} else {
var xid = Common.explodeThis('?', link, 0);
var action = Common.explodeThis('?', link, 1);
switch(action) {
// Groupchat
case 'join':
Chat.checkCreate(xid, 'groupchat');
break;
// Profile
case 'vcard':
UserInfos.open(xid);
break;
// Subscription
case 'subscribe':
Roster.addThisContact(xid);
break;
// Unsubscription
case 'unsubscribe':
Roster.send(xid, 'remove');
break;
// Private chat
default:
Chat.checkCreate(xid, 'chat');
break;
}
}
@ -89,14 +89,14 @@ var XMPPLinks = (function () {
var hash;
var vars = [];
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = $.trim(decodeURIComponent(hash[1]));
}
return vars;
})();

View file

@ -359,46 +359,31 @@ html[dir="rtl"] #muji .chatroom .chatroom_participants .participants_invite_box
}
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate {
background: #f9f9f9;
border: 1px solid #e7e7e7;
color: #94a6aa;
text-decoration: none;
padding: 4px 6px 5px 6px;
display: none;
position: absolute;
top: 4px;
right: 9px;
-moz-border-radius: 1px;
-webkit-border-radius: 1px;
border-radius: 1px;
}
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_go {
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate:active {
padding-top: 5px;
padding-bottom: 4px;
}
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_validate_icon {
background-position: 0 -329px;
width: 14px;
height: 11px;
opacity: 0.6;
margin-top: 2px;
display: block;
position: absolute;
top: 11px;
right: 16px;
}
html[dir="rtl"] #muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_go {
right: auto;
left: 8px;
}
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_go:hover,
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_go:active {
opacity: 1;
}
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_separator,
#muji .chatroom form.chatroom_form .message_separator {
background: #e9e9e9;
width: 1px;
position: absolute;
top: 6px;
bottom: 6px;
}
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_separator {
right: 40px;
}
html[dir="rtl"] #muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_validate .invite_separator {
right: auto;
left: 32px;
}
#muji .chatroom .chatroom_participants .participants_invite_box form.participants_invite_form .invite_input_container {
@ -672,6 +657,11 @@ html[dir="rtl"] #muji .chatroom form.chatroom_form .message_icon {
}
#muji .chatroom form.chatroom_form .message_separator {
background: #e9e9e9;
width: 1px;
position: absolute;
top: 6px;
bottom: 6px;
left: 40px;
}

View file

@ -1,19 +1,19 @@
/*
Jappix - An open social platform
This is the others CSS stylesheet for Jappix
-------------------------------------------------
License: AGPL
Author: Valérian Saliou
*/
#audio {
display: none;
}
#top-content {
position: absolute;
right: 5px;
@ -22,7 +22,7 @@ Author: Valérian Saliou
min-width: 860px;
z-index: 50;
}
#main-content {
position: absolute;
top: 34px;
@ -32,7 +32,7 @@ Author: Valérian Saliou
min-width: 850px;
min-height: 450px;
}
#left-content {
position: absolute;
top: 0;
@ -45,7 +45,7 @@ html[dir="rtl"] #left-content {
left: auto;
right: 0;
}
#right-content,
#suggest {
background-color: rgb(20,20,20);
@ -68,7 +68,7 @@ html[dir="rtl"] #right-content {
left: 0;
right: 260px;
}
#general-wait {
background: url(../images/others/blank.gif) repeat;
z-index: 10000;
@ -78,7 +78,7 @@ html[dir="rtl"] #right-content {
left: 0;
right: 0;
}
.general-wait-content {
background-color: rgb(255,255,255);
background-color: rgba(255,255,255,0.9);
@ -112,7 +112,7 @@ html[dir="rtl"] .general-wait-content {
.muji-hidable {
display: none;
}
#reconnect .pane {
background-color: rgb(20,20,20);
background-color: rgba(20,20,20,0.85);
@ -128,7 +128,7 @@ html[dir="rtl"] .general-wait-content {
-webkit-box-shadow: 0 0 35px #232323;
box-shadow: 0 0 35px #232323;
}
#reconnect .pane a {
margin-top: -4px;
float: right;

View file

@ -1,15 +1,15 @@
/*
Jappix - An open social platform
This is the roster CSS stylesheet for Jappix
-------------------------------------------------
License: AGPL
Author: Valérian Saliou
*/
#roster {
background-color: rgb(20,20,20);
background-color: rgba(20,20,20,0.85);
@ -22,7 +22,7 @@ Author: Valérian Saliou
-webkit-box-shadow: 0 0 6px #5c5c5c;
box-shadow: 0 0 6px #5c5c5c;
}
#roster .content {
background: #e8f1f3;
background: -moz-linear-gradient(top, #e8f1f3, #e4edef);
@ -41,11 +41,11 @@ Author: Valérian Saliou
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
#roster .one-group {
margin-bottom: 10px;
}
#roster .one-group a.group {
color: #202c2f;
font-size: 0.8em;
@ -60,19 +60,19 @@ Author: Valérian Saliou
html[dir="rtl"] #roster .one-group a.group {
float: right;
}
#roster .one-group a.group.plus {
background-position: -4px -1143px;
}
#roster .one-group a.group.minus {
background-position: -4px -1162px;
}
#roster .one-group a.group:hover {
cursor: pointer;
}
#roster .hidden-buddy,
#roster .foot-edit-finish,
.buddy-conf-more-display-available {
@ -82,14 +82,14 @@ html[dir="rtl"] #roster .one-group a.group {
#roster .group-buddy {
clear: both;
}
#roster .buddy {
width: 100%;
height: 50px;
margin-bottom: 4px;
clear: both;
}
#roster .buddy-click {
background: #d9e7ea;
width: 100%;
@ -99,32 +99,32 @@ html[dir="rtl"] #roster .one-group a.group {
-webkit-border-radius: 3px;
border-radius: 3px;
}
#roster .buddy-click:hover,
#roster .buddy-click:focus {
background: #cedee1;
cursor: pointer;
}
#roster .buddy-click:active {
background: #c3d3d7;
}
#roster .gateway {
height: 27px;
}
#roster .gateway .name {
margin-left: 0;
}
#roster .gateway .buddy-presence {
float: left;
overflow: hidden;
width: 0;
margin: 0 4px;
}
#roster .avatar-container {
float: left;
text-align: center;
@ -136,12 +136,12 @@ html[dir="rtl"] #roster .one-group a.group {
html[dir="rtl"] #roster .avatar-container {
float: right;
}
#roster .avatar {
max-width: 44px;
max-height: 44px;
}
#roster .name {
margin: 4px 3px 5px 56px;
}
@ -159,11 +159,11 @@ html[dir="rtl"] #roster .name {
margin: 5px 0 5px 2px;
overflow: hidden;
}
#roster .buddy.blocked p.buddy-name {
text-decoration: line-through;
}
#roster .buddy-presence {
height: 14px;
font-size: 0.7em;
@ -175,13 +175,13 @@ html[dir="rtl"] #roster .name {
html[dir="rtl"] #roster .buddy-presence {
float: right;
}
#roster .unavailable,
#page-switch .unavailable,
#page-engine p.bc-infos span.show.unavailable {
background-position: 0 -153px;
}
#roster .available,
#page-engine p.bc-infos span.show.available,
#page-engine .list .available,
@ -190,7 +190,7 @@ html[dir="rtl"] #roster .buddy-presence {
#my-infos .f-presence a[data-value="available"] span {
background-position: 0 -169px;
}
#roster .away,
#page-engine p.bc-infos span.show.away,
#page-engine .list .away,
@ -198,7 +198,7 @@ html[dir="rtl"] #roster .buddy-presence {
#my-infos .f-presence a[data-value="away"] span {
background-position: 0 -185px;
}
#roster .busy,
#page-engine p.bc-infos span.show.busy,
#page-engine .list .xa,
@ -207,13 +207,13 @@ html[dir="rtl"] #roster .buddy-presence {
#my-infos .f-presence a[data-value="xa"] span {
background-position: 0 -201px;
}
#roster .error,
#page-switch .error,
#page-engine p.bc-infos span.show.error {
background-position: 0 -217px;
}
#roster .buddy-infos {
position: absolute;
z-index: 100;
@ -235,7 +235,7 @@ html[dir="rtl"] .buddy-infos-subarrow {
background-position: -10px -241px;
float: right;
}
.buddy-infos-subitem {
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.8);
@ -256,54 +256,54 @@ html[dir="rtl"] .buddy-infos-subitem {
#rosterx .oneresult span.action.add {
background-position: 0 -1181px;
}
.manage-infos p.bm-remove,
#rosterx .oneresult span.action.delete,
#attach div.one-file a.remove {
background-position: 0 -1200px;
}
.manage-infos p.bm-remove {
margin-bottom: 18px;
}
.manage-infos p.bm-rename {
background-position: 0 -1216px;
}
.manage-infos p.bm-group {
background-position: 0 -1241px;
}
.manage-infos div.bm-choose {
max-height: 95px;
margin: 0 0 8px 102px;
overflow: auto;
}
.manage-infos div.bm-choose label {
float: left;
clear: both;
margin-bottom: 1px;
}
.manage-infos div.bm-choose input {
float: left;
}
.manage-infos div.bm-choose input[type="checkbox"] {
margin: 0 6px 0 0;
}
.manage-infos div.bm-choose div {
clear: both;
}
.manage-infos p.bm-rename,
.manage-infos p.bm-group {
height: 26px;
}
.manage-infos p.bm-rename label,
.manage-infos p.bm-group label {
width: 80px;
@ -315,7 +315,7 @@ html[dir="rtl"] .manage-infos p.bm-rename label,
html[dir="rtl"] .manage-infos p.bm-group label {
float: right;
}
.manage-infos p.bm-rename input,
.manage-infos p.bm-group input {
float: left;
@ -326,28 +326,28 @@ html[dir="rtl"] .manage-infos p.bm-rename input,
html[dir="rtl"] .manage-infos p.bm-group input {
float: right;
}
.manage-infos a.save {
float: right;
margin: 4px;
}
.buddy-infos-subitem p {
margin: 6px 0;
padding-left: 22px;
height: 16px;
overflow: hidden;
}
.buddy-infos-subitem a {
color: white;
text-decoration: underline;
}
.tune-note {
background-position: 0 -676px;
}
.location-world {
background-position: 0 -658px;
}
@ -380,11 +380,11 @@ body.in_muji_call .roster-muji a {
.view-individual {
background-position: 0 -34px;
}
.edit-buddy {
background-position: 0 -1008px;
}
#roster .filter {
background-color: white;
border-top: 1px solid #b8c2c4;
@ -398,7 +398,7 @@ body.in_muji_call .roster-muji a {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
#roster .filter input {
border: none;
color: #273a3f;
@ -408,7 +408,7 @@ body.in_muji_call .roster-muji a {
-webkit-box-shadow: none;
box-shadow: none;
}
#roster .filter a {
display: none;
background-color: #9a2d2d;
@ -428,20 +428,20 @@ body.in_muji_call .roster-muji a {
html[dir="rtl"] #roster .filter a {
float: left;
}
#roster .filter a:hover,
#roster .filter a:focus {
background-color: #8c2121;
}
#roster .filter a:active {
background-color: #7e1919;
}
#roster .foot {
padding: 9px 1px 3px;
}
#roster .roster-icon {
height: 16px;
width: 16px;
@ -455,7 +455,7 @@ html[dir="rtl"] #roster .roster-icon {
margin-left: 5px;
float: right;
}
#roster .roster-icon a.talk-images {
height: 16px;
width: 16px;
@ -466,11 +466,11 @@ html[dir="rtl"] #roster .roster-icon {
#page-engine .text .tools-add {
background-position: 0 -1047px;
}
#roster .join {
background-position: 0 -1065px;
}
#roster .groupchat,
#page-switch .groupchat-default {
background-position: 0 -1082px;
@ -483,7 +483,7 @@ html[dir="rtl"] #roster .roster-icon {
#roster .more {
background-position: 0 -1100px;
}
#roster .foot-edit-finish a {
color: white;
font-size: 0.8em;
@ -491,13 +491,13 @@ html[dir="rtl"] #roster .roster-icon {
float: right;
display: block;
}
#roster .foot-edit-finish a:hover,
#roster .foot-edit-finish a:focus {
text-decoration: underline;
cursor: pointer;
}
.buddy-conf-item {
position: absolute;
left: -10px;
@ -511,11 +511,11 @@ html[dir="rtl"] .buddy-conf-item {
left: auto;
right: -10px;
}
.buddy-conf-item:hover {
cursor: default;
}
.buddy-conf-subarrow {
background-position: 0 -241px;
opacity: 0.8;
@ -549,7 +549,7 @@ html[dir="rtl"] .buddy-conf-muji .buddy-conf-subarrow {
-webkit-border-radius: 5px;
border-radius: 5px;
}
.buddy-conf-p {
margin-bottom: 4px;
width: 220px;
@ -560,33 +560,33 @@ html[dir="rtl"] .buddy-conf-muji .buddy-conf-subarrow {
html[dir="rtl"] .buddy-conf-p {
float: right;
}
.buddy-conf-input {
padding-top: 2px;
}
.buddy-conf-text {
font-size: 11px;
clear: both;
margin-bottom: 3px;
}
.buddy-conf-text a {
color: white;
}
.buddy-conf-text a:hover,
.buddy-conf-text a:focus {
cursor: pointer;
text-decoration: underline;
}
.buddy-conf-text a.buddy-conf-add-search {
text-decoration: underline;
margin-top: 6px;
display: block;
}
.buddy-conf-select {
font-size: 1.1em;
clear: both;
@ -594,28 +594,28 @@ html[dir="rtl"] .buddy-conf-p {
width: 180px;
height: 23px;
}
.join-jid {
width: 220px;
margin-top: 5px;
}
.add-contact-jid,
.add-contact-name,
.add-contact-gateway {
width: 156px;
margin-bottom: 4px;
}
.add-contact-name-get {
font-size: 0.8em;
display: none;
}
.buddy-conf-subitem label {
clear: both;
}
.buddy-conf-subitem label span {
width: 76px;
height: 14px;
@ -639,7 +639,7 @@ html[dir="rtl"] #buddy-conf-join ul {
left: auto;
right: 10px;
}
.buddy-conf-join-select {
margin: 8px 0 0 0;
}

View file

@ -571,13 +571,15 @@ html[dir="rtl"] .call-content .call-notify .avatar-pane .avatar-container .avata
bottom: 8px;
}
.call-content .call-notify.notify-call_audio .avatar-pane .icon {
.call-content .call-notify.notify-call_audio .avatar-pane .icon,
.call-content .call-notify.notify-broadcast_audio .avatar-pane .icon {
background-position: 0 -120px;
width: 33px;
height: 33px;
}
.call-content .call-notify.notify-call_video .avatar-pane .icon {
.call-content .call-notify.notify-call_video .avatar-pane .icon,
.call-content .call-notify.notify-broadcast_video .avatar-pane .icon {
background-position: 0 -154px;
width: 33px;
height: 22px;

Binary file not shown.

View file

@ -4,10 +4,11 @@
# License: AGPL
# Authors: Valérian Saliou, JanCBorchardt
# Translators:
# sahwar <ve4ernik@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: Jappix\n"
"PO-Revision-Date: 2014-05-08 10:20+0100\n"
"PO-Revision-Date: 2014-10-13 10:45+0100\n"
"Last-Translator: Valérian Saliou <valerian@valeriansaliou.name>\n"
"Language-Team: Bulgarian (http://www.transifex.com/projects/p/jappix/"
"language/bg/)\n"
@ -17,7 +18,7 @@ msgstr ""
"Language: bg\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"POT-Creation-Date: \n"
"X-Generator: Poedit 1.6.5\n"
"X-Generator: Poedit 1.6.9\n"
msgid "default:LTR"
msgstr "default:LTR"
@ -60,12 +61,12 @@ msgid "Find a public Jappix node."
msgstr ""
msgid "Credits"
msgstr ""
msgstr "Благодарности"
msgid "Association"
msgstr ""
msgid "Web agency"
msgid "Company"
msgstr ""
msgid "Legal"
@ -84,10 +85,10 @@ msgid "Node owner"
msgstr ""
msgid "By using our service, you accept %s."
msgstr ""
msgstr "Като използвате нашата услуга, вие приемате %s."
msgid "our terms of use"
msgstr ""
msgstr "нашите условия за ползване"
msgid ""
"Jappix has been interrupted by a network issue, a bug or bad login (check "
@ -199,6 +200,21 @@ msgstr "Добяване на приятел"
msgid "Your groupchats"
msgstr "Вашите групови чатове"
msgid "Audio/video conference"
msgstr ""
msgid "Launch a group call"
msgstr ""
msgid "Audio conference"
msgstr "Аудио конференция"
msgid "Video conference"
msgstr "Видео конференция"
msgid "Conference call"
msgstr "Конферетно обаждане"
msgid "Manage your favorite groupchats"
msgstr "Управление на любимите ви групови чатове"
@ -254,7 +270,7 @@ msgid "Busy"
msgstr "зает"
msgid "Offline"
msgstr ""
msgstr "извън линия"
msgid "Mood"
msgstr "Настроение"
@ -457,22 +473,22 @@ msgid "Message archiving"
msgstr "Архивиране на съобщенията"
msgid "Store an history of your chats"
msgstr ""
msgstr "Запис на историята на вашите чатове"
msgid "Geolocation"
msgstr "Геолокация"
msgid "Disabled"
msgstr ""
msgstr "Изключено"
msgid "Store all chats"
msgstr ""
msgstr "Запис на всички чатове"
msgid "Store friend chats"
msgstr ""
msgid "Remove all archives"
msgstr ""
msgstr "Премахване на всички архиви"
msgid "Empty"
msgstr "Празно"
@ -571,7 +587,7 @@ msgid "Underlined text"
msgstr "Подчертан текст"
msgid "Send a file"
msgstr ""
msgstr "Изпращане на файл"
msgid ""
"Once uploaded, your friend will be prompted to download the file you sent."
@ -613,7 +629,7 @@ msgid "All tabs"
msgstr "Всички подпрозорци (табове)"
msgid "Join groupchat"
msgstr ""
msgstr "Присъединяване към групов чат"
msgid "Close this tab"
msgstr "Затваряне на подпрозореца (таба)"
@ -817,10 +833,10 @@ msgid "left the chat room"
msgstr "напусна чат стаята"
msgid "%s left"
msgstr ""
msgstr "%s напусна чата"
msgid "%s joined"
msgstr ""
msgstr "%s се присъедини към чата"
msgid "no status"
msgstr "без статус"
@ -841,6 +857,8 @@ msgid ""
"Jappix is an open social platform, that let's you easily get or keep in "
"touch with everyone."
msgstr ""
"Jappix е отворена социална платформа, която ви позволява лесно да поддържате "
"връзка с всекиго."
msgid ""
"Join the millions of users who are currently using the XMPP Network (Google "
@ -855,7 +873,7 @@ msgid "Hi there!"
msgstr "Ей, ти там, здравей!"
msgid "Welcome to %1s, “%2s”."
msgstr ""
msgstr "Добре дошли в %1s, „%2s“."
msgid "Login to your existing XMPP account or create a new one for free!"
msgstr ""
@ -999,7 +1017,7 @@ msgid "would like to get authorization."
msgstr "желае да получи пълномощно."
msgid "would like to send you a file: “%s”."
msgstr ""
msgstr "желае да ви изпрати файл: „%s“."
msgid "has received a file exchange request: “%s”."
msgstr ""
@ -1053,13 +1071,13 @@ msgid ""
msgstr ""
msgid "Open"
msgstr ""
msgstr "Отваряне"
msgid "Show"
msgstr ""
msgstr "Показване"
msgid "Hide"
msgstr ""
msgstr "Скриване"
msgid "Submit"
msgstr "Изпращане"
@ -1194,7 +1212,7 @@ msgid "Media integration"
msgstr "Медийна интеграция"
msgid "Keep local chat archives"
msgstr ""
msgstr "Пазене на локални архиви на чата"
msgid "XMPP links"
msgstr "XMPP връзки"
@ -2361,12 +2379,24 @@ msgstr ""
msgid "Stop"
msgstr ""
msgid "Leave"
msgstr ""
msgid "Mute"
msgstr ""
msgid "Unmute"
msgstr ""
msgid "Nobody there. Invite some people!"
msgstr ""
msgid "Invite people..."
msgstr ""
msgid "Enter people names..."
msgstr ""
msgid "Is calling you"
msgstr ""
@ -2406,6 +2436,24 @@ msgstr ""
msgid "Ending call..."
msgstr ""
msgid "Incoming group call"
msgstr ""
msgid "Preparing group call..."
msgstr ""
msgid "Connecting to group call..."
msgstr ""
msgid "Group call error"
msgstr ""
msgid "Ending group call..."
msgstr ""
msgid "Group call ended"
msgstr ""
msgid "Accept"
msgstr ""
@ -2423,3 +2471,51 @@ msgstr ""
msgid "Video Call"
msgstr ""
msgid "%s participant"
msgstr ""
msgid "%s participants"
msgstr ""
msgid "(full)"
msgstr ""
msgid "%s is able to receive group calls."
msgstr ""
msgid "%s may not support group calls."
msgstr ""
msgid "Send a message..."
msgstr ""
msgid "Edited"
msgstr ""
msgid "Edited (%s)"
msgstr ""
msgid "Editing"
msgstr ""
msgid "Being edited"
msgstr ""
msgid "Delivered"
msgstr ""
msgid "Read"
msgstr ""
msgid "Sending..."
msgstr ""
msgid "%s requested your attention to the conversation"
msgstr ""
msgid "You requested %s's attention to the conversation"
msgstr ""
msgid "Attention to conversation requested."
msgstr ""

View file

@ -54,7 +54,7 @@ msgstr ""
msgid "Association"
msgstr ""
msgid "Web agency"
msgid "Company"
msgstr ""
msgid "Legal"
@ -2091,6 +2091,12 @@ msgstr ""
msgid "Waiting..."
msgstr ""
msgid "Proposing call..."
msgstr ""
msgid "No answer"
msgstr ""
msgid "Ringing..."
msgstr ""

Binary file not shown.

View file

@ -11,7 +11,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Jappix\n"
"PO-Revision-Date: 2014-05-29 17:06+0100\n"
"PO-Revision-Date: 2014-10-13 10:45+0100\n"
"Last-Translator: Valérian Saliou <valerian@valeriansaliou.name>\n"
"Language-Team: French (http://www.transifex.com/projects/p/jappix/language/"
"fr/)\n"
@ -21,7 +21,7 @@ msgstr ""
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"POT-Creation-Date: \n"
"X-Generator: Poedit 1.6.5\n"
"X-Generator: Poedit 1.6.9\n"
msgid "default:LTR"
msgstr "default:LTR"
@ -69,8 +69,8 @@ msgstr "Crédits"
msgid "Association"
msgstr "Association"
msgid "Web agency"
msgstr "Agence Web"
msgid "Company"
msgstr "Entreprise"
msgid "Legal"
msgstr "Légal"
@ -198,6 +198,21 @@ msgstr "Ajouter un ami"
msgid "Your groupchats"
msgstr "Vos salons de discussion"
msgid "Audio/video conference"
msgstr "Conférence audio/vidéo"
msgid "Launch a group call"
msgstr "Lancer un appel de groupe"
msgid "Audio conference"
msgstr "Conférence audio"
msgid "Video conference"
msgstr "Conférence vidéo"
msgid "Conference call"
msgstr "Appel de groupe"
msgid "Manage your favorite groupchats"
msgstr "Gérer mes salons favoris"
@ -2387,12 +2402,24 @@ msgstr "Slot AdSense"
msgid "Stop"
msgstr "Stop"
msgid "Leave"
msgstr "Partir"
msgid "Mute"
msgstr "Muet"
msgid "Unmute"
msgstr "Audible"
msgid "Nobody there. Invite some people!"
msgstr "Il n'y a personne. Invitez du monde !"
msgid "Invite people..."
msgstr "Inviter des personnes..."
msgid "Enter people names..."
msgstr "Entrez les noms..."
msgid "Is calling you"
msgstr "Vous appelle"
@ -2432,6 +2459,24 @@ msgstr "Est déjà en appel"
msgid "Ending call..."
msgstr "Fin de l'appel..."
msgid "Incoming group call"
msgstr "Appel de groupe"
msgid "Preparing group call..."
msgstr "Préparation de l'appel..."
msgid "Connecting to group call..."
msgstr "Connexion à l'appel..."
msgid "Group call error"
msgstr "Erreur d'appel"
msgid "Ending group call..."
msgstr "Fin de l'appel..."
msgid "Group call ended"
msgstr "Appel terminé"
msgid "Accept"
msgstr "Accepter"
@ -2450,6 +2495,24 @@ msgstr "Appel Audio"
msgid "Video Call"
msgstr "Appel Vidéo"
msgid "%s participant"
msgstr "%s participant"
msgid "%s participants"
msgstr "%s participants"
msgid "(full)"
msgstr "(maxi)"
msgid "%s is able to receive group calls."
msgstr "%s peut recevoir des appels de groupe."
msgid "%s may not support group calls."
msgstr "%s ne semble pas supporter les appels de groupe."
msgid "Send a message..."
msgstr "Envoyer un message..."
msgid "Edited"
msgstr "Édité"

Binary file not shown.

View file

@ -10,7 +10,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Jappix\n"
"PO-Revision-Date: 2014-05-08 10:21+0100\n"
"PO-Revision-Date: 2014-08-09 15:36+0100\n"
"Last-Translator: Valérian Saliou <valerian@valeriansaliou.name>\n"
"Language-Team: Hebrew (http://www.transifex.com/projects/p/jappix/language/"
"he/)\n"
@ -36,7 +36,7 @@ msgid "Social channel, chat and more."
msgstr "ערוץ חברתי, צ'אט ועוד."
msgid "Create your public profile."
msgstr "צור את הדיקן הפומבי שלך."
msgstr "צור דיקן פומבי משלך."
msgid "A mini-chat for your website."
msgstr "מיני צ'אט עבור אתר הרשת שלך."
@ -60,7 +60,7 @@ msgid "Jappix for your company."
msgstr "Jappix עבור הפירמה שלך."
msgid "Find a public Jappix node."
msgstr "מצא נקודת ממסר Jappix פומבית."
msgstr "מצא צומת Jappix פומבי."
msgid "Credits"
msgstr "תודות"
@ -84,7 +84,7 @@ msgid "Owner"
msgstr "בעלים"
msgid "Node owner"
msgstr "בעל הממסר"
msgstr "בעל צומת"
msgid "By using our service, you accept %s."
msgstr "על ידי שימוש בשירותנו, הינך מסכים/ה %s."
@ -144,7 +144,7 @@ msgid "Register"
msgstr "הרשמה"
msgid "Here we go!"
msgstr "קדימה לדרך!"
msgstr "המשך!"
msgid "Server"
msgstr "שרת"
@ -186,6 +186,21 @@ msgstr "הוספת חברים"
msgid "Your groupchats"
msgstr "שיחות הקבוצה שלך"
msgid "Audio/video conference"
msgstr "ועידת אודיו/וידאו"
msgid "Launch a group call"
msgstr "שגר שיחה קבוצתית"
msgid "Audio conference"
msgstr "ועידה קולית"
msgid "Video conference"
msgstr "ועידה חזותית"
msgid "Conference call"
msgstr "שיחת ועידה"
msgid "Manage your favorite groupchats"
msgstr "ניהול שיחות הקבוצה המועדפות עליך"
@ -1571,7 +1586,7 @@ msgstr "משתמשים"
msgid ""
"This is a restricted area: only the authorized users can manage this Jappix "
"node."
msgstr "זהו אזור מוגבל: רק משתמשים מורשים יכולים לנהל את ממסר Jappix זה."
msgstr "זהו אזור מוגבל: רק משתמשים מורשים יכולים לנהל את צומת Jappix זה."
msgid "Please use the form below to login to the administration panel."
msgstr "אנא השתמש בתבנית שלמטה כדי להתחבר את לוח הניהול."
@ -1602,16 +1617,16 @@ msgstr ""
"אותן למטה."
msgid "Change your Jappix node configuration with this tool."
msgstr "שינוי תצורת ממסר Jappix בעזרת כלי זה."
msgstr "שינוי תצורת צומת Jappix בעזרת כלי זה."
msgid "Change the XMPP hosts that this Jappix node serves with this tool."
msgstr "שנה מארחי XMPP שממסר Jappix זה משרת, בעזרת כלי זה."
msgstr "שנה מארחי XMPP אשר צומת Jappix זה משרת, בעזרת כלי זה."
msgid ""
"All this Jappix node stored files can be managed with this tool: please "
"select a sub-folder and start editing its content!"
msgstr ""
"כל הקבצים אשר מאוחסנים בממסר Jappix זה יכולים להתנהל בעזרת כלי זה: אנא בחר "
"כל הקבצים אשר מאוחסנים בצומת Jappix זה יכולים להתנהל בעזרת כלי זה: אנא בחר "
"תיקיית משנה ולאחר מכן תעמוד לרשותך האפשרות להתחיל לערוך את התוכן שלה!"
msgid "Jappix is fully customisable: you can change its design right here."
@ -1663,14 +1678,14 @@ msgid ""
"You can define more than one administrator for this Jappix node. You can "
"also change a password with this tool."
msgstr ""
"ניתן לתחום יותר ממנהלן אחד עבור ממסר Jappix זה. ניתן גם לשנות את הסיסמה "
"בעזרת כלי זה."
"באפשרותך לתחום יותר מאשר מנהלן אחד עבור צומת Jappix זה. באפשרותך גם לשנות את "
"הסיסמה בעזרת כלי זה."
msgid ""
"Update your Jappix node with this tool, or check if a new one is available. "
"Informations about the latest version are also displayed (in english)."
msgstr ""
"עדכון ממסר Jappix בעזרת כלי זה, לחלופין ניתן לבדוק אם ממסר חדש זמין כעת. "
"עדכון צומת Jappix בעזרת כלי זה, לחלופין ניתן לבדוק אם ממסר חדש זמין כעת. "
"מידע אודות הגרסה האחרונה גם כן מוצג (באנגלית)."
msgid "Access statistics"
@ -1770,7 +1785,7 @@ msgid ""
"Change your Jappix node background with this tool. You can either set a "
"custom color or an uploaded image. Let your creativity flow!"
msgstr ""
"שינוי רקע ממסר Jappix בעזרת כלי זה. ניתן להגדיר צבע מותאם או להעלות תמונה. "
"שינוי רקע צומת Jappix בעזרת כלי זה. ניתן להגדיר צבע מותאם או להעלות תמונה. "
"התירו ליצירתיות לזרום!"
msgid "Use default background"
@ -1934,7 +1949,7 @@ msgstr "תיקיית האחסון שרצית לטהר, הינה ריקה כעת!
msgid ""
"Keep your Jappix node fresh and fast, clean the storage folders regularly!"
msgstr "שמור על ממסר Jappix רענן ומהיר, על ידי טיהור תיקיות האחסון בקביעות!"
msgstr "שמור על צומת Jappix רענן ומהיר, על ידי טיהור תיקיות האחסון בקביעות!"
msgid ""
"Upload your music (Ogg Vorbis, MP3 or WAV) to be able to listen to it in "
@ -2296,12 +2311,24 @@ msgstr "משבצת AdSense"
msgid "Stop"
msgstr "עצור"
msgid "Leave"
msgstr ""
msgid "Mute"
msgstr "השתק"
msgid "Unmute"
msgstr "בטל השתקה"
msgid "Nobody there. Invite some people!"
msgstr "אף אחד לא נמצא שם. הזמן כמה אנשים!"
msgid "Invite people..."
msgstr "הזמנת אנשים..."
msgid "Enter people names..."
msgstr "הזנת שמות אנשים..."
msgid "Is calling you"
msgstr "מחייג/ת אליך"
@ -2309,7 +2336,7 @@ msgid "Initiating call"
msgstr "מתחיל כעת קריאה"
msgid "Connecting to call..."
msgstr "כעת מתחבר אל קריאה..."
msgstr "כעת מתחבר אל שיחה..."
msgid "Waiting..."
msgstr "כעת ממתין..."
@ -2341,6 +2368,24 @@ msgstr "כבר בעיצומה של שיחה"
msgid "Ending call..."
msgstr "כעת מסיים שיחה..."
msgid "Incoming group call"
msgstr "שיחת קבוצה נכנסת"
msgid "Preparing group call..."
msgstr "כעת מכין שיחת קבוצה..."
msgid "Connecting to group call..."
msgstr "כעת מתחבר אל שיחת קבוצה..."
msgid "Group call error"
msgstr "שגיאת שיחת קבוצה"
msgid "Ending group call..."
msgstr "כעת מסיים שיחת קבוצה..."
msgid "Group call ended"
msgstr "שיחת קבוצה הסתיימה"
msgid "Accept"
msgstr "קבל"
@ -2354,7 +2399,55 @@ msgid "Retry"
msgstr "נסה שוב"
msgid "Audio Call"
msgstr "שיחה קולית (אודיו)"
msgstr "שיחה קולית"
msgid "Video Call"
msgstr "שיחה חזותית (וידאו)"
msgstr "שיחה חזותית"
msgid "%s participant"
msgstr "משתתף %s"
msgid "%s participants"
msgstr "%s משתתפים"
msgid "(full)"
msgstr "(מלא)"
msgid "%s is able to receive group calls."
msgstr "%s מסוגל/ת לקבל שיחות קבוצתיות."
msgid "%s may not support group calls."
msgstr "%s עשוי שלא לתמוך בשיחות קבוצתיות."
msgid "Send a message..."
msgstr "שליחת הודעה..."
msgid "Edited"
msgstr ""
msgid "Edited (%s)"
msgstr ""
msgid "Editing"
msgstr ""
msgid "Being edited"
msgstr ""
msgid "Delivered"
msgstr ""
msgid "Read"
msgstr ""
msgid "Sending..."
msgstr "כעת שולח..."
msgid "%s requested your attention to the conversation"
msgstr "%s ביקש/ה את תשומת לבך אל הדיון"
msgid "You requested %s's attention to the conversation"
msgstr "ביקשת את הסבת צומת הלב של %s אל הדיון"
msgid "Attention to conversation requested."
msgstr "הסבת צומת לב אל הדיון התבקשה."

Binary file not shown.

View file

@ -4,13 +4,13 @@
# License: AGPL
# Authors: Valérian Saliou, JanCBorchardt
# Translators:
# DonIncognito <joe.brendel.ronck@gmail.com>, 2013
# Joé BRENDEL <joe.brendel.ronck@gmail.com>, 2013
# Kahr Patrick <patrick@nerds.lu>, 2013-2014
# Tullius, 2013
# Thull Michel, 2013
msgid ""
msgstr ""
"Project-Id-Version: Jappix\n"
"PO-Revision-Date: 2014-05-08 10:21+0100\n"
"PO-Revision-Date: 2014-08-09 15:36+0100\n"
"Last-Translator: Valérian Saliou <valerian@valeriansaliou.name>\n"
"Language-Team: Luxembourgish (http://www.transifex.com/projects/p/jappix/"
"language/lb/)\n"
@ -190,6 +190,21 @@ msgstr "E Kolleg adden"
msgid "Your groupchats"
msgstr "Deng Gruppenchats"
msgid "Audio/video conference"
msgstr ""
msgid "Launch a group call"
msgstr ""
msgid "Audio conference"
msgstr ""
msgid "Video conference"
msgstr ""
msgid "Conference call"
msgstr ""
msgid "Manage your favorite groupchats"
msgstr "Organiséier deng Gruppenchats"
@ -852,7 +867,7 @@ msgid "Hi there!"
msgstr "Moien!"
msgid "Welcome to %1s, “%2s”."
msgstr ""
msgstr "Wëllkomm op %1s, \"%2s\"."
msgid "Login to your existing XMPP account or create a new one for free!"
msgstr ""
@ -1215,7 +1230,7 @@ msgid "Friends"
msgstr "Kollegen"
msgid "Welcome to Jappix, your own social cloud!"
msgstr ""
msgstr "Wëllkomm op Jappix, denger eegener sozialer Cloud+"
msgid ""
"Before you start using it, you will have to change some settings, search for "
@ -1250,10 +1265,10 @@ msgid ""
"When you will press the save button, the profile editor will be opened. "
"Happy socializing!"
msgstr ""
"Wann dier op Späicheren dréckt geet den Profileditor op. Happy socializing!"
"Wanns du op Späicheren drécks geet den Profileditor op. Happy socializing!"
msgid "Share Jappix on %s"
msgstr "Deelt Jappix op %s"
msgstr "Deel Jappix op %s"
msgid "Follow Jappix topic on %s"
msgstr "Jappix op %s followen"
@ -1280,7 +1295,7 @@ msgid "Jappix installation"
msgstr "Jappix-Installatioun"
msgid "Welcome to the Jappix installation!"
msgstr "Moien fir d'Installatioun vun Jappix!"
msgstr "Wëlkomm bei der Installatioun vun Jappix!"
msgid ""
"This tool will help you installing Jappix, the first full-featured XMPP-"
@ -1296,7 +1311,7 @@ msgid "Welcome"
msgstr "Moien"
msgid "Storage configuration"
msgstr "Späicher Konfiguratioun"
msgstr "Späicher-Konfiguratioun"
msgid "Administrator account"
msgstr "Administrator-Kont"
@ -1326,7 +1341,7 @@ msgstr ""
msgid "It's time to build your own social cloud: just go to the next step!"
msgstr ""
"Et as Zäit fier Äer eegen Social Cloud opzebauen: weider bei dee nächste "
"Et as Zäit fier deng eegen Social Cloud opzebauen: weider bei dee nächste "
"Schrëtt!"
msgid ""
@ -1346,22 +1361,22 @@ msgstr ""
"Besëtzer vum Uerdner op %3s setzen (Hängt vun denger Konfiguratioun of)."
msgid "The folder is writable, you can continue!"
msgstr "An desen Uerdner kënnt Der schreiwen, Dier kënnt weidermaachen!"
msgstr "Du hues d'Schreiwrechter fier dësen Uerdner, du kanns weidermaachen!"
msgid ""
"Jappix offers you the possibility to manage your configuration, install new "
"plugins or search for updates. That's why you must create an administrator "
"account to access the manager."
msgstr ""
"Jappix gëtt Iech d'Méiglechkeet fier äer Astellungen ze geréieren, nei "
"Plugins ze installéieren oder no Updates ze sichen. Dofier musst dier en "
"Jappix gëtt Dier d'Méiglechkeet fier deng Astellungen ze geréieren, nei "
"Plugins ze installéieren oder no Updates ze sichen. Dofier musst de en "
"Administrator-Kont opmaachen fier un de Manager ze kommen."
msgid ""
"When Jappix will be installed, just click on the manager link on the home "
"page to access it."
msgstr ""
"Wann Jappix installéiert gëtt, klickt op de Manager-Link op der Haaptsäit "
"Wann Jappix bis installéiert as, klick op de Manager-Link op der Haaptsäit "
"fier eranzekommen."
msgid "Oops, you missed something or the two passwords do not match!"
@ -1527,7 +1542,7 @@ msgid "Finish"
msgstr "Fäerdeg"
msgid "Check again"
msgstr "Nach eng Kéier préifen"
msgstr "Nach eng Kéier iwwerpréifen"
msgid ""
"The folder is not writable, set the right permissions to the %s directory."
@ -2376,12 +2391,24 @@ msgstr "AdSense slot"
msgid "Stop"
msgstr "Stop"
msgid "Leave"
msgstr ""
msgid "Mute"
msgstr "Mute"
msgid "Unmute"
msgstr "Unmute"
msgid "Nobody there. Invite some people!"
msgstr ""
msgid "Invite people..."
msgstr ""
msgid "Enter people names..."
msgstr ""
msgid "Is calling you"
msgstr "Rifft dech un"
@ -2421,6 +2448,24 @@ msgstr "As besat"
msgid "Ending call..."
msgstr "Uruff beendegen..."
msgid "Incoming group call"
msgstr ""
msgid "Preparing group call..."
msgstr ""
msgid "Connecting to group call..."
msgstr ""
msgid "Group call error"
msgstr ""
msgid "Ending group call..."
msgstr ""
msgid "Group call ended"
msgstr ""
msgid "Accept"
msgstr "Unhuelen"
@ -2438,3 +2483,51 @@ msgstr "Uruff"
msgid "Video Call"
msgstr "Video Konferenz"
msgid "%s participant"
msgstr ""
msgid "%s participants"
msgstr ""
msgid "(full)"
msgstr ""
msgid "%s is able to receive group calls."
msgstr ""
msgid "%s may not support group calls."
msgstr ""
msgid "Send a message..."
msgstr ""
msgid "Edited"
msgstr "Editéiert"
msgid "Edited (%s)"
msgstr "editéiert (%s)"
msgid "Editing"
msgstr "editéiert"
msgid "Being edited"
msgstr "gëtt editéiert"
msgid "Delivered"
msgstr "verschéckt"
msgid "Read"
msgstr "liesen"
msgid "Sending..."
msgstr "fortschécken..."
msgid "%s requested your attention to the conversation"
msgstr ""
msgid "You requested %s's attention to the conversation"
msgstr ""
msgid "Attention to conversation requested."
msgstr ""

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -51,12 +51,12 @@ if(!isInstalled()) {
} else if(isset($_GET['m']) && !empty($_GET['m'])) {
// Not anonymous, any forced mode?
$force_mode = $_GET['m'];
// Switch between two Jappix apps
if(($force_mode == 'desktop') || ($force_mode == 'mobile')) {
// Write the cookie
setcookie('jappix_mode', $force_mode, (time() + 31536000));
// Define the app to include
$include_app = $force_mode;
} else if(($force_mode == 'manager') || ($force_mode == 'download')) {
@ -71,7 +71,7 @@ if(!isInstalled()) {
// No cookie, is this a mobile device?
require_once('./server/mobile-detect.php');
$mobile = new Mobile_Detect();
// Really mobile?
if(($mobile -> isMobile()) && !($mobile -> isTablet())) {
$include_app = 'mobile';
@ -85,21 +85,21 @@ if(($include_app == 'desktop') || ($include_app == 'mobile')) {
// Apply some special headers
header('Status: 301 Moved Permanently', true, 301);
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
// Kill the script!
exit('HTTP/1.1 301 Moved Permanently');
}
// Is it a static node?
if(isStatic()) {
$include_app = 'static';
}
// Is it an upload node?
if(isUpload()) {
$include_app = 'upload';
}
// Save this visit (for the stats)
if(hasStatistics()) {
writeVisit();

View file

@ -38,7 +38,7 @@ if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type');
header('Access-Control-Max-Age: 31536000');
exit;
}
@ -50,7 +50,7 @@ if($data) {
// CORS headers
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
$method = 'POST';
}
@ -81,7 +81,7 @@ if(function_exists('curl_init')) {
if($use_curl) {
// Initialize CURL
$connection = curl_init(HOST_BOSH);
// Set the CURL settings
curl_setopt($connection, CURLOPT_HEADER, 0);
curl_setopt($connection, CURLOPT_POST, 1);
@ -94,7 +94,7 @@ if($use_curl) {
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
// Get the CURL output
$output = curl_exec($connection);
}
@ -138,7 +138,7 @@ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
if($method == 'POST') {
// XML header
header('Content-Type: text/xml; charset=utf-8');
if(!$output) {
echo('<body xmlns=\'http://jabber.org/protocol/httpbind\' type=\'terminate\'/>');
} else {
@ -150,10 +150,10 @@ if($method == 'POST') {
if($method == 'GET') {
// JSON header
header('Content-type: application/json');
// Encode output to JSON
$json_output = json_encode($output);
if(($output == false) || ($output == '') || ($json_output == 'null')) {
echo($callback.'({"reply":"<body xmlns=\'http:\/\/jabber.org\/protocol\/httpbind\' type=\'terminate\'\/>"});');
} else {

View file

@ -47,21 +47,21 @@ function captcha($security_code) {
$font = 4;
$offset_x = 8;
$offset_y = 3;
// Create image
$im = @imagecreate($width, $height);
$background_color = imagecolorallocate($im, 10, 102, 174);
$text_color = imagecolorallocate($im, rand(150, 255), rand(150, 255), rand(150, 255));
// Create the circles
$r = 0.01; $g = 0.51; $b = 0.87;
$r = 0.01; $g = 0.51; $b = 0.87;
for($i = 1; $i <= $circles; $i++) {
$value = rand(200, 255);
$randomcolor = imagecolorallocate($im, $value * $r, $value * $g, $value * $b);
imagefilledellipse($im, rand(0, $width - 10), rand(0, $height - 3), rand(20, 70), rand(20, 70), $randomcolor);
}
// Create the text
imagerectangle($im, 0, 0, $width - 1, $height - 1, $text_color);
imagestring($im, $font, $offset_x, $offset_y, $security_code, $text_color);
@ -80,10 +80,10 @@ function captcha($security_code) {
imageline($im, $x, 0, $x, $height, $randomcolor);
}
// Tell the browser what kind of file is come in
// Tell the browser what kind of file is come in
header('Content-Type: image/png');
// Output the newly created image in jpeg format
// Output the newly created image in jpeg format
imagepng($im);
// Free up resources

View file

@ -23,7 +23,7 @@ if(!defined('JAPPIX_BASE')) {
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?php
// Enable compatibility mode for IE 10
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE 10\.0/", $_SERVER['HTTP_USER_AGENT'])) {
@ -34,12 +34,12 @@ if(!defined('JAPPIX_BASE')) {
<title><?php echo htmlspecialchars(SERVICE_NAME); ?> &bull; <?php echo htmlspecialchars(SERVICE_DESC); ?></title>
<link rel="shortcut icon" href="./favicon.ico" />
<?php echoGetFiles($hash, '', 'css', 'desktop.xml', ''); echo "\n"; ?>
<!--[if lt IE 9]><?php echoGetFiles($hash, '', 'css', '', 'ie.css'); ?><![endif]-->
<?php echoGetFiles($hash, $locale, 'js', 'desktop.xml', ''); echo "\n";
if(anonymousMode()) {
echo "\n\t";
echoGetFiles($hash, '', 'css', 'anonymous.xml', '');
@ -47,7 +47,7 @@ if(!defined('JAPPIX_BASE')) {
echoGetFiles($hash, $locale, 'js', 'anonymous.xml', '');
echo "\n";
}
if(httpAuthEnabled()) {
echo "\n\t";
echoGetFiles($hash, '', 'js', 'httpauth.xml', '');
@ -66,7 +66,7 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
<!-- BEGIN HOMEPAGE -->
<div id="home">
<div class="home-images plane"></div>
<div class="main">
<div class="mainview">
<div class="left">
@ -75,34 +75,34 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
<p class="secondary"><?php _e("Jappix is an open social platform, that let's you easily get or keep in touch with everyone."); ?></p>
<p class="secondary"><?php _e("Join the millions of users who are currently using the XMPP Network (Google Talk, etc), don't stay out!"); ?></p>
</div>
<div class="right">
<h1 class="top default"><?php _e("Hi there!"); ?></h1>
<div class="default homediv">
<p><?php printf(T_("Welcome to %1s, “%2s”."), htmlspecialchars(SERVICE_NAME), htmlspecialchars(SERVICE_DESC)); ?></p>
<p><?php _e("Login to your existing XMPP account or create a new one for free!"); ?></p>
<button class="login buttons-images">
<span class="home-images"></span>
<span class="text"><?php _e("Login"); ?></span>
</button>
<button class="register buttons-images">
<span class="home-images"></span>
<span class="text"><?php _e("Register"); ?></span>
</button>
<p class="notice"><?php _e("For your account safety, when you login or register, make sure your password remains secret."); ?></p>
</div>
<div class="navigation">
<?php
// Keep get var
$keep_get = keepGet('m', false);
?>
<a class="home-images mobile" href="./?m=mobile<?php echo $keep_get; ?>"><span class="vert_center"><?php _e("Mobile"); ?></span></a>
<?php if(showManagerLink()) { ?>
@ -111,32 +111,32 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
</div>
</div>
</div>
<?php if((ADS_ENABLE == 'on') && (ADS_STANDARD || ADS_STANDARD)) { ?>
<?php require_once('./server/functions-advertising.php'); ?>
<?php $advertise_link = 'http://www.backlinks.com/?aff=58769'; ?>
<div class="friendsview">
<div class="friends">
<div class="group content">
<?php displayAdverts('content', $advertise_link); ?>
</div>
<div class="group standard">
<div class="separator">
<span class="sep_top"></span>
<span class="sep_bottom"></span>
</div>
<?php displayAdverts('standard', $advertise_link); ?>
</div>
<a class="group refer" href="<?php echo $advertise_link; ?>" target="_blank">
<div class="separator">
<span class="sep_top"></span>
<span class="sep_bottom"></span>
</div>
<span class="home-images icon"></span>
<span class="label"><?php _e("Advertise here"); ?></span>
</a>
@ -144,7 +144,7 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
</div>
<?php } ?>
</div>
<div class="home-images corporation">
<div class="corp_network">
<h2 class="nomargin">Jappix.com</h2>
@ -174,7 +174,7 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
<span class="desc"><?php _e("Legal disclaimer for Jappix."); ?></span>
</a>
</div>
<h2>Jappix.org</h2>
<div class="tabulate">
<a href="https://jappix.org/">
@ -186,7 +186,7 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
<span class="desc"><?php _e("Contribute to the Jappix code."); ?></span>
</a>
</div>
<h2>Jappix.pro</h2>
<div class="tabulate">
<a href="https://jappix.pro/">
@ -194,7 +194,7 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
<span class="desc"><?php _e("Jappix for your company."); ?></span>
</a>
</div>
<h2>Jappix.net</h2>
<div class="tabulate">
<a href="https://jappix.net/">
@ -204,21 +204,21 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
</div>
</div>
</div>
<div class="home-images aboutus">
<div class="aboutus_org">
<span class="version"><b>Jappix</b> <?php echo htmlspecialchars($version); ?></span>
<h2><?php _e("Credits"); ?></h2>
<span class="one">
<a class="name" href="http://www.post-pro.fr/">PostPro</a>
<a class="desc" href="http://www.post-pro.fr/"><?php _e("Association"); ?></a>
</span>
<span class="one">
<a class="name" href="https://frenchtouch.pro/">FrenchTouch</a>
<a class="desc" href="https://frenchtouch.pro/"><?php _e("Web agency"); ?></a>
<a class="name" href="https://hakuma.holdings/">Hakuma Holdings</a>
<a class="desc" href="https://hakuma.holdings/"><?php _e("Company"); ?></a>
</span>
<?php if(hasLegal()) { ?>
<h2><?php _e("Legal"); ?></h2>
<span class="one">
@ -226,7 +226,7 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
<a class="desc" href="<?php echo htmlspecialchars(LEGAL); ?>"><?php _e("Terms of use and legal"); ?></a>
</span>
<?php } ?>
<?php if(hasOwner()) { ?>
<h2><?php _e("Owner"); ?></h2>
<span class="one">
@ -236,7 +236,7 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
<?php } ?>
</div>
</div>
<?php if(!LANGUAGE || LANGUAGE == 'all') { ?>
<div class="locale" data-keepget="<?php echo(keepGet('l', false)); ?>">
<div class="current">
@ -244,24 +244,24 @@ if(!anonymousMode() && !httpAuthEnabled()) { ?>
</div>
</div>
<?php } ?>
<?php
// Add the notice
$conf_notice = readNotice();
$type_notice = $conf_notice['type'];
$text_notice = $conf_notice['notice'];
// Simple notice
if(($type_notice == 'simple') || ($type_notice == 'advanced')) {
// We must encode special HTML characters
if($type_notice == 'simple')
$text_notice = '<span class="title home-images">'.T_("Notice").'</span><span class="text">'.htmlentities($text_notice).'</span>';
// Echo the notice
echo('<div class="notice '.$type_notice.'">'.$text_notice.'</div>');
}
?>
</div>
<!-- END HOMEPAGE -->

View file

@ -36,7 +36,7 @@ if(isset($_GET['id']) && !empty($_GET['id']) && isSafe($_GET['id'])) {
$filename = $_GET['id'];
$content_dir = '../tmp/archives/';
$filepath = $content_dir.$filename.'.html';
// We set special headers
header("Content-disposition: attachment; filename=\"$filename.html\"");
header("Content-Type: application/force-download");
@ -46,7 +46,7 @@ if(isset($_GET['id']) && !empty($_GET['id']) && isSafe($_GET['id'])) {
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");
readfile($filepath);
// We delete the stored log file
unlink($filepath);
}

Some files were not shown because too many files have changed in this diff Show more