示例#1
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;
        }
示例#2
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "XmppUserTuneEvent">XmppUserTuneEvent</see> class.
 /// </summary>
 /// <param name = "user">User contact</param>
 /// <param name = "tune">User tune</param>
 public XmppUserTuneEvent(XmppContact user, Tune tune)
     : base(user)
 {
     artist = tune.Artist;
     length = tune.Length;
     rating = tune.Rating;
     source = tune.Source;
     title = tune.Title;
     track = tune.Track;
     uri = tune.Uri;
 }
示例#3
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;
        }