mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-16 12:12:06 +01:00
Document how an Avatar can be removed from a vCard. Add a convenience method.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13585 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
ebfe3e69ed
commit
374a12b73a
1 changed files with 13 additions and 13 deletions
|
@ -338,22 +338,22 @@ public class VCard extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the bytes for the avatar to use.
|
* Removes the avatar from the vCard
|
||||||
*
|
*
|
||||||
* @param bytes the bytes of the avatar.
|
* This is done by setting the PHOTO value to the empty string as defined in XEP-0153
|
||||||
*/
|
*/
|
||||||
public void setAvatar(byte[] bytes) {
|
public void removeAvatar() {
|
||||||
if (bytes == null) {
|
setAvatar(null, "image/jpeg");
|
||||||
// Remove avatar (if any) from mappings
|
|
||||||
otherUnescapableFields.remove("PHOTO");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, add to mappings.
|
/**
|
||||||
String encodedImage = StringUtils.encodeBase64(bytes);
|
* Specify the bytes for the avatar to use.
|
||||||
avatar = encodedImage;
|
* If bytes is null, then the avatar will be removed.
|
||||||
|
*
|
||||||
setField("PHOTO", "<TYPE>image/jpeg</TYPE><BINVAL>" + encodedImage + "</BINVAL>", true);
|
* @param bytes the bytes of the avatar, or null to remove the avatar data
|
||||||
|
*/
|
||||||
|
public void setAvatar(byte[] bytes) {
|
||||||
|
setAvatar(bytes, "image/jpeg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue