Mercurial > eldonilo > avatar
changeset 3:805f24754ff1
Don’t delete avatar on error, only allow update.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 19 May 2011 16:38:36 +0200 |
parents | ad496e8a5e66 |
children | 8acaa0a575c7 |
files | avatar.js |
diffstat | 1 files changed, 5 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/avatar.js +++ b/avatar.js @@ -194,7 +194,7 @@ function onError(stanza) { conn.send(makeError(response)); } -var getVCard = function(jid) { +var getVCard = function(jid, res) { var id = conn.getUniqueId(); var toSend = new Element('iq', {to: jid, from: config.jid, type: 'get', id: id}) @@ -202,7 +202,7 @@ var getVCard = function(jid) { conn.send(toSend); - return id; + sent[id] = res; } var showImage = function(jid, res) { @@ -221,13 +221,8 @@ var showImage = function(jid, res) { var last = new Date(stats.mtime); var now = new Date(); - if (now - last > 24*60*60*1000) { - fs.unlink(file, function() { - delete jids[jid]; - var id = getVCard(jid); - sent[id] = res; - }); - } + if (now - last > 24*60*60*1000) + getVCard(jid, res); }); return; } @@ -321,7 +316,5 @@ http.createServer(function (req, res) { return; } - var id = getVCard(jid); - - sent[id] = res; + getVCard(jid, res); }).listen(8032);