aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-01-18 02:53:31 +0000
committerMelanie2010-01-18 02:53:31 +0000
commit51bb31156502c391ac84aa207fce125a4299d755 (patch)
treebdfbd0aa8814841f4ed5444e494b61b28a9dadfe /OpenSim
parentFix a typo (diff)
downloadopensim-SC-51bb31156502c391ac84aa207fce125a4299d755.zip
opensim-SC-51bb31156502c391ac84aa207fce125a4299d755.tar.gz
opensim-SC-51bb31156502c391ac84aa207fce125a4299d755.tar.bz2
opensim-SC-51bb31156502c391ac84aa207fce125a4299d755.tar.xz
Add chat banning. Staff patch
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs51
1 files changed, 49 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index e3e8718..acc3a78 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
49 private int m_shoutdistance = 100; 49 private int m_shoutdistance = 100;
50 private int m_whisperdistance = 10; 50 private int m_whisperdistance = 10;
51 private List<Scene> m_scenes = new List<Scene>(); 51 private List<Scene> m_scenes = new List<Scene>();
52 private List<string> FreezeCache = new List<string>();
52 private string m_adminPrefix = ""; 53 private string m_adminPrefix = "";
53 internal object m_syncy = new object(); 54 internal object m_syncy = new object();
54 55
@@ -172,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
172 return; 173 return;
173 } 174 }
174 175
175 DeliverChatToAvatars(ChatSourceType.Agent, c); 176 if (FreezeCache.Contains(c.Sender.AgentId.ToString()))
177 {
178 if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping)
179 c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false);
180 }
181 else
182 {
183 DeliverChatToAvatars(ChatSourceType.Agent, c);
184 }
176 } 185 }
177 186
178 public virtual void OnChatFromWorld(Object sender, OSChatMessage c) 187 public virtual void OnChatFromWorld(Object sender, OSChatMessage c)
@@ -232,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
232 s.ForEachScenePresence( 241 s.ForEachScenePresence(
233 delegate(ScenePresence presence) 242 delegate(ScenePresence presence)
234 { 243 {
235 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); 244 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
245 if (Presencecheck != null)
246 {
247 if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true)
248 {
249 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType);
250 }
251 }
252
236 } 253 }
237 ); 254 );
238 } 255 }
@@ -322,5 +339,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
322 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 339 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
323 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); 340 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
324 } 341 }
342
343 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
344 public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
345 {
346 System.Threading.Timer Timer;
347 if (flags == 0)
348 {
349 FreezeCache.Add(target.ToString());
350 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
351 Timer = new System.Threading.Timer(timeCB, target, 30000, 0);
352 Timers.Add(target, Timer);
353 }
354 else
355 {
356 FreezeCache.Remove(target.ToString());
357 Timers.TryGetValue(target, out Timer);
358 Timers.Remove(target);
359 Timer.Dispose();
360 }
361 }
362
363 private void OnEndParcelFrozen(object avatar)
364 {
365 UUID target = (UUID)avatar;
366 FreezeCache.Remove(target.ToString());
367 System.Threading.Timer Timer;
368 Timers.TryGetValue(target, out Timer);
369 Timers.Remove(target);
370 Timer.Dispose();
371 }
325 } 372 }
326} 373}