Beispiel #1
0
        /// <summary>
        /// Publishes user mood information
        /// </summary>
        public IXmppSession PublishMood(MoodType mood, string description)
        {
            Mood instance = new Mood();

            instance.MoodType   = mood;
            instance.Text       = description;

            this.PublishMood(new XmppUserMoodEvent(null, instance));

            return this;
        }
Beispiel #2
0
        /// <summary>
        /// Publishes user mood information
        /// </summary>
        public IXmppSession PublishMood(XmppUserMoodEvent moodEvent)
        {
            IQ 				iq 		= new IQ();
            PubSub			pubsub	= new PubSub();
            PubSubPublish 	publish = new PubSubPublish();
            PubSubItem		item	= new PubSubItem();
            Mood 			mood 	= new Mood();

            iq.Items.Add(pubsub);
            pubsub.Items.Add(publish);
            publish.Items.Add(item);

            iq.From			= this.UserId.ToString();
            iq.ID			= XmppIdentifierGenerator.Generate();
            iq.Type 		= IQType.Set;
            publish.Node	= XmppFeatures.UserMood;
            item.Item		= mood;
            mood.MoodType	= (MoodType)Enum.Parse(typeof(MoodType), moodEvent.Mood);
            mood.Text		= moodEvent.Text;

            this.Send(iq);

            return this;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="XmppUserMoodEvent">XmppUserMoodEvent</see> class.
 /// </summary>
 /// <param name="user">User contact</param>
 /// <param name="mood">User mood</param>
 public XmppUserMoodEvent(XmppContact user, Mood mood)
     : base(user)
 {
     this.mood = mood.MoodType.ToString();
     this.text = mood.Text;
 }