aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-12-12 22:19:31 +0000
committerUbitUmarov2017-12-12 22:19:31 +0000
commitab0f866087f1565863ac516820761cb48386f96e (patch)
treee15b415a9feee5f042f4ca7f8d9eb05f536fddad /OpenSim
parentMerge branch 'master' into httptests (diff)
parent commit what i did so far for core mutes module, befere i lose it (diff)
downloadopensim-SC-ab0f866087f1565863ac516820761cb48386f96e.zip
opensim-SC-ab0f866087f1565863ac516820761cb48386f96e.tar.gz
opensim-SC-ab0f866087f1565863ac516820761cb48386f96e.tar.bz2
opensim-SC-ab0f866087f1565863ac516820761cb48386f96e.tar.xz
Merge branch 'master' into httptests
# Conflicts: # prebuild.xml
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/IMuteListData.cs44
-rw-r--r--OpenSim/Data/MySQL/MySQLMuteListData.cs67
-rw-r--r--OpenSim/Data/MySQL/Resources/MuteListStore.migrations16
-rw-r--r--OpenSim/Data/MySQL/Resources/XMute.migrations16
-rw-r--r--OpenSim/Framework/Crc32.cs139
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/MuteData.cs41
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs35
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModuleTst.cs229
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/XMuteModule.cs239
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/LocalMuteListServiceConnector.cs180
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs43
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
-rw-r--r--OpenSim/Services/Interfaces/IMuteLIstService.cs41
-rw-r--r--OpenSim/Services/MuteListService/MuteListService.cs127
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs4
21 files changed, 1231 insertions, 28 deletions
diff --git a/OpenSim/Data/IMuteListData.cs b/OpenSim/Data/IMuteListData.cs
new file mode 100644
index 0000000..b0235b2
--- /dev/null
+++ b/OpenSim/Data/IMuteListData.cs
@@ -0,0 +1,44 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Data
34{
35 /// <summary>
36 /// An interface for connecting to the Mute List datastore
37 /// </summary>
38 public interface IMuteListData
39 {
40 bool Store(MuteData data);
41 MuteData[] Get(UUID agentID);
42 bool Delete(UUID agentID, UUID muteID, string muteName);
43 }
44}
diff --git a/OpenSim/Data/MySQL/MySQLMuteListData.cs b/OpenSim/Data/MySQL/MySQLMuteListData.cs
new file mode 100644
index 0000000..a5935a3
--- /dev/null
+++ b/OpenSim/Data/MySQL/MySQLMuteListData.cs
@@ -0,0 +1,67 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Data;
32using OpenMetaverse;
33using OpenSim.Framework;
34using MySql.Data.MySqlClient;
35
36namespace OpenSim.Data.MySQL
37{
38 public class MySqlMuteListData : MySQLGenericTableHandler<MuteData>, IMuteListData
39 {
40 public MySqlMuteListData(string connectionString)
41 : base(connectionString, "MuteList", "MuteListStore")
42 {
43 }
44
45 public MuteData[] Get(UUID agentID)
46 {
47 MuteData[] data = base.Get("AgentID", agentID.ToString());
48 return data;
49 }
50
51 public bool Delete(UUID agentID, UUID muteID, string muteName)
52 {
53 string cmnd ="delete from MuteList where AgentID = ?AgentID and MuteID = ?MuteID and MuteName = ?MuteName";
54
55 using (MySqlCommand cmd = new MySqlCommand(cmnd))
56 {
57 cmd.Parameters.AddWithValue("?AgentID", agentID.ToString());
58 cmd.Parameters.AddWithValue("?MuteID", muteID.ToString());
59 cmd.Parameters.AddWithValue("?MuteName", muteName);
60
61 if (ExecuteNonQuery(cmd) > 0)
62 return true;
63 return false;
64 }
65 }
66 }
67} \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/Resources/MuteListStore.migrations b/OpenSim/Data/MySQL/Resources/MuteListStore.migrations
new file mode 100644
index 0000000..5bde63e
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/MuteListStore.migrations
@@ -0,0 +1,16 @@
1:VERSION 1
2
3BEGIN;
4
5CREATE TABLE `MuteList` (
6 `AgentID` char(36) NOT NULL,
7 `MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
8 `MuteName` varchar(64) NOT NULL DEFAULT '',
9 `MuteType` int(11) NOT NULL DEFAULT '1',
10 `MuteFlags` int(11) NOT NULL DEFAULT '0',
11 `Stamp` int(11) NOT NULL,
12 UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`),
13 KEY `AgentID` (`AgentID`)
14);
15
16COMMIT;
diff --git a/OpenSim/Data/MySQL/Resources/XMute.migrations b/OpenSim/Data/MySQL/Resources/XMute.migrations
new file mode 100644
index 0000000..4ac7f82
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/XMute.migrations
@@ -0,0 +1,16 @@
1:VERSION 1
2
3BEGIN;
4
5CREATE TABLE `XMute` (
6 `AgentID` char(36) NOT NULL,
7 `MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
8 `MuteName` varchar(64) NOT NULL DEFAULT '',
9 `MuteType` int(11) NOT NULL DEFAULT '1',
10 `MuteFlags` int(11) NOT NULL DEFAULT '0',
11 `Stamp` int(11) NOT NULL,
12 UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`),
13 KEY `AgentID` (`AgentID`)
14);
15
16COMMIT;
diff --git a/OpenSim/Framework/Crc32.cs b/OpenSim/Framework/Crc32.cs
new file mode 100644
index 0000000..7ad1566
--- /dev/null
+++ b/OpenSim/Framework/Crc32.cs
@@ -0,0 +1,139 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Security.Cryptography;
30
31namespace OpenSim.Framework
32{
33 // this is more generic than openmetaverse CRC32
34
35 public class Crc32 : HashAlgorithm
36 {
37 public const UInt32 DefaultPolynomial = 0xedb88320;
38 public const UInt32 DefaultSeed = 0xffffffff;
39
40 private UInt32 hash;
41 private UInt32 seed;
42 private UInt32[] table;
43 private static UInt32[] defaultTable;
44
45 public Crc32()
46 {
47 table = InitializeTable(DefaultPolynomial);
48 seed = DefaultSeed;
49 Initialize();
50 }
51
52 public Crc32(UInt32 polynomial, UInt32 seed)
53 {
54 table = InitializeTable(polynomial);
55 this.seed = seed;
56 Initialize();
57 }
58
59 public override void Initialize()
60 {
61 hash = seed;
62 }
63
64 protected override void HashCore(byte[] buffer, int start, int length)
65 {
66 hash = CalculateHash(table, hash, buffer, start, length);
67 }
68
69 protected override byte[] HashFinal()
70 {
71 byte[] hashBuffer = UInt32ToBigEndianBytes(~hash);
72 this.HashValue = hashBuffer;
73 return hashBuffer;
74 }
75
76 public override int HashSize
77 {
78 get { return 32; }
79 }
80
81 public static UInt32 Compute(byte[] buffer)
82 {
83 return ~CalculateHash(InitializeTable(DefaultPolynomial), DefaultSeed, buffer, 0, buffer.Length);
84 }
85
86 public static UInt32 Compute(UInt32 seed, byte[] buffer)
87 {
88 return ~CalculateHash(InitializeTable(DefaultPolynomial), seed, buffer, 0, buffer.Length);
89 }
90
91 public static UInt32 Compute(UInt32 polynomial, UInt32 seed, byte[] buffer)
92 {
93 return ~CalculateHash(InitializeTable(polynomial), seed, buffer, 0, buffer.Length);
94 }
95
96 private static UInt32[] InitializeTable(UInt32 polynomial)
97 {
98 if (polynomial == DefaultPolynomial && defaultTable != null)
99 return defaultTable;
100
101 UInt32[] createTable = new UInt32[256];
102 for (int i = 0; i < 256; i++)
103 {
104 UInt32 entry = (UInt32)i;
105 for (int j = 0; j < 8; j++)
106 if ((entry & 1) == 1)
107 entry = (entry >> 1) ^ polynomial;
108 else
109 entry = entry >> 1;
110 createTable[i] = entry;
111 }
112
113 if (polynomial == DefaultPolynomial)
114 defaultTable = createTable;
115
116 return createTable;
117 }
118
119 private static UInt32 CalculateHash(UInt32[] table, UInt32 seed, byte[] buffer, int start, int size)
120 {
121 UInt32 crc = seed;
122 for (int i = start; i < size; i++)
123 unchecked
124 {
125 crc = (crc >> 8) ^ table[buffer[i] ^ crc & 0xff];
126 }
127 return crc;
128 }
129
130 private byte[] UInt32ToBigEndianBytes(UInt32 x)
131 {
132 return new byte[] {
133 (byte)((x >> 24) & 0xff),
134 (byte)((x >> 16) & 0xff),
135 (byte)((x >> 8) & 0xff),
136 (byte)(x & 0xff) };
137 }
138 }
139}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 5ca8c88..a9044d5 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1485,7 +1485,7 @@ namespace OpenSim.Framework
1485 void SendUserInfoReply(bool imViaEmail, bool visible, string email); 1485 void SendUserInfoReply(bool imViaEmail, bool visible, string email);
1486 1486
1487 void SendUseCachedMuteList(); 1487 void SendUseCachedMuteList();
1488 1488 void SendEmpytMuteList();
1489 void SendMuteListUpdate(string filename); 1489 void SendMuteListUpdate(string filename);
1490 1490
1491 void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals); 1491 void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals);
diff --git a/OpenSim/Framework/MuteData.cs b/OpenSim/Framework/MuteData.cs
new file mode 100644
index 0000000..7c946d6
--- /dev/null
+++ b/OpenSim/Framework/MuteData.cs
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public class MuteData
33 {
34 public UUID AgentID;
35 public UUID MuteID;
36 public string MuteName;
37 public int MuteType;
38 public int MuteFlags;
39 public int Stamp;
40 }
41}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 4a76ffc..2ff6ced 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2307,11 +2307,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2307 OutPacket(remove, ThrottleOutPacketType.Asset); 2307 OutPacket(remove, ThrottleOutPacketType.Asset);
2308 } 2308 }
2309 2309
2310/*
2311 private uint adjustControls(int input)
2312 {
2313 uint ret = (uint)input;
2314 uint masked = ret & 0x0f;
2315 masked <<= 19;
2316 ret |= masked;
2317 return ret;
2318 }
2319*/
2320
2310 public void SendTakeControls(int controls, bool passToAgent, bool TakeControls) 2321 public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
2311 { 2322 {
2312 ScriptControlChangePacket scriptcontrol = (ScriptControlChangePacket)PacketPool.Instance.GetPacket(PacketType.ScriptControlChange); 2323 ScriptControlChangePacket scriptcontrol = (ScriptControlChangePacket)PacketPool.Instance.GetPacket(PacketType.ScriptControlChange);
2313 ScriptControlChangePacket.DataBlock[] data = new ScriptControlChangePacket.DataBlock[1]; 2324 ScriptControlChangePacket.DataBlock[] data = new ScriptControlChangePacket.DataBlock[1];
2314 ScriptControlChangePacket.DataBlock ddata = new ScriptControlChangePacket.DataBlock(); 2325 ScriptControlChangePacket.DataBlock ddata = new ScriptControlChangePacket.DataBlock();
2326// ddata.Controls = adjustControls(controls);
2315 ddata.Controls = (uint)controls; 2327 ddata.Controls = (uint)controls;
2316 ddata.PassToAgent = passToAgent; 2328 ddata.PassToAgent = passToAgent;
2317 ddata.TakeControls = TakeControls; 2329 ddata.TakeControls = TakeControls;
@@ -3762,6 +3774,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3762 OutPacket(useCachedMuteList, ThrottleOutPacketType.Task); 3774 OutPacket(useCachedMuteList, ThrottleOutPacketType.Task);
3763 } 3775 }
3764 3776
3777 public void SendEmpytMuteList()
3778 {
3779 GenericMessagePacket gmp = new GenericMessagePacket();
3780
3781 gmp.AgentData.AgentID = AgentId;
3782 gmp.AgentData.SessionID = m_sessionId;
3783 gmp.AgentData.TransactionID = UUID.Zero;
3784
3785 gmp.MethodData.Method = Util.StringToBytes256("emptymutelist");
3786 gmp.ParamList = new GenericMessagePacket.ParamListBlock[1];
3787 gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
3788 gmp.ParamList[0].Parameter = new byte[0];
3789
3790 OutPacket(gmp, ThrottleOutPacketType.Task);
3791 }
3792
3765 public void SendMuteListUpdate(string filename) 3793 public void SendMuteListUpdate(string filename)
3766 { 3794 {
3767 MuteListUpdatePacket muteListUpdate = (MuteListUpdatePacket)PacketPool.Instance.GetPacket(PacketType.MuteListUpdate); 3795 MuteListUpdatePacket muteListUpdate = (MuteListUpdatePacket)PacketPool.Instance.GetPacket(PacketType.MuteListUpdate);
@@ -11008,9 +11036,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11008 } 11036 }
11009 else 11037 else
11010 { 11038 {
11011 SendUseCachedMuteList(); 11039 if(muteListRequest.MuteData.MuteCRC == 0)
11040 SendEmpytMuteList();
11041 else
11042 SendUseCachedMuteList();
11012 } 11043 }
11013 return true; 11044 return true;
11014 } 11045 }
11015 11046
11016 private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet) 11047 private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet)
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModuleTst.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModuleTst.cs
new file mode 100644
index 0000000..6857f35
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModuleTst.cs
@@ -0,0 +1,229 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Reflection;
30using System.Text;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Servers;
36using OpenSim.Framework.Client;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using Mono.Addins;
40
41using OpenSim.Server.Base;
42using OpenSim.Services.Interfaces;
43
44namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
45{
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MuteListModuleTst")]
47 public class MuteListModuleTst : ISharedRegionModule
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType);
51
52 protected bool m_Enabled = false;
53 protected List<Scene> m_SceneList = new List<Scene>();
54 protected IMuteListService m_service = null;
55
56 public void Initialise(IConfigSource config)
57 {
58 IConfig cnf = config.Configs["Messaging"];
59 if (cnf == null)
60 return;
61
62 if (cnf.GetString("MuteListModule", "None") != "MuteListModuleTst")
63 return;
64
65 m_Enabled = true;
66 }
67
68 public void AddRegion(Scene scene)
69 {
70 }
71
72 public void RegionLoaded(Scene scene)
73 {
74 if (!m_Enabled)
75 return;
76
77 IXfer xfer = scene.RequestModuleInterface<IXfer>();
78 if (xfer == null)
79 {
80 m_log.ErrorFormat("[MuteListModuleTst]: Xfer not availble in region {0}. Module Disabled", scene.Name);
81 m_Enabled = false;
82 return;
83 }
84
85 IMuteListService srv = scene.RequestModuleInterface<IMuteListService>();
86 if(srv == null)
87 {
88 m_log.ErrorFormat("[MuteListModuleTst]: MuteListService not availble in region {0}. Module Disabled", scene.Name);
89 m_Enabled = false;
90 return;
91 }
92 lock (m_SceneList)
93 {
94 if(m_service == null)
95 m_service = srv;
96 m_SceneList.Add(scene);
97 scene.EventManager.OnNewClient += OnNewClient;
98 }
99 }
100
101 public void RemoveRegion(Scene scene)
102 {
103 lock (m_SceneList)
104 {
105 if(m_SceneList.Contains(scene))
106 {
107 m_SceneList.Remove(scene);
108 scene.EventManager.OnNewClient -= OnNewClient;
109 }
110 }
111 }
112
113 public void PostInitialise()
114 {
115 if (!m_Enabled)
116 return;
117
118 m_log.Debug("[MuteListModuleTst]: enabled");
119 }
120
121 public string Name
122 {
123 get { return "MuteListModuleTst"; }
124 }
125
126 public Type ReplaceableInterface
127 {
128 get { return null; }
129 }
130
131 public void Close()
132 {
133 }
134
135 private void OnNewClient(IClientAPI client)
136 {
137 client.OnMuteListRequest += OnMuteListRequest;
138 client.OnUpdateMuteListEntry += OnUpdateMuteListEntry;
139 client.OnRemoveMuteListEntry += OnRemoveMuteListEntry;
140 }
141
142 private void OnMuteListRequest(IClientAPI client, uint crc)
143 {
144 if (!m_Enabled)
145 {
146 if(crc == 0)
147 client.SendEmpytMuteList();
148 else
149 client.SendUseCachedMuteList();
150 return;
151 }
152
153 IXfer xfer = client.Scene.RequestModuleInterface<IXfer>();
154 if (xfer == null)
155 {
156 if(crc == 0)
157 client.SendEmpytMuteList();
158 else
159 client.SendUseCachedMuteList();
160 return;
161 }
162
163 Byte[] data = m_service.MuteListRequest(client.AgentId, crc);
164 if (data == null)
165 {
166 if(crc == 0)
167 client.SendEmpytMuteList();
168 else
169 client.SendUseCachedMuteList();
170 return;
171 }
172
173 if (data.Length == 0)
174 {
175 client.SendEmpytMuteList();
176 return;
177 }
178
179 if (data.Length == 1)
180 {
181 if(crc == 0)
182 client.SendEmpytMuteList();
183 else
184 client.SendUseCachedMuteList();
185 return;
186 }
187
188 string filename = "mutes" + client.AgentId.ToString();
189 xfer.AddNewFile(filename, data);
190 client.SendMuteListUpdate(filename);
191 }
192
193 private void OnUpdateMuteListEntry(IClientAPI client, UUID muteID, string muteName, int muteType, uint muteFlags)
194 {
195 if (!m_Enabled)
196 return;
197
198 UUID agentID = client.AgentId;
199 if(muteType == 1) // agent
200 {
201 if(agentID == muteID)
202 return;
203 if(m_SceneList[0].Permissions.IsAdministrator(muteID))
204 {
205 OnMuteListRequest(client, 0);
206 return;
207 }
208 }
209
210 MuteData mute = new MuteData();
211 mute.AgentID = agentID;
212 mute.MuteID = muteID;
213 mute.MuteName = muteName;
214 mute.MuteType = muteType;
215 mute.MuteFlags = (int)muteFlags;
216 mute.Stamp = Util.UnixTimeSinceEpoch();
217
218 m_service.UpdateMute(mute);
219 }
220
221 private void OnRemoveMuteListEntry(IClientAPI client, UUID muteID, string muteName)
222 {
223 if (!m_Enabled)
224 return;
225 m_service.RemoveMute(client.AgentId, muteID, muteName);
226 }
227 }
228}
229
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/XMuteModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/XMuteModule.cs
new file mode 100644
index 0000000..b61e848
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/XMuteModule.cs
@@ -0,0 +1,239 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Reflection;
30using System.Text;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes;
37using Mono.Addins;
38using OpenSim.Data.MySQL;
39using MySql.Data.MySqlClient;
40
41
42namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMute")]
45 public class XMuteModule : ISharedRegionModule
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 protected bool m_Enabled = true;
51 protected List<Scene> m_SceneList = new List<Scene>();
52 protected MuteTableHandler m_MuteTable;
53 protected string m_DatabaseConnect;
54
55 public void Initialise(IConfigSource config)
56 {
57 IConfig cnf = config.Configs["Messaging"];
58 if (cnf == null)
59 {
60 m_Enabled = false;
61 return;
62 }
63
64 if (cnf.GetString("MuteListModule", "None") !=
65 "XMute")
66 {
67 m_Enabled = false;
68 return;
69 }
70
71 m_DatabaseConnect = cnf.GetString("MuteDatabaseConnect", String.Empty);
72 if (m_DatabaseConnect == String.Empty)
73 {
74 m_log.Debug("[XMute]: MuteDatabaseConnect missing or empty");
75 m_Enabled = false;
76 return;
77 }
78
79 m_MuteTable = new MuteTableHandler(
80 m_DatabaseConnect, "XMute", String.Empty);
81 }
82
83 public void AddRegion(Scene scene)
84 {
85 if (!m_Enabled)
86 return;
87
88 lock (m_SceneList)
89 {
90 m_SceneList.Add(scene);
91
92 scene.EventManager.OnNewClient += OnNewClient;
93 }
94 }
95
96 public void RegionLoaded(Scene scene)
97 {
98 }
99
100 public void RemoveRegion(Scene scene)
101 {
102 if (!m_Enabled)
103 return;
104
105 lock (m_SceneList)
106 {
107 m_SceneList.Remove(scene);
108 }
109 }
110
111 public void PostInitialise()
112 {
113 if (!m_Enabled)
114 return;
115
116 m_log.Debug("[XMute]: Mute list enabled");
117 }
118
119 public string Name
120 {
121 get { return "XMuteModule"; }
122 }
123
124 public Type ReplaceableInterface
125 {
126 get { return null; }
127 }
128
129 public void Close()
130 {
131 }
132
133 private void OnNewClient(IClientAPI client)
134 {
135 client.OnMuteListRequest += OnMuteListRequest;
136 client.OnUpdateMuteListEntry += OnUpdateMuteListEntry;
137 client.OnRemoveMuteListEntry += OnRemoveMuteListEntry;
138 }
139
140 private void OnMuteListRequest(IClientAPI client, uint crc)
141 {
142 string filename = "mutes"+client.AgentId.ToString();
143
144 IXfer xfer = client.Scene.RequestModuleInterface<IXfer>();
145 if (xfer != null)
146 {
147 MuteData[] data = m_MuteTable.Get("AgentID", client.AgentId.ToString());
148 if (data == null || data.Length == 0)
149 {
150 xfer.AddNewFile(filename, new Byte[0]);
151 }
152 else
153 {
154 StringBuilder sb = new StringBuilder(1024);
155
156 foreach (MuteData d in data)
157 sb.AppendFormat("{0} {1} {2}|{3}\n",
158 d.MuteType,
159 d.MuteID.ToString(),
160 d.MuteName,
161 d.MuteFlags);
162
163 Byte[] filedata = Util.UTF8.GetBytes(sb.ToString());
164
165 uint dataCrc = Crc32.Compute(filedata);
166
167 if (dataCrc == crc)
168 {
169 client.SendUseCachedMuteList();
170 return;
171 }
172
173 xfer.AddNewFile(filename, filedata);
174 }
175
176 client.SendMuteListUpdate(filename);
177 }
178 }
179
180 private void OnUpdateMuteListEntry(IClientAPI client, UUID muteID, string muteName, int muteType, uint muteFlags)
181 {
182 MuteData mute = new MuteData();
183
184 mute.AgentID = client.AgentId;
185 mute.MuteID = muteID;
186 mute.MuteName = muteName;
187 mute.MuteType = muteType;
188 mute.MuteFlags = (int)muteFlags;
189 mute.Stamp = Util.UnixTimeSinceEpoch();
190
191 m_MuteTable.Store(mute);
192 }
193
194 private void OnRemoveMuteListEntry(IClientAPI client, UUID muteID, string muteName)
195 {
196 m_MuteTable.Delete(new string[] { "AgentID",
197 "MuteID",
198 "MuteName" },
199 new string[] { client.AgentId.ToString(),
200 muteID.ToString(),
201 muteName });
202 }
203 }
204
205 public class MuteTableHandler : MySQLGenericTableHandler<MuteData>
206 {
207 public MuteTableHandler(string conn, string realm, string m) : base(conn, realm, m)
208 {
209 }
210
211 public bool Delete(string[] fields, string[] val)
212 {
213 if (fields.Length != val.Length)
214 return false;
215
216 using (MySqlCommand cmd = new MySqlCommand())
217 {
218 string text = String.Format("delete from {0} where ", m_Realm);
219
220 List<string> terms = new List<string>();
221
222 for (int i = 0 ; i < fields.Length ; i++)
223 {
224 terms.Add(String.Format("{0} = ?{0}", fields[i]));
225 cmd.Parameters.AddWithValue("?" + fields[i], val[i]);
226 }
227
228 text += string.Join(" and ", terms.ToArray());
229
230 cmd.CommandText = text;
231
232 if (ExecuteNonQuery(cmd) > 0)
233 return true;
234 return false;
235 }
236 }
237 }
238}
239
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/LocalMuteListServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/LocalMuteListServiceConnector.cs
new file mode 100644
index 0000000..833d883
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/LocalMuteListServiceConnector.cs
@@ -0,0 +1,180 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using Mono.Addins;
30using Nini.Config;
31using System;
32using System.Collections.Generic;
33using System.Reflection;
34using OpenSim.Framework;
35using OpenSim.Server.Base;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
39using OpenMetaverse;
40
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
42{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalMuteListServicesConnector")]
44 public class LocalMuteListServicesConnector : ISharedRegionModule, IMuteListService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 private List<Scene> m_Scenes = new List<Scene>();
51 protected IMuteListService m_service = null;
52
53 private bool m_Enabled = false;
54
55 #region ISharedRegionModule
56
57 public Type ReplaceableInterface
58 {
59 get { return null; }
60 }
61
62 public string Name
63 {
64 get { return "LocalMuteListServicesConnector"; }
65 }
66
67 public void Initialise(IConfigSource source)
68 {
69 IConfig moduleConfig = source.Configs["Modules"];
70
71 if (moduleConfig == null)
72 return;
73
74 string name = moduleConfig.GetString("MuteListService", "");
75 if(name != Name)
76 return;
77
78 IConfig userConfig = source.Configs["MuteListService"];
79 if (userConfig == null)
80 {
81 m_log.Error("[MuteList LOCALCONNECTOR]: MuteListService missing from configuration");
82 return;
83 }
84
85 string serviceDll = userConfig.GetString("LocalServiceModule",
86 String.Empty);
87
88 if (serviceDll == String.Empty)
89 {
90 m_log.Error("[MuteList LOCALCONNECTOR]: No LocalServiceModule named in section MuteListService");
91 return;
92 }
93
94 Object[] args = new Object[] { source };
95 try
96 {
97 m_service = ServerUtils.LoadPlugin<IMuteListService>(serviceDll, args);
98 }
99 catch
100 {
101 m_log.Error("[MuteList LOCALCONNECTOR]: Failed to load mute service");
102 return;
103 }
104
105 if (m_service == null)
106 {
107 m_log.Error("[MuteList LOCALCONNECTOR]: Can't load MuteList service");
108 return;
109 }
110
111 m_Enabled = true;
112 m_log.Info("[MuteList LOCALCONNECTOR]: enabled");
113 }
114
115 public void Close()
116 {
117 }
118
119 public void AddRegion(Scene scene)
120 {
121 if (!m_Enabled)
122 return;
123
124 lock(m_Scenes)
125 {
126 m_Scenes.Add(scene);
127 scene.RegisterModuleInterface<IMuteListService>(this);
128 }
129 }
130
131 public void RegionLoaded(Scene scene)
132 {
133 }
134
135 public void PostInitialise()
136 {
137 }
138
139 public void RemoveRegion(Scene scene)
140 {
141 if (!m_Enabled)
142 return;
143
144 lock(m_Scenes)
145 {
146 if (m_Scenes.Contains(scene))
147 {
148 m_Scenes.Remove(scene);
149 scene.UnregisterModuleInterface<IMuteListService>(this);
150 }
151 }
152 }
153
154 #endregion ISharedRegionModule
155
156 #region IMuteListService
157 public Byte[] MuteListRequest(UUID agentID, uint crc)
158 {
159 if (!m_Enabled)
160 return null;
161 return m_service.MuteListRequest(agentID, crc);
162 }
163
164 public bool UpdateMute(MuteData mute)
165 {
166 if (!m_Enabled)
167 return false;
168 return m_service.UpdateMute(mute);
169 }
170
171 public bool RemoveMute(UUID agentID, UUID muteID, string muteName)
172 {
173 if (!m_Enabled)
174 return false;
175 return m_service.RemoveMute(agentID, muteID, muteName);
176 }
177
178 #endregion IMuteListService
179 }
180}
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
index 708286c..0b37179 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
@@ -38,18 +38,20 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
38{ 38{
39 public class ShadedMapTileRenderer : IMapTileTerrainRenderer 39 public class ShadedMapTileRenderer : IMapTileTerrainRenderer
40 { 40 {
41 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
42
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]"; 42 private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]";
45 43
46 private Scene m_scene; 44 private Scene m_scene;
47 //private IConfigSource m_config; // not used currently 45 private IConfigSource m_config;
46 private Color m_color_water;
48 47
49 public void Initialise(Scene scene, IConfigSource config) 48 public void Initialise(Scene scene, IConfigSource config)
50 { 49 {
51 m_scene = scene; 50 m_scene = scene;
52 // m_config = config; // not used currently 51 m_config = config;
52
53 string[] configSections = new string[] { "Map", "Startup" };
54 m_color_water = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColorWater", configSections, "#1D475F"));
53 } 55 }
54 56
55 public void TerrainToBitmap(Bitmap mapbmp) 57 public void TerrainToBitmap(Bitmap mapbmp)
@@ -231,7 +233,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
231 233
232 try 234 try
233 { 235 {
234 mapbmp.SetPixel(x, yr, WATER_COLOR); 236 mapbmp.SetPixel(x, yr, m_color_water);
235 } 237 }
236 catch (ArgumentException) 238 catch (ArgumentException)
237 { 239 {
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index 4b3ee18..c71f5c0 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -130,21 +130,19 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
130 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank"). 130 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank").
131 // The color-values were choosen because they "look right" (at least to me) ;-) 131 // The color-values were choosen because they "look right" (at least to me) ;-)
132 private static readonly UUID defaultTerrainTexture1 = new UUID("0bc58228-74a0-7e83-89bc-5c23464bcec5"); 132 private static readonly UUID defaultTerrainTexture1 = new UUID("0bc58228-74a0-7e83-89bc-5c23464bcec5");
133 private static readonly Color defaultColor1 = Color.FromArgb(165, 137, 118);
134 private static readonly UUID defaultTerrainTexture2 = new UUID("63338ede-0037-c4fd-855b-015d77112fc8"); 133 private static readonly UUID defaultTerrainTexture2 = new UUID("63338ede-0037-c4fd-855b-015d77112fc8");
135 private static readonly Color defaultColor2 = Color.FromArgb(69, 89, 49);
136 private static readonly UUID defaultTerrainTexture3 = new UUID("303cd381-8560-7579-23f1-f0a880799740"); 134 private static readonly UUID defaultTerrainTexture3 = new UUID("303cd381-8560-7579-23f1-f0a880799740");
137 private static readonly Color defaultColor3 = Color.FromArgb(162, 154, 141);
138 private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c"); 135 private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
139 private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
140
141 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
142 136
143 #endregion 137 #endregion
144 138
145
146 private Scene m_scene; 139 private Scene m_scene;
147 // private IConfigSource m_config; // not used currently 140 private IConfigSource m_config;
141 private Color m_color_water;
142 private Color m_color_1;
143 private Color m_color_2;
144 private Color m_color_3;
145 private Color m_color_4;
148 146
149 // mapping from texture UUIDs to averaged color. This will contain 5-9 values, in general; new values are only 147 // mapping from texture UUIDs to averaged color. This will contain 5-9 values, in general; new values are only
150 // added when the terrain textures are changed in the estate dialog and a new map is generated (and will stay in 148 // 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
156 public void Initialise(Scene scene, IConfigSource source) 154 public void Initialise(Scene scene, IConfigSource source)
157 { 155 {
158 m_scene = scene; 156 m_scene = scene;
159 // m_config = source; // not used currently 157 m_config = source;
158
159 string[] configSections = new string[] { "Map", "Startup" };
160
161 m_color_water = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColorWater", configSections, "#1D475F"));
162 m_color_1 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor1", configSections, "#A58976"));
163 m_color_2 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor2", configSections, "#455931"));
164 m_color_3 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor3", configSections, "#A29A8D"));
165 m_color_4 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor4", configSections, "#C8C8C8"));
166
160 m_mapping = new Dictionary<UUID,Color>(); 167 m_mapping = new Dictionary<UUID,Color>();
161 m_mapping.Add(defaultTerrainTexture1, defaultColor1); 168 m_mapping.Add(defaultTerrainTexture1, m_color_1);
162 m_mapping.Add(defaultTerrainTexture2, defaultColor2); 169 m_mapping.Add(defaultTerrainTexture2, m_color_2);
163 m_mapping.Add(defaultTerrainTexture3, defaultColor3); 170 m_mapping.Add(defaultTerrainTexture3, m_color_3);
164 m_mapping.Add(defaultTerrainTexture4, defaultColor4); 171 m_mapping.Add(defaultTerrainTexture4, m_color_4);
165 m_mapping.Add(Util.BLANK_TEXTURE_UUID, Color.White); 172 m_mapping.Add(Util.BLANK_TEXTURE_UUID, Color.White);
166 } 173 }
167 174
@@ -298,10 +305,10 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
298 RegionSettings settings = m_scene.RegionInfo.RegionSettings; 305 RegionSettings settings = m_scene.RegionInfo.RegionSettings;
299 306
300 // the four terrain colors as HSVs for interpolation 307 // the four terrain colors as HSVs for interpolation
301 HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, defaultColor1)); 308 HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, m_color_1));
302 HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, defaultColor2)); 309 HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, m_color_2));
303 HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, defaultColor3)); 310 HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, m_color_3));
304 HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, defaultColor4)); 311 HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, m_color_4));
305 312
306 float levelNElow = (float)settings.Elevation1NE; 313 float levelNElow = (float)settings.Elevation1NE;
307 float levelNEhigh = (float)settings.Elevation2NE; 314 float levelNEhigh = (float)settings.Elevation2NE;
@@ -417,7 +424,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
417 424
418 heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0 425 heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0
419 426
420 mapbmp.SetPixel(x, yr, WATER_COLOR); 427 mapbmp.SetPixel(x, yr, m_color_water);
421 } 428 }
422 } 429 }
423 } 430 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c06b3dd..c223aae 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4632,10 +4632,10 @@ Label_GroupsDone:
4632 /// <param name='agentID'></param> 4632 /// <param name='agentID'></param>
4633 protected virtual ScenePresence WaitGetScenePresence(UUID agentID) 4633 protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
4634 { 4634 {
4635 int ntimes = 30; 4635 int ntimes = 120; // 30s
4636 ScenePresence sp = null; 4636 ScenePresence sp = null;
4637 while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) 4637 while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0))
4638 Thread.Sleep(1000); 4638 Thread.Sleep(250);
4639 4639
4640 if (sp == null) 4640 if (sp == null)
4641 m_log.WarnFormat( 4641 m_log.WarnFormat(
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index d39c224..469dd67 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1702,6 +1702,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1702 1702
1703 } 1703 }
1704 1704
1705 public void SendEmpytMuteList()
1706 {
1707
1708 }
1709
1705 public void SendMuteListUpdate(string filename) 1710 public void SendMuteListUpdate(string filename)
1706 { 1711 {
1707 1712
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 151a202..bb23f2f 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -1314,6 +1314,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1314 { 1314 {
1315 } 1315 }
1316 1316
1317 public void SendEmpytMuteList()
1318 {
1319 }
1320
1317 public void SendMuteListUpdate(string filename) 1321 public void SendMuteListUpdate(string filename)
1318 { 1322 {
1319 } 1323 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fa32986..d36d9a0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6639,11 +6639,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6639 /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object 6639 /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object
6640 /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the 6640 /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the
6641 /// current parcel. 6641 /// current parcel.
6642 /// AGENT_LIST_EXCLUDENPC ignore NPCs (bit mask)
6642 /// </summary> 6643 /// </summary>
6643 public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) 6644 public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
6644 { 6645 {
6645 m_host.AddScriptLPS(1); 6646 m_host.AddScriptLPS(1);
6646 6647
6648 // do our bit masks part
6649 bool noNPC = (scope & ScriptBaseClass.AGENT_LIST_EXCLUDENPC) !=0;
6650
6651 // remove bit masks part
6652 scope &= ~ ScriptBaseClass.AGENT_LIST_EXCLUDENPC;
6653
6647 // the constants are 1, 2 and 4 so bits are being set, but you 6654 // the constants are 1, 2 and 4 so bits are being set, but you
6648 // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4 6655 // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
6649 bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION; 6656 bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
@@ -6684,6 +6691,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6684 World.ForEachRootScenePresence( 6691 World.ForEachRootScenePresence(
6685 delegate (ScenePresence ssp) 6692 delegate (ScenePresence ssp)
6686 { 6693 {
6694 if(noNPC && ssp.IsNPC)
6695 return;
6696
6687 // Gods are not listed in SL 6697 // Gods are not listed in SL
6688 if (!ssp.IsDeleted && !ssp.IsViewerUIGod && !ssp.IsChildAgent) 6698 if (!ssp.IsDeleted && !ssp.IsViewerUIGod && !ssp.IsChildAgent)
6689 { 6699 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index e4c1ca0..2f249a7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -660,6 +660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
660 public const int AGENT_LIST_PARCEL = 1; 660 public const int AGENT_LIST_PARCEL = 1;
661 public const int AGENT_LIST_PARCEL_OWNER = 2; 661 public const int AGENT_LIST_PARCEL_OWNER = 2;
662 public const int AGENT_LIST_REGION = 4; 662 public const int AGENT_LIST_REGION = 4;
663 public const int AGENT_LIST_EXCLUDENPC = 0x4000000; // our flag, not SL and it is a bit mask
663 664
664 // Can not be public const? 665 // Can not be public const?
665 public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); 666 public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
diff --git a/OpenSim/Services/Interfaces/IMuteLIstService.cs b/OpenSim/Services/Interfaces/IMuteLIstService.cs
new file mode 100644
index 0000000..9ffd47f
--- /dev/null
+++ b/OpenSim/Services/Interfaces/IMuteLIstService.cs
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenSim.Framework;
31using OpenMetaverse;
32
33namespace OpenSim.Services.Interfaces
34{
35 public interface IMuteListService
36 {
37 Byte[] MuteListRequest(UUID agent, uint crc);
38 bool UpdateMute(MuteData mute);
39 bool RemoveMute(UUID agentID, UUID muteID, string muteName);
40 }
41} \ No newline at end of file
diff --git a/OpenSim/Services/MuteListService/MuteListService.cs b/OpenSim/Services/MuteListService/MuteListService.cs
new file mode 100644
index 0000000..7e5ded1
--- /dev/null
+++ b/OpenSim/Services/MuteListService/MuteListService.cs
@@ -0,0 +1,127 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Text;
30using OpenMetaverse;
31using log4net;
32using Nini.Config;
33using OpenSim.Services.Base;
34using OpenSim.Services.Interfaces;
35using OpenSim.Data;
36using OpenSim.Framework;
37
38namespace OpenSim.Services.EstateService
39{
40 public class MuteListService : ServiceBase, IMuteListService
41 {
42// private static readonly ILog m_log =
43// LogManager.GetLogger(
44// MethodBase.GetCurrentMethod().DeclaringType);
45
46 protected IMuteListData m_database;
47
48 public MuteListService(IConfigSource config)
49 : base(config)
50 {
51 string dllName = String.Empty;
52 string connString = String.Empty;
53
54 // Try reading the [DatabaseService] section, if it exists
55 IConfig dbConfig = config.Configs["DatabaseService"];
56 if (dbConfig != null)
57 {
58 dllName = dbConfig.GetString("StorageProvider", String.Empty);
59 connString = dbConfig.GetString("ConnectionString", String.Empty);
60 connString = dbConfig.GetString("MuteConnectionString", connString);
61 }
62
63 // Try reading the [MuteListStore] section, if it exists
64 IConfig muteConfig = config.Configs["MuteListStore"];
65 if (muteConfig != null)
66 {
67 dllName = muteConfig.GetString("StorageProvider", dllName);
68 connString = muteConfig.GetString("ConnectionString", connString);
69 }
70
71 // We tried, but this doesn't exist. We can't proceed
72 if (dllName == String.Empty)
73 throw new Exception("No StorageProvider configured");
74
75 m_database = LoadPlugin<IMuteListData>(dllName, new Object[] { connString });
76 if (m_database == null)
77 throw new Exception("Could not find a storage interface in the given module");
78 }
79
80 public Byte[] MuteListRequest(UUID agentID, uint crc)
81 {
82 if(m_database == null)
83 return null;
84
85 MuteData[] data = m_database.Get(agentID);
86 if (data == null || data.Length == 0)
87 return new Byte[0];
88
89 StringBuilder sb = new StringBuilder(16384);
90 foreach (MuteData d in data)
91 sb.AppendFormat("{0} {1} {2}|{3}\n",
92 d.MuteType,
93 d.MuteID.ToString(),
94 d.MuteName,
95 d.MuteFlags);
96
97 Byte[] filedata = Util.UTF8.GetBytes(sb.ToString());
98
99 uint dataCrc = Crc32.Compute(filedata);
100
101 if (dataCrc == crc)
102 {
103 if(crc == 0)
104 return new Byte[0];
105
106 Byte[] ret = new Byte[1] {1};
107 return ret;
108 }
109
110 return filedata;
111 }
112
113 public bool UpdateMute(MuteData mute)
114 {
115 if(m_database == null)
116 return false;
117 return m_database.Store(mute);
118 }
119
120 public bool RemoveMute(UUID agentID, UUID muteID, string muteName)
121 {
122 if(m_database == null)
123 return false;
124 return m_database.Delete(agentID, muteID, muteName);
125 }
126 }
127}
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index a835925..449716b 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -1315,6 +1315,10 @@ namespace OpenSim.Tests.Common
1315 { 1315 {
1316 } 1316 }
1317 1317
1318 public void SendEmpytMuteList()
1319 {
1320 }
1321
1318 public void SendMuteListUpdate(string filename) 1322 public void SendMuteListUpdate(string filename)
1319 { 1323 {
1320 } 1324 }