1
0

OSChatMessage.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using OpenMetaverse;
  29. namespace OpenSim.Framework
  30. {
  31. public interface IEventArgs
  32. {
  33. IScene Scene { get; set; }
  34. IClientAPI Sender { get; set; }
  35. }
  36. /// <summary>
  37. /// ChatFromViewer Arguments
  38. /// </summary>
  39. public class OSChatMessage : EventArgs, IEventArgs
  40. {
  41. protected int m_channel;
  42. protected string m_from;
  43. protected string m_message;
  44. protected Vector3 m_position;
  45. protected IScene m_scene;
  46. protected IClientAPI m_sender;
  47. protected object m_senderObject;
  48. protected ChatTypeEnum m_type;
  49. protected UUID m_fromID;
  50. public OSChatMessage()
  51. {
  52. m_position = new Vector3();
  53. }
  54. /// <summary>
  55. /// The message sent by the user
  56. /// </summary>
  57. public string Message
  58. {
  59. get { return m_message; }
  60. set { m_message = value; }
  61. }
  62. /// <summary>
  63. /// The type of message, eg say, shout, broadcast.
  64. /// </summary>
  65. public ChatTypeEnum Type
  66. {
  67. get { return m_type; }
  68. set { m_type = value; }
  69. }
  70. /// <summary>
  71. /// Which channel was this message sent on? Different channels may have different listeners. Public chat is on channel zero.
  72. /// </summary>
  73. public int Channel
  74. {
  75. get { return m_channel; }
  76. set { m_channel = value; }
  77. }
  78. /// <summary>
  79. /// The position of the sender at the time of the message broadcast.
  80. /// </summary>
  81. public Vector3 Position
  82. {
  83. get { return m_position; }
  84. set { m_position = value; }
  85. }
  86. /// <summary>
  87. /// The name of the sender (needed for scripts)
  88. /// </summary>
  89. public string From
  90. {
  91. get { return m_from; }
  92. set { m_from = value; }
  93. }
  94. #region IEventArgs Members
  95. /// TODO: Sender and SenderObject should just be Sender and of
  96. /// type IChatSender
  97. /// <summary>
  98. /// The client responsible for sending the message, or null.
  99. /// </summary>
  100. public IClientAPI Sender
  101. {
  102. get { return m_sender; }
  103. set { m_sender = value; }
  104. }
  105. /// <summary>
  106. /// The object responsible for sending the message, or null.
  107. /// </summary>
  108. public object SenderObject
  109. {
  110. get { return m_senderObject; }
  111. set { m_senderObject = value; }
  112. }
  113. public UUID SenderUUID
  114. {
  115. get { return m_fromID; }
  116. set { m_fromID = value; }
  117. }
  118. /// <summary>
  119. ///
  120. /// </summary>
  121. public IScene Scene
  122. {
  123. get { return m_scene; }
  124. set { m_scene = value; }
  125. }
  126. public override string ToString()
  127. {
  128. return m_message;
  129. }
  130. #endregion
  131. }
  132. }