New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download and use own avatar from vcard #304

Open
xeux opened this Issue Mar 22, 2016 · 10 comments

Comments

Projects
None yet
5 participants
@xeux
Copy link

xeux commented Mar 22, 2016

I have some users with user avatars using XEP-0054 http://xmpp.org/extensions/xep-0054.html

Scenario 1: If I log in my roster comes without avatars, when I login with another user in my roster with JSXC it comes online but avatar still in default.

Scenario 2: If I do the same one log in in JSXC and one using Pidgin, it loads the last connected user avatar.

Scenario 3: If I login one account using AstraChat (Android App) it brings all my roster avatars.

Maybe I have to set a parameter to JSXC to always load user avatars?

Also in the scenario 2, the user avatar loaded just works in that browser, I used Firefox, if I login in Chrome the user avatar is default again.

@sualko

This comment has been minimized.

Copy link
Member

sualko commented Mar 31, 2016

User avatars are only loaded if a presence information with caps is received.

Scenario 1: If I log in my roster comes without avatars, when I login with another user in my roster with JSXC it comes online but avatar still in default.

JSXC is not able to provide an avatar, so this is the expected behaviour.

Scenario 2: If I do the same one log in in JSXC and one using Pidgin, it loads the last connected user avatar.

This should be right.

Maybe I have to set a parameter to JSXC to always load user avatars?

This is not implemented, because with big contact lists this would result in bad performance.

@xeux

This comment has been minimized.

Copy link
Author

xeux commented Mar 31, 2016

@sualko I saw JSXC working with avatars when used with ownCloud, to make that possible, what could I do? use caps XEP-0115?

@sualko

This comment has been minimized.

Copy link
Member

sualko commented Apr 4, 2016

JSXC is only partial working with avatars. If the other client provides an avatar, jsxc will display it. But we are currently unable to provide an avatar by ourself. The oc version uses oc avatars as an fallback, if no xmpp avatar is available. I hope I could answer all your questions.

@mhchu

This comment has been minimized.

Copy link

mhchu commented Apr 4, 2016

JSXC is only partial working with avatars. If the other client provides an avatar, jsxc will display it. But we are currently unable to provide an avatar by ourself.

Having just read this statement, I fear that my attempts at getting avatars to work on JSXC this weekend was in vain. Does this statement mean that if I run a website and deploy only JSXC as the website's client, there is no way to show avatars other than the colored circle with the first letter of the user's name? Or have I misunderstood the statement? Thanks!

@MarcelWaldvogel

This comment has been minimized.

Copy link
Contributor

MarcelWaldvogel commented Apr 5, 2016

@xeux

This comment has been minimized.

Copy link
Author

xeux commented Apr 5, 2016

@sualko @mhchu @MarcelWaldvogel In my case is not about upload the avatar using JSXC the user already have an avatar, if both users are using JSXC online it does not display the avatar. If I understand Klaus, using other client bring the avatars. Also brings avatars if using caps XEP-0115?

Please Klaus, confirm me if using XEP-0115 and login users only with JSXC will display the avatars?

@sualko

This comment has been minimized.

Copy link
Member

sualko commented Apr 6, 2016

A client has to announce that there is a avatar available, see XEP-0153 for details. To fix your issue, we have to download our own avatar and calculate the sha-1 value of its binary. This is the tricky part, but it could be probably done, see http://stackoverflow.com/questions/17819820/how-to-get-correct-sha1-hash-of-blob-using-cryptojs. If you are interested in implementing, please open a new pull request to discuss the details.

@sualko sualko added the enhancement label May 2, 2016

@backstageel

This comment has been minimized.

Copy link

backstageel commented Aug 3, 2016

Is there an option to use custom avatars as a fallback?

My app already provides avatars, and i want to use those avatars as JSXC avatars.

@sualko

This comment has been minimized.

Copy link
Member

sualko commented Aug 4, 2016

@backstageel You can use the option defaultAvatar, for an example look at the config of the owncloud app.

@sualko sualko changed the title JSXC init not bringing user avatar Download and use own avatar from vcard Jan 20, 2017

@sualko

This comment has been minimized.

Copy link
Member

sualko commented Apr 25, 2017

Something like the following could work:

var vCard = $(stanza).find("vCard > PHOTO");
var img = vCard.find('BINVAL').text();
var content = Base64.decode(img.split("\n").join(""));
aid = CryptoJS.SHA1(content);

originally posted in #514 by @eLFuvo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment