summaryrefslogtreecommitdiff
path: root/lib/realtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/realtime.js')
-rw-r--r--lib/realtime.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/realtime.js b/lib/realtime.js
index 2f648c11..ca9cecd8 100644
--- a/lib/realtime.js
+++ b/lib/realtime.js
@@ -348,6 +348,7 @@ function buildUserOutData(user) {
id: user.id,
login: user.login,
userid: user.userid,
+ photo: user.photo,
color: user.color,
cursor: user.cursor,
name: user.name,
@@ -361,24 +362,23 @@ function updateUserData(socket, user) {
//retrieve user data from passport
if (socket.request.user && socket.request.user.logged_in) {
var profile = JSON.parse(socket.request.user.profile);
- /*
var photo = null;
switch(profile.provider) {
case "facebook":
- console.log(profile);
+ photo = 'https://graph.facebook.com/' + profile.id + '/picture';
break;
case "twitter":
- photo = profile.photos[0];
+ photo = profile.photos[0].value;
break;
case "github":
- photo = profile.avatar_url;
+ photo = 'https://avatars.githubusercontent.com/u/' + profile.id + '?s=48';
break;
case "dropbox":
- //not image api provided
+ //no image api provided, use gravatar
+ photo = 'https://www.gravatar.com/avatar/' + md5(profile.emails[0].value);
break;
}
user.photo = photo;
- */
user.name = profile.displayName || profile.username;
user.userid = socket.request.user._id;
user.login = true;