diff options
author | lbsa71 | 2007-09-14 13:46:05 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-14 13:46:05 +0000 |
commit | f8ddf7429eaeae3a3aae88d4560473c3516d20fd (patch) | |
tree | 91b92e54331971c6162636ade1f7c0b6b91f3afe /OpenSim/Region/Environment/Modules/ChatModule.cs | |
parent | * fixed script compilation (diff) | |
download | opensim-SC_OLD-f8ddf7429eaeae3a3aae88d4560473c3516d20fd.zip opensim-SC_OLD-f8ddf7429eaeae3a3aae88d4560473c3516d20fd.tar.gz opensim-SC_OLD-f8ddf7429eaeae3a3aae88d4560473c3516d20fd.tar.bz2 opensim-SC_OLD-f8ddf7429eaeae3a3aae88d4560473c3516d20fd.tar.xz |
* Wired up chat so that channel goes into OnChatFromViewer. However:
* There's no libsl reply packet field for it, I guess other channels than 0 makes no sense sending back to clients.
* We do not currently support objects listening, so there's really no way of actually using this feature.
So; somebody please wire chat all the way to the scripts.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 106 |
1 files changed, 60 insertions, 46 deletions
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 | } |