aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorlbsa712007-09-14 13:46:05 +0000
committerlbsa712007-09-14 13:46:05 +0000
commitf8ddf7429eaeae3a3aae88d4560473c3516d20fd (patch)
tree91b92e54331971c6162636ade1f7c0b6b91f3afe /OpenSim
parent* fixed script compilation (diff)
downloadopensim-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/Framework/General/Interfaces/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/General/NullClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs9
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs5
-rw-r--r--OpenSim/Region/Environment/Interfaces/ISimChat.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs106
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs2
11 files changed, 76 insertions, 66 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 8155373..747ad5c 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -34,7 +34,7 @@ using OpenSim.Framework.Data;
34 34
35namespace OpenSim.Framework.Interfaces 35namespace OpenSim.Framework.Interfaces
36{ 36{
37 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 37 public delegate void ChatFromViewer(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list 38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list
39 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); 39 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
40 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient); 40 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
index 56faae2..cf7e448 100644
--- a/OpenSim/Framework/General/NullClientAPI.cs
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Framework
119 public virtual void SendKillObject(ulong regionHandle, uint localID){} 119 public virtual void SendKillObject(ulong regionHandle, uint localID){}
120 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){} 120 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){}
121 public virtual void SendRegionHandshake(RegionInfo regionInfo){} 121 public virtual void SendRegionHandshake(RegionInfo regionInfo){}
122 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} 122 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { }
123 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} 123 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){}
124 public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp){} 124 public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp){}
125 public virtual void SendLayerData(float[] map){} 125 public virtual void SendLayerData(float[] map){}
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 {