Code refactoring

This commit is contained in:
RainLoop Team 2014-10-18 17:43:44 +04:00
parent 345e7c58af
commit 8cf8b94d39
103 changed files with 664 additions and 659 deletions

View file

@ -17,7 +17,7 @@
/**
* @constructor
*/
function CacheAppStorage()
function CacheUserStorage()
{
this.oFoldersCache = {};
this.oFoldersNamesCache = {};
@ -34,54 +34,54 @@
/**
* @type {boolean}
*/
CacheAppStorage.prototype.bCapaGravatar = false;
CacheUserStorage.prototype.bCapaGravatar = false;
/**
* @type {Object}
*/
CacheAppStorage.prototype.oFoldersCache = {};
CacheUserStorage.prototype.oFoldersCache = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oFoldersNamesCache = {};
CacheUserStorage.prototype.oFoldersNamesCache = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oFolderHashCache = {};
CacheUserStorage.prototype.oFolderHashCache = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oFolderUidNextCache = {};
CacheUserStorage.prototype.oFolderUidNextCache = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oMessageListHashCache = {};
CacheUserStorage.prototype.oMessageListHashCache = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oMessageFlagsCache = {};
CacheUserStorage.prototype.oMessageFlagsCache = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oBodies = {};
CacheUserStorage.prototype.oBodies = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oNewMessage = {};
CacheUserStorage.prototype.oNewMessage = {};
/**
* @type {Object}
*/
CacheAppStorage.prototype.oRequestedMessage = {};
CacheUserStorage.prototype.oRequestedMessage = {};
CacheAppStorage.prototype.clear = function ()
CacheUserStorage.prototype.clear = function ()
{
this.oFoldersCache = {};
this.oFoldersNamesCache = {};
@ -98,7 +98,7 @@
* @param {Function} fCallback
* @return {string}
*/
CacheAppStorage.prototype.getUserPic = function (sEmail, fCallback)
CacheUserStorage.prototype.getUserPic = function (sEmail, fCallback)
{
sEmail = Utils.trim(sEmail);
fCallback(this.bCapaGravatar && '' !== sEmail ? Links.avatarLink(sEmail) : '', sEmail);
@ -109,7 +109,7 @@
* @param {string} sUid
* @return {string}
*/
CacheAppStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
CacheUserStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
{
return sFolderFullNameRaw + '#' + sUid;
};
@ -118,7 +118,7 @@
* @param {string} sFolder
* @param {string} sUid
*/
CacheAppStorage.prototype.addRequestedMessage = function (sFolder, sUid)
CacheUserStorage.prototype.addRequestedMessage = function (sFolder, sUid)
{
this.oRequestedMessage[this.getMessageKey(sFolder, sUid)] = true;
};
@ -128,7 +128,7 @@
* @param {string} sUid
* @return {boolean}
*/
CacheAppStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
CacheUserStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
{
return true === this.oRequestedMessage[this.getMessageKey(sFolder, sUid)];
};
@ -137,7 +137,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sUid
*/
CacheAppStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
CacheUserStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
{
this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = true;
};
@ -146,7 +146,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sUid
*/
CacheAppStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
CacheUserStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
{
if (this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)])
{
@ -157,7 +157,7 @@
return false;
};
CacheAppStorage.prototype.clearNewMessageCache = function ()
CacheUserStorage.prototype.clearNewMessageCache = function ()
{
this.oNewMessage = {};
};
@ -165,12 +165,12 @@
/**
* @type {string}
*/
CacheAppStorage.prototype.sInboxFolderName = '';
CacheUserStorage.prototype.sInboxFolderName = '';
/**
* @return {string}
*/
CacheAppStorage.prototype.getFolderInboxName = function ()
CacheUserStorage.prototype.getFolderInboxName = function ()
{
return '' === this.sInboxFolderName ? 'INBOX' : this.sInboxFolderName;
};
@ -179,7 +179,7 @@
* @param {string} sFolderHash
* @return {string}
*/
CacheAppStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
CacheUserStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
{
return '' !== sFolderHash && this.oFoldersNamesCache[sFolderHash] ? this.oFoldersNamesCache[sFolderHash] : '';
};
@ -188,7 +188,7 @@
* @param {string} sFolderHash
* @param {string} sFolderFullNameRaw
*/
CacheAppStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
CacheUserStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
{
this.oFoldersNamesCache[sFolderHash] = sFolderFullNameRaw;
if ('INBOX' === sFolderFullNameRaw || '' === this.sInboxFolderName)
@ -201,7 +201,7 @@
* @param {string} sFolderFullNameRaw
* @return {string}
*/
CacheAppStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
CacheUserStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
{
return '' !== sFolderFullNameRaw && this.oFolderHashCache[sFolderFullNameRaw] ? this.oFolderHashCache[sFolderFullNameRaw] : '';
};
@ -210,7 +210,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sFolderHash
*/
CacheAppStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
CacheUserStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
{
this.oFolderHashCache[sFolderFullNameRaw] = sFolderHash;
};
@ -219,7 +219,7 @@
* @param {string} sFolderFullNameRaw
* @return {string}
*/
CacheAppStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
CacheUserStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
{
return '' !== sFolderFullNameRaw && this.oFolderUidNextCache[sFolderFullNameRaw] ? this.oFolderUidNextCache[sFolderFullNameRaw] : '';
};
@ -228,7 +228,7 @@
* @param {string} sFolderFullNameRaw
* @param {string} sUidNext
*/
CacheAppStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
CacheUserStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
{
this.oFolderUidNextCache[sFolderFullNameRaw] = sUidNext;
};
@ -237,7 +237,7 @@
* @param {string} sFolderFullNameRaw
* @return {?FolderModel}
*/
CacheAppStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
CacheUserStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
{
return '' !== sFolderFullNameRaw && this.oFoldersCache[sFolderFullNameRaw] ? this.oFoldersCache[sFolderFullNameRaw] : null;
};
@ -246,7 +246,7 @@
* @param {string} sFolderFullNameRaw
* @param {?FolderModel} oFolder
*/
CacheAppStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
CacheUserStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
{
this.oFoldersCache[sFolderFullNameRaw] = oFolder;
};
@ -254,7 +254,7 @@
/**
* @param {string} sFolderFullNameRaw
*/
CacheAppStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
CacheUserStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
{
this.setFolderToCacheList(sFolderFullNameRaw, null);
};
@ -264,7 +264,7 @@
* @param {string} sUid
* @return {?Array}
*/
CacheAppStorage.prototype.getMessageFlagsFromCache = function (sFolderFullName, sUid)
CacheUserStorage.prototype.getMessageFlagsFromCache = function (sFolderFullName, sUid)
{
return this.oMessageFlagsCache[sFolderFullName] && this.oMessageFlagsCache[sFolderFullName][sUid] ?
this.oMessageFlagsCache[sFolderFullName][sUid] : null;
@ -275,7 +275,7 @@
* @param {string} sUid
* @param {Array} aFlagsCache
*/
CacheAppStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
CacheUserStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
{
if (!this.oMessageFlagsCache[sFolderFullName])
{
@ -288,7 +288,7 @@
/**
* @param {string} sFolderFullName
*/
CacheAppStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
CacheUserStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
{
this.oMessageFlagsCache[sFolderFullName] = {};
};
@ -296,7 +296,7 @@
/**
* @param {(MessageModel|null)} oMessage
*/
CacheAppStorage.prototype.initMessageFlagsFromCache = function (oMessage)
CacheUserStorage.prototype.initMessageFlagsFromCache = function (oMessage)
{
if (oMessage)
{
@ -337,7 +337,7 @@
/**
* @param {(MessageModel|null)} oMessage
*/
CacheAppStorage.prototype.storeMessageFlagsToCache = function (oMessage)
CacheUserStorage.prototype.storeMessageFlagsToCache = function (oMessage)
{
if (oMessage)
{
@ -353,7 +353,7 @@
* @param {string} sUid
* @param {Array} aFlags
*/
CacheAppStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
CacheUserStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
{
if (Utils.isArray(aFlags) && 0 < aFlags.length)
{
@ -361,6 +361,6 @@
}
};
module.exports = new CacheAppStorage();
module.exports = new CacheUserStorage();
}());

View file

@ -18,7 +18,7 @@
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Cache = require('Storage/App/Cache'),
Cache = require('Storage/User/Cache'),
kn = require('Knoin/Knoin'),
@ -32,7 +32,7 @@
* @constructor
* @extends AbstractData
*/
function DataAppStorage()
function DataUserStorage()
{
AbstractData.call(this);
@ -322,7 +322,7 @@
if (Enums.Layout.NoPreview === this.layout() &&
-1 < window.location.hash.indexOf('message-preview'))
{
require('App/App').historyBack();
require('App/User').historyBack();
}
}
else if (Enums.Layout.NoPreview === this.layout())
@ -470,9 +470,9 @@
this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30);
}
_.extend(DataAppStorage.prototype, AbstractData.prototype);
_.extend(DataUserStorage.prototype, AbstractData.prototype);
DataAppStorage.prototype.purgeMessageBodyCache = function()
DataUserStorage.prototype.purgeMessageBodyCache = function()
{
var
iCount = 0,
@ -504,7 +504,7 @@
}
};
DataAppStorage.prototype.populateDataOnStart = function()
DataUserStorage.prototype.populateDataOnStart = function()
{
AbstractData.prototype.populateDataOnStart.call(this);
@ -529,7 +529,7 @@
this.devPassword = Settings.settingsGet('DevPassword');
};
DataAppStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages)
DataUserStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages)
{
if (Cache.getFolderInboxName() === sFolder && Utils.isNormal(sUidNext) && sUidNext !== '')
{
@ -608,7 +608,7 @@
}
};
DataAppStorage.prototype.hideMessageBodies = function ()
DataUserStorage.prototype.hideMessageBodies = function ()
{
var oMessagesBodiesDom = this.messagesBodiesDom();
if (oMessagesBodiesDom)
@ -621,7 +621,7 @@
* @param {boolean=} bBoot = false
* @returns {Array}
*/
DataAppStorage.prototype.getNextFolderNames = function (bBoot)
DataUserStorage.prototype.getNextFolderNames = function (bBoot)
{
bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
@ -685,7 +685,7 @@
* @param {string=} sToFolderFullNameRaw = ''
* @param {bCopy=} bCopy = false
*/
DataAppStorage.prototype.removeMessagesFromList = function (
DataUserStorage.prototype.removeMessagesFromList = function (
sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
{
sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : '';
@ -782,7 +782,7 @@
/**
* @param {Object} oMessageTextBody
*/
DataAppStorage.prototype.initBlockquoteSwitcher = function (oMessageTextBody)
DataUserStorage.prototype.initBlockquoteSwitcher = function (oMessageTextBody)
{
if (oMessageTextBody)
{
@ -814,7 +814,7 @@
}
};
DataAppStorage.prototype.setMessage = function (oData, bCached)
DataUserStorage.prototype.setMessage = function (oData, bCached)
{
var
bIsHtml = false,
@ -960,7 +960,7 @@
Cache.initMessageFlagsFromCache(oMessage);
if (oMessage.unseen())
{
require('App/App').setMessageSeen(oMessage);
require('App/User').setMessageSeen(oMessage);
}
Utils.windowResize();
@ -971,21 +971,21 @@
* @param {Array} aList
* @returns {string}
*/
DataAppStorage.prototype.calculateMessageListHash = function (aList)
DataUserStorage.prototype.calculateMessageListHash = function (aList)
{
return _.map(aList, function (oMessage) {
return '' + oMessage.hash + '_' + oMessage.threadsLen() + '_' + oMessage.flagHash();
}).join('|');
};
DataAppStorage.prototype.findPublicKeyByHex = function (sHash)
DataUserStorage.prototype.findPublicKeyByHex = function (sHash)
{
return _.find(this.openpgpkeysPublic(), function (oItem) {
return oItem && sHash === oItem.id;
});
};
DataAppStorage.prototype.findPublicKeysByEmail = function (sEmail)
DataUserStorage.prototype.findPublicKeysByEmail = function (sEmail)
{
var self = this;
return _.compact(_.map(this.openpgpkeysPublic(), function (oItem) {
@ -1014,7 +1014,7 @@
* @param {string=} sPassword
* @returns {?}
*/
DataAppStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
DataUserStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
{
var
self = this,
@ -1052,11 +1052,11 @@
* @param {string=} sPassword
* @returns {?}
*/
DataAppStorage.prototype.findSelfPrivateKey = function (sPassword)
DataUserStorage.prototype.findSelfPrivateKey = function (sPassword)
{
return this.findPrivateKeyByEmail(this.accountEmail(), sPassword);
};
module.exports = new DataAppStorage();
module.exports = new DataUserStorage();
}());

View file

@ -12,8 +12,8 @@
Base64 = require('Common/Base64'),
Settings = require('Storage/Settings'),
Cache = require('Storage/App/Cache'),
Data = require('Storage/App/Data'),
Cache = require('Storage/User/Cache'),
Data = require('Storage/User/Data'),
AbstractRemoteStorage = require('Storage/AbstractRemote')
;
@ -22,19 +22,19 @@
* @constructor
* @extends AbstractRemoteStorage
*/
function RemoteAppStorage()
function RemoteUserStorage()
{
AbstractRemoteStorage.call(this);
this.oRequests = {};
}
_.extend(RemoteAppStorage.prototype, AbstractRemoteStorage.prototype);
_.extend(RemoteUserStorage.prototype, AbstractRemoteStorage.prototype);
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.folders = function (fCallback)
RemoteUserStorage.prototype.folders = function (fCallback)
{
this.defaultRequest(fCallback, 'Folders', {
'SentFolder': Settings.settingsGet('SentFolder'),
@ -55,7 +55,7 @@
* @param {string=} sAdditionalCode
* @param {boolean=} bAdditionalCodeSignMe
*/
RemoteAppStorage.prototype.login = function (fCallback, sEmail, sLogin, sPassword, bSignMe, sLanguage, sAdditionalCode, bAdditionalCodeSignMe)
RemoteUserStorage.prototype.login = function (fCallback, sEmail, sLogin, sPassword, bSignMe, sLanguage, sAdditionalCode, bAdditionalCodeSignMe)
{
this.defaultRequest(fCallback, 'Login', {
'Email': sEmail,
@ -71,7 +71,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.getTwoFactor = function (fCallback)
RemoteUserStorage.prototype.getTwoFactor = function (fCallback)
{
this.defaultRequest(fCallback, 'GetTwoFactorInfo');
};
@ -79,7 +79,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.createTwoFactor = function (fCallback)
RemoteUserStorage.prototype.createTwoFactor = function (fCallback)
{
this.defaultRequest(fCallback, 'CreateTwoFactorSecret');
};
@ -87,7 +87,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.clearTwoFactor = function (fCallback)
RemoteUserStorage.prototype.clearTwoFactor = function (fCallback)
{
this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
};
@ -95,7 +95,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.showTwoFactorSecret = function (fCallback)
RemoteUserStorage.prototype.showTwoFactorSecret = function (fCallback)
{
this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
};
@ -104,7 +104,7 @@
* @param {?Function} fCallback
* @param {string} sCode
*/
RemoteAppStorage.prototype.testTwoFactor = function (fCallback, sCode)
RemoteUserStorage.prototype.testTwoFactor = function (fCallback, sCode)
{
this.defaultRequest(fCallback, 'TestTwoFactorInfo', {
'Code': sCode
@ -115,7 +115,7 @@
* @param {?Function} fCallback
* @param {boolean} bEnable
*/
RemoteAppStorage.prototype.enableTwoFactor = function (fCallback, bEnable)
RemoteUserStorage.prototype.enableTwoFactor = function (fCallback, bEnable)
{
this.defaultRequest(fCallback, 'EnableTwoFactor', {
'Enable': bEnable ? '1' : '0'
@ -125,7 +125,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.clearTwoFactorInfo = function (fCallback)
RemoteUserStorage.prototype.clearTwoFactorInfo = function (fCallback)
{
this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
};
@ -133,7 +133,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.contactsSync = function (fCallback)
RemoteUserStorage.prototype.contactsSync = function (fCallback)
{
this.defaultRequest(fCallback, 'ContactsSync', null, Consts.Defaults.ContactsSyncAjaxTimeout);
};
@ -145,7 +145,7 @@
* @param {string} sUser
* @param {string} sPassword
*/
RemoteAppStorage.prototype.saveContactsSyncData = function (fCallback, bEnable, sUrl, sUser, sPassword)
RemoteUserStorage.prototype.saveContactsSyncData = function (fCallback, bEnable, sUrl, sUser, sPassword)
{
this.defaultRequest(fCallback, 'SaveContactsSyncData', {
'Enable': bEnable ? '1' : '0',
@ -161,7 +161,7 @@
* @param {string} sLogin
* @param {string} sPassword
*/
RemoteAppStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
RemoteUserStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
{
this.defaultRequest(fCallback, 'AccountAdd', {
'Email': sEmail,
@ -174,7 +174,7 @@
* @param {?Function} fCallback
* @param {string} sEmailToDelete
*/
RemoteAppStorage.prototype.accountDelete = function (fCallback, sEmailToDelete)
RemoteUserStorage.prototype.accountDelete = function (fCallback, sEmailToDelete)
{
this.defaultRequest(fCallback, 'AccountDelete', {
'EmailToDelete': sEmailToDelete
@ -189,7 +189,7 @@
* @param {string} sReplyTo
* @param {string} sBcc
*/
RemoteAppStorage.prototype.identityUpdate = function (fCallback, sId, sEmail, sName, sReplyTo, sBcc)
RemoteUserStorage.prototype.identityUpdate = function (fCallback, sId, sEmail, sName, sReplyTo, sBcc)
{
this.defaultRequest(fCallback, 'IdentityUpdate', {
'Id': sId,
@ -204,7 +204,7 @@
* @param {?Function} fCallback
* @param {string} sIdToDelete
*/
RemoteAppStorage.prototype.identityDelete = function (fCallback, sIdToDelete)
RemoteUserStorage.prototype.identityDelete = function (fCallback, sIdToDelete)
{
this.defaultRequest(fCallback, 'IdentityDelete', {
'IdToDelete': sIdToDelete
@ -214,7 +214,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.accountsAndIdentities = function (fCallback)
RemoteUserStorage.prototype.accountsAndIdentities = function (fCallback)
{
this.defaultRequest(fCallback, 'AccountsAndIdentities');
};
@ -227,7 +227,7 @@
* @param {string=} sSearch = ''
* @param {boolean=} bSilent = false
*/
RemoteAppStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent)
RemoteUserStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent)
{
sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
@ -274,7 +274,7 @@
* @param {?Function} fCallback
* @param {Array} aDownloads
*/
RemoteAppStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads)
RemoteUserStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads)
{
this.defaultRequest(fCallback, 'MessageUploadAttachments', {
'Attachments': aDownloads
@ -287,7 +287,7 @@
* @param {number} iUid
* @return {boolean}
*/
RemoteAppStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid)
RemoteUserStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid)
{
sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
iUid = Utils.pInt(iUid);
@ -312,7 +312,7 @@
* @param {?Function} fCallback
* @param {Array} aExternals
*/
RemoteAppStorage.prototype.composeUploadExternals = function (fCallback, aExternals)
RemoteUserStorage.prototype.composeUploadExternals = function (fCallback, aExternals)
{
this.defaultRequest(fCallback, 'ComposeUploadExternals', {
'Externals': aExternals
@ -324,7 +324,7 @@
* @param {string} sUrl
* @param {string} sAccessToken
*/
RemoteAppStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
RemoteUserStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
{
this.defaultRequest(fCallback, 'ComposeUploadDrive', {
'AccessToken': sAccessToken,
@ -337,7 +337,7 @@
* @param {string} sFolder
* @param {Array=} aList = []
*/
RemoteAppStorage.prototype.folderInformation = function (fCallback, sFolder, aList)
RemoteUserStorage.prototype.folderInformation = function (fCallback, sFolder, aList)
{
var
bRequest = true,
@ -380,7 +380,7 @@
}
else if (Data.useThreads())
{
require('App/App').reloadFlagsCurrentMessageListAndMessageFromCache();
require('App/User').reloadFlagsCurrentMessageListAndMessageFromCache();
}
};
@ -388,7 +388,7 @@
* @param {?Function} fCallback
* @param {Array} aFolders
*/
RemoteAppStorage.prototype.folderInformationMultiply = function (fCallback, aFolders)
RemoteUserStorage.prototype.folderInformationMultiply = function (fCallback, aFolders)
{
this.defaultRequest(fCallback, 'FolderInformationMultiply', {
'Folders': aFolders
@ -398,7 +398,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.logout = function (fCallback)
RemoteUserStorage.prototype.logout = function (fCallback)
{
this.defaultRequest(fCallback, 'Logout');
};
@ -409,7 +409,7 @@
* @param {Array} aUids
* @param {boolean} bSetFlagged
*/
RemoteAppStorage.prototype.messageSetFlagged = function (fCallback, sFolderFullNameRaw, aUids, bSetFlagged)
RemoteUserStorage.prototype.messageSetFlagged = function (fCallback, sFolderFullNameRaw, aUids, bSetFlagged)
{
this.defaultRequest(fCallback, 'MessageSetFlagged', {
'Folder': sFolderFullNameRaw,
@ -424,7 +424,7 @@
* @param {Array} aUids
* @param {boolean} bSetSeen
*/
RemoteAppStorage.prototype.messageSetSeen = function (fCallback, sFolderFullNameRaw, aUids, bSetSeen)
RemoteUserStorage.prototype.messageSetSeen = function (fCallback, sFolderFullNameRaw, aUids, bSetSeen)
{
this.defaultRequest(fCallback, 'MessageSetSeen', {
'Folder': sFolderFullNameRaw,
@ -438,7 +438,7 @@
* @param {string} sFolderFullNameRaw
* @param {boolean} bSetSeen
*/
RemoteAppStorage.prototype.messageSetSeenToAll = function (fCallback, sFolderFullNameRaw, bSetSeen)
RemoteUserStorage.prototype.messageSetSeenToAll = function (fCallback, sFolderFullNameRaw, bSetSeen)
{
this.defaultRequest(fCallback, 'MessageSetSeenToAll', {
'Folder': sFolderFullNameRaw,
@ -463,7 +463,7 @@
* @param {string} sInReplyTo
* @param {string} sReferences
*/
RemoteAppStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
RemoteUserStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences)
{
this.defaultRequest(fCallback, 'SaveMessage', {
@ -493,7 +493,7 @@
* @param {string} sSubject
* @param {string} sText
*/
RemoteAppStorage.prototype.sendReadReceiptMessage = function (fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText)
RemoteUserStorage.prototype.sendReadReceiptMessage = function (fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText)
{
this.defaultRequest(fCallback, 'SendReadReceiptMessage', {
'MessageFolder': sMessageFolder,
@ -522,7 +522,7 @@
* @param {string} sReferences
* @param {boolean} bRequestReadReceipt
*/
RemoteAppStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder,
RemoteUserStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bRequestReadReceipt)
{
this.defaultRequest(fCallback, 'SendMessage', {
@ -548,7 +548,7 @@
* @param {?Function} fCallback
* @param {Object} oData
*/
RemoteAppStorage.prototype.saveSystemFolders = function (fCallback, oData)
RemoteUserStorage.prototype.saveSystemFolders = function (fCallback, oData)
{
this.defaultRequest(fCallback, 'SystemFoldersUpdate', oData);
};
@ -557,7 +557,7 @@
* @param {?Function} fCallback
* @param {Object} oData
*/
RemoteAppStorage.prototype.saveSettings = function (fCallback, oData)
RemoteUserStorage.prototype.saveSettings = function (fCallback, oData)
{
this.defaultRequest(fCallback, 'SettingsUpdate', oData);
};
@ -567,7 +567,7 @@
* @param {string} sPrevPassword
* @param {string} sNewPassword
*/
RemoteAppStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword)
RemoteUserStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword)
{
this.defaultRequest(fCallback, 'ChangePassword', {
'PrevPassword': sPrevPassword,
@ -580,7 +580,7 @@
* @param {string} sNewFolderName
* @param {string} sParentName
*/
RemoteAppStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName)
RemoteUserStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName)
{
this.defaultRequest(fCallback, 'FolderCreate', {
'Folder': sNewFolderName,
@ -592,7 +592,7 @@
* @param {?Function} fCallback
* @param {string} sFolderFullNameRaw
*/
RemoteAppStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw)
RemoteUserStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw)
{
this.defaultRequest(fCallback, 'FolderDelete', {
'Folder': sFolderFullNameRaw
@ -604,7 +604,7 @@
* @param {string} sPrevFolderFullNameRaw
* @param {string} sNewFolderName
*/
RemoteAppStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName)
RemoteUserStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName)
{
this.defaultRequest(fCallback, 'FolderRename', {
'Folder': sPrevFolderFullNameRaw,
@ -616,7 +616,7 @@
* @param {?Function} fCallback
* @param {string} sFolderFullNameRaw
*/
RemoteAppStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw)
RemoteUserStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw)
{
this.defaultRequest(fCallback, 'FolderClear', {
'Folder': sFolderFullNameRaw
@ -628,7 +628,7 @@
* @param {string} sFolderFullNameRaw
* @param {boolean} bSubscribe
*/
RemoteAppStorage.prototype.folderSetSubscribe = function (fCallback, sFolderFullNameRaw, bSubscribe)
RemoteUserStorage.prototype.folderSetSubscribe = function (fCallback, sFolderFullNameRaw, bSubscribe)
{
this.defaultRequest(fCallback, 'FolderSubscribe', {
'Folder': sFolderFullNameRaw,
@ -643,7 +643,7 @@
* @param {Array} aUids
* @param {string=} sLearning
*/
RemoteAppStorage.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning)
RemoteUserStorage.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning)
{
this.defaultRequest(fCallback, 'MessageMove', {
'FromFolder': sFolder,
@ -659,7 +659,7 @@
* @param {string} sToFolder
* @param {Array} aUids
*/
RemoteAppStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids)
RemoteUserStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids)
{
this.defaultRequest(fCallback, 'MessageCopy', {
'FromFolder': sFolder,
@ -673,7 +673,7 @@
* @param {string} sFolder
* @param {Array} aUids
*/
RemoteAppStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids)
RemoteUserStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids)
{
this.defaultRequest(fCallback, 'MessageDelete', {
'Folder': sFolder,
@ -684,7 +684,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.appDelayStart = function (fCallback)
RemoteUserStorage.prototype.appDelayStart = function (fCallback)
{
this.defaultRequest(fCallback, 'AppDelayStart');
};
@ -692,7 +692,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.quota = function (fCallback)
RemoteUserStorage.prototype.quota = function (fCallback)
{
this.defaultRequest(fCallback, 'Quota');
};
@ -703,7 +703,7 @@
* @param {number} iLimit
* @param {string} sSearch
*/
RemoteAppStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
RemoteUserStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
{
this.defaultRequest(fCallback, 'Contacts', {
'Offset': iOffset,
@ -715,7 +715,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, aProperties)
RemoteUserStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, aProperties)
{
this.defaultRequest(fCallback, 'ContactSave', {
'RequestUid': sRequestUid,
@ -728,7 +728,7 @@
* @param {?Function} fCallback
* @param {Array} aUids
*/
RemoteAppStorage.prototype.contactsDelete = function (fCallback, aUids)
RemoteUserStorage.prototype.contactsDelete = function (fCallback, aUids)
{
this.defaultRequest(fCallback, 'ContactsDelete', {
'Uids': aUids.join(',')
@ -740,7 +740,7 @@
* @param {string} sQuery
* @param {number} iPage
*/
RemoteAppStorage.prototype.suggestions = function (fCallback, sQuery, iPage)
RemoteUserStorage.prototype.suggestions = function (fCallback, sQuery, iPage)
{
this.defaultRequest(fCallback, 'Suggestions', {
'Query': sQuery,
@ -751,7 +751,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.facebookUser = function (fCallback)
RemoteUserStorage.prototype.facebookUser = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialFacebookUserInformation');
};
@ -759,7 +759,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.facebookDisconnect = function (fCallback)
RemoteUserStorage.prototype.facebookDisconnect = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialFacebookDisconnect');
};
@ -767,7 +767,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.twitterUser = function (fCallback)
RemoteUserStorage.prototype.twitterUser = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialTwitterUserInformation');
};
@ -775,7 +775,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.twitterDisconnect = function (fCallback)
RemoteUserStorage.prototype.twitterDisconnect = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialTwitterDisconnect');
};
@ -783,7 +783,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.googleUser = function (fCallback)
RemoteUserStorage.prototype.googleUser = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialGoogleUserInformation');
};
@ -791,7 +791,7 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.googleDisconnect = function (fCallback)
RemoteUserStorage.prototype.googleDisconnect = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialGoogleDisconnect');
};
@ -799,11 +799,11 @@
/**
* @param {?Function} fCallback
*/
RemoteAppStorage.prototype.socialUsers = function (fCallback)
RemoteUserStorage.prototype.socialUsers = function (fCallback)
{
this.defaultRequest(fCallback, 'SocialUsers');
};
module.exports = new RemoteAppStorage();
module.exports = new RemoteUserStorage();
}());