From d5aceb6d95779b19d13eef9f2427c79233166a63 Mon Sep 17 00:00:00 2001 From: CasperW Date: Tue, 24 Nov 2009 23:33:12 +0100 Subject: [PATCH] Append a prefix to the god avatar names appearing in chat whilst in god mode (disabled by default, config entry admin_prefix) --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 11 ++++++++--- bin/OpenSim.ini.example | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 5c24f03347..1e63e3ee22 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat private int m_shoutdistance = 100; private int m_whisperdistance = 10; private List m_scenes = new List(); - + private string m_adminPrefix = ""; internal object m_syncy = new object(); internal IConfig m_config; @@ -76,6 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); + m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); } public virtual void AddRegion(Scene scene) @@ -185,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) { string fromName = c.From; + string fromNamePrefix = ""; UUID fromID = UUID.Zero; string message = c.Message; IScene scene = c.Scene; @@ -207,7 +209,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat fromPos = avatar.AbsolutePosition; fromName = avatar.Name; fromID = c.Sender.AgentId; - + if (avatar.GodLevel > 200) + { + fromNamePrefix = m_adminPrefix; + } break; case ChatSourceType.Object: @@ -227,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat s.ForEachScenePresence( delegate(ScenePresence presence) { - TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); + TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); } ); } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 116a8fd6ac..f9d9ca6b36 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -454,6 +454,9 @@ ; Distance in meters that shouts should travel. Default is 100m shout_distance = 100 + + ; Append a prefix to the god avatar names appearing in chat whilst in god mode + ; admin_prefix = "@" [Messaging]