Ejemplo n.º 1
0
        /// <summary>
        /// Publishes user tune information
        /// </summary>
        public IXmppSession PublishTune(XmppUserTuneEvent tuneEvent)
        {
            IQ 				iq 		= new IQ();
            PubSub			pubsub	= new PubSub();
            PubSubPublish 	publish = new PubSubPublish();
            PubSubItem		item	= new PubSubItem();
            Tune			tune	= new Tune();

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

            this.Send(iq);

            return this;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Stops user tune publications
        /// </summary>
        public IXmppSession StopTunePublication()
        {
            IQ 				iq 		= new IQ();
            PubSub			pubsub	= new PubSub();
            PubSubPublish 	publish = new PubSubPublish();
            PubSubItem		item	= new PubSubItem();
            Tune			tune	= new Tune();

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

            this.Send(iq);

            return this;
        }
Ejemplo n.º 3
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)
 {
     this.artist	= tune.Artist;
     this.length	= tune.Length;
     this.rating = tune.Rating;
     this.source	= tune.Source;
     this.title	= tune.Title;
     this.track	= tune.Track;
     this.uri	= tune.Uri;
 }