snappymail/dev/Storages/AbstractCache.js
RainLoop Team 4cc2207513 Uploading and preparing the repository to the dev version.
Original unminified source code (dev folder - js, css, less) (fixes #6)
Grunt build system
Multiple identities correction (fixes #9)
Compose html editor (fixes #12)
New general settings - Loading Description
New warning about default admin password
Split general and login screen settings
2013-11-16 02:21:12 +04:00

67 lines
1.2 KiB
JavaScript

/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AbstractCacheStorage()
{
this.oEmailsPicsHashes = {};
this.oServices = {};
}
/**
* @type {Object}
*/
AbstractCacheStorage.prototype.oEmailsPicsHashes = {};
/**
* @type {Object}
*/
AbstractCacheStorage.prototype.oServices = {};
AbstractCacheStorage.prototype.clear = function ()
{
this.oServices = {};
this.oEmailsPicsHashes = {};
};
/**
* @param {string} sEmail
* @return {string}
*/
AbstractCacheStorage.prototype.getUserPic = function (sEmail)
{
var
sUrl = '',
sService = '',
sEmailLower = sEmail.toLowerCase(),
sPicHash = Utils.isUnd(this.oEmailsPicsHashes[sEmail]) ? '' : this.oEmailsPicsHashes[sEmail]
;
if ('' === sPicHash)
{
sService = sEmailLower.substr(sEmail.indexOf('@') + 1);
sUrl = '' !== sService && this.oServices[sService] ? this.oServices[sService] : '';
}
else
{
sUrl = RL.link().getUserPicUrlFromHash(sPicHash);
}
return sUrl;
};
/**
* @param {Object} oData
*/
AbstractCacheStorage.prototype.setServicesData = function (oData)
{
this.oServices = oData;
};
/**
* @param {Object} oData
*/
AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{
this.oEmailsPicsHashes = oData;
};