Package rocks.xmpp.extensions.avatar
Class UserAvatarProtocol
- java.lang.Object
-
- rocks.xmpp.extensions.avatar.AbstractAvatarManager
-
- rocks.xmpp.extensions.avatar.UserAvatarProtocol
-
- All Implemented Interfaces:
ExtensionProtocol
,InboundMessageHandler
,AvatarManager
,DiscoverableInfo
public final class UserAvatarProtocol extends AbstractAvatarManager implements InboundMessageHandler, ExtensionProtocol, DiscoverableInfo
The implementation of XEP-0084: User Avatar.
-
-
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.Set<String>
getFeatures()
Gets the features.String
getNamespace()
The protocol's main namespace.void
handleInboundMessage(MessageEvent e)
Handles an inbound message.boolean
isEnabled()
Indicates whether this protocol is enabled.AsyncResult<Void>
publishAvatar(byte[] imageData)
Publishes an avatar to the personal eventing service.-
Methods inherited from class rocks.xmpp.extensions.avatar.AbstractAvatarManager
addAvatarChangeListener, getAvatarImage, loadFromCache, publishAvatarImage, removeAvatarChangeListener, storeToCache
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface rocks.xmpp.extensions.disco.model.info.DiscoverableInfo
getExtensions, getIdentities
-
-
-
-
Method Detail
-
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:
- "urn:xmpp:avatar:data"
-
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.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfo
Gets the features.- Specified by:
getFeatures
in interfaceDiscoverableInfo
- Returns:
- The features.
-
handleInboundMessage
public final void handleInboundMessage(MessageEvent e)
Description copied from interface:InboundMessageHandler
Handles an inbound message.- Specified by:
handleInboundMessage
in interfaceInboundMessageHandler
- Parameters:
e
- The message 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[] imageData)
Publishes an avatar to the personal eventing service.- Specified by:
publishAvatar
in interfaceAvatarManager
- Parameters:
imageData
- The avatar or null, if the avatar is reset.- Returns:
- The async result.
-
-