Merge branch 'master' into httptests

# Conflicts:
#	prebuild.xml
httptests
UbitUmarov 2017-12-12 22:19:31 +00:00
commit ab0f866087
25 changed files with 1403 additions and 147 deletions

View File

@ -0,0 +1,44 @@
/*
* 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 OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data
{
/// <summary>
/// An interface for connecting to the Mute List datastore
/// </summary>
public interface IMuteListData
{
bool Store(MuteData data);
MuteData[] Get(UUID agentID);
bool Delete(UUID agentID, UUID muteID, string muteName);
}
}

View File

@ -0,0 +1,67 @@
/*
* 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;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL
{
public class MySqlMuteListData : MySQLGenericTableHandler<MuteData>, IMuteListData
{
public MySqlMuteListData(string connectionString)
: base(connectionString, "MuteList", "MuteListStore")
{
}
public MuteData[] Get(UUID agentID)
{
MuteData[] data = base.Get("AgentID", agentID.ToString());
return data;
}
public bool Delete(UUID agentID, UUID muteID, string muteName)
{
string cmnd ="delete from MuteList where AgentID = ?AgentID and MuteID = ?MuteID and MuteName = ?MuteName";
using (MySqlCommand cmd = new MySqlCommand(cmnd))
{
cmd.Parameters.AddWithValue("?AgentID", agentID.ToString());
cmd.Parameters.AddWithValue("?MuteID", muteID.ToString());
cmd.Parameters.AddWithValue("?MuteName", muteName);
if (ExecuteNonQuery(cmd) > 0)
return true;
return false;
}
}
}
}

View File

@ -0,0 +1,16 @@
:VERSION 1
BEGIN;
CREATE TABLE `MuteList` (
`AgentID` char(36) NOT NULL,
`MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`MuteName` varchar(64) NOT NULL DEFAULT '',
`MuteType` int(11) NOT NULL DEFAULT '1',
`MuteFlags` int(11) NOT NULL DEFAULT '0',
`Stamp` int(11) NOT NULL,
UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`),
KEY `AgentID` (`AgentID`)
);
COMMIT;

View File

@ -0,0 +1,16 @@
:VERSION 1
BEGIN;
CREATE TABLE `XMute` (
`AgentID` char(36) NOT NULL,
`MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`MuteName` varchar(64) NOT NULL DEFAULT '',
`MuteType` int(11) NOT NULL DEFAULT '1',
`MuteFlags` int(11) NOT NULL DEFAULT '0',
`Stamp` int(11) NOT NULL,
UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`),
KEY `AgentID` (`AgentID`)
);
COMMIT;

139
OpenSim/Framework/Crc32.cs Normal file
View File

@ -0,0 +1,139 @@
/*
* 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.Security.Cryptography;
namespace OpenSim.Framework
{
// this is more generic than openmetaverse CRC32
public class Crc32 : HashAlgorithm
{
public const UInt32 DefaultPolynomial = 0xedb88320;
public const UInt32 DefaultSeed = 0xffffffff;
private UInt32 hash;
private UInt32 seed;
private UInt32[] table;
private static UInt32[] defaultTable;
public Crc32()
{
table = InitializeTable(DefaultPolynomial);
seed = DefaultSeed;
Initialize();
}
public Crc32(UInt32 polynomial, UInt32 seed)
{
table = InitializeTable(polynomial);
this.seed = seed;
Initialize();
}
public override void Initialize()
{
hash = seed;
}
protected override void HashCore(byte[] buffer, int start, int length)
{
hash = CalculateHash(table, hash, buffer, start, length);
}
protected override byte[] HashFinal()
{
byte[] hashBuffer = UInt32ToBigEndianBytes(~hash);
this.HashValue = hashBuffer;
return hashBuffer;
}
public override int HashSize
{
get { return 32; }
}
public static UInt32 Compute(byte[] buffer)
{
return ~CalculateHash(InitializeTable(DefaultPolynomial), DefaultSeed, buffer, 0, buffer.Length);
}
public static UInt32 Compute(UInt32 seed, byte[] buffer)
{
return ~CalculateHash(InitializeTable(DefaultPolynomial), seed, buffer, 0, buffer.Length);
}
public static UInt32 Compute(UInt32 polynomial, UInt32 seed, byte[] buffer)
{
return ~CalculateHash(InitializeTable(polynomial), seed, buffer, 0, buffer.Length);
}
private static UInt32[] InitializeTable(UInt32 polynomial)
{
if (polynomial == DefaultPolynomial && defaultTable != null)
return defaultTable;
UInt32[] createTable = new UInt32[256];
for (int i = 0; i < 256; i++)
{
UInt32 entry = (UInt32)i;
for (int j = 0; j < 8; j++)
if ((entry & 1) == 1)
entry = (entry >> 1) ^ polynomial;
else
entry = entry >> 1;
createTable[i] = entry;
}
if (polynomial == DefaultPolynomial)
defaultTable = createTable;
return createTable;
}
private static UInt32 CalculateHash(UInt32[] table, UInt32 seed, byte[] buffer, int start, int size)
{
UInt32 crc = seed;
for (int i = start; i < size; i++)
unchecked
{
crc = (crc >> 8) ^ table[buffer[i] ^ crc & 0xff];
}
return crc;
}
private byte[] UInt32ToBigEndianBytes(UInt32 x)
{
return new byte[] {
(byte)((x >> 24) & 0xff),
(byte)((x >> 16) & 0xff),
(byte)((x >> 8) & 0xff),
(byte)(x & 0xff) };
}
}
}

View File

@ -1485,7 +1485,7 @@ namespace OpenSim.Framework
void SendUserInfoReply(bool imViaEmail, bool visible, string email); void SendUserInfoReply(bool imViaEmail, bool visible, string email);
void SendUseCachedMuteList(); void SendUseCachedMuteList();
void SendEmpytMuteList();
void SendMuteListUpdate(string filename); void SendMuteListUpdate(string filename);
void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals); void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals);

View File

@ -0,0 +1,41 @@
/*
* 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 OpenMetaverse;
namespace OpenSim.Framework
{
public class MuteData
{
public UUID AgentID;
public UUID MuteID;
public string MuteName;
public int MuteType;
public int MuteFlags;
public int Stamp;
}
}

View File

@ -2307,11 +2307,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(remove, ThrottleOutPacketType.Asset); OutPacket(remove, ThrottleOutPacketType.Asset);
} }
/*
private uint adjustControls(int input)
{
uint ret = (uint)input;
uint masked = ret & 0x0f;
masked <<= 19;
ret |= masked;
return ret;
}
*/
public void SendTakeControls(int controls, bool passToAgent, bool TakeControls) public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
{ {
ScriptControlChangePacket scriptcontrol = (ScriptControlChangePacket)PacketPool.Instance.GetPacket(PacketType.ScriptControlChange); ScriptControlChangePacket scriptcontrol = (ScriptControlChangePacket)PacketPool.Instance.GetPacket(PacketType.ScriptControlChange);
ScriptControlChangePacket.DataBlock[] data = new ScriptControlChangePacket.DataBlock[1]; ScriptControlChangePacket.DataBlock[] data = new ScriptControlChangePacket.DataBlock[1];
ScriptControlChangePacket.DataBlock ddata = new ScriptControlChangePacket.DataBlock(); ScriptControlChangePacket.DataBlock ddata = new ScriptControlChangePacket.DataBlock();
// ddata.Controls = adjustControls(controls);
ddata.Controls = (uint)controls; ddata.Controls = (uint)controls;
ddata.PassToAgent = passToAgent; ddata.PassToAgent = passToAgent;
ddata.TakeControls = TakeControls; ddata.TakeControls = TakeControls;
@ -3762,6 +3774,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(useCachedMuteList, ThrottleOutPacketType.Task); OutPacket(useCachedMuteList, ThrottleOutPacketType.Task);
} }
public void SendEmpytMuteList()
{
GenericMessagePacket gmp = new GenericMessagePacket();
gmp.AgentData.AgentID = AgentId;
gmp.AgentData.SessionID = m_sessionId;
gmp.AgentData.TransactionID = UUID.Zero;
gmp.MethodData.Method = Util.StringToBytes256("emptymutelist");
gmp.ParamList = new GenericMessagePacket.ParamListBlock[1];
gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
gmp.ParamList[0].Parameter = new byte[0];
OutPacket(gmp, ThrottleOutPacketType.Task);
}
public void SendMuteListUpdate(string filename) public void SendMuteListUpdate(string filename)
{ {
MuteListUpdatePacket muteListUpdate = (MuteListUpdatePacket)PacketPool.Instance.GetPacket(PacketType.MuteListUpdate); MuteListUpdatePacket muteListUpdate = (MuteListUpdatePacket)PacketPool.Instance.GetPacket(PacketType.MuteListUpdate);
@ -11008,9 +11036,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
else else
{ {
SendUseCachedMuteList(); if(muteListRequest.MuteData.MuteCRC == 0)
SendEmpytMuteList();
else
SendUseCachedMuteList();
} }
return true; return true;
} }
private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet) private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet)

View File

@ -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);
}
}
}

View 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;
}
}
}
}

View File

@ -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
}
}

View File

@ -38,18 +38,20 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
{ {
public class ShadedMapTileRenderer : IMapTileTerrainRenderer 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 ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]"; private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]";
private Scene m_scene; 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) public void Initialise(Scene scene, IConfigSource config)
{ {
m_scene = scene; 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) public void TerrainToBitmap(Bitmap mapbmp)
@ -231,7 +233,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
try try
{ {
mapbmp.SetPixel(x, yr, WATER_COLOR); mapbmp.SetPixel(x, yr, m_color_water);
} }
catch (ArgumentException) catch (ArgumentException)
{ {

View File

@ -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"). // 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) ;-) // 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 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 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 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 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 #endregion
private Scene m_scene; 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 // 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 // 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) public void Initialise(Scene scene, IConfigSource source)
{ {
m_scene = scene; 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 = new Dictionary<UUID,Color>();
m_mapping.Add(defaultTerrainTexture1, defaultColor1); m_mapping.Add(defaultTerrainTexture1, m_color_1);
m_mapping.Add(defaultTerrainTexture2, defaultColor2); m_mapping.Add(defaultTerrainTexture2, m_color_2);
m_mapping.Add(defaultTerrainTexture3, defaultColor3); m_mapping.Add(defaultTerrainTexture3, m_color_3);
m_mapping.Add(defaultTerrainTexture4, defaultColor4); m_mapping.Add(defaultTerrainTexture4, m_color_4);
m_mapping.Add(Util.BLANK_TEXTURE_UUID, Color.White); 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; RegionSettings settings = m_scene.RegionInfo.RegionSettings;
// the four terrain colors as HSVs for interpolation // the four terrain colors as HSVs for interpolation
HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, defaultColor1)); HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, m_color_1));
HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, defaultColor2)); HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, m_color_2));
HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, defaultColor3)); HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, m_color_3));
HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, defaultColor4)); HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, m_color_4));
float levelNElow = (float)settings.Elevation1NE; float levelNElow = (float)settings.Elevation1NE;
float levelNEhigh = (float)settings.Elevation2NE; float levelNEhigh = (float)settings.Elevation2NE;
@ -417,7 +424,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0 heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0
mapbmp.SetPixel(x, yr, WATER_COLOR); mapbmp.SetPixel(x, yr, m_color_water);
} }
} }
} }

View File

@ -4632,10 +4632,10 @@ Label_GroupsDone:
/// <param name='agentID'></param> /// <param name='agentID'></param>
protected virtual ScenePresence WaitGetScenePresence(UUID agentID) protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
{ {
int ntimes = 30; int ntimes = 120; // 30s
ScenePresence sp = null; ScenePresence sp = null;
while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0))
Thread.Sleep(1000); Thread.Sleep(250);
if (sp == null) if (sp == null)
m_log.WarnFormat( m_log.WarnFormat(

View File

@ -1702,6 +1702,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
public void SendEmpytMuteList()
{
}
public void SendMuteListUpdate(string filename) public void SendMuteListUpdate(string filename)
{ {

View File

@ -1314,6 +1314,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
} }
public void SendEmpytMuteList()
{
}
public void SendMuteListUpdate(string filename) public void SendMuteListUpdate(string filename)
{ {
} }

View File

@ -6639,11 +6639,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// AGENT_LIST_PARCEL - all in the same parcel as the scripted object /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object
/// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the
/// current parcel. /// current parcel.
/// AGENT_LIST_EXCLUDENPC ignore NPCs (bit mask)
/// </summary> /// </summary>
public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// do our bit masks part
bool noNPC = (scope & ScriptBaseClass.AGENT_LIST_EXCLUDENPC) !=0;
// remove bit masks part
scope &= ~ ScriptBaseClass.AGENT_LIST_EXCLUDENPC;
// the constants are 1, 2 and 4 so bits are being set, but you // the constants are 1, 2 and 4 so bits are being set, but you
// get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4 // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION; bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
@ -6684,6 +6691,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.ForEachRootScenePresence( World.ForEachRootScenePresence(
delegate (ScenePresence ssp) delegate (ScenePresence ssp)
{ {
if(noNPC && ssp.IsNPC)
return;
// Gods are not listed in SL // Gods are not listed in SL
if (!ssp.IsDeleted && !ssp.IsViewerUIGod && !ssp.IsChildAgent) if (!ssp.IsDeleted && !ssp.IsViewerUIGod && !ssp.IsChildAgent)
{ {

View File

@ -660,6 +660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int AGENT_LIST_PARCEL = 1; public const int AGENT_LIST_PARCEL = 1;
public const int AGENT_LIST_PARCEL_OWNER = 2; public const int AGENT_LIST_PARCEL_OWNER = 2;
public const int AGENT_LIST_REGION = 4; public const int AGENT_LIST_REGION = 4;
public const int AGENT_LIST_EXCLUDENPC = 0x4000000; // our flag, not SL and it is a bit mask
// Can not be public const? // Can not be public const?
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);

View File

@ -0,0 +1,41 @@
/*
* 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 OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Services.Interfaces
{
public interface IMuteListService
{
Byte[] MuteListRequest(UUID agent, uint crc);
bool UpdateMute(MuteData mute);
bool RemoveMute(UUID agentID, UUID muteID, string muteName);
}
}

View File

@ -0,0 +1,127 @@
/*
* 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.Text;
using OpenMetaverse;
using log4net;
using Nini.Config;
using OpenSim.Services.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Data;
using OpenSim.Framework;
namespace OpenSim.Services.EstateService
{
public class MuteListService : ServiceBase, IMuteListService
{
// private static readonly ILog m_log =
// LogManager.GetLogger(
// MethodBase.GetCurrentMethod().DeclaringType);
protected IMuteListData m_database;
public MuteListService(IConfigSource config)
: base(config)
{
string dllName = String.Empty;
string connString = String.Empty;
// Try reading the [DatabaseService] section, if it exists
IConfig dbConfig = config.Configs["DatabaseService"];
if (dbConfig != null)
{
dllName = dbConfig.GetString("StorageProvider", String.Empty);
connString = dbConfig.GetString("ConnectionString", String.Empty);
connString = dbConfig.GetString("MuteConnectionString", connString);
}
// Try reading the [MuteListStore] section, if it exists
IConfig muteConfig = config.Configs["MuteListStore"];
if (muteConfig != null)
{
dllName = muteConfig.GetString("StorageProvider", dllName);
connString = muteConfig.GetString("ConnectionString", connString);
}
// We tried, but this doesn't exist. We can't proceed
if (dllName == String.Empty)
throw new Exception("No StorageProvider configured");
m_database = LoadPlugin<IMuteListData>(dllName, new Object[] { connString });
if (m_database == null)
throw new Exception("Could not find a storage interface in the given module");
}
public Byte[] MuteListRequest(UUID agentID, uint crc)
{
if(m_database == null)
return null;
MuteData[] data = m_database.Get(agentID);
if (data == null || data.Length == 0)
return new Byte[0];
StringBuilder sb = new StringBuilder(16384);
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)
{
if(crc == 0)
return new Byte[0];
Byte[] ret = new Byte[1] {1};
return ret;
}
return filedata;
}
public bool UpdateMute(MuteData mute)
{
if(m_database == null)
return false;
return m_database.Store(mute);
}
public bool RemoveMute(UUID agentID, UUID muteID, string muteName)
{
if(m_database == null)
return false;
return m_database.Delete(agentID, muteID, muteName);
}
}
}

View File

@ -1315,6 +1315,10 @@ namespace OpenSim.Tests.Common
{ {
} }
public void SendEmpytMuteList()
{
}
public void SendMuteListUpdate(string filename) public void SendMuteListUpdate(string filename)
{ {
} }

View File

@ -378,6 +378,21 @@
;; Attempt to render meshes and sculpties on the map. ;; Attempt to render meshes and sculpties on the map.
; RenderMeshes = false ; RenderMeshes = false
;# {MapColorWater} {} {Water color for textured and shaded maps} {"#1D475F"}
; MapColorWater = "#3399FF"
;# {MapColor1} {} {Terrain color 1 for textured maps} {"#A58976"}
; MapColor1 = "#A58976"
;# {MapColor2} {} {Terrain color 2 for textured maps} {"#455931"}
; MapColor2 = "#455931"
;# {MapColor3} {} {Terrain color 3 for textured maps} {"#A29A8D"}
; MapColor3 = "#A29A8D"
;# {MapColor4} {} {Terrain color 4 for textured maps} {"#C8C8C8"}
; MapColor4 = "#C8C8C8"
[Permissions] [Permissions]
;# {permissionmodules} {} {Permission modules to use (may specify multiple modules, separated by comma} {} DefaultPermissionsModule ;# {permissionmodules} {} {Permission modules to use (may specify multiple modules, separated by comma} {} DefaultPermissionsModule

View File

@ -22,6 +22,7 @@
InventoryAccessModule = "BasicInventoryAccessModule" InventoryAccessModule = "BasicInventoryAccessModule"
MapImageService = "MapImageServiceModule" MapImageService = "MapImageServiceModule"
SearchModule = "BasicSearchModule" SearchModule = "BasicSearchModule"
MuteListService = "LocalMuteListServicesConnector"
LibraryModule = true LibraryModule = true
LLLoginServiceInConnector = true LLLoginServiceInConnector = true
@ -113,6 +114,9 @@
[MapImageService] [MapImageService]
LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService"
[MuteListService]
LocalServiceModule = "OpenSim.Services.MuteListService.dll:MuteListService"
;; This should always be the very last thing on this file ;; This should always be the very last thing on this file
[Includes] [Includes]
Include-Common = "config-include/StandaloneCommon.ini" Include-Common = "config-include/StandaloneCommon.ini"

View File

@ -27,6 +27,7 @@
FriendsModule = "HGFriendsModule" FriendsModule = "HGFriendsModule"
UserManagementModule = "HGUserManagementModule" UserManagementModule = "HGUserManagementModule"
SearchModule = "BasicSearchModule" SearchModule = "BasicSearchModule"
MuteListService = "LocalMuteListServicesConnector"
InventoryServiceInConnector = true InventoryServiceInConnector = true
AssetServiceInConnector = true AssetServiceInConnector = true
@ -190,6 +191,9 @@
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
InGatekeeper = True InGatekeeper = True
[MuteListService]
LocalServiceModule = "OpenSim.Services.MuteListService.dll:MuteListService"
;; This should always be the very last thing on this file ;; This should always be the very last thing on this file
[Includes] [Includes]
Include-Common = "config-include/StandaloneCommon.ini" Include-Common = "config-include/StandaloneCommon.ini"

View File

@ -99,6 +99,8 @@
<Reference name="System.Data"/> <Reference name="System.Data"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="System.Security"/>
<Reference name="System.Security.Cryptography"/>
<Reference name="OpenMetaverseTypes" path="../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../bin/"/>
<Reference name="OpenMetaverse" path="../../bin/"/> <Reference name="OpenMetaverse" path="../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../bin/"/>
@ -1099,6 +1101,33 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v4_5" name="OpenSim.Services.MuteListService" path="OpenSim/Services/MuteListService" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_5" name="OpenSim.Services.UserProfilesService" path="OpenSim/Services/UserProfilesService" type="Library"> <Project frameworkVersion="v4_5" name="OpenSim.Services.UserProfilesService" path="OpenSim/Services/UserProfilesService" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
@ -1381,6 +1410,122 @@
</Files> </Files>
</Project> </Project>
<!-- Data Base Modules -->
<Project frameworkVersion="v4_5" name="OpenSim.Data.MySQL" path="OpenSim/Data/MySQL" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="MySql.Data" path="../../../bin/"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="Tests" pattern="Tests"/>
</Match>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.sql"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_5" name="OpenSim.Data.PGSQL" path="OpenSim/Data/PGSQL" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="Npgsql" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_0" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="Mono.Data.Sqlite"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="Tests" pattern="Tests"/>
</Match>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.sql"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_5" name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library"> <Project frameworkVersion="v4_5" name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
@ -1403,6 +1548,7 @@
<Reference name="System.Xml.Linq"/> <Reference name="System.Xml.Linq"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="System.Data"/>
<Reference name="Microsoft.CSharp" /> <Reference name="Microsoft.CSharp" />
<Reference name="NDesk.Options" path="../../../bin/"/> <Reference name="NDesk.Options" path="../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
@ -1411,7 +1557,6 @@
<Reference name="CSJ2K" path="../../../bin/"/> <Reference name="CSJ2K" path="../../../bin/"/>
<Reference name="Warp3D" path="../../../bin/"/> <Reference name="Warp3D" path="../../../bin/"/>
<Reference name="OpenSim.Capabilities"/> <Reference name="OpenSim.Capabilities"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/> <Reference name="OpenSim.Framework.Monitoring"/>
@ -1426,7 +1571,10 @@
<Reference name="OpenSim.Services.Connectors"/> <Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Services.Base"/> <Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Data.MySQL"/>
<Reference name="Ionic.Zip" path="../../../bin/"/> <Reference name="Ionic.Zip" path="../../../bin/"/>
<Reference name="MySql.Data" path="../../../bin/"/>
<Reference name="GlynnTucker.Cache" path="../../../bin/"/> <Reference name="GlynnTucker.Cache" path="../../../bin/"/>
@ -1935,124 +2083,6 @@
<!-- Scene Server API Example Apps --> <!-- Scene Server API Example Apps -->
<!-- Data Base Modules -->
<Project frameworkVersion="v4_5" name="OpenSim.Data.MySQL" path="OpenSim/Data/MySQL" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="MySql.Data" path="../../../bin/"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="obj" pattern="obj"/>
<Exclude name="Tests" pattern="Tests"/>
</Match>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.sql"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_5" name="OpenSim.Data.PGSQL" path="OpenSim/Data/PGSQL" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="Npgsql" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="Mono.Data.Sqlite"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="obj" pattern="obj"/>
<Exclude name="Tests" pattern="Tests"/>
</Match>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.sql"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v4_5" name="OpenSim.Region.ScriptEngine.Shared" path="OpenSim/Region/ScriptEngine/Shared" type="Library"> <Project frameworkVersion="v4_5" name="OpenSim.Region.ScriptEngine.Shared" path="OpenSim/Region/ScriptEngine/Shared" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>