Code refactoring

This commit is contained in:
RainLoop Team 2014-08-27 19:59:44 +04:00
parent 36329110e5
commit b4f416b6f8
105 changed files with 4331 additions and 4339 deletions

View file

@ -8,7 +8,7 @@
Enums = require('Enums'),
Utils = require('Utils'),
AppSettings = require('./AppSettings.js')
Settings = require('Storage:Settings')
;
/**
@ -22,9 +22,9 @@
AbstractData.prototype.populateDataOnStart = function()
{
var
mLayout = Utils.pInt(AppSettings.settingsGet('Layout')),
aLanguages = AppSettings.settingsGet('Languages'),
aThemes = AppSettings.settingsGet('Themes')
mLayout = Utils.pInt(Settings.settingsGet('Layout')),
aLanguages = Settings.settingsGet('Languages'),
aThemes = Settings.settingsGet('Themes')
;
if (Utils.isArray(aLanguages))
@ -37,55 +37,55 @@
this.themes(aThemes);
}
this.mainLanguage(AppSettings.settingsGet('Language'));
this.mainTheme(AppSettings.settingsGet('Theme'));
this.mainLanguage(Settings.settingsGet('Language'));
this.mainTheme(Settings.settingsGet('Theme'));
this.capaAdditionalAccounts(AppSettings.capa(Enums.Capa.AdditionalAccounts));
this.capaAdditionalIdentities(AppSettings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(AppSettings.capa(Enums.Capa.Gravatar));
this.determineUserLanguage(!!AppSettings.settingsGet('DetermineUserLanguage'));
this.determineUserDomain(!!AppSettings.settingsGet('DetermineUserDomain'));
this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
this.determineUserLanguage(!!Settings.settingsGet('DetermineUserLanguage'));
this.determineUserDomain(!!Settings.settingsGet('DetermineUserDomain'));
this.capaThemes(AppSettings.capa(Enums.Capa.Themes));
this.allowLanguagesOnLogin(!!AppSettings.settingsGet('AllowLanguagesOnLogin'));
this.allowLanguagesOnSettings(!!AppSettings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!AppSettings.settingsGet('UseLocalProxyForExternalImages'));
this.capaThemes(Settings.capa(Enums.Capa.Themes));
this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
this.editorDefaultType(AppSettings.settingsGet('EditorDefaultType'));
this.showImages(!!AppSettings.settingsGet('ShowImages'));
this.contactsAutosave(!!AppSettings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(AppSettings.settingsGet('InterfaceAnimation'));
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
this.showImages(!!Settings.settingsGet('ShowImages'));
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(Settings.settingsGet('InterfaceAnimation'));
this.mainMessagesPerPage(AppSettings.settingsGet('MPP'));
this.mainMessagesPerPage(Settings.settingsGet('MPP'));
this.desktopNotifications(!!AppSettings.settingsGet('DesktopNotifications'));
this.useThreads(!!AppSettings.settingsGet('UseThreads'));
this.replySameFolder(!!AppSettings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!AppSettings.settingsGet('UseCheckboxesInList'));
this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
this.useThreads(!!Settings.settingsGet('UseThreads'));
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{
this.layout(mLayout);
}
this.facebookSupported(!!AppSettings.settingsGet('SupportedFacebookSocial'));
this.facebookEnable(!!AppSettings.settingsGet('AllowFacebookSocial'));
this.facebookAppID(AppSettings.settingsGet('FacebookAppID'));
this.facebookAppSecret(AppSettings.settingsGet('FacebookAppSecret'));
this.facebookSupported(!!Settings.settingsGet('SupportedFacebookSocial'));
this.facebookEnable(!!Settings.settingsGet('AllowFacebookSocial'));
this.facebookAppID(Settings.settingsGet('FacebookAppID'));
this.facebookAppSecret(Settings.settingsGet('FacebookAppSecret'));
this.twitterEnable(!!AppSettings.settingsGet('AllowTwitterSocial'));
this.twitterConsumerKey(AppSettings.settingsGet('TwitterConsumerKey'));
this.twitterConsumerSecret(AppSettings.settingsGet('TwitterConsumerSecret'));
this.twitterEnable(!!Settings.settingsGet('AllowTwitterSocial'));
this.twitterConsumerKey(Settings.settingsGet('TwitterConsumerKey'));
this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
this.googleEnable(!!AppSettings.settingsGet('AllowGoogleSocial'));
this.googleClientID(AppSettings.settingsGet('GoogleClientID'));
this.googleClientSecret(AppSettings.settingsGet('GoogleClientSecret'));
this.googleApiKey(AppSettings.settingsGet('GoogleApiKey'));
this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
this.googleClientID(Settings.settingsGet('GoogleClientID'));
this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
this.googleApiKey(Settings.settingsGet('GoogleApiKey'));
this.dropboxEnable(!!AppSettings.settingsGet('AllowDropboxSocial'));
this.dropboxApiKey(AppSettings.settingsGet('DropboxApiKey'));
this.dropboxEnable(!!Settings.settingsGet('AllowDropboxSocial'));
this.dropboxApiKey(Settings.settingsGet('DropboxApiKey'));
this.contactsIsAllowed(!!AppSettings.settingsGet('ContactsIsAllowed'));
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
};
module.exports = AbstractData;

View file

@ -7,6 +7,7 @@
var
window = require('window'),
$ = require('$'),
_ = require('_'),
Consts = require('Consts'),
Enums = require('Enums'),
@ -15,18 +16,18 @@
Plugins = require('Plugins'),
LinkBuilder = require('LinkBuilder'),
AppSettings = require('./AppSettings.js')
Settings = require('Storage:Settings')
;
/**
* @constructor
*/
function AbstractAjaxRemoteStorage()
function AbstractRemoteStorage()
{
this.oRequests = {};
}
AbstractAjaxRemoteStorage.prototype.oRequests = {};
AbstractRemoteStorage.prototype.oRequests = {};
/**
* @param {?Function} fCallback
@ -36,7 +37,7 @@
* @param {boolean} bCached
* @param {*=} oRequestParameters
*/
AbstractAjaxRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
AbstractRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
{
var
fCall = function () {
@ -134,7 +135,7 @@
* @param {Array=} aAbortActions = []
* @return {jQuery.jqXHR}
*/
AbstractAjaxRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
AbstractRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
{
var
self = this,
@ -169,7 +170,7 @@
if (bPost)
{
oParameters['XToken'] = AppSettings.settingsGet('Token');
oParameters['XToken'] = Settings.settingsGet('Token');
}
oDefAjax = $.ajax({
@ -230,7 +231,7 @@
* @param {string=} sGetAdd = ''
* @param {Array=} aAbortActions = []
*/
AbstractAjaxRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
AbstractRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
{
oParameters = oParameters || {};
oParameters.Action = sAction;
@ -246,7 +247,7 @@
/**
* @param {?Function} fCallback
*/
AbstractAjaxRemoteStorage.prototype.noop = function (fCallback)
AbstractRemoteStorage.prototype.noop = function (fCallback)
{
this.defaultRequest(fCallback, 'Noop');
};
@ -260,7 +261,7 @@
* @param {string} sHtmlCapa
* @param {number} iTime
*/
AbstractAjaxRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
AbstractRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
{
this.defaultRequest(fCallback, 'JsError', {
'Message': sMessage,
@ -278,7 +279,7 @@
* @param {Array=} mData = null
* @param {boolean=} bIsError = false
*/
AbstractAjaxRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
AbstractRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
{
this.defaultRequest(fCallback, 'JsInfo', {
'Type': sType,
@ -290,7 +291,7 @@
/**
* @param {?Function} fCallback
*/
AbstractAjaxRemoteStorage.prototype.getPublicKey = function (fCallback)
AbstractRemoteStorage.prototype.getPublicKey = function (fCallback)
{
this.defaultRequest(fCallback, 'GetPublicKey');
};
@ -299,13 +300,13 @@
* @param {?Function} fCallback
* @param {string} sVersion
*/
AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
AbstractRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
{
this.defaultRequest(fCallback, 'Version', {
'Version': sVersion
});
};
module.exports = AbstractAjaxRemoteStorage;
module.exports = AbstractRemoteStorage;
}(module, require));

View file

@ -8,7 +8,7 @@
_ = require('_'),
ko = require('ko'),
AbstractData = require('./AbstractData.js')
AbstractData = require('Storage:Abstract:Data')
;
/**

View file

@ -7,28 +7,28 @@
var
_ = require('_'),
AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js')
AbstractRemoteStorage = require('Storage:Abstract:Remote')
;
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
* @extends AbstractRemoteStorage
*/
function AdminAjaxRemoteStorage()
function AdminRemoteStorage()
{
AbstractAjaxRemoteStorage.call(this);
AbstractRemoteStorage.call(this);
this.oRequests = {};
}
_.extend(AdminAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype);
_.extend(AdminRemoteStorage.prototype, AbstractRemoteStorage.prototype);
/**
* @param {?Function} fCallback
* @param {string} sLogin
* @param {string} sPassword
*/
AdminAjaxRemoteStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
AdminRemoteStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
{
this.defaultRequest(fCallback, 'AdminLogin', {
'Login': sLogin,
@ -39,7 +39,7 @@
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.adminLogout = function (fCallback)
AdminRemoteStorage.prototype.adminLogout = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminLogout');
};
@ -48,7 +48,7 @@
* @param {?Function} fCallback
* @param {?} oData
*/
AdminAjaxRemoteStorage.prototype.saveAdminConfig = function (fCallback, oData)
AdminRemoteStorage.prototype.saveAdminConfig = function (fCallback, oData)
{
this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
};
@ -56,7 +56,7 @@
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.domainList = function (fCallback)
AdminRemoteStorage.prototype.domainList = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminDomainList');
};
@ -64,7 +64,7 @@
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.pluginList = function (fCallback)
AdminRemoteStorage.prototype.pluginList = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminPluginList');
};
@ -72,7 +72,7 @@
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.packagesList = function (fCallback)
AdminRemoteStorage.prototype.packagesList = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminPackagesList');
};
@ -80,7 +80,7 @@
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.coreData = function (fCallback)
AdminRemoteStorage.prototype.coreData = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminCoreData');
};
@ -88,7 +88,7 @@
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.updateCoreData = function (fCallback)
AdminRemoteStorage.prototype.updateCoreData = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
};
@ -97,7 +97,7 @@
* @param {?Function} fCallback
* @param {Object} oPackage
*/
AdminAjaxRemoteStorage.prototype.packageInstall = function (fCallback, oPackage)
AdminRemoteStorage.prototype.packageInstall = function (fCallback, oPackage)
{
this.defaultRequest(fCallback, 'AdminPackageInstall', {
'Id': oPackage.id,
@ -110,7 +110,7 @@
* @param {?Function} fCallback
* @param {Object} oPackage
*/
AdminAjaxRemoteStorage.prototype.packageDelete = function (fCallback, oPackage)
AdminRemoteStorage.prototype.packageDelete = function (fCallback, oPackage)
{
this.defaultRequest(fCallback, 'AdminPackageDelete', {
'Id': oPackage.id
@ -121,7 +121,7 @@
* @param {?Function} fCallback
* @param {string} sName
*/
AdminAjaxRemoteStorage.prototype.domain = function (fCallback, sName)
AdminRemoteStorage.prototype.domain = function (fCallback, sName)
{
this.defaultRequest(fCallback, 'AdminDomainLoad', {
'Name': sName
@ -132,7 +132,7 @@
* @param {?Function} fCallback
* @param {string} sName
*/
AdminAjaxRemoteStorage.prototype.plugin = function (fCallback, sName)
AdminRemoteStorage.prototype.plugin = function (fCallback, sName)
{
this.defaultRequest(fCallback, 'AdminPluginLoad', {
'Name': sName
@ -143,7 +143,7 @@
* @param {?Function} fCallback
* @param {string} sName
*/
AdminAjaxRemoteStorage.prototype.domainDelete = function (fCallback, sName)
AdminRemoteStorage.prototype.domainDelete = function (fCallback, sName)
{
this.defaultRequest(fCallback, 'AdminDomainDelete', {
'Name': sName
@ -155,7 +155,7 @@
* @param {string} sName
* @param {boolean} bDisabled
*/
AdminAjaxRemoteStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
AdminRemoteStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
{
return this.defaultRequest(fCallback, 'AdminDomainDisable', {
'Name': sName,
@ -167,7 +167,7 @@
* @param {?Function} fCallback
* @param {Object} oConfig
*/
AdminAjaxRemoteStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
AdminRemoteStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
{
return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
};
@ -176,7 +176,7 @@
* @param {?Function} fCallback
* @param {boolean} bForce
*/
AdminAjaxRemoteStorage.prototype.licensing = function (fCallback, bForce)
AdminRemoteStorage.prototype.licensing = function (fCallback, bForce)
{
return this.defaultRequest(fCallback, 'AdminLicensing', {
'Force' : bForce ? '1' : '0'
@ -188,7 +188,7 @@
* @param {string} sDomain
* @param {string} sKey
*/
AdminAjaxRemoteStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
AdminRemoteStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
{
return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
'Domain' : sDomain,
@ -201,7 +201,7 @@
* @param {string} sName
* @param {boolean} bDisabled
*/
AdminAjaxRemoteStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
AdminRemoteStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
{
return this.defaultRequest(fCallback, 'AdminPluginDisable', {
'Name': sName,
@ -209,7 +209,7 @@
});
};
AdminAjaxRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
AdminRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin,
sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, sWhiteList)
{
@ -229,7 +229,7 @@
});
};
AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
AdminRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
sIncHost, iIncPort, sIncSecure,
sOutHost, iOutPort, sOutSecure, bOutAuth)
{
@ -249,7 +249,7 @@
* @param {?Function} fCallback
* @param {?} oData
*/
AdminAjaxRemoteStorage.prototype.testContacts = function (fCallback, oData)
AdminRemoteStorage.prototype.testContacts = function (fCallback, oData)
{
this.defaultRequest(fCallback, 'AdminContactsTest', oData);
};
@ -258,7 +258,7 @@
* @param {?Function} fCallback
* @param {?} oData
*/
AdminAjaxRemoteStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
AdminRemoteStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
{
this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
};
@ -266,11 +266,11 @@
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
AdminRemoteStorage.prototype.adminPing = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminPing');
};
module.exports = new AdminAjaxRemoteStorage();
module.exports = new AdminRemoteStorage();
}(module, require));

View file

@ -11,13 +11,13 @@
Utils = require('Utils'),
LinkBuilder = require('LinkBuilder'),
AppSettings = require('./AppSettings.js')
Settings = require('Storage:Settings')
;
/**
* @constructor
*/
function WebMailCacheStorage()
function CacheStorage()
{
this.oFoldersCache = {};
this.oFoldersNamesCache = {};
@ -28,60 +28,60 @@
this.oNewMessage = {};
this.oRequestedMessage = {};
this.bCapaGravatar = AppSettings.capa(Enums.Capa.Gravatar);
this.bCapaGravatar = Settings.capa(Enums.Capa.Gravatar);
}
/**
* @type {boolean}
*/
WebMailCacheStorage.prototype.bCapaGravatar = false;
CacheStorage.prototype.bCapaGravatar = false;
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oFoldersCache = {};
CacheStorage.prototype.oFoldersCache = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oFoldersNamesCache = {};
CacheStorage.prototype.oFoldersNamesCache = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oFolderHashCache = {};
CacheStorage.prototype.oFolderHashCache = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oFolderUidNextCache = {};
CacheStorage.prototype.oFolderUidNextCache = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oMessageListHashCache = {};
CacheStorage.prototype.oMessageListHashCache = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oMessageFlagsCache = {};
CacheStorage.prototype.oMessageFlagsCache = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oBodies = {};
CacheStorage.prototype.oBodies = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oNewMessage = {};
CacheStorage.prototype.oNewMessage = {};
/**
* @type {Object}
*/
WebMailCacheStorage.prototype.oRequestedMessage = {};
CacheStorage.prototype.oRequestedMessage = {};
WebMailCacheStorage.prototype.clear = function ()
CacheStorage.prototype.clear = function ()
{
this.oFoldersCache = {};
this.oFoldersNamesCache = {};
@ -98,7 +98,7 @@
* @param {Function} fCallback
* @return {string}
*/
WebMailCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
CacheStorage.prototype.getUserPic = function (sEmail, fCallback)
{
sEmail = Utils.trim(sEmail);
fCallback(this.bCapaGravatar && '' !== sEmail ? LinkBuilder.avatarLink(sEmail) : '', sEmail);
@ -109,7 +109,7 @@
* @param {string} sUid
* @return {string}
*/
WebMailCacheStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
CacheStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
{
return sFolderFullNameRaw + '#' + sUid;
};
@ -118,7 +118,7 @@
* @param {string} sFolder
* @param {string} sUid
*/
WebMailCacheStorage.prototype.addRequestedMessage = function (sFolder, sUid)
CacheStorage.prototype.addRequestedMessage = function (sFolder, sUid)
{
this.oRequestedMessage[this.getMessageKey(sFolder, sUid)] = true;
};
@ -128,7 +128,7 @@
* @param {string} sUid
* @return {boolean}
*/
WebMailCacheStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
CacheStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
{
return true === this.oRequestedMessage[this.getMessageKey(sFolder, sUid)];
};
@ -137,7 +137,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sUid
*/
WebMailCacheStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
CacheStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
{
this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = true;
};
@ -146,7 +146,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sUid
*/
WebMailCacheStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
CacheStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
{
if (this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)])
{
@ -157,7 +157,7 @@
return false;
};
WebMailCacheStorage.prototype.clearNewMessageCache = function ()
CacheStorage.prototype.clearNewMessageCache = function ()
{
this.oNewMessage = {};
};
@ -166,7 +166,7 @@
* @param {string} sFolderHash
* @return {string}
*/
WebMailCacheStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
CacheStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
{
return '' !== sFolderHash && this.oFoldersNamesCache[sFolderHash] ? this.oFoldersNamesCache[sFolderHash] : '';
};
@ -175,7 +175,7 @@
* @param {string} sFolderHash
* @param {string} sFolderFullNameRaw
*/
WebMailCacheStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
CacheStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
{
this.oFoldersNamesCache[sFolderHash] = sFolderFullNameRaw;
};
@ -184,7 +184,7 @@
* @param {string} sFolderFullNameRaw
* @return {string}
*/
WebMailCacheStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
CacheStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
{
return '' !== sFolderFullNameRaw && this.oFolderHashCache[sFolderFullNameRaw] ? this.oFolderHashCache[sFolderFullNameRaw] : '';
};
@ -193,7 +193,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sFolderHash
*/
WebMailCacheStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
CacheStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
{
this.oFolderHashCache[sFolderFullNameRaw] = sFolderHash;
};
@ -202,7 +202,7 @@
* @param {string} sFolderFullNameRaw
* @return {string}
*/
WebMailCacheStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
CacheStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
{
return '' !== sFolderFullNameRaw && this.oFolderUidNextCache[sFolderFullNameRaw] ? this.oFolderUidNextCache[sFolderFullNameRaw] : '';
};
@ -211,7 +211,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sUidNext
*/
WebMailCacheStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
CacheStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
{
this.oFolderUidNextCache[sFolderFullNameRaw] = sUidNext;
};
@ -220,7 +220,7 @@
* @param {string} sFolderFullNameRaw
* @return {?FolderModel}
*/
WebMailCacheStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
CacheStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
{
return '' !== sFolderFullNameRaw && this.oFoldersCache[sFolderFullNameRaw] ? this.oFoldersCache[sFolderFullNameRaw] : null;
};
@ -229,7 +229,7 @@
* @param {string} sFolderFullNameRaw
* @param {?FolderModel} oFolder
*/
WebMailCacheStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
CacheStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
{
this.oFoldersCache[sFolderFullNameRaw] = oFolder;
};
@ -237,7 +237,7 @@
/**
* @param {string} sFolderFullNameRaw
*/
WebMailCacheStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
CacheStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
{
this.setFolderToCacheList(sFolderFullNameRaw, null);
};
@ -247,7 +247,7 @@
* @param {string} sUid
* @return {?Array}
*/
WebMailCacheStorage.prototype.getMessageFlagsFromCache = function (sFolderFullName, sUid)
CacheStorage.prototype.getMessageFlagsFromCache = function (sFolderFullName, sUid)
{
return this.oMessageFlagsCache[sFolderFullName] && this.oMessageFlagsCache[sFolderFullName][sUid] ?
this.oMessageFlagsCache[sFolderFullName][sUid] : null;
@ -258,7 +258,7 @@
* @param {string} sUid
* @param {Array} aFlagsCache
*/
WebMailCacheStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
CacheStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
{
if (!this.oMessageFlagsCache[sFolderFullName])
{
@ -271,7 +271,7 @@
/**
* @param {string} sFolderFullName
*/
WebMailCacheStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
CacheStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
{
this.oMessageFlagsCache[sFolderFullName] = {};
};
@ -279,7 +279,7 @@
/**
* @param {(MessageModel|null)} oMessage
*/
WebMailCacheStorage.prototype.initMessageFlagsFromCache = function (oMessage)
CacheStorage.prototype.initMessageFlagsFromCache = function (oMessage)
{
if (oMessage)
{
@ -320,7 +320,7 @@
/**
* @param {(MessageModel|null)} oMessage
*/
WebMailCacheStorage.prototype.storeMessageFlagsToCache = function (oMessage)
CacheStorage.prototype.storeMessageFlagsToCache = function (oMessage)
{
if (oMessage)
{
@ -336,7 +336,7 @@
* @param {string} sUid
* @param {Array} aFlags
*/
WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
CacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
{
if (Utils.isArray(aFlags) && 0 < aFlags.length)
{
@ -344,6 +344,6 @@
}
};
module.exports = new WebMailCacheStorage();
module.exports = new CacheStorage();
}(module, require));

View file

@ -19,22 +19,22 @@
Utils = require('Utils'),
LinkBuilder = require('LinkBuilder'),
AppSettings = require('./AppSettings.js'),
Cache = require('./WebMailCacheStorage.js'),
Settings = require('Storage:Settings'),
Cache = require('Storage:RainLoop:Cache'),
kn = require('kn'),
kn = require('App:Knoin'),
MessageModel = require('../Models/MessageModel.js'),
MessageModel = require('Model:Message'),
LocalStorage = require('./LocalStorage.js'),
AbstractData = require('./AbstractData.js')
LocalStorage = require('Storage:LocalStorage'),
AbstractData = require('Storage:Abstract:Data')
;
/**
* @constructor
* @extends AbstractData
*/
function WebMailDataStorage()
function DataStorage()
{
AbstractData.call(this);
@ -127,11 +127,11 @@
this.contactsSyncUser = ko.observable('');
this.contactsSyncPass = ko.observable('');
this.allowContactsSync = ko.observable(!!AppSettings.settingsGet('ContactsSyncIsAllowed'));
this.enableContactsSync = ko.observable(!!AppSettings.settingsGet('EnableContactsSync'));
this.contactsSyncUrl = ko.observable(AppSettings.settingsGet('ContactsSyncUrl'));
this.contactsSyncUser = ko.observable(AppSettings.settingsGet('ContactsSyncUser'));
this.contactsSyncPass = ko.observable(AppSettings.settingsGet('ContactsSyncPassword'));
this.allowContactsSync = ko.observable(!!Settings.settingsGet('ContactsSyncIsAllowed'));
this.enableContactsSync = ko.observable(!!Settings.settingsGet('EnableContactsSync'));
this.contactsSyncUrl = ko.observable(Settings.settingsGet('ContactsSyncUrl'));
this.contactsSyncUser = ko.observable(Settings.settingsGet('ContactsSyncUser'));
this.contactsSyncPass = ko.observable(Settings.settingsGet('ContactsSyncPassword'));
// folders
this.namespace = '';
@ -475,9 +475,9 @@
this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30);
}
_.extend(WebMailDataStorage.prototype, AbstractData.prototype);
_.extend(DataStorage.prototype, AbstractData.prototype);
WebMailDataStorage.prototype.purgeMessageBodyCache = function()
DataStorage.prototype.purgeMessageBodyCache = function()
{
var
iCount = 0,
@ -509,32 +509,32 @@
}
};
WebMailDataStorage.prototype.populateDataOnStart = function()
DataStorage.prototype.populateDataOnStart = function()
{
AbstractData.prototype.populateDataOnStart.call(this);
this.accountEmail(AppSettings.settingsGet('Email'));
this.accountIncLogin(AppSettings.settingsGet('IncLogin'));
this.accountOutLogin(AppSettings.settingsGet('OutLogin'));
this.projectHash(AppSettings.settingsGet('ProjectHash'));
this.accountEmail(Settings.settingsGet('Email'));
this.accountIncLogin(Settings.settingsGet('IncLogin'));
this.accountOutLogin(Settings.settingsGet('OutLogin'));
this.projectHash(Settings.settingsGet('ProjectHash'));
this.defaultIdentityID(AppSettings.settingsGet('DefaultIdentityID'));
this.defaultIdentityID(Settings.settingsGet('DefaultIdentityID'));
this.displayName(AppSettings.settingsGet('DisplayName'));
this.replyTo(AppSettings.settingsGet('ReplyTo'));
this.signature(AppSettings.settingsGet('Signature'));
this.signatureToAll(!!AppSettings.settingsGet('SignatureToAll'));
this.enableTwoFactor(!!AppSettings.settingsGet('EnableTwoFactor'));
this.displayName(Settings.settingsGet('DisplayName'));
this.replyTo(Settings.settingsGet('ReplyTo'));
this.signature(Settings.settingsGet('Signature'));
this.signatureToAll(!!Settings.settingsGet('SignatureToAll'));
this.enableTwoFactor(!!Settings.settingsGet('EnableTwoFactor'));
this.lastFoldersHash = LocalStorage.get(Enums.ClientSideKeyName.FoldersLashHash) || '';
this.remoteSuggestions = !!AppSettings.settingsGet('RemoteSuggestions');
this.remoteSuggestions = !!Settings.settingsGet('RemoteSuggestions');
this.devEmail = AppSettings.settingsGet('DevEmail');
this.devPassword = AppSettings.settingsGet('DevPassword');
this.devEmail = Settings.settingsGet('DevEmail');
this.devPassword = Settings.settingsGet('DevPassword');
};
WebMailDataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages)
DataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages)
{
if ('INBOX' === sFolder && Utils.isNormal(sUidNext) && sUidNext !== '')
{
@ -609,7 +609,7 @@
}
};
WebMailDataStorage.prototype.hideMessageBodies = function ()
DataStorage.prototype.hideMessageBodies = function ()
{
var oMessagesBodiesDom = this.messagesBodiesDom();
if (oMessagesBodiesDom)
@ -622,7 +622,7 @@
* @param {boolean=} bBoot = false
* @returns {Array}
*/
WebMailDataStorage.prototype.getNextFolderNames = function (bBoot)
DataStorage.prototype.getNextFolderNames = function (bBoot)
{
bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
@ -685,7 +685,7 @@
* @param {string=} sToFolderFullNameRaw = ''
* @param {bCopy=} bCopy = false
*/
WebMailDataStorage.prototype.removeMessagesFromList = function (
DataStorage.prototype.removeMessagesFromList = function (
sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
{
sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : '';
@ -779,7 +779,7 @@
}
};
WebMailDataStorage.prototype.setMessage = function (oData, bCached)
DataStorage.prototype.setMessage = function (oData, bCached)
{
var
bIsHtml = false,
@ -939,21 +939,21 @@
* @param {Array} aList
* @returns {string}
*/
WebMailDataStorage.prototype.calculateMessageListHash = function (aList)
DataStorage.prototype.calculateMessageListHash = function (aList)
{
return _.map(aList, function (oMessage) {
return '' + oMessage.hash + '_' + oMessage.threadsLen() + '_' + oMessage.flagHash();
}).join('|');
};
WebMailDataStorage.prototype.findPublicKeyByHex = function (sHash)
DataStorage.prototype.findPublicKeyByHex = function (sHash)
{
return _.find(this.openpgpkeysPublic(), function (oItem) {
return oItem && sHash === oItem.id;
});
};
WebMailDataStorage.prototype.findPublicKeysByEmail = function (sEmail)
DataStorage.prototype.findPublicKeysByEmail = function (sEmail)
{
return _.compact(_.map(this.openpgpkeysPublic(), function (oItem) {
@ -981,7 +981,7 @@
* @param {string=} sPassword
* @returns {?}
*/
WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
DataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
{
var
oPrivateKey = null,
@ -1018,11 +1018,11 @@
* @param {string=} sPassword
* @returns {?}
*/
WebMailDataStorage.prototype.findSelfPrivateKey = function (sPassword)
DataStorage.prototype.findSelfPrivateKey = function (sPassword)
{
return this.findPrivateKeyByEmail(this.accountEmail(), sPassword);
};
module.exports = new WebMailDataStorage();
module.exports = new DataStorage();
}(module, require));

View file

@ -4,20 +4,17 @@
'use strict';
var
_ = require('_'),
CookieDriver = require('./LocalStorages/CookieDriver.js'),
LocalStorageDriver = require('./LocalStorages/LocalStorageDriver.js')
;
/**
* @constructor
*/
function LocalStorage()
{
var
NextStorageDriver = _.find([LocalStorageDriver, CookieDriver], function (NextStorageDriver) {
_ = require('_'),
NextStorageDriver = _.find([
require('Storage:LocalStorage:Cookie'),
require('Storage:LocalStorage:LocalStorage')
], function (NextStorageDriver) {
return NextStorageDriver.supported();
})
;
@ -26,7 +23,6 @@
if (NextStorageDriver)
{
NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
this.oDriver = new NextStorageDriver();
}
}

View file

@ -12,37 +12,37 @@
Globals = require('Globals'),
Base64 = require('Base64'),
AppSettings = require('./AppSettings.js'),
Cache = require('./WebMailCacheStorage.js'),
Data = require('./WebMailDataStorage.js'),
Settings = require('Storage:Settings'),
Cache = require('Storage:RainLoop:Cache'),
Data = require('Storage:RainLoop:Data'),
AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js')
AbstractRemoteStorage = require('Storage:Abstract:Remote')
;
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
* @extends AbstractRemoteStorage
*/
function WebMailAjaxRemoteStorage()
function RemoteStorage()
{
AbstractAjaxRemoteStorage.call(this);
AbstractRemoteStorage.call(this);
this.oRequests = {};
}
_.extend(WebMailAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype);
_.extend(RemoteStorage.prototype, AbstractRemoteStorage.prototype);
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.folders = function (fCallback)
RemoteStorage.prototype.folders = function (fCallback)
{
this.defaultRequest(fCallback, 'Folders', {
'SentFolder': AppSettings.settingsGet('SentFolder'),
'DraftFolder': AppSettings.settingsGet('DraftFolder'),
'SpamFolder': AppSettings.settingsGet('SpamFolder'),
'TrashFolder': AppSettings.settingsGet('TrashFolder'),
'ArchiveFolder': AppSettings.settingsGet('ArchiveFolder')
'SentFolder': Settings.settingsGet('SentFolder'),
'DraftFolder': Settings.settingsGet('DraftFolder'),
'SpamFolder': Settings.settingsGet('SpamFolder'),
'TrashFolder': Settings.settingsGet('TrashFolder'),
'ArchiveFolder': Settings.settingsGet('ArchiveFolder')
}, null, '', ['Folders']);
};
@ -56,7 +56,7 @@
* @param {string=} sAdditionalCode
* @param {boolean=} bAdditionalCodeSignMe
*/
WebMailAjaxRemoteStorage.prototype.login = function (fCallback, sEmail, sLogin, sPassword, bSignMe, sLanguage, sAdditionalCode, bAdditionalCodeSignMe)
RemoteStorage.prototype.login = function (fCallback, sEmail, sLogin, sPassword, bSignMe, sLanguage, sAdditionalCode, bAdditionalCodeSignMe)
{
this.defaultRequest(fCallback, 'Login', {
'Email': sEmail,
@ -72,7 +72,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.getTwoFactor = function (fCallback)
RemoteStorage.prototype.getTwoFactor = function (fCallback)
{
this.defaultRequest(fCallback, 'GetTwoFactorInfo');
};
@ -80,7 +80,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.createTwoFactor = function (fCallback)
RemoteStorage.prototype.createTwoFactor = function (fCallback)
{
this.defaultRequest(fCallback, 'CreateTwoFactorSecret');
};
@ -88,7 +88,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.clearTwoFactor = function (fCallback)
RemoteStorage.prototype.clearTwoFactor = function (fCallback)
{
this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
};
@ -96,7 +96,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
RemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
{
this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
};
@ -105,7 +105,7 @@
* @param {?Function} fCallback
* @param {string} sCode
*/
WebMailAjaxRemoteStorage.prototype.testTwoFactor = function (fCallback, sCode)
RemoteStorage.prototype.testTwoFactor = function (fCallback, sCode)
{
this.defaultRequest(fCallback, 'TestTwoFactorInfo', {
'Code': sCode
@ -116,7 +116,7 @@
* @param {?Function} fCallback
* @param {boolean} bEnable
*/
WebMailAjaxRemoteStorage.prototype.enableTwoFactor = function (fCallback, bEnable)
RemoteStorage.prototype.enableTwoFactor = function (fCallback, bEnable)
{
this.defaultRequest(fCallback, 'EnableTwoFactor', {
'Enable': bEnable ? '1' : '0'
@ -126,7 +126,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.clearTwoFactorInfo = function (fCallback)
RemoteStorage.prototype.clearTwoFactorInfo = function (fCallback)
{
this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
};
@ -134,7 +134,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.contactsSync = function (fCallback)
RemoteStorage.prototype.contactsSync = function (fCallback)
{
this.defaultRequest(fCallback, 'ContactsSync', null, Consts.Defaults.ContactsSyncAjaxTimeout);
};
@ -146,7 +146,7 @@
* @param {string} sUser
* @param {string} sPassword
*/
WebMailAjaxRemoteStorage.prototype.saveContactsSyncData = function (fCallback, bEnable, sUrl, sUser, sPassword)
RemoteStorage.prototype.saveContactsSyncData = function (fCallback, bEnable, sUrl, sUser, sPassword)
{
this.defaultRequest(fCallback, 'SaveContactsSyncData', {
'Enable': bEnable ? '1' : '0',
@ -162,7 +162,7 @@
* @param {string} sLogin
* @param {string} sPassword
*/
WebMailAjaxRemoteStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
RemoteStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
{
this.defaultRequest(fCallback, 'AccountAdd', {
'Email': sEmail,
@ -175,7 +175,7 @@
* @param {?Function} fCallback
* @param {string} sEmailToDelete
*/
WebMailAjaxRemoteStorage.prototype.accountDelete = function (fCallback, sEmailToDelete)
RemoteStorage.prototype.accountDelete = function (fCallback, sEmailToDelete)
{
this.defaultRequest(fCallback, 'AccountDelete', {
'EmailToDelete': sEmailToDelete
@ -190,7 +190,7 @@
* @param {string} sReplyTo
* @param {string} sBcc
*/
WebMailAjaxRemoteStorage.prototype.identityUpdate = function (fCallback, sId, sEmail, sName, sReplyTo, sBcc)
RemoteStorage.prototype.identityUpdate = function (fCallback, sId, sEmail, sName, sReplyTo, sBcc)
{
this.defaultRequest(fCallback, 'IdentityUpdate', {
'Id': sId,
@ -205,7 +205,7 @@
* @param {?Function} fCallback
* @param {string} sIdToDelete
*/
WebMailAjaxRemoteStorage.prototype.identityDelete = function (fCallback, sIdToDelete)
RemoteStorage.prototype.identityDelete = function (fCallback, sIdToDelete)
{
this.defaultRequest(fCallback, 'IdentityDelete', {
'IdToDelete': sIdToDelete
@ -215,7 +215,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.accountsAndIdentities = function (fCallback)
RemoteStorage.prototype.accountsAndIdentities = function (fCallback)
{
this.defaultRequest(fCallback, 'AccountsAndIdentities');
};
@ -228,7 +228,7 @@
* @param {string=} sSearch = ''
* @param {boolean=} bSilent = false
*/
WebMailAjaxRemoteStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent)
RemoteStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent)
{
sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
@ -275,7 +275,7 @@
* @param {?Function} fCallback
* @param {Array} aDownloads
*/
WebMailAjaxRemoteStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads)
RemoteStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads)
{
this.defaultRequest(fCallback, 'MessageUploadAttachments', {
'Attachments': aDownloads
@ -288,7 +288,7 @@
* @param {number} iUid
* @return {boolean}
*/
WebMailAjaxRemoteStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid)
RemoteStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid)
{
sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
iUid = Utils.pInt(iUid);
@ -313,7 +313,7 @@
* @param {?Function} fCallback
* @param {Array} aExternals
*/
WebMailAjaxRemoteStorage.prototype.composeUploadExternals = function (fCallback, aExternals)
RemoteStorage.prototype.composeUploadExternals = function (fCallback, aExternals)
{
this.defaultRequest(fCallback, 'ComposeUploadExternals', {
'Externals': aExternals
@ -325,7 +325,7 @@
* @param {string} sUrl
* @param {string} sAccessToken
*/
WebMailAjaxRemoteStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
RemoteStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
{
this.defaultRequest(fCallback, 'ComposeUploadDrive', {
'AccessToken': sAccessToken,
@ -338,7 +338,7 @@
* @param {string} sFolder
* @param {Array=} aList = []
*/
WebMailAjaxRemoteStorage.prototype.folderInformation = function (fCallback, sFolder, aList)
RemoteStorage.prototype.folderInformation = function (fCallback, sFolder, aList)
{
var
bRequest = true,
@ -392,7 +392,7 @@
* @param {?Function} fCallback
* @param {Array} aFolders
*/
WebMailAjaxRemoteStorage.prototype.folderInformationMultiply = function (fCallback, aFolders)
RemoteStorage.prototype.folderInformationMultiply = function (fCallback, aFolders)
{
this.defaultRequest(fCallback, 'FolderInformationMultiply', {
'Folders': aFolders
@ -402,7 +402,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.logout = function (fCallback)
RemoteStorage.prototype.logout = function (fCallback)
{
this.defaultRequest(fCallback, 'Logout');
};
@ -413,7 +413,7 @@
* @param {Array} aUids
* @param {boolean} bSetFlagged
*/
WebMailAjaxRemoteStorage.prototype.messageSetFlagged = function (fCallback, sFolderFullNameRaw, aUids, bSetFlagged)
RemoteStorage.prototype.messageSetFlagged = function (fCallback, sFolderFullNameRaw, aUids, bSetFlagged)
{
this.defaultRequest(fCallback, 'MessageSetFlagged', {
'Folder': sFolderFullNameRaw,
@ -428,7 +428,7 @@
* @param {Array} aUids
* @param {boolean} bSetSeen
*/
WebMailAjaxRemoteStorage.prototype.messageSetSeen = function (fCallback, sFolderFullNameRaw, aUids, bSetSeen)
RemoteStorage.prototype.messageSetSeen = function (fCallback, sFolderFullNameRaw, aUids, bSetSeen)
{
this.defaultRequest(fCallback, 'MessageSetSeen', {
'Folder': sFolderFullNameRaw,
@ -442,7 +442,7 @@
* @param {string} sFolderFullNameRaw
* @param {boolean} bSetSeen
*/
WebMailAjaxRemoteStorage.prototype.messageSetSeenToAll = function (fCallback, sFolderFullNameRaw, bSetSeen)
RemoteStorage.prototype.messageSetSeenToAll = function (fCallback, sFolderFullNameRaw, bSetSeen)
{
this.defaultRequest(fCallback, 'MessageSetSeenToAll', {
'Folder': sFolderFullNameRaw,
@ -467,7 +467,7 @@
* @param {string} sInReplyTo
* @param {string} sReferences
*/
WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
RemoteStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences)
{
this.defaultRequest(fCallback, 'SaveMessage', {
@ -497,7 +497,7 @@
* @param {string} sSubject
* @param {string} sText
*/
WebMailAjaxRemoteStorage.prototype.sendReadReceiptMessage = function (fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText)
RemoteStorage.prototype.sendReadReceiptMessage = function (fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText)
{
this.defaultRequest(fCallback, 'SendReadReceiptMessage', {
'MessageFolder': sMessageFolder,
@ -526,7 +526,7 @@
* @param {string} sReferences
* @param {boolean} bRequestReadReceipt
*/
WebMailAjaxRemoteStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder,
RemoteStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bRequestReadReceipt)
{
this.defaultRequest(fCallback, 'SendMessage', {
@ -552,7 +552,7 @@
* @param {?Function} fCallback
* @param {Object} oData
*/
WebMailAjaxRemoteStorage.prototype.saveSystemFolders = function (fCallback, oData)
RemoteStorage.prototype.saveSystemFolders = function (fCallback, oData)
{
this.defaultRequest(fCallback, 'SystemFoldersUpdate', oData);
};
@ -561,7 +561,7 @@
* @param {?Function} fCallback
* @param {Object} oData
*/
WebMailAjaxRemoteStorage.prototype.saveSettings = function (fCallback, oData)
RemoteStorage.prototype.saveSettings = function (fCallback, oData)
{
this.defaultRequest(fCallback, 'SettingsUpdate', oData);
};
@ -571,7 +571,7 @@
* @param {string} sPrevPassword
* @param {string} sNewPassword
*/
WebMailAjaxRemoteStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword)
RemoteStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword)
{
this.defaultRequest(fCallback, 'ChangePassword', {
'PrevPassword': sPrevPassword,
@ -584,7 +584,7 @@
* @param {string} sNewFolderName
* @param {string} sParentName
*/
WebMailAjaxRemoteStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName)
RemoteStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName)
{
this.defaultRequest(fCallback, 'FolderCreate', {
'Folder': sNewFolderName,
@ -596,7 +596,7 @@
* @param {?Function} fCallback
* @param {string} sFolderFullNameRaw
*/
WebMailAjaxRemoteStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw)
RemoteStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw)
{
this.defaultRequest(fCallback, 'FolderDelete', {
'Folder': sFolderFullNameRaw
@ -608,7 +608,7 @@
* @param {string} sPrevFolderFullNameRaw
* @param {string} sNewFolderName
*/
WebMailAjaxRemoteStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName)
RemoteStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName)
{
this.defaultRequest(fCallback, 'FolderRename', {
'Folder': sPrevFolderFullNameRaw,
@ -620,7 +620,7 @@
* @param {?Function} fCallback
* @param {string} sFolderFullNameRaw
*/
WebMailAjaxRemoteStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw)
RemoteStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw)
{
this.defaultRequest(fCallback, 'FolderClear', {
'Folder': sFolderFullNameRaw
@ -632,7 +632,7 @@
* @param {string} sFolderFullNameRaw
* @param {boolean} bSubscribe
*/
WebMailAjaxRemoteStorage.prototype.folderSetSubscribe = function (fCallback, sFolderFullNameRaw, bSubscribe)
RemoteStorage.prototype.folderSetSubscribe = function (fCallback, sFolderFullNameRaw, bSubscribe)
{
this.defaultRequest(fCallback, 'FolderSubscribe', {
'Folder': sFolderFullNameRaw,
@ -647,7 +647,7 @@
* @param {Array} aUids
* @param {string=} sLearning
*/
WebMailAjaxRemoteStorage.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning)
RemoteStorage.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning)
{
this.defaultRequest(fCallback, 'MessageMove', {
'FromFolder': sFolder,
@ -663,7 +663,7 @@
* @param {string} sToFolder
* @param {Array} aUids
*/
WebMailAjaxRemoteStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids)
RemoteStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids)
{
this.defaultRequest(fCallback, 'MessageCopy', {
'FromFolder': sFolder,
@ -677,7 +677,7 @@
* @param {string} sFolder
* @param {Array} aUids
*/
WebMailAjaxRemoteStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids)
RemoteStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids)
{
this.defaultRequest(fCallback, 'MessageDelete', {
'Folder': sFolder,
@ -688,7 +688,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.appDelayStart = function (fCallback)
RemoteStorage.prototype.appDelayStart = function (fCallback)
{
this.defaultRequest(fCallback, 'AppDelayStart');
};
@ -696,7 +696,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.quota = function (fCallback)
RemoteStorage.prototype.quota = function (fCallback)
{
this.defaultRequest(fCallback, 'Quota');
};
@ -707,7 +707,7 @@
* @param {number} iLimit
* @param {string} sSearch
*/
WebMailAjaxRemoteStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
RemoteStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
{
this.defaultRequest(fCallback, 'Contacts', {
'Offset': iOffset,
@ -719,7 +719,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, sTags, aProperties)
RemoteStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, sTags, aProperties)
{
this.defaultRequest(fCallback, 'ContactSave', {
'RequestUid': sRequestUid,
@ -733,7 +733,7 @@
* @param {?Function} fCallback
* @param {Array} aUids
*/
WebMailAjaxRemoteStorage.prototype.contactsDelete = function (fCallback, aUids)
RemoteStorage.prototype.contactsDelete = function (fCallback, aUids)
{
this.defaultRequest(fCallback, 'ContactsDelete', {
'Uids': aUids.join(',')
@ -745,7 +745,7 @@
* @param {string} sQuery
* @param {number} iPage
*/
WebMailAjaxRemoteStorage.prototype.suggestions = function (fCallback, sQuery, iPage)
RemoteStorage.prototype.suggestions = function (fCallback, sQuery, iPage)
{
this.defaultRequest(fCallback, 'Suggestions', {
'Query': sQuery,
@ -756,7 +756,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.facebookUser = function (fCallback)
RemoteStorage.prototype.facebookUser = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialFacebookUserInformation');
};
@ -764,7 +764,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.facebookDisconnect = function (fCallback)
RemoteStorage.prototype.facebookDisconnect = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialFacebookDisconnect');
};
@ -772,7 +772,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.twitterUser = function (fCallback)
RemoteStorage.prototype.twitterUser = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialTwitterUserInformation');
};
@ -780,7 +780,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.twitterDisconnect = function (fCallback)
RemoteStorage.prototype.twitterDisconnect = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialTwitterDisconnect');
};
@ -788,7 +788,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.googleUser = function (fCallback)
RemoteStorage.prototype.googleUser = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialGoogleUserInformation');
};
@ -796,7 +796,7 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.googleDisconnect = function (fCallback)
RemoteStorage.prototype.googleDisconnect = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialGoogleDisconnect');
};
@ -804,11 +804,11 @@
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.socialUsers = function (fCallback)
RemoteStorage.prototype.socialUsers = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialUsers');
};
module.exports = new WebMailAjaxRemoteStorage();
module.exports = new RemoteStorage();
}(module, require));

View file

@ -5,31 +5,26 @@
'use strict';
var
AppData = require('AppData'),
Utils = require('Utils')
;
/**
* @constructor
*/
function AppSettings()
function SettingsStorage()
{
this.oSettings = null;
this.oSettings = require('AppData');
this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
}
AppSettings.prototype.oSettings = null;
SettingsStorage.prototype.oSettings = null;
/**
* @param {string} sName
* @return {?}
*/
AppSettings.prototype.settingsGet = function (sName)
SettingsStorage.prototype.settingsGet = function (sName)
{
if (null === this.oSettings)
{
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
}
return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
};
@ -37,13 +32,8 @@
* @param {string} sName
* @param {?} mValue
*/
AppSettings.prototype.settingsSet = function (sName, mValue)
SettingsStorage.prototype.settingsSet = function (sName, mValue)
{
if (null === this.oSettings)
{
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
}
this.oSettings[sName] = mValue;
};
@ -51,13 +41,13 @@
* @param {string} sName
* @return {boolean}
*/
AppSettings.prototype.capa = function (sName)
SettingsStorage.prototype.capa = function (sName)
{
var mCapa = this.settingsGet('Capa');
return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
};
module.exports = new AppSettings();
module.exports = new SettingsStorage();
}(module, require));