コード例 #1
0
 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;
 }
コード例 #2
0
		/// <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;
		}
コード例 #3
0
 /// <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;
 }
コード例 #4
0
ファイル: UserActivity.cs プロジェクト: rafaneri/Sharp.Xmpp
		/// <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);
		}
コード例 #5
0
        /// <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());
        }
コード例 #6
0
ファイル: UserActivity.cs プロジェクト: lcmxiaoya/xmpp-source
        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 });
        }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
ファイル: XmppClient.cs プロジェクト: REPLDigital/Sharp.Xmpp
 /// <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);
 }
コード例 #9
0
ファイル: UserActivity.cs プロジェクト: rafaneri/Sharp.Xmpp
		/// <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();
		}
コード例 #10
0
 public void SetActivity(GeneralActivity activity, String description)
 {
     xmppClient.SetActivity(activity, description: description);
 }
コード例 #11
0
ファイル: XmppClient.cs プロジェクト: lcmxiaoya/xmpp-source
 public void SetActivity(GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null)
 {
     this.AssertValid();
     this.userActivity.SetActivity(activity, specific, description);
 }