diff options
Diffstat (limited to 'OpenSim/Region')
9 files changed, 74 insertions, 64 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 031e50a..c97ba37 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -243,14 +243,7 @@ namespace OpenSim.Region.ClientStack | |||
243 | SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID); | 243 | SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID); |
244 | } | 244 | } |
245 | 245 | ||
246 | /// <summary> | 246 | |
247 | /// | ||
248 | /// </summary> | ||
249 | /// <param name="message"></param> | ||
250 | /// <param name="type"></param> | ||
251 | /// <param name="fromPos"></param> | ||
252 | /// <param name="fromName"></param> | ||
253 | /// <param name="fromAgentID"></param> | ||
254 | public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 247 | public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
255 | { | 248 | { |
256 | Encoding enc = Encoding.ASCII; | 249 | Encoding enc = Encoding.ASCII; |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index fab5433..fe3e82c 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -107,9 +107,12 @@ namespace OpenSim.Region.ClientStack | |||
107 | byte type = inchatpack.ChatData.Type; | 107 | byte type = inchatpack.ChatData.Type; |
108 | LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos; | 108 | LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos; |
109 | LLUUID fromAgentID = AgentID; | 109 | LLUUID fromAgentID = AgentID; |
110 | |||
111 | int channel = inchatpack.ChatData.Channel; | ||
112 | |||
110 | if (OnChatFromViewer != null) | 113 | if (OnChatFromViewer != null) |
111 | { | 114 | { |
112 | this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); | 115 | this.OnChatFromViewer(message, type, channel, fromPos, fromName, fromAgentID); |
113 | } | 116 | } |
114 | break; | 117 | break; |
115 | case PacketType.ImprovedInstantMessage: | 118 | case PacketType.ImprovedInstantMessage: |
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs index 0b83b34..73ef476 100644 --- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs +++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs | |||
@@ -7,6 +7,6 @@ namespace OpenSim.Region.Environment.Interfaces | |||
7 | { | 7 | { |
8 | public interface ISimChat | 8 | public interface ISimChat |
9 | { | 9 | { |
10 | void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); | 10 | void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); |
11 | } | 11 | } |
12 | } | 12 | } |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index b38665d..a46343b 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Modules | |||
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 139 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
140 | { | 140 | { |
141 | ScenePresence avatar = null; | 141 | ScenePresence avatar = null; |
142 | avatar = m_scene.RequestAvatar(fromAgentID); | 142 | avatar = m_scene.RequestAvatar(fromAgentID); |
@@ -149,54 +149,68 @@ namespace OpenSim.Region.Environment.Modules | |||
149 | 149 | ||
150 | if (connected) | 150 | if (connected) |
151 | { | 151 | { |
152 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + Util.FieldToString(message)); | 152 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + |
153 | Util.FieldToString(message)); | ||
153 | m_ircWriter.Flush(); | 154 | m_ircWriter.Flush(); |
154 | } | 155 | } |
155 | 156 | ||
156 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 157 | if (channel == 0) |
157 | { | 158 | { |
158 | int dis = -1000; | 159 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
159 | 160 | { | |
160 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it | 161 | int dis = -1000; |
161 | avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId); | 162 | |
162 | if (avatar != null) | 163 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it |
163 | { | 164 | avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId); |
164 | dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos); | 165 | if (avatar != null) |
165 | } | 166 | { |
166 | 167 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); | |
167 | switch (type) | 168 | } |
168 | { | 169 | |
169 | case 0: // Whisper | 170 | switch (type) |
170 | if ((dis < 10) && (dis > -10)) | 171 | { |
171 | { | 172 | case 0: // Whisper |
172 | //should change so the message is sent through the avatar rather than direct to the ClientView | 173 | if ((dis < 10) && (dis > -10)) |
173 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 174 | { |
174 | fromAgentID); | 175 | //should change so the message is sent through the avatar rather than direct to the ClientView |
175 | } | 176 | presence.ControllingClient.SendChatMessage(message, |
176 | break; | 177 | type, |
177 | case 1: // Say | 178 | fromPos, |
178 | if ((dis < 30) && (dis > -30)) | 179 | fromName, |
179 | { | 180 | fromAgentID); |
180 | //Console.WriteLine("sending chat"); | 181 | } |
181 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 182 | break; |
182 | fromAgentID); | 183 | case 1: // Say |
183 | } | 184 | if ((dis < 30) && (dis > -30)) |
184 | break; | 185 | { |
185 | case 2: // Shout | 186 | //Console.WriteLine("sending chat"); |
186 | if ((dis < 100) && (dis > -100)) | 187 | presence.ControllingClient.SendChatMessage(message, |
187 | { | 188 | type, |
188 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 189 | fromPos, |
189 | fromAgentID); | 190 | fromName, |
190 | } | 191 | fromAgentID); |
191 | break; | 192 | } |
192 | 193 | break; | |
193 | case 0xff: // Broadcast | 194 | case 2: // Shout |
194 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 195 | if ((dis < 100) && (dis > -100)) |
195 | fromAgentID); | 196 | { |
196 | break; | 197 | presence.ControllingClient.SendChatMessage(message, |
197 | } | 198 | type, |
198 | }); | 199 | fromPos, |
200 | fromName, | ||
201 | fromAgentID); | ||
202 | } | ||
203 | break; | ||
204 | |||
205 | case 0xff: // Broadcast | ||
206 | presence.ControllingClient.SendChatMessage(message, type, | ||
207 | fromPos, | ||
208 | fromName, | ||
209 | fromAgentID); | ||
210 | break; | ||
211 | } | ||
212 | }); | ||
213 | } | ||
199 | } | 214 | } |
200 | |||
201 | } | 215 | } |
202 | } | 216 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index ab65e36..881b4a1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -102,11 +102,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
102 | /// <param name="fromPos"></param> | 102 | /// <param name="fromPos"></param> |
103 | /// <param name="fromName"></param> | 103 | /// <param name="fromName"></param> |
104 | /// <param name="fromAgentID"></param> | 104 | /// <param name="fromAgentID"></param> |
105 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 105 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
106 | { | 106 | { |
107 | if (m_simChatModule != null) | 107 | if (m_simChatModule != null) |
108 | { | 108 | { |
109 | m_simChatModule.SimChat(message, type, fromPos, fromName, fromAgentID); | 109 | m_simChatModule.SimChat(message, type, channel, fromPos, fromName, fromAgentID); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 7e6101c..b009192 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -211,7 +211,7 @@ namespace SimpleApp | |||
211 | { | 211 | { |
212 | if (OnChatFromViewer != null) | 212 | if (OnChatFromViewer != null) |
213 | { | 213 | { |
214 | this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); | 214 | this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, 0, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); |
215 | } | 215 | } |
216 | count = -1; | 216 | count = -1; |
217 | 217 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 028544e..fe20e99 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -168,7 +168,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
168 | { | 168 | { |
169 | //type for whisper is 0 | 169 | //type for whisper is 0 |
170 | World.SimChat(Helpers.StringToField(text), | 170 | World.SimChat(Helpers.StringToField(text), |
171 | 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 171 | 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
172 | } | 172 | } |
173 | 173 | ||
174 | public void llSay(int channelID, string text) | 174 | public void llSay(int channelID, string text) |
@@ -176,14 +176,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
176 | //type for say is 1 | 176 | //type for say is 1 |
177 | 177 | ||
178 | World.SimChat(Helpers.StringToField(text), | 178 | World.SimChat(Helpers.StringToField(text), |
179 | 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 179 | 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
180 | } | 180 | } |
181 | 181 | ||
182 | public void llShout(int channelID, string text) | 182 | public void llShout(int channelID, string text) |
183 | { | 183 | { |
184 | //type for shout is 2 | 184 | //type for shout is 2 |
185 | World.SimChat(Helpers.StringToField(text), | 185 | World.SimChat(Helpers.StringToField(text), |
186 | 2, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 186 | 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
187 | } | 187 | } |
188 | 188 | ||
189 | public int llListen(int channelID, string name, string ID, string msg) { return 0; } | 189 | public int llListen(int channelID, string name, string ID, string msg) { return 0; } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index 955e978..aa36ea2 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | |||
@@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
197 | IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); | 197 | IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); |
198 | //if (m_host != null) | 198 | //if (m_host != null) |
199 | //{ | 199 | //{ |
200 | m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 200 | m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
201 | } catch { | 201 | } catch { |
202 | //} | 202 | //} |
203 | //else | 203 | //else |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index f731cb4..c521d47 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -310,7 +310,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
310 | string text = "Error compiling script:\r\n" + e.Message.ToString(); | 310 | string text = "Error compiling script:\r\n" + e.Message.ToString(); |
311 | if (text.Length > 1500) | 311 | if (text.Length > 1500) |
312 | text = text.Substring(0, 1500); | 312 | text = text.Substring(0, 1500); |
313 | World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 313 | World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
314 | } | 314 | } |
315 | catch (Exception e2) | 315 | catch (Exception e2) |
316 | { | 316 | { |