From d32debe6184b1d6575b97541b98c520a8c4360c1 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 11 Dec 2017 23:58:27 +0000
Subject: commit what i did so far for core mutes module, befere i lose it
---
OpenSim/Data/IMuteListData.cs | 44 ++++++++++++++
OpenSim/Data/MySQL/MySQLMuteListData.cs | 67 ++++++++++++++++++++++
.../Data/MySQL/Resources/MuteListStore.migrations | 16 ++++++
3 files changed, 127 insertions(+)
create mode 100644 OpenSim/Data/IMuteListData.cs
create mode 100644 OpenSim/Data/MySQL/MySQLMuteListData.cs
create mode 100644 OpenSim/Data/MySQL/Resources/MuteListStore.migrations
(limited to 'OpenSim/Data')
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 @@
+/*
+ * 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
+{
+ ///
+ /// An interface for connecting to the Mute List datastore
+ ///
+ public interface IMuteListData
+ {
+ bool Store(MuteData data);
+ MuteData[] Get(UUID agentID);
+ bool Delete(UUID agentID, UUID muteID, string muteName);
+ }
+}
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 @@
+/*
+ * 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, 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;
+ }
+ }
+ }
+}
\ 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 @@
+: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;
--
cgit v1.1