public ActivityChangedEventArgs(S22.Xmpp.Jid jid, GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null) { jid.ThrowIfNull <S22.Xmpp.Jid>("jid"); this.Jid = jid; this.Activity = activity; this.Specific = specific; this.Description = description; }
/// <summary> /// Initializes a new instance of the ActivityChangedEventArgs class. /// </summary> /// <param name="jid">The JID of the XMPP entity that published the /// activity information.</param> /// <param name="activity">One of the values from the GeneralActivity /// enumeration.</param> /// <param name="specific">A value from the SpecificActivity enumeration /// best describing the user's activity in more detail.</param> /// <param name="description">A natural-language description of, or /// reason for, the activity.</param> /// <exception cref="ArgumentNullException">The jid parameter is /// null.</exception> public ActivityChangedEventArgs(Jid jid, GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null) { jid.ThrowIfNull("jid"); Jid = jid; Activity = activity; Specific = specific; Description = description; }
/// <summary> /// Sets the user's activity to the specified activity value(s). /// </summary> /// <param name="activity">A value from the GeneralActivity enumeration to /// set the user's general activity to.</param> /// <param name="specific">A value from the SpecificActivity enumeration /// best describing the user's activity in more detail.</param> /// <param name="description">A natural-language description of, or reason /// for, the activity.</param> public void SetActivity(GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null) { var xml = Xml.Element("activity", "http://jabber.org/protocol/activity"); var e = Xml.Element(GeneralActivityToTagName(activity)); if (specific != SpecificActivity.Other) e.Child(Xml.Element(SpecificActivityToTagName(specific))); xml.Child(e); if (description != null) xml.Child(Xml.Element("text").Text(description)); pep.Publish("http://jabber.org/protocol/activity", null, xml); }
/// <summary> /// Returns the XMPP element name of the specified general activity value. /// </summary> /// <param name="activity">A value from the GeneralActivity enumeration /// to convert into an element name.</param> /// <returns>The XML element name of the specified activity value.</returns> private string GeneralActivityToTagName(GeneralActivity activity) { StringBuilder b = new StringBuilder(); string s = activity.ToString(); for (int i = 0; i < s.Length; i++) { if (char.IsUpper(s, i) && i > 0) { b.Append('_'); } b.Append(char.ToLower(s[i])); } return(b.ToString()); }
public void SetActivity(GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null) { XmlElement e = Xml.Element("activity", "http://jabber.org/protocol/activity"); XmlElement element2 = Xml.Element(this.GeneralActivityToTagName(activity), null); if (specific != SpecificActivity.Other) { element2.Child(Xml.Element(this.SpecificActivityToTagName(specific), null)); } e.Child(element2); if (description != null) { e.Child(Xml.Element("text", null).Text(description)); } this.pep.Publish("http://jabber.org/protocol/activity", null, new XmlElement[] { e }); }
/// <summary> /// Sets the user's activity to the specified activity value(s). /// </summary> /// <param name="activity">A value from the GeneralActivity enumeration to /// set the user's general activity to.</param> /// <param name="specific">A value from the SpecificActivity enumeration /// best describing the user's activity in more detail.</param> /// <param name="description">A natural-language description of, or reason /// for, the activity.</param> public void SetActivity(GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null) { var xml = Xml.Element("activity", "http://jabber.org/protocol/activity"); var e = Xml.Element(GeneralActivityToTagName(activity)); if (specific != SpecificActivity.Other) { e.Child(Xml.Element(SpecificActivityToTagName(specific))); } xml.Child(e); if (description != null) { xml.Child(Xml.Element("text").Text(description)); } pep.Publish("http://jabber.org/protocol/activity", null, xml); }
/// <summary> /// Sets the user's activity to the specified activity value(s). /// </summary> /// <param name="activity">A value from the GeneralActivity enumeration to /// set the user's general activity to.</param> /// <param name="specific">A value from the SpecificActivity enumeration /// best describing the user's activity in more detail.</param> /// <param name="description">A natural-language description of, or reason /// for, the activity.</param> /// <exception cref="InvalidOperationException">The XmppClient instance is not /// connected to a remote host, or the XmppClient instance has not authenticated with /// the XMPP server.</exception> /// <exception cref="ObjectDisposedException">The XmppClient object has been /// disposed.</exception> /// <include file='Examples.xml' path='S22/Xmpp/Client/XmppClient[@name="SetActivity"]/*'/> public void SetActivity(GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null) { AssertValid(); userActivity.SetActivity(activity, specific, description); }
/// <summary> /// Returns the XMPP element name of the specified general activity value. /// </summary> /// <param name="activity">A value from the GeneralActivity enumeration /// to convert into an element name.</param> /// <returns>The XML element name of the specified activity value.</returns> string GeneralActivityToTagName(GeneralActivity activity) { StringBuilder b = new StringBuilder(); string s = activity.ToString(); for (int i = 0; i < s.Length; i++) { if (Char.IsUpper(s, i) && i > 0) b.Append('_'); b.Append(Char.ToLower(s[i])); } return b.ToString(); }
public void SetActivity(GeneralActivity activity, String description) { xmppClient.SetActivity(activity, description: description); }
public void SetActivity(GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null) { this.AssertValid(); this.userActivity.SetActivity(activity, specific, description); }