Package org.jivesoftware.smackx.mood
Class MoodManager
- java.lang.Object
-
- org.jivesoftware.smack.Manager
-
- org.jivesoftware.smackx.mood.MoodManager
-
public final class MoodManager extends Manager
Entry point for Smacks API for XEP-0107: User Mood. To set a mood, please use one of thesetMood(Mood)methods. This will publish the users mood to a pubsub node.
In order to get updated about other users moods, register aPepEventListenerataddMoodListener(PepEventListener). That listener will get updated about any incoming mood updates of contacts.
To stop publishing the users mood, refer toclearMood().
It is also possible to addMoodElements toMessages by usingaddMoodToMessage(Message, Mood).
The API can be extended with custom mood concretisations by extendingMoodConcretisationand registeringMoodConcretisationProviders usingProviderManager.addExtensionProvider(String, String, Object).
An example of how this can be done can be found in the MoodConcretisationTest in the test package.- See Also:
- XEP-0107: User Mood
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMOOD_NODE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddMoodListener(PepEventListener<MoodElement> listener)static voidaddMoodToMessage(Message message, Mood mood)static voidaddMoodToMessage(Message message, Mood mood, MoodConcretisation concretisation)voidclearMood()static MoodManagergetInstanceFor(XMPPConnection connection)booleanremoveMoodListener(PepEventListener<MoodElement> listener)voidsetMood(Mood mood)voidsetMood(Mood mood, java.lang.String text)voidsetMood(Mood mood, MoodConcretisation concretisation)voidsetMood(Mood mood, MoodConcretisation concretisation, java.lang.String text)-
Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
-
-
-
Field Detail
-
MOOD_NODE
public static final java.lang.String MOOD_NODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstanceFor
public static MoodManager getInstanceFor(XMPPConnection connection)
-
setMood
public void setMood(Mood mood) throws java.lang.InterruptedException, SmackException.NotLoggedInException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException
-
setMood
public void setMood(Mood mood, java.lang.String text) throws java.lang.InterruptedException, SmackException.NotLoggedInException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException
-
setMood
public void setMood(Mood mood, MoodConcretisation concretisation) throws java.lang.InterruptedException, SmackException.NotLoggedInException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException
-
setMood
public void setMood(Mood mood, MoodConcretisation concretisation, java.lang.String text) throws java.lang.InterruptedException, SmackException.NotLoggedInException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException
-
clearMood
public void clearMood() throws java.lang.InterruptedException, SmackException.NotLoggedInException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException
-
addMoodToMessage
public static void addMoodToMessage(Message message, Mood mood)
-
addMoodToMessage
public static void addMoodToMessage(Message message, Mood mood, MoodConcretisation concretisation)
-
addMoodListener
public boolean addMoodListener(PepEventListener<MoodElement> listener)
-
removeMoodListener
public boolean removeMoodListener(PepEventListener<MoodElement> listener)
-
-