I've started to use JML for creating a legacy network proxy.
More specifically, I'm interested in communication between xmpp and msn.
However, when it comes to set a client avatar or get client contact's
avatars.
I simply can't set a client avatar using JML. My code for setting a client
is as follow:
public void setAvatar(byte data){
//xmpp avatar is in base64 so we need to decode it
MsnObject pic = MsnObject.getInstance( msnclient.getOwner().getEmail().toString(), Base64.decode(data));
pic.setSize(data.length);
pic.setType(3);
msnclient.getOwner().setDisplayPicture(pic);
//Next line is not necessary because jml calls that function inside setDisplayPicture…
//msnclient.getOwner().setInitDisplayPicture(pic);
}
Also, I can get a contact's avatar for the second time.
If I try to get a contact's avatar more than once, it just freezes
and never hits the callback. When it comes to an avatar hasn't changed I solved
it using a cache for avatars. However when an avatar has changed I need to get the new avatar…
My code for getting an avatar is simply as follow:
MsnObject avatar = contact.getAvatar();
if(avatar!=null ){
//if hash of avatar is not equal to hash in cache
msnclient.retrieveDisplayPicture(avatar, new MsnSessionObjectHandler());
}
Also my callback skeleton is:
private class MsnSessionObjectHandler implements DisplayPictureListener;
I'm sure that the flow reaches msnclient.retrieveDisplayPicture
and that the callback is never called.
Btw, I'm using JML 1.0b4…
Is there any solution for any of this problems?
Thanks in advance,
Ze
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I've started to use JML for creating a legacy network proxy.
More specifically, I'm interested in communication between xmpp and msn.
However, when it comes to set a client avatar or get client contact's
avatars.
I simply can't set a client avatar using JML. My code for setting a client
is as follow:
public void setAvatar(byte data){
//xmpp avatar is in base64 so we need to decode it
MsnObject pic = MsnObject.getInstance( msnclient.getOwner().getEmail().toString(), Base64.decode(data));
pic.setSize(data.length);
pic.setType(3);
msnclient.getOwner().setDisplayPicture(pic);
//Next line is not necessary because jml calls that function inside setDisplayPicture…
//msnclient.getOwner().setInitDisplayPicture(pic);
}
Also, I can get a contact's avatar for the second time.
If I try to get a contact's avatar more than once, it just freezes
and never hits the callback. When it comes to an avatar hasn't changed I solved
it using a cache for avatars. However when an avatar has changed I need to get the new avatar…
My code for getting an avatar is simply as follow:
MsnObject avatar = contact.getAvatar();
if(avatar!=null ){
//if hash of avatar is not equal to hash in cache
msnclient.retrieveDisplayPicture(avatar, new MsnSessionObjectHandler());
}
Also my callback skeleton is:
private class MsnSessionObjectHandler implements DisplayPictureListener;
I'm sure that the flow reaches msnclient.retrieveDisplayPicture
and that the callback is never called.
Btw, I'm using JML 1.0b4…
Is there any solution for any of this problems?
Thanks in advance,
Ze