improved comments

This commit is contained in:
jomo 2015-02-18 23:16:48 +01:00
parent e951e9b0e7
commit 71ac3db416
2 changed files with 9 additions and 8 deletions

View File

@ -146,13 +146,16 @@ function store_images(rid, userId, details, type, callback) {
currently_running.push(new_hash); currently_running.push(new_hash);
networking.get_profile(rid, (is_uuid ? userId : null), function(err, profile) { networking.get_profile(rid, (is_uuid ? userId : null), function(err, profile) {
if (err || (is_uuid && !profile)) { if (err || (is_uuid && !profile)) {
// error or uuid without profile
if (!err && !profile) { if (!err && !profile) {
// no error, but uuid without profile
cache.save_hash(rid, userId, null, null, function(cache_err) { cache.save_hash(rid, userId, null, null, function(cache_err) {
// we have no profile, so we have neither skin nor cape // we have no profile, so we have neither skin nor cape
callback_for(userId, "skin", cache_err, null); callback_for(userId, "skin", cache_err, null);
callback_for(userId, "cape", cache_err, null); callback_for(userId, "cape", cache_err, null);
}); });
} else { } else {
// an error occured, not caching
callback_for(userId, type, err, null); callback_for(userId, type, err, null);
} }
} else { } else {

View File

@ -110,8 +110,8 @@ exp.get_uuid_url = function(profile, type, callback) {
callback(url || null); callback(url || null);
}; };
// make a request to sessionserver // make a request to sessionserver for +uuid+
// profile is returned as json // +callback+ contains error, profile
exp.get_profile = function(rid, uuid, callback) { exp.get_profile = function(rid, uuid, callback) {
if (!uuid) { if (!uuid) {
callback(null, null); callback(null, null);
@ -122,18 +122,16 @@ exp.get_profile = function(rid, uuid, callback) {
} }
}; };
// +userId+ is likely a username and if so // get the skin URL for +userId+
// +userId+ is used to get the url, otherwise // +profile+ is used if +userId+ is a uuid
// +profile+ will be used to get the url
exp.get_skin_url = function(rid, userId, profile, callback) { exp.get_skin_url = function(rid, userId, profile, callback) {
get_url(rid, userId, profile, 0, function(url) { get_url(rid, userId, profile, 0, function(url) {
callback(url); callback(url);
}); });
}; };
// +userId+ is likely a username and if so // get the cape URL for +userId+
// +userId+ is used to get the url, otherwise // +profile+ is used if +userId+ is a uuid
// +profile+ will be used to get the url
exp.get_cape_url = function(rid, userId, profile, callback) { exp.get_cape_url = function(rid, userId, profile, callback) {
get_url(rid, userId, profile, 1, function(url) { get_url(rid, userId, profile, 1, function(url) {
callback(url); callback(url);