Пример #1
0
        /// <summary>
        ///   Publishes user tune information
        /// </summary>
        public IXmppSession PublishTune(XmppUserTuneEvent tuneEvent)
        {
            var iq = new IQ();
            var pubsub = new PubSub();
            var publish = new PubSubPublish();
            var item = new PubSubItem();
            var tune = new Tune();

            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 = tune;
            tune.Artist = tuneEvent.Artist;
            tune.Length = tuneEvent.Length;
            tune.Rating = tuneEvent.Rating;
            tune.Source = tuneEvent.Source;
            tune.Title = tuneEvent.Title;
            tune.Track = tuneEvent.Track;
            tune.Uri = tuneEvent.Uri;

            Send(iq);

            return this;
        }
Пример #2
0
        /// <summary>
        ///   Stops user tune publications
        /// </summary>
        public IXmppSession StopTunePublication()
        {
            var iq = new IQ();
            var pubsub = new PubSub();
            var publish = new PubSubPublish();
            var item = new PubSubItem();
            var tune = new Tune();

            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 = tune;

            Send(iq);

            return this;
        }
Пример #3
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;
        }