Exemplo n.º 1
0
        /// <summary>
        ///   Publishes user mood information
        /// </summary>
        public IXmppSession PublishMood(XmppUserMoodEvent moodEvent)
        {
            var iq = new IQ();
            var pubsub = new PubSub();
            var publish = new PubSubPublish();
            var item = new PubSubItem();
            var mood = new Mood();

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

            iq.From = 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;

            Send(iq);

            return this;
        }
Exemplo n.º 2
0
 /// <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();
     text = mood.Text;
 }
Exemplo n.º 3
0
        /// <summary>
        ///   Publishes user mood information
        /// </summary>
        public IXmppSession PublishMood(MoodType mood, string description)
        {
            var instance = new Mood();

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

            PublishMood(new XmppUserMoodEvent(null, instance));

            return this;
        }