/// <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; }
/// <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; }
/// <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; }