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.String
getNamespace()
The protocol's main namespace.void
handleInboundPresence(PresenceEvent e)
Handles an inbound presence.void
handleOutboundPresence(PresenceEvent e)
Handles an outbound presence.boolean
isEnabled()
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:InboundPresenceHandler
Handles an inbound presence.- Specified by:
handleInboundPresence
in interfaceInboundPresenceHandler
- Parameters:
e
- The presence event.
-
handleOutboundPresence
public final void handleOutboundPresence(PresenceEvent e)
Description copied from interface:OutboundPresenceHandler
Handles an outbound presence.- Specified by:
handleOutboundPresence
in interfaceOutboundPresenceHandler
- Parameters:
e
- The presence event.
-
getAvatar
public final AsyncResult<byte[]> getAvatar(Jid contact)
Description copied from interface:AvatarManager
Gets the user avatar as byte array.- Specified by:
getAvatar
in 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:
publishAvatar
in 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:
getNamespace
in interfaceExtensionProtocol
- Returns:
- "vcard-temp:x:update"
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocol
Indicates whether this protocol is enabled.- Specified by:
isEnabled
in interfaceExtensionProtocol
- Returns:
- true, if enabled; false if disabled.
-
-