Message.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Globalization;
  5. using System.Xml;
  6. namespace FastReport.Messaging.Xmpp
  7. {
  8. /// <summary>
  9. /// Represents the XMPP message.
  10. /// </summary>
  11. public class Message : Stanza
  12. {
  13. #region Fields
  14. private string type;
  15. #endregion // Fields
  16. #region Properties
  17. /// <summary>
  18. /// Gets or sets the type of message.
  19. /// </summary>
  20. public string Type
  21. {
  22. get { return type; }
  23. set
  24. {
  25. type = value;
  26. if (value == null)
  27. {
  28. Data.RemoveAttribute("type");
  29. }
  30. else
  31. {
  32. Data.SetAttribute("type", value);
  33. }
  34. }
  35. }
  36. #endregion // Properties
  37. #region Constructors
  38. /// <summary>
  39. /// Initializes a new instance of the <see cref="Message"/> class with specified parameters.
  40. /// </summary>
  41. /// <param name="nspace">The namespace of the message.</param>
  42. /// <param name="type">The type of message.</param>
  43. /// <param name="jidFrom">The JID of the sender.</param>
  44. /// <param name="jidTo">The JID of the recipient.</param>
  45. /// <param name="id">The ID of the message.</param>
  46. /// <param name="language">The language of the message.</param>
  47. /// <param name="data">The data of the message.</param>
  48. public Message(string nspace, string type, string jidFrom, string jidTo, string id, CultureInfo language, List<XmlElement> data)
  49. : base(nspace, jidFrom, jidTo, id, language, data)
  50. {
  51. Type = type;
  52. }
  53. /// <summary>
  54. /// Initializes a new instance of the <see cref="Message"/> class using specified XmlElement instance.
  55. /// </summary>
  56. /// <param name="data">The XmlElement instance using like a data.</param>
  57. public Message(XmlElement data) : base(data)
  58. {
  59. }
  60. #endregion // Constructors
  61. }
  62. }