From 0a83fde85c8cffa1da46ef0a17390399ae74fa61 Mon Sep 17 00:00:00 2001
From: Jonathan Freedman
Date: Sun, 29 Aug 2010 21:28:31 -0400
Subject: Implements parcel media setting persistence and packet / CAPS
 handling properly for the new media settings.

Signed-off-by: Melanie <melanie@t-data.com>
---
 OpenSim/Data/MySQL/MySQLLegacyRegionData.cs        | 22 ++++++++++++++++++++--
 .../Data/MySQL/Resources/RegionStore.migrations    | 14 ++++++++++++--
 2 files changed, 32 insertions(+), 4 deletions(-)

(limited to 'OpenSim/Data/MySQL')

diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index 37d7a88..04446ce 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -677,7 +677,8 @@ namespace OpenSim.Data.MySQL
                             "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
                             "UserLocationX, UserLocationY, UserLocationZ, " +
                             "UserLookAtX, UserLookAtY, UserLookAtZ, " +
-                            "AuthbuyerID, OtherCleanTime, Dwell) values (" +
+                            "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
+							"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
                             "?UUID, ?RegionUUID, " +
                             "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
                             "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@@ -687,7 +688,8 @@ namespace OpenSim.Data.MySQL
                             "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
                             "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
                             "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
-                            "?AuthbuyerID, ?OtherCleanTime, ?Dwell)";
+                            "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
+							"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
 
                         FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
 
@@ -1347,6 +1349,14 @@ namespace OpenSim.Data.MySQL
                 m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
             }
 
+			newData.MediaDescription = (string) row["MediaDescription"];
+			newData.MediaType = (string) row["MediaType"];
+			newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
+			newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
+			newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
+			newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
+			newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
+
             newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
 
             return newData;
@@ -1651,6 +1661,14 @@ namespace OpenSim.Data.MySQL
             cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
             cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
             cmd.Parameters.AddWithValue("Dwell", land.Dwell);
+            cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
+            cmd.Parameters.AddWithValue("MediaType", land.MediaType);
+            cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
+            cmd.Parameters.AddWithValue("MediaHeight", land.MediaHeight);
+            cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
+            cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
+            cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
+
         }
 
         /// <summary>
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index 1369704..1405207 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -801,9 +801,19 @@ ALTER TABLE `regionwindlight`  CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` F
 COMMIT;
 
 :VERSION 35         #---------------------
--- Added post 0.7
 
 BEGIN;
 ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
 ALTER TABLE primshapes ADD COLUMN Media TEXT;
-COMMIT;
\ No newline at end of file
+COMMIT;
+
+:VERSION 36         #---------------------
+
+BEGIN;
+ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ;
+ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
+ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
+ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
+ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
+ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
+COMMIT;
-- 
cgit v1.1