Class MoodManager


  • public final class MoodManager
    extends org.jivesoftware.smack.Manager
    Entry point for Smacks API for XEP-0107: User Mood. To set a mood, please use one of the setMood(Mood) methods. This will publish the users mood to a pubsub node.

    In order to get updated about other users moods, register a PepEventListener at addMoodListener(PepEventListener). That listener will get updated about any incoming mood updates of contacts.

    To stop publishing the users mood, refer to clearMood().

    It is also possible to add MoodElements to Messages by using addMoodToMessage(Message, Mood).

    The API can be extended with custom mood concretisations by extending MoodConcretisation and registering MoodConcretisationProviders using ProviderManager.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
    • Method Detail

      • getInstanceFor

        public static MoodManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)
      • setMood

        public void setMood​(Mood mood)
                     throws java.lang.InterruptedException,
                            org.jivesoftware.smack.SmackException.NotLoggedInException,
                            org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.SmackException.NotConnectedException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            PubSubException.NotALeafNodeException
        Throws:
        java.lang.InterruptedException
        org.jivesoftware.smack.SmackException.NotLoggedInException
        org.jivesoftware.smack.SmackException.NoResponseException
        org.jivesoftware.smack.SmackException.NotConnectedException
        org.jivesoftware.smack.XMPPException.XMPPErrorException
        PubSubException.NotALeafNodeException
      • setMood

        public void setMood​(Mood mood,
                            java.lang.String text)
                     throws java.lang.InterruptedException,
                            org.jivesoftware.smack.SmackException.NotLoggedInException,
                            org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.SmackException.NotConnectedException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            PubSubException.NotALeafNodeException
        Throws:
        java.lang.InterruptedException
        org.jivesoftware.smack.SmackException.NotLoggedInException
        org.jivesoftware.smack.SmackException.NoResponseException
        org.jivesoftware.smack.SmackException.NotConnectedException
        org.jivesoftware.smack.XMPPException.XMPPErrorException
        PubSubException.NotALeafNodeException
      • setMood

        public void setMood​(Mood mood,
                            MoodConcretisation concretisation)
                     throws java.lang.InterruptedException,
                            org.jivesoftware.smack.SmackException.NotLoggedInException,
                            org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.SmackException.NotConnectedException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            PubSubException.NotALeafNodeException
        Throws:
        java.lang.InterruptedException
        org.jivesoftware.smack.SmackException.NotLoggedInException
        org.jivesoftware.smack.SmackException.NoResponseException
        org.jivesoftware.smack.SmackException.NotConnectedException
        org.jivesoftware.smack.XMPPException.XMPPErrorException
        PubSubException.NotALeafNodeException
      • setMood

        public void setMood​(Mood mood,
                            MoodConcretisation concretisation,
                            java.lang.String text)
                     throws java.lang.InterruptedException,
                            org.jivesoftware.smack.SmackException.NotLoggedInException,
                            org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.SmackException.NotConnectedException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            PubSubException.NotALeafNodeException
        Throws:
        java.lang.InterruptedException
        org.jivesoftware.smack.SmackException.NotLoggedInException
        org.jivesoftware.smack.SmackException.NoResponseException
        org.jivesoftware.smack.SmackException.NotConnectedException
        org.jivesoftware.smack.XMPPException.XMPPErrorException
        PubSubException.NotALeafNodeException
      • clearMood

        public void clearMood()
                       throws java.lang.InterruptedException,
                              org.jivesoftware.smack.SmackException.NotLoggedInException,
                              org.jivesoftware.smack.SmackException.NoResponseException,
                              org.jivesoftware.smack.SmackException.NotConnectedException,
                              org.jivesoftware.smack.XMPPException.XMPPErrorException,
                              PubSubException.NotALeafNodeException
        Throws:
        java.lang.InterruptedException
        org.jivesoftware.smack.SmackException.NotLoggedInException
        org.jivesoftware.smack.SmackException.NoResponseException
        org.jivesoftware.smack.SmackException.NotConnectedException
        org.jivesoftware.smack.XMPPException.XMPPErrorException
        PubSubException.NotALeafNodeException
      • addMoodToMessage

        public static void addMoodToMessage​(org.jivesoftware.smack.packet.Message message,
                                            Mood mood)
      • addMoodToMessage

        public static void addMoodToMessage​(org.jivesoftware.smack.packet.Message message,
                                            Mood mood,
                                            MoodConcretisation concretisation)