diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/OSChatMessage.cs | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs new file mode 100644 index 0000000..455756d --- /dev/null +++ b/OpenSim/Framework/OSChatMessage.cs | |||
@@ -0,0 +1,170 @@ | |||
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 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | public interface IEventArgs | ||
34 | { | ||
35 | IScene Scene { get; set; } | ||
36 | IClientAPI Sender { get; set; } | ||
37 | } | ||
38 | |||
39 | /// <summary> | ||
40 | /// ChatFromViewer Arguments | ||
41 | /// </summary> | ||
42 | public class OSChatMessage : EventArgs, IEventArgs | ||
43 | { | ||
44 | protected int m_channel; | ||
45 | protected string m_from; | ||
46 | protected string m_message; | ||
47 | protected Vector3 m_position; | ||
48 | |||
49 | protected IScene m_scene; | ||
50 | protected IClientAPI m_sender; | ||
51 | protected object m_senderObject; | ||
52 | protected ChatTypeEnum m_type; | ||
53 | protected UUID m_fromID; | ||
54 | protected UUID m_toID; | ||
55 | |||
56 | public OSChatMessage() | ||
57 | { | ||
58 | m_position = new Vector3(); | ||
59 | m_toID = UUID.Zero; | ||
60 | } | ||
61 | |||
62 | /// <summary> | ||
63 | /// The message sent by the user | ||
64 | /// </summary> | ||
65 | public string Message | ||
66 | { | ||
67 | get { return m_message; } | ||
68 | set { m_message = value; } | ||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// The type of message, eg say, shout, broadcast. | ||
73 | /// </summary> | ||
74 | public ChatTypeEnum Type | ||
75 | { | ||
76 | get { return m_type; } | ||
77 | set { m_type = value; } | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Which channel was this message sent on? Different channels may have different listeners. Public chat is on channel zero. | ||
82 | /// </summary> | ||
83 | public int Channel | ||
84 | { | ||
85 | get { return m_channel; } | ||
86 | set { m_channel = value; } | ||
87 | } | ||
88 | |||
89 | /// <summary> | ||
90 | /// The position of the sender at the time of the message broadcast. | ||
91 | /// </summary> | ||
92 | public Vector3 Position | ||
93 | { | ||
94 | get { return m_position; } | ||
95 | set { m_position = value; } | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// The name of the sender (needed for scripts) | ||
100 | /// </summary> | ||
101 | public string From | ||
102 | { | ||
103 | get { return m_from; } | ||
104 | set { m_from = value; } | ||
105 | } | ||
106 | |||
107 | /// <summary> | ||
108 | /// The name of the sender (needed for scripts) | ||
109 | /// </summary> | ||
110 | public string To | ||
111 | { | ||
112 | get { return m_from; } | ||
113 | set { m_from = value; } | ||
114 | } | ||
115 | |||
116 | #region IEventArgs Members | ||
117 | |||
118 | /// TODO: Sender and SenderObject should just be Sender and of | ||
119 | /// type IChatSender | ||
120 | |||
121 | /// <summary> | ||
122 | /// The client responsible for sending the message, or null. | ||
123 | /// </summary> | ||
124 | public IClientAPI Sender | ||
125 | { | ||
126 | get { return m_sender; } | ||
127 | set { m_sender = value; } | ||
128 | } | ||
129 | |||
130 | /// <summary> | ||
131 | /// The object responsible for sending the message, or null. | ||
132 | /// </summary> | ||
133 | public object SenderObject | ||
134 | { | ||
135 | get { return m_senderObject; } | ||
136 | set { m_senderObject = value; } | ||
137 | } | ||
138 | |||
139 | public UUID SenderUUID | ||
140 | { | ||
141 | get { return m_fromID; } | ||
142 | set { m_fromID = value; } | ||
143 | } | ||
144 | |||
145 | /// <summary> | ||
146 | /// The single recipient or all if not set. | ||
147 | /// </summary> | ||
148 | public UUID TargetUUID | ||
149 | { | ||
150 | get { return m_toID; } | ||
151 | set { m_toID = value; } | ||
152 | } | ||
153 | |||
154 | /// <summary> | ||
155 | /// | ||
156 | /// </summary> | ||
157 | public IScene Scene | ||
158 | { | ||
159 | get { return m_scene; } | ||
160 | set { m_scene = value; } | ||
161 | } | ||
162 | |||
163 | public override string ToString() | ||
164 | { | ||
165 | return m_message; | ||
166 | } | ||
167 | |||
168 | #endregion | ||
169 | } | ||
170 | } | ||