aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJeff Ames2007-12-10 02:29:42 +0000
committerJeff Ames2007-12-10 02:29:42 +0000
commite278d07220f976dec730890e4853ead58f83502a (patch)
tree14873c24f88ae4e32e75ec286df34de00c0db94f /OpenSim
parent* Hooked up the GridComm event ChildDataUpdate to the scene. (diff)
downloadopensim-SC_OLD-e278d07220f976dec730890e4853ead58f83502a.zip
opensim-SC_OLD-e278d07220f976dec730890e4853ead58f83502a.tar.gz
opensim-SC_OLD-e278d07220f976dec730890e4853ead58f83502a.tar.bz2
opensim-SC_OLD-e278d07220f976dec730890e4853ead58f83502a.tar.xz
refactored ChatModule a bit.
misc cleanup and code convention fixes.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IClientAPI.cs21
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs1
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs134
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs7
7 files changed, 74 insertions, 105 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 43c8c70..76578df 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -50,10 +50,12 @@ namespace OpenSim.Framework
50 Whisper = 0, 50 Whisper = 0,
51 Say = 1, 51 Say = 1,
52 Shout = 2, 52 Shout = 2,
53 // 3 is an obsolete version of Say
53 StartTyping = 4, 54 StartTyping = 4,
54 StopTyping = 5, 55 StopTyping = 5,
55 Broadcast = 0xFF 56 Broadcast = 0xFF
56 } ; 57 }
58
57 public enum ThrottleOutPacketType : int 59 public enum ThrottleOutPacketType : int
58 { 60 {
59 Resend = 0, 61 Resend = 0,
@@ -135,6 +137,9 @@ namespace OpenSim.Framework
135 set { m_sender = value; } 137 set { m_sender = value; }
136 } 138 }
137 139
140 /// <summary>
141 ///
142 /// </summary>
138 public IScene Scene 143 public IScene Scene
139 { 144 {
140 get { return m_scene; } 145 get { return m_scene; }
@@ -153,18 +158,27 @@ namespace OpenSim.Framework
153 private sbyte m_discardLevel; 158 private sbyte m_discardLevel;
154 private uint m_packetNumber; 159 private uint m_packetNumber;
155 160
161 /// <summary>
162 ///
163 /// </summary>
156 public uint PacketNumber 164 public uint PacketNumber
157 { 165 {
158 get { return m_packetNumber; } 166 get { return m_packetNumber; }
159 set { m_packetNumber = value; } 167 set { m_packetNumber = value; }
160 } 168 }
161 169
170 /// <summary>
171 ///
172 /// </summary>
162 public sbyte DiscardLevel 173 public sbyte DiscardLevel
163 { 174 {
164 get { return m_discardLevel; } 175 get { return m_discardLevel; }
165 set { m_discardLevel = value; } 176 set { m_discardLevel = value; }
166 } 177 }
167 178
179 /// <summary>
180 ///
181 /// </summary>
168 public LLUUID RequestedAssetID 182 public LLUUID RequestedAssetID
169 { 183 {
170 get { return m_requestedAssetID; } 184 get { return m_requestedAssetID; }
@@ -176,6 +190,9 @@ namespace OpenSim.Framework
176 { 190 {
177 private List<Wearable> m_nowWearing = new List<Wearable>(); 191 private List<Wearable> m_nowWearing = new List<Wearable>();
178 192
193 /// <summary>
194 ///
195 /// </summary>
179 public List<Wearable> NowWearing 196 public List<Wearable> NowWearing
180 { 197 {
181 get { return m_nowWearing; } 198 get { return m_nowWearing; }
@@ -269,6 +286,7 @@ namespace OpenSim.Framework
269 public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset); 286 public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset);
270 287
271 public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); 288 public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID);
289
272 public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery); 290 public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery);
273 291
274 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); 292 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
@@ -340,7 +358,6 @@ namespace OpenSim.Framework
340 358
341 public delegate void ObjectPermissions(IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, List<ObjectPermissionsPacket.ObjectDataBlock> permChanges); 359 public delegate void ObjectPermissions(IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, List<ObjectPermissionsPacket.ObjectDataBlock> permChanges);
342 360
343
344 public interface IClientAPI 361 public interface IClientAPI
345 { 362 {
346 event ImprovedInstantMessage OnInstantMessage; 363 event ImprovedInstantMessage OnInstantMessage;
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 540536e..5d5629b 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -587,7 +587,6 @@ namespace OpenSim.Region.ClientStack
587 /// <summary> 587 /// <summary>
588 /// 588 ///
589 /// </summary> 589 /// </summary>
590 /// <remarks>TODO</remarks>
591 /// <param name="message"></param> 590 /// <param name="message"></param>
592 /// <param name="target"></param> 591 /// <param name="target"></param>
593 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, 592 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index ef46224..081e7ac 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -110,6 +110,43 @@ namespace OpenSim.Region.Environment.Modules
110 client.OnChatFromViewer += SimChat; 110 client.OnChatFromViewer += SimChat;
111 } 111 }
112 112
113 private void TrySendChatMessage(ScenePresence presence, LLVector3 fromPos, LLVector3 regionPos,
114 LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message)
115 {
116 if (!presence.IsChildAgent)
117 {
118 LLVector3 fromRegionPos = fromPos + regionPos;
119 LLVector3 toRegionPos = presence.AbsolutePosition + regionPos;
120 int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos));
121
122 switch (type)
123 {
124 case ChatTypeEnum.Whisper:
125 if (dis < m_whisperdistance)
126 {
127 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
128 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID);
129 }
130 break;
131 case ChatTypeEnum.Say:
132 if (dis < m_saydistance)
133 {
134 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID);
135 }
136 break;
137 case ChatTypeEnum.Shout:
138 if (dis < m_shoutdistance)
139 {
140 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID);
141 }
142 break;
143 case ChatTypeEnum.Broadcast:
144 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID);
145 break;
146 }
147 }
148 }
149
113 public void SimChat(Object sender, ChatFromViewerArgs e) 150 public void SimChat(Object sender, ChatFromViewerArgs e)
114 { 151 {
115 ScenePresence avatar = null; 152 ScenePresence avatar = null;
@@ -123,12 +160,10 @@ namespace OpenSim.Region.Environment.Modules
123 160
124 // Filled in since it's easier than rewriting right now. 161 // Filled in since it's easier than rewriting right now.
125 LLVector3 fromPos = e.Position; 162 LLVector3 fromPos = e.Position;
126 LLVector3 fromRegionPos = e.Position + 163 LLVector3 regionPos = new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0);
127 new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 164
128 0);
129 string fromName = e.From; 165 string fromName = e.From;
130 string message = e.Message; 166 string message = e.Message;
131 byte type = (byte) e.Type;
132 LLUUID fromAgentID = LLUUID.Zero; 167 LLUUID fromAgentID = LLUUID.Zero;
133 168
134 if (e.Sender != null) 169 if (e.Sender != null)
@@ -139,32 +174,11 @@ namespace OpenSim.Region.Environment.Modules
139 if (avatar != null) 174 if (avatar != null)
140 { 175 {
141 fromPos = avatar.AbsolutePosition; 176 fromPos = avatar.AbsolutePosition;
142 fromRegionPos = fromPos + 177 regionPos = 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; 178 fromName = avatar.Firstname + " " + avatar.Lastname;
145 fromAgentID = e.Sender.AgentId; 179 fromAgentID = e.Sender.AgentId;
146 } 180 }
147 181
148 string typeName;
149 switch (e.Type)
150 {
151 case ChatTypeEnum.Broadcast:
152 typeName = "broadcasts";
153 break;
154 case ChatTypeEnum.Say:
155 typeName = "says";
156 break;
157 case ChatTypeEnum.Shout:
158 typeName = "shouts";
159 break;
160 case ChatTypeEnum.Whisper:
161 typeName = "whispers";
162 break;
163 default:
164 typeName = "unknown";
165 break;
166 }
167
168 if (e.Message.Length > 0) 182 if (e.Message.Length > 0)
169 { 183 {
170 if (m_irc.Connected) 184 if (m_irc.Connected)
@@ -174,69 +188,13 @@ namespace OpenSim.Region.Environment.Modules
174 188
175 if (e.Channel == 0) 189 if (e.Channel == 0)
176 { 190 {
177 foreach (Scene m_scene in m_scenes) 191 foreach (Scene s in m_scenes)
178 { 192 {
179 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 193 s.ForEachScenePresence(delegate(ScenePresence presence)
180 { 194 {
181 if (!presence.IsChildAgent) 195 TrySendChatMessage(presence, fromPos, regionPos,
182 { 196 fromAgentID, fromName, e.Type, message);
183 int dis = -100000; 197 });
184
185 LLVector3 avatarRegionPos = presence.AbsolutePosition +
186 new LLVector3(
187 scene.RegionInfo.RegionLocX * 256,
188 scene.RegionInfo.RegionLocY * 256,
189 0);
190 dis =
191 Math.Abs((int) Util.GetDistanceTo(avatarRegionPos, fromRegionPos));
192
193 switch (e.Type)
194 {
195 case ChatTypeEnum.Whisper:
196 if (dis < m_whisperdistance)
197 {
198 //should change so the message is sent through the avatar rather than direct to the ClientView
199 presence.ControllingClient.SendChatMessage(message,
200 type,
201 fromPos,
202 fromName,
203 fromAgentID);
204 }
205 break;
206 case ChatTypeEnum.Say:
207 if (dis < m_saydistance)
208 {
209 //Console.WriteLine("sending chat");
210 presence.ControllingClient.SendChatMessage(message,
211 type,
212 fromPos,
213 fromName,
214 fromAgentID);
215 }
216 break;
217 case ChatTypeEnum.Shout:
218 if (dis < m_shoutdistance)
219 {
220 presence.ControllingClient.SendChatMessage(message,
221 type,
222 fromPos,
223 fromName,
224 fromAgentID);
225 }
226 break;
227
228 case ChatTypeEnum.Broadcast:
229 presence.ControllingClient.SendChatMessage(message,
230 type,
231 fromPos,
232 fromName,
233 fromAgentID);
234 break;
235 default:
236 break;
237 }
238 }
239 });
240 } 198 }
241 } 199 }
242 } 200 }
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index 23dd0d9..cf6a94d 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -65,12 +65,12 @@ namespace OpenSim.Region.Environment.Modules
65 LLUUID imSessionID, uint timestamp, string fromAgentName, 65 LLUUID imSessionID, uint timestamp, string fromAgentName,
66 string message, byte dialog) 66 string message, byte dialog)
67 { 67 {
68 foreach (Scene m_scene in m_scenes) 68 foreach (Scene scene in m_scenes)
69 { 69 {
70 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 70 if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence)
71 { 71 {
72 // Local Message 72 // Local message
73 ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; 73 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
74 if (!user.IsChildAgent) 74 if (!user.IsChildAgent)
75 { 75 {
76 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 76 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
@@ -83,6 +83,7 @@ namespace OpenSim.Region.Environment.Modules
83 } 83 }
84 84
85 // Still here, try send via Grid 85 // Still here, try send via Grid
86 // TODO
86 } 87 }
87 88
88 public void PostInitialise() 89 public void PostInitialise()
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 745345d..0c9f38c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -156,10 +156,10 @@ namespace OpenSim.Region.Environment.Scenes
156 } 156 }
157 } 157 }
158 } 158 }
159
159 public void ProcessAvatarPickerRequest(IClientAPI client, LLUUID avatarID, LLUUID RequestID, string query) 160 public void ProcessAvatarPickerRequest(IClientAPI client, LLUUID avatarID, LLUUID RequestID, string query)
160 { 161 {
161 //EventManager.TriggerAvatarPickerRequest(); 162 //EventManager.TriggerAvatarPickerRequest();
162
163 163
164 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); 164 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>();
165 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); 165 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query);
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Environment.Scenes
167 AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket(); 167 AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket();
168 AvatarPickerReplyPacket.DataBlock[] searchData = new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; 168 AvatarPickerReplyPacket.DataBlock[] searchData = new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count];
169 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); 169 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
170 170
171 agentData.AgentID = avatarID; 171 agentData.AgentID = avatarID;
172 agentData.QueryID = RequestID; 172 agentData.QueryID = RequestID;
173 replyPacket.AgentData = agentData; 173 replyPacket.AgentData = agentData;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 05a59a2..8eef40b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Environment.Scenes
68 public Int32 CreationDate; 68 public Int32 CreationDate;
69 public uint ParentID = 0; 69 public uint ParentID = 0;
70 70
71 // Main grid has default permissions as follows 71 // Main grid has default permissions as follows
72 // 72 //
73 public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER; 73 public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER;
74 public uint NextOwnerMask = OBJNEXT_OWNER; 74 public uint NextOwnerMask = OBJNEXT_OWNER;
@@ -85,7 +85,6 @@ namespace OpenSim.Region.Environment.Scenes
85 [XmlIgnore] 85 [XmlIgnore]
86 public uint TimeStampLastActivity = 0; // Will be used for AutoReturn 86 public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
87 87
88
89 /// <summary> 88 /// <summary>
90 /// Only used internally to schedule client updates 89 /// Only used internally to schedule client updates
91 /// </summary> 90 /// </summary>
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 1b660b8..353382d 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
@@ -59,7 +59,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
59 private LLUUID m_itemID; 59 private LLUUID m_itemID;
60 private bool throwErrorOnNotImplemented = true; 60 private bool throwErrorOnNotImplemented = true;
61 61
62
63 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) 62 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
64 { 63 {
65 m_ScriptEngine = ScriptEngine; 64 m_ScriptEngine = ScriptEngine;
@@ -67,11 +66,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
67 m_localID = localID; 66 m_localID = localID;
68 m_itemID = itemID; 67 m_itemID = itemID;
69 68
70
71 //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); 69 //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
72 } 70 }
73 71
74
75 private string m_state = "default"; 72 private string m_state = "default";
76 73
77 public string State() 74 public string State()
@@ -95,7 +92,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
95 return lease; 92 return lease;
96 } 93 }
97 94
98
99 public Scene World 95 public Scene World
100 { 96 {
101 get { return m_ScriptEngine.World; } 97 get { return m_ScriptEngine.World; }
@@ -1022,7 +1018,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1022 m_host.SetText(text, av3, alpha); 1018 m_host.SetText(text, av3, alpha);
1023 } 1019 }
1024 1020
1025
1026 public double llWater(LSL_Types.Vector3 offset) 1021 public double llWater(LSL_Types.Vector3 offset)
1027 { 1022 {
1028 NotImplemented("llWater"); 1023 NotImplemented("llWater");
@@ -2300,4 +2295,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2300 throw new NotImplementedException("Command not implemented: " + Command); 2295 throw new NotImplementedException("Command not implemented: " + Command);
2301 } 2296 }
2302 } 2297 }
2303} \ No newline at end of file 2298}