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