diff options
author | Jeff Ames | 2007-12-10 02:29:42 +0000 |
---|---|---|
committer | Jeff Ames | 2007-12-10 02:29:42 +0000 |
commit | e278d07220f976dec730890e4853ead58f83502a (patch) | |
tree | 14873c24f88ae4e32e75ec286df34de00c0db94f /OpenSim/Region | |
parent | * Hooked up the GridComm event ChildDataUpdate to the scene. (diff) | |
download | opensim-SC-e278d07220f976dec730890e4853ead58f83502a.zip opensim-SC-e278d07220f976dec730890e4853ead58f83502a.tar.gz opensim-SC-e278d07220f976dec730890e4853ead58f83502a.tar.bz2 opensim-SC-e278d07220f976dec730890e4853ead58f83502a.tar.xz |
refactored ChatModule a bit.
misc cleanup and code convention fixes.
Diffstat (limited to 'OpenSim/Region')
6 files changed, 55 insertions, 103 deletions
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 | } |