mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
Merge branch 'master' into httptests
# Conflicts: # prebuild.xml
This commit is contained in:
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Mono.Addins;
|
||||
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MuteListModuleTst")]
|
||||
public class MuteListModuleTst : ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected bool m_Enabled = false;
|
||||
protected List<Scene> m_SceneList = new List<Scene>();
|
||||
protected IMuteListService m_service = null;
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
IConfig cnf = config.Configs["Messaging"];
|
||||
if (cnf == null)
|
||||
return;
|
||||
|
||||
if (cnf.GetString("MuteListModule", "None") != "MuteListModuleTst")
|
||||
return;
|
||||
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
IXfer xfer = scene.RequestModuleInterface<IXfer>();
|
||||
if (xfer == null)
|
||||
{
|
||||
m_log.ErrorFormat("[MuteListModuleTst]: Xfer not availble in region {0}. Module Disabled", scene.Name);
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
IMuteListService srv = scene.RequestModuleInterface<IMuteListService>();
|
||||
if(srv == null)
|
||||
{
|
||||
m_log.ErrorFormat("[MuteListModuleTst]: MuteListService not availble in region {0}. Module Disabled", scene.Name);
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
lock (m_SceneList)
|
||||
{
|
||||
if(m_service == null)
|
||||
m_service = srv;
|
||||
m_SceneList.Add(scene);
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
lock (m_SceneList)
|
||||
{
|
||||
if(m_SceneList.Contains(scene))
|
||||
{
|
||||
m_SceneList.Remove(scene);
|
||||
scene.EventManager.OnNewClient -= OnNewClient;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_log.Debug("[MuteListModuleTst]: enabled");
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "MuteListModuleTst"; }
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnMuteListRequest += OnMuteListRequest;
|
||||
client.OnUpdateMuteListEntry += OnUpdateMuteListEntry;
|
||||
client.OnRemoveMuteListEntry += OnRemoveMuteListEntry;
|
||||
}
|
||||
|
||||
private void OnMuteListRequest(IClientAPI client, uint crc)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
{
|
||||
if(crc == 0)
|
||||
client.SendEmpytMuteList();
|
||||
else
|
||||
client.SendUseCachedMuteList();
|
||||
return;
|
||||
}
|
||||
|
||||
IXfer xfer = client.Scene.RequestModuleInterface<IXfer>();
|
||||
if (xfer == null)
|
||||
{
|
||||
if(crc == 0)
|
||||
client.SendEmpytMuteList();
|
||||
else
|
||||
client.SendUseCachedMuteList();
|
||||
return;
|
||||
}
|
||||
|
||||
Byte[] data = m_service.MuteListRequest(client.AgentId, crc);
|
||||
if (data == null)
|
||||
{
|
||||
if(crc == 0)
|
||||
client.SendEmpytMuteList();
|
||||
else
|
||||
client.SendUseCachedMuteList();
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.Length == 0)
|
||||
{
|
||||
client.SendEmpytMuteList();
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.Length == 1)
|
||||
{
|
||||
if(crc == 0)
|
||||
client.SendEmpytMuteList();
|
||||
else
|
||||
client.SendUseCachedMuteList();
|
||||
return;
|
||||
}
|
||||
|
||||
string filename = "mutes" + client.AgentId.ToString();
|
||||
xfer.AddNewFile(filename, data);
|
||||
client.SendMuteListUpdate(filename);
|
||||
}
|
||||
|
||||
private void OnUpdateMuteListEntry(IClientAPI client, UUID muteID, string muteName, int muteType, uint muteFlags)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
UUID agentID = client.AgentId;
|
||||
if(muteType == 1) // agent
|
||||
{
|
||||
if(agentID == muteID)
|
||||
return;
|
||||
if(m_SceneList[0].Permissions.IsAdministrator(muteID))
|
||||
{
|
||||
OnMuteListRequest(client, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MuteData mute = new MuteData();
|
||||
mute.AgentID = agentID;
|
||||
mute.MuteID = muteID;
|
||||
mute.MuteName = muteName;
|
||||
mute.MuteType = muteType;
|
||||
mute.MuteFlags = (int)muteFlags;
|
||||
mute.Stamp = Util.UnixTimeSinceEpoch();
|
||||
|
||||
m_service.UpdateMute(mute);
|
||||
}
|
||||
|
||||
private void OnRemoveMuteListEntry(IClientAPI client, UUID muteID, string muteName)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
m_service.RemoveMute(client.AgentId, muteID, muteName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
239
OpenSim/Region/CoreModules/Avatar/InstantMessage/XMuteModule.cs
Normal file
239
OpenSim/Region/CoreModules/Avatar/InstantMessage/XMuteModule.cs
Normal file
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Mono.Addins;
|
||||
using OpenSim.Data.MySQL;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMute")]
|
||||
public class XMuteModule : ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected bool m_Enabled = true;
|
||||
protected List<Scene> m_SceneList = new List<Scene>();
|
||||
protected MuteTableHandler m_MuteTable;
|
||||
protected string m_DatabaseConnect;
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
IConfig cnf = config.Configs["Messaging"];
|
||||
if (cnf == null)
|
||||
{
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cnf.GetString("MuteListModule", "None") !=
|
||||
"XMute")
|
||||
{
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_DatabaseConnect = cnf.GetString("MuteDatabaseConnect", String.Empty);
|
||||
if (m_DatabaseConnect == String.Empty)
|
||||
{
|
||||
m_log.Debug("[XMute]: MuteDatabaseConnect missing or empty");
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_MuteTable = new MuteTableHandler(
|
||||
m_DatabaseConnect, "XMute", String.Empty);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
lock (m_SceneList)
|
||||
{
|
||||
m_SceneList.Add(scene);
|
||||
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
}
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
lock (m_SceneList)
|
||||
{
|
||||
m_SceneList.Remove(scene);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_log.Debug("[XMute]: Mute list enabled");
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "XMuteModule"; }
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnMuteListRequest += OnMuteListRequest;
|
||||
client.OnUpdateMuteListEntry += OnUpdateMuteListEntry;
|
||||
client.OnRemoveMuteListEntry += OnRemoveMuteListEntry;
|
||||
}
|
||||
|
||||
private void OnMuteListRequest(IClientAPI client, uint crc)
|
||||
{
|
||||
string filename = "mutes"+client.AgentId.ToString();
|
||||
|
||||
IXfer xfer = client.Scene.RequestModuleInterface<IXfer>();
|
||||
if (xfer != null)
|
||||
{
|
||||
MuteData[] data = m_MuteTable.Get("AgentID", client.AgentId.ToString());
|
||||
if (data == null || data.Length == 0)
|
||||
{
|
||||
xfer.AddNewFile(filename, new Byte[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
|
||||
foreach (MuteData d in data)
|
||||
sb.AppendFormat("{0} {1} {2}|{3}\n",
|
||||
d.MuteType,
|
||||
d.MuteID.ToString(),
|
||||
d.MuteName,
|
||||
d.MuteFlags);
|
||||
|
||||
Byte[] filedata = Util.UTF8.GetBytes(sb.ToString());
|
||||
|
||||
uint dataCrc = Crc32.Compute(filedata);
|
||||
|
||||
if (dataCrc == crc)
|
||||
{
|
||||
client.SendUseCachedMuteList();
|
||||
return;
|
||||
}
|
||||
|
||||
xfer.AddNewFile(filename, filedata);
|
||||
}
|
||||
|
||||
client.SendMuteListUpdate(filename);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUpdateMuteListEntry(IClientAPI client, UUID muteID, string muteName, int muteType, uint muteFlags)
|
||||
{
|
||||
MuteData mute = new MuteData();
|
||||
|
||||
mute.AgentID = client.AgentId;
|
||||
mute.MuteID = muteID;
|
||||
mute.MuteName = muteName;
|
||||
mute.MuteType = muteType;
|
||||
mute.MuteFlags = (int)muteFlags;
|
||||
mute.Stamp = Util.UnixTimeSinceEpoch();
|
||||
|
||||
m_MuteTable.Store(mute);
|
||||
}
|
||||
|
||||
private void OnRemoveMuteListEntry(IClientAPI client, UUID muteID, string muteName)
|
||||
{
|
||||
m_MuteTable.Delete(new string[] { "AgentID",
|
||||
"MuteID",
|
||||
"MuteName" },
|
||||
new string[] { client.AgentId.ToString(),
|
||||
muteID.ToString(),
|
||||
muteName });
|
||||
}
|
||||
}
|
||||
|
||||
public class MuteTableHandler : MySQLGenericTableHandler<MuteData>
|
||||
{
|
||||
public MuteTableHandler(string conn, string realm, string m) : base(conn, realm, m)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Delete(string[] fields, string[] val)
|
||||
{
|
||||
if (fields.Length != val.Length)
|
||||
return false;
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
string text = String.Format("delete from {0} where ", m_Realm);
|
||||
|
||||
List<string> terms = new List<string>();
|
||||
|
||||
for (int i = 0 ; i < fields.Length ; i++)
|
||||
{
|
||||
terms.Add(String.Format("{0} = ?{0}", fields[i]));
|
||||
cmd.Parameters.AddWithValue("?" + fields[i], val[i]);
|
||||
}
|
||||
|
||||
text += string.Join(" and ", terms.ToArray());
|
||||
|
||||
cmd.CommandText = text;
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalMuteListServicesConnector")]
|
||||
public class LocalMuteListServicesConnector : ISharedRegionModule, IMuteListService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
protected IMuteListService m_service = null;
|
||||
|
||||
private bool m_Enabled = false;
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LocalMuteListServicesConnector"; }
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig moduleConfig = source.Configs["Modules"];
|
||||
|
||||
if (moduleConfig == null)
|
||||
return;
|
||||
|
||||
string name = moduleConfig.GetString("MuteListService", "");
|
||||
if(name != Name)
|
||||
return;
|
||||
|
||||
IConfig userConfig = source.Configs["MuteListService"];
|
||||
if (userConfig == null)
|
||||
{
|
||||
m_log.Error("[MuteList LOCALCONNECTOR]: MuteListService missing from configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
string serviceDll = userConfig.GetString("LocalServiceModule",
|
||||
String.Empty);
|
||||
|
||||
if (serviceDll == String.Empty)
|
||||
{
|
||||
m_log.Error("[MuteList LOCALCONNECTOR]: No LocalServiceModule named in section MuteListService");
|
||||
return;
|
||||
}
|
||||
|
||||
Object[] args = new Object[] { source };
|
||||
try
|
||||
{
|
||||
m_service = ServerUtils.LoadPlugin<IMuteListService>(serviceDll, args);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.Error("[MuteList LOCALCONNECTOR]: Failed to load mute service");
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_service == null)
|
||||
{
|
||||
m_log.Error("[MuteList LOCALCONNECTOR]: Can't load MuteList service");
|
||||
return;
|
||||
}
|
||||
|
||||
m_Enabled = true;
|
||||
m_log.Info("[MuteList LOCALCONNECTOR]: enabled");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
lock(m_Scenes)
|
||||
{
|
||||
m_Scenes.Add(scene);
|
||||
scene.RegisterModuleInterface<IMuteListService>(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
lock(m_Scenes)
|
||||
{
|
||||
if (m_Scenes.Contains(scene))
|
||||
{
|
||||
m_Scenes.Remove(scene);
|
||||
scene.UnregisterModuleInterface<IMuteListService>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion ISharedRegionModule
|
||||
|
||||
#region IMuteListService
|
||||
public Byte[] MuteListRequest(UUID agentID, uint crc)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return null;
|
||||
return m_service.MuteListRequest(agentID, crc);
|
||||
}
|
||||
|
||||
public bool UpdateMute(MuteData mute)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return false;
|
||||
return m_service.UpdateMute(mute);
|
||||
}
|
||||
|
||||
public bool RemoveMute(UUID agentID, UUID muteID, string muteName)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return false;
|
||||
return m_service.RemoveMute(agentID, muteID, muteName);
|
||||
}
|
||||
|
||||
#endregion IMuteListService
|
||||
}
|
||||
}
|
||||
@@ -38,18 +38,20 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
{
|
||||
public class ShadedMapTileRenderer : IMapTileTerrainRenderer
|
||||
{
|
||||
private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]";
|
||||
|
||||
private Scene m_scene;
|
||||
//private IConfigSource m_config; // not used currently
|
||||
private IConfigSource m_config;
|
||||
private Color m_color_water;
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
// m_config = config; // not used currently
|
||||
m_config = config;
|
||||
|
||||
string[] configSections = new string[] { "Map", "Startup" };
|
||||
m_color_water = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColorWater", configSections, "#1D475F"));
|
||||
}
|
||||
|
||||
public void TerrainToBitmap(Bitmap mapbmp)
|
||||
@@ -231,7 +233,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
|
||||
try
|
||||
{
|
||||
mapbmp.SetPixel(x, yr, WATER_COLOR);
|
||||
mapbmp.SetPixel(x, yr, m_color_water);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
|
||||
@@ -130,21 +130,19 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
// some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank").
|
||||
// The color-values were choosen because they "look right" (at least to me) ;-)
|
||||
private static readonly UUID defaultTerrainTexture1 = new UUID("0bc58228-74a0-7e83-89bc-5c23464bcec5");
|
||||
private static readonly Color defaultColor1 = Color.FromArgb(165, 137, 118);
|
||||
private static readonly UUID defaultTerrainTexture2 = new UUID("63338ede-0037-c4fd-855b-015d77112fc8");
|
||||
private static readonly Color defaultColor2 = Color.FromArgb(69, 89, 49);
|
||||
private static readonly UUID defaultTerrainTexture3 = new UUID("303cd381-8560-7579-23f1-f0a880799740");
|
||||
private static readonly Color defaultColor3 = Color.FromArgb(162, 154, 141);
|
||||
private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
|
||||
private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
|
||||
|
||||
private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private Scene m_scene;
|
||||
// private IConfigSource m_config; // not used currently
|
||||
private IConfigSource m_config;
|
||||
private Color m_color_water;
|
||||
private Color m_color_1;
|
||||
private Color m_color_2;
|
||||
private Color m_color_3;
|
||||
private Color m_color_4;
|
||||
|
||||
// mapping from texture UUIDs to averaged color. This will contain 5-9 values, in general; new values are only
|
||||
// added when the terrain textures are changed in the estate dialog and a new map is generated (and will stay in
|
||||
@@ -156,12 +154,21 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
m_scene = scene;
|
||||
// m_config = source; // not used currently
|
||||
m_config = source;
|
||||
|
||||
string[] configSections = new string[] { "Map", "Startup" };
|
||||
|
||||
m_color_water = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColorWater", configSections, "#1D475F"));
|
||||
m_color_1 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor1", configSections, "#A58976"));
|
||||
m_color_2 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor2", configSections, "#455931"));
|
||||
m_color_3 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor3", configSections, "#A29A8D"));
|
||||
m_color_4 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor4", configSections, "#C8C8C8"));
|
||||
|
||||
m_mapping = new Dictionary<UUID,Color>();
|
||||
m_mapping.Add(defaultTerrainTexture1, defaultColor1);
|
||||
m_mapping.Add(defaultTerrainTexture2, defaultColor2);
|
||||
m_mapping.Add(defaultTerrainTexture3, defaultColor3);
|
||||
m_mapping.Add(defaultTerrainTexture4, defaultColor4);
|
||||
m_mapping.Add(defaultTerrainTexture1, m_color_1);
|
||||
m_mapping.Add(defaultTerrainTexture2, m_color_2);
|
||||
m_mapping.Add(defaultTerrainTexture3, m_color_3);
|
||||
m_mapping.Add(defaultTerrainTexture4, m_color_4);
|
||||
m_mapping.Add(Util.BLANK_TEXTURE_UUID, Color.White);
|
||||
}
|
||||
|
||||
@@ -298,10 +305,10 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
RegionSettings settings = m_scene.RegionInfo.RegionSettings;
|
||||
|
||||
// the four terrain colors as HSVs for interpolation
|
||||
HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, defaultColor1));
|
||||
HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, defaultColor2));
|
||||
HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, defaultColor3));
|
||||
HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, defaultColor4));
|
||||
HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, m_color_1));
|
||||
HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, m_color_2));
|
||||
HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, m_color_3));
|
||||
HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, m_color_4));
|
||||
|
||||
float levelNElow = (float)settings.Elevation1NE;
|
||||
float levelNEhigh = (float)settings.Elevation2NE;
|
||||
@@ -417,7 +424,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
|
||||
heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0
|
||||
|
||||
mapbmp.SetPixel(x, yr, WATER_COLOR);
|
||||
mapbmp.SetPixel(x, yr, m_color_water);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user