|
|
@ -9,7 +9,6 @@ define([
|
|
|
|
'/common/common-feedback.js',
|
|
|
|
'/common/common-feedback.js',
|
|
|
|
'/common/common-realtime.js',
|
|
|
|
'/common/common-realtime.js',
|
|
|
|
'/common/common-messaging.js',
|
|
|
|
'/common/common-messaging.js',
|
|
|
|
'/common/common-messenger.js',
|
|
|
|
|
|
|
|
'/common/outer/sharedfolder.js',
|
|
|
|
'/common/outer/sharedfolder.js',
|
|
|
|
'/common/outer/cursor.js',
|
|
|
|
'/common/outer/cursor.js',
|
|
|
|
'/common/outer/onlyoffice.js',
|
|
|
|
'/common/outer/onlyoffice.js',
|
|
|
@ -27,8 +26,8 @@ define([
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
'/bower_components/saferphore/index.js',
|
|
|
|
'/bower_components/saferphore/index.js',
|
|
|
|
], function (Sortify, UserObject, ProxyManager, Migrate, Hash, Util, Constants, Feedback,
|
|
|
|
], function (Sortify, UserObject, ProxyManager, Migrate, Hash, Util, Constants, Feedback,
|
|
|
|
Realtime, Messaging, Messenger,
|
|
|
|
Realtime, Messaging,
|
|
|
|
SF, Cursor, OnlyOffice, Mailbox, Profile, Team, _Messenger,
|
|
|
|
SF, Cursor, OnlyOffice, Mailbox, Profile, Team, Messenger,
|
|
|
|
NetConfig, AppConfig,
|
|
|
|
NetConfig, AppConfig,
|
|
|
|
Crypto, ChainPad, CpNetflux, Listmap, nThen, Saferphore) {
|
|
|
|
Crypto, ChainPad, CpNetflux, Listmap, nThen, Saferphore) {
|
|
|
|
|
|
|
|
|
|
|
@ -1243,14 +1242,6 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Messenger
|
|
|
|
|
|
|
|
Store.messenger = {
|
|
|
|
|
|
|
|
execCommand: function (clientId, data, cb) {
|
|
|
|
|
|
|
|
if (!store.messenger) { return void cb({error: 'Messenger is disabled'}); }
|
|
|
|
|
|
|
|
store.messenger.execCommand(data, cb);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// OnlyOffice
|
|
|
|
// OnlyOffice
|
|
|
|
Store.onlyoffice = {
|
|
|
|
Store.onlyoffice = {
|
|
|
|
execCommand: function (clientId, data, cb) {
|
|
|
|
execCommand: function (clientId, data, cb) {
|
|
|
@ -1755,7 +1746,6 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// Clients management
|
|
|
|
// Clients management
|
|
|
|
var driveEventClients = [];
|
|
|
|
var driveEventClients = [];
|
|
|
|
var messengerEventClients = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dropChannel = function (chanId) {
|
|
|
|
var dropChannel = function (chanId) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -1781,10 +1771,6 @@ define([
|
|
|
|
if (driveIdx !== -1) {
|
|
|
|
if (driveIdx !== -1) {
|
|
|
|
driveEventClients.splice(driveIdx, 1);
|
|
|
|
driveEventClients.splice(driveIdx, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var messengerIdx = messengerEventClients.indexOf(clientId);
|
|
|
|
|
|
|
|
if (messengerIdx !== -1) {
|
|
|
|
|
|
|
|
messengerEventClients.splice(messengerIdx, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
store.cursor.removeClient(clientId);
|
|
|
|
store.cursor.removeClient(clientId);
|
|
|
|
} catch (e) { console.error(e); }
|
|
|
|
} catch (e) { console.error(e); }
|
|
|
@ -1875,28 +1861,6 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var sendMessengerEvent = function (q, data) {
|
|
|
|
|
|
|
|
messengerEventClients.forEach(function (cId) {
|
|
|
|
|
|
|
|
postMessage(cId, q, data);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Store._subscribeToMessenger = function (clientId) {
|
|
|
|
|
|
|
|
if (messengerEventClients.indexOf(clientId) === -1) {
|
|
|
|
|
|
|
|
messengerEventClients.push(clientId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var loadMessenger = function () {
|
|
|
|
|
|
|
|
if (AppConfig.availablePadTypes.indexOf('contacts') === -1) { return; }
|
|
|
|
|
|
|
|
var messenger = store.messenger = Messenger.messenger(store, function () {
|
|
|
|
|
|
|
|
broadcast([], "UPDATE_METADATA");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
messenger.on('event', function (ev, data) {
|
|
|
|
|
|
|
|
sendMessengerEvent('CHAT_EVENT', {
|
|
|
|
|
|
|
|
ev: ev,
|
|
|
|
|
|
|
|
data: data
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
var loadProfile = function (waitFor) {
|
|
|
|
var loadProfile = function (waitFor) {
|
|
|
@ -2027,10 +1991,10 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
userObject.fixFiles();
|
|
|
|
userObject.fixFiles();
|
|
|
|
SF.loadSharedFolders(Store, store.network, store, userObject, waitFor);
|
|
|
|
SF.loadSharedFolders(Store, store.network, store, userObject, waitFor);
|
|
|
|
loadMessenger();
|
|
|
|
|
|
|
|
loadCursor();
|
|
|
|
loadCursor();
|
|
|
|
loadOnlyOffice();
|
|
|
|
loadOnlyOffice();
|
|
|
|
loadUniversal(_Messenger, 'messenger', waitFor);
|
|
|
|
loadUniversal(Messenger, 'messenger', waitFor);
|
|
|
|
|
|
|
|
store.messenger = store.modules['messenger'];
|
|
|
|
loadUniversal(Profile, 'profile', waitFor);
|
|
|
|
loadUniversal(Profile, 'profile', waitFor);
|
|
|
|
loadUniversal(Team, 'team', waitFor);
|
|
|
|
loadUniversal(Team, 'team', waitFor);
|
|
|
|
cleanFriendRequests();
|
|
|
|
cleanFriendRequests();
|
|
|
|