Class VCardBasedAvatarsProtocol
- java.lang.Object
-
- rocks.xmpp.extensions.avatar.AbstractAvatarManager
-
- rocks.xmpp.extensions.vcard.avatar.VCardBasedAvatarsProtocol
-
- All Implemented Interfaces:
ExtensionProtocol,InboundPresenceHandler,OutboundPresenceHandler,AvatarManager
public final class VCardBasedAvatarsProtocol extends AbstractAvatarManager implements InboundPresenceHandler, OutboundPresenceHandler, ExtensionProtocol
The implementation of XEP-0153: vCard-Based Avatars.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncResult<byte[]>getAvatar(Jid contact)Gets the user avatar as byte array.StringgetNamespace()The protocol's main namespace.voidhandleInboundPresence(PresenceEvent e)Handles an inbound presence.voidhandleOutboundPresence(PresenceEvent e)Handles an outbound presence.booleanisEnabled()Indicates whether this protocol is enabled.AsyncResult<Void>publishAvatar(byte[] avatar)Publishes an avatar to the VCard and uses XEP-0153 to notify the contacts about the update.-
Methods inherited from class rocks.xmpp.extensions.avatar.AbstractAvatarManager
addAvatarChangeListener, getAvatarImage, loadFromCache, publishAvatarImage, removeAvatarChangeListener, storeToCache
-
-
-
-
Method Detail
-
handleInboundPresence
public final void handleInboundPresence(PresenceEvent e)
Description copied from interface:InboundPresenceHandlerHandles an inbound presence.- Specified by:
handleInboundPresencein interfaceInboundPresenceHandler- Parameters:
e- The presence event.
-
handleOutboundPresence
public final void handleOutboundPresence(PresenceEvent e)
Description copied from interface:OutboundPresenceHandlerHandles an outbound presence.- Specified by:
handleOutboundPresencein interfaceOutboundPresenceHandler- Parameters:
e- The presence event.
-
getAvatar
public final AsyncResult<byte[]> getAvatar(Jid contact)
Description copied from interface:AvatarManagerGets the user avatar as byte array.- Specified by:
getAvatarin interfaceAvatarManager- Parameters:
contact- The contact. Must not benull.- Returns:
- The async result with the contact's avatar or null, if it has no avatar.
-
publishAvatar
public final AsyncResult<Void> publishAvatar(byte[] avatar)
Publishes an avatar to the VCard and uses XEP-0153 to notify the contacts about the update.- Specified by:
publishAvatarin interfaceAvatarManager- Parameters:
avatar- The avatar or null, if the avatar is reset.- Returns:
- The async result.
-
getNamespace
public final String getNamespace()
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespacein interfaceExtensionProtocol- Returns:
- "vcard-temp:x:update"
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocolIndicates whether this protocol is enabled.- Specified by:
isEnabledin interfaceExtensionProtocol- Returns:
- true, if enabled; false if disabled.
-
-