public final class AvatarManager extends Manager
Whenever an avatar update is received by a contact, either via the presence based avatar extension (XEP-0153) or the PEP-based notification (XEP-0084), the registered listeners are triggered.
By default this manager is not enabled.
This class is thread-safe.| Modifier and Type | Method and Description |
|---|---|
void |
addAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
Adds an avatar listener, to listen for avatar updates.
|
byte[] |
getAvatar(rocks.xmpp.addr.Jid contact)
Gets the user avatar from the user's vCard.
|
BufferedImage |
getAvatarImage(rocks.xmpp.addr.Jid contact)
Gets the user avatar from the user's vCard.
|
void |
publishAvatar(byte[] imageData)
Publishes an avatar to your VCard.
|
void |
publishAvatarImage(BufferedImage bufferedImage)
Publishes an avatar to your VCard.
|
void |
removeAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
Removes a previously added avatar listener.
|
isEnabled, setEnabledpublic final byte[] getAvatar(rocks.xmpp.addr.Jid contact)
throws XmppException
contact - The contact.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final BufferedImage getAvatarImage(rocks.xmpp.addr.Jid contact) throws XmppException
contact - The contact. Must not be null.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final void publishAvatar(byte[] imageData)
throws XmppException
imageData - The avatar image data, which must be in PNG format. null resets the avatar.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final void publishAvatarImage(BufferedImage bufferedImage) throws XmppException
bufferedImage - The avatar image, which must be in PNG format. null
resets the avatar.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final void addAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
avatarChangeListener - The avatar listener.public final void removeAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
avatarChangeListener - The avatar listener.Copyright © 2014–2015 XMPP.rocks. All rights reserved.