diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ChatModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 124 |
1 files changed, 71 insertions, 53 deletions
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index f12612e..d5edc6d 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -143,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules | |||
143 | new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); | 143 | new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); |
144 | fromName = avatar.Firstname + " " + avatar.Lastname; | 144 | fromName = avatar.Firstname + " " + avatar.Lastname; |
145 | fromAgentID = e.Sender.AgentId; | 145 | fromAgentID = e.Sender.AgentId; |
146 | avatar = null; | ||
147 | } | 146 | } |
148 | 147 | ||
149 | string typeName; | 148 | string typeName; |
@@ -166,82 +165,101 @@ namespace OpenSim.Region.Environment.Modules | |||
166 | break; | 165 | break; |
167 | } | 166 | } |
168 | 167 | ||
169 | m_log.Verbose("CHAT", | 168 | if (e.Message.Length > 0) |
170 | fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + | ||
171 | e.Message); | ||
172 | |||
173 | if (m_irc.Connected) | ||
174 | { | 169 | { |
175 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); | 170 | m_log.Verbose("CHAT", |
176 | } | 171 | fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + |
172 | e.Message); | ||
177 | 173 | ||
178 | if (e.Channel == 0) | 174 | if (m_irc.Connected) |
179 | { | ||
180 | foreach (Scene m_scene in m_scenes) | ||
181 | { | 175 | { |
182 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 176 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); |
177 | } | ||
178 | |||
179 | if (e.Channel == 0) | ||
180 | { | ||
181 | foreach (Scene m_scene in m_scenes) | ||
182 | { | ||
183 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | ||
183 | { | 184 | { |
184 | if (!presence.IsChildAgent) | 185 | if (!presence.IsChildAgent) |
185 | { | 186 | { |
186 | int dis = -100000; | 187 | int dis = -100000; |
187 | 188 | ||
188 | LLVector3 avatarRegionPos = presence.AbsolutePosition + | 189 | LLVector3 avatarRegionPos = presence.AbsolutePosition + |
189 | new LLVector3( | 190 | new LLVector3( |
190 | scene.RegionInfo.RegionLocX * 256, | 191 | scene.RegionInfo.RegionLocX * 256, |
191 | scene.RegionInfo.RegionLocY * 256, | 192 | scene.RegionInfo.RegionLocY * 256, |
192 | 0); | 193 | 0); |
193 | dis = | 194 | dis = |
194 | Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); | 195 | Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); |
195 | 196 | ||
196 | switch (e.Type) | 197 | switch (e.Type) |
197 | { | 198 | { |
198 | case ChatTypeEnum.Whisper: | 199 | case ChatTypeEnum.Whisper: |
199 | if (dis < m_whisperdistance) | 200 | if (dis < m_whisperdistance) |
200 | { | 201 | { |
201 | //should change so the message is sent through the avatar rather than direct to the ClientView | 202 | //should change so the message is sent through the avatar rather than direct to the ClientView |
202 | presence.ControllingClient.SendChatMessage(message, | 203 | presence.ControllingClient.SendChatMessage(message, |
203 | type, | 204 | type, |
204 | fromPos, | 205 | fromPos, |
205 | fromName, | 206 | fromName, |
206 | fromAgentID); | 207 | fromAgentID); |
207 | } | 208 | } |
208 | break; | 209 | break; |
209 | case ChatTypeEnum.Say: | 210 | case ChatTypeEnum.Say: |
210 | if (dis < m_saydistance) | 211 | if (dis < m_saydistance) |
211 | { | 212 | { |
212 | //Console.WriteLine("sending chat"); | 213 | //Console.WriteLine("sending chat"); |
213 | presence.ControllingClient.SendChatMessage(message, | 214 | presence.ControllingClient.SendChatMessage(message, |
214 | type, | 215 | type, |
215 | fromPos, | 216 | fromPos, |
216 | fromName, | 217 | fromName, |
217 | fromAgentID); | 218 | fromAgentID); |
218 | } | 219 | } |
219 | break; | 220 | break; |
220 | case ChatTypeEnum.Shout: | 221 | case ChatTypeEnum.Shout: |
221 | if (dis < m_shoutdistance) | 222 | if (dis < m_shoutdistance) |
222 | { | 223 | { |
223 | presence.ControllingClient.SendChatMessage(message, | ||
224 | type, | ||
225 | fromPos, | ||
226 | fromName, | ||
227 | fromAgentID); | ||
228 | } | ||
229 | break; | ||
230 | |||
231 | case ChatTypeEnum.Broadcast: | ||
232 | presence.ControllingClient.SendChatMessage(message, | 224 | presence.ControllingClient.SendChatMessage(message, |
233 | type, | 225 | type, |
234 | fromPos, | 226 | fromPos, |
235 | fromName, | 227 | fromName, |
236 | fromAgentID); | 228 | fromAgentID); |
237 | break; | 229 | } |
238 | default: | 230 | break; |
239 | break; | 231 | |
232 | case ChatTypeEnum.Broadcast: | ||
233 | presence.ControllingClient.SendChatMessage(message, | ||
234 | type, | ||
235 | fromPos, | ||
236 | fromName, | ||
237 | fromAgentID); | ||
238 | break; | ||
239 | default: | ||
240 | break; | ||
240 | } | 241 | } |
241 | } | 242 | } |
242 | }); | 243 | }); |
244 | } | ||
243 | } | 245 | } |
244 | } | 246 | } |
247 | else | ||
248 | { | ||
249 | if (avatar != null) | ||
250 | { | ||
251 | switch (e.Type) | ||
252 | { | ||
253 | case ChatTypeEnum.StartTyping: | ||
254 | avatar.setTyping(true); | ||
255 | break; | ||
256 | case ChatTypeEnum.StopTyping: | ||
257 | avatar.setTyping(false); | ||
258 | break; | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | |||
245 | } | 263 | } |
246 | } | 264 | } |
247 | 265 | ||