From 033a3da254d5acba8fff002bec921dc39752bff8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Jan 2010 23:30:38 +0000 Subject: [PATCH 01/21] Sqlite framework and generic handler. They compile. More I cannot say. --- OpenSim/Data/SQLite/SQLiteFramework.cs | 83 ++++++ .../Data/SQLite/SQLiteGenericTableHandler.cs | 253 ++++++++++++++++++ 2 files changed, 336 insertions(+) create mode 100644 OpenSim/Data/SQLite/SQLiteFramework.cs create mode 100644 OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs new file mode 100644 index 0000000000..12b2750d2d --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteFramework.cs @@ -0,0 +1,83 @@ +/* + * 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 Mono.Data.SqliteClient; + +namespace OpenSim.Data.SQLite +{ + /// + /// A database interface class to a user profile storage system + /// + public class SQLiteFramework + { + protected SqliteConnection m_Connection; + + protected SQLiteFramework(string connectionString) + { + m_Connection = new SqliteConnection(connectionString); + m_Connection.Open(); + } + + ////////////////////////////////////////////////////////////// + // + // All non queries are funneled through one connection + // to increase performance a little + // + protected int ExecuteNonQuery(SqliteCommand cmd) + { + lock (m_Connection) + { + cmd.Connection = m_Connection; + + return cmd.ExecuteNonQuery(); + } + } + + protected IDataReader ExecuteReader(SqliteCommand cmd) + { + SqliteConnection newConnection = + (SqliteConnection)((ICloneable)m_Connection).Clone(); + newConnection.Open(); + + cmd.Connection = newConnection; + return cmd.ExecuteReader(); + } + + protected void CloseReaderCommand(SqliteCommand cmd) + { + cmd.Connection.Close(); + cmd.Connection.Dispose(); + cmd.Dispose(); + } + } +} diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs new file mode 100644 index 0000000000..6b67ec6fd7 --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs @@ -0,0 +1,253 @@ +/* + * 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.Data; +using System.Reflection; +using log4net; +using Mono.Data.SqliteClient; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; + +namespace OpenSim.Data.SQLite +{ + public class SQLiteGenericTableHandler : SQLiteFramework where T: class, new() + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + + protected Dictionary m_Fields = + new Dictionary(); + + protected List m_ColumnNames = null; + protected string m_Realm; + protected FieldInfo m_DataField = null; + + public SQLiteGenericTableHandler(string connectionString, + string realm, string storeName) : base(connectionString) + { + m_Realm = realm; + if (storeName != String.Empty) + { + Assembly assem = GetType().Assembly; + + Migration m = new Migration(m_Connection, assem, storeName); + m.Update(); + } + + Type t = typeof(T); + FieldInfo[] fields = t.GetFields(BindingFlags.Public | + BindingFlags.Instance | + BindingFlags.DeclaredOnly); + + if (fields.Length == 0) + return; + + foreach (FieldInfo f in fields) + { + if (f.Name != "Data") + m_Fields[f.Name] = f; + else + m_DataField = f; + } + } + + private void CheckColumnNames(IDataReader reader) + { + if (m_ColumnNames != null) + return; + + m_ColumnNames = new List(); + + DataTable schemaTable = reader.GetSchemaTable(); + foreach (DataRow row in schemaTable.Rows) + { + if (row["ColumnName"] != null && + (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) + m_ColumnNames.Add(row["ColumnName"].ToString()); + } + } + + public T[] Get(string field, string key) + { + return Get(new string[] { field }, new string[] { key }); + } + + public T[] Get(string[] fields, string[] keys) + { + if (fields.Length != keys.Length) + return new T[0]; + + List terms = new List(); + + SqliteCommand cmd = new SqliteCommand(); + + for (int i = 0 ; i < fields.Length ; i++) + { + cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i])); + terms.Add("`" + fields[i] + "` = :" + fields[i]); + } + + string where = String.Join(" and ", terms.ToArray()); + + string query = String.Format("select * from {0} where {1}", + m_Realm, where); + + cmd.CommandText = query; + + return DoQuery(cmd); + } + + protected T[] DoQuery(SqliteCommand cmd) + { + IDataReader reader = ExecuteReader(cmd); + if (reader == null) + return new T[0]; + + CheckColumnNames(reader); + + List result = new List(); + + while (reader.Read()) + { + T row = new T(); + + foreach (string name in m_Fields.Keys) + { + if (m_Fields[name].GetValue(row) is bool) + { + int v = Convert.ToInt32(reader[name]); + m_Fields[name].SetValue(row, v != 0 ? true : false); + } + else if (m_Fields[name].GetValue(row) is UUID) + { + UUID uuid = UUID.Zero; + + UUID.TryParse(reader[name].ToString(), out uuid); + m_Fields[name].SetValue(row, uuid); + } + else if (m_Fields[name].GetValue(row) is int) + { + int v = Convert.ToInt32(reader[name]); + m_Fields[name].SetValue(row, v); + } + else + { + m_Fields[name].SetValue(row, reader[name]); + } + } + + if (m_DataField != null) + { + Dictionary data = + new Dictionary(); + + foreach (string col in m_ColumnNames) + { + data[col] = reader[col].ToString(); + if (data[col] == null) + data[col] = String.Empty; + } + + m_DataField.SetValue(row, data); + } + + result.Add(row); + } + + CloseReaderCommand(cmd); + + return result.ToArray(); + } + + public T[] Get(string where) + { + SqliteCommand cmd = new SqliteCommand(); + + string query = String.Format("select * from {0} where {1}", + m_Realm, where); + + cmd.CommandText = query; + + return DoQuery(cmd); + } + + public bool Store(T row) + { + SqliteCommand cmd = new SqliteCommand(); + + string query = ""; + List names = new List(); + List values = new List(); + + foreach (FieldInfo fi in m_Fields.Values) + { + names.Add(fi.Name); + values.Add(":" + fi.Name); + cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString())); + } + + if (m_DataField != null) + { + Dictionary data = + (Dictionary)m_DataField.GetValue(row); + + foreach (KeyValuePair kvp in data) + { + names.Add(kvp.Key); + values.Add(":" + kvp.Key); + cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value)); + } + } + + query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")"; + + cmd.CommandText = query; + + if (ExecuteNonQuery(cmd) > 0) + return true; + + return false; + } + + public bool Delete(string field, string val) + { + SqliteCommand cmd = new SqliteCommand(); + + cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field); + cmd.Parameters.Add(new SqliteParameter(field, val)); + + if (ExecuteNonQuery(cmd) > 0) + return true; + + return false; + } + } +} From 28ba16ee531a6d21f793845f897828e7b1b3fdca Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 00:35:54 +0000 Subject: [PATCH 02/21] Add the port of the XInventoryService for the new Sqlite framework --- OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 156 ++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 OpenSim/Data/SQLite/SQLiteXInventoryData.cs diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs new file mode 100644 index 0000000000..97625a74c5 --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -0,0 +1,156 @@ +/* + * 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.Data; +using System.Reflection; +using System.Collections.Generic; +using Mono.Data.SqliteClient; +using log4net; +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Data.SQLite +{ + /// + /// A MySQL Interface for the Asset Server + /// + public class SQLiteXInventoryData : IXInventoryData + { + private static readonly ILog m_log = LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private SQLiteGenericTableHandler m_Folders; + private SqliteItemHandler m_Items; + + public SQLiteXInventoryData(string conn, string realm) + { + m_Folders = new SQLiteGenericTableHandler( + conn, "inventoryfolders", "InventoryStore"); + m_Items = new SqliteItemHandler( + conn, "inventoryitems", String.Empty); + } + + public XInventoryFolder[] GetFolders(string[] fields, string[] vals) + { + return m_Folders.Get(fields, vals); + } + + public XInventoryItem[] GetItems(string[] fields, string[] vals) + { + return m_Items.Get(fields, vals); + } + + public bool StoreFolder(XInventoryFolder folder) + { + return m_Folders.Store(folder); + } + + public bool StoreItem(XInventoryItem item) + { + return m_Items.Store(item); + } + + public bool DeleteFolders(string field, string val) + { + return m_Folders.Delete(field, val); + } + + public bool DeleteItems(string field, string val) + { + return m_Items.Delete(field, val); + } + + public bool MoveItem(string id, string newParent) + { + return m_Items.MoveItem(id, newParent); + } + + public XInventoryItem[] GetActiveGestures(UUID principalID) + { + return m_Items.GetActiveGestures(principalID); + } + + public int GetAssetPermissions(UUID principalID, UUID assetID) + { + return m_Items.GetAssetPermissions(principalID, assetID); + } + } + + public class SqliteItemHandler : SQLiteGenericTableHandler + { + public SqliteItemHandler(string c, string t, string m) : + base(c, t, m) + { + } + + public bool MoveItem(string id, string newParent) + { + SqliteCommand cmd = new SqliteCommand(); + + cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm); + cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent)); + cmd.Parameters.Add(new SqliteParameter(":InventoryID", id)); + + return ExecuteNonQuery(cmd) == 0 ? false : true; + } + + public XInventoryItem[] GetActiveGestures(UUID principalID) + { + SqliteCommand cmd = new SqliteCommand(); + cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm); + + cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture)); + + return DoQuery(cmd); + } + + public int GetAssetPermissions(UUID principalID, UUID assetID) + { + SqliteCommand cmd = new SqliteCommand(); + + cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm); + cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString())); + + IDataReader reader = ExecuteReader(cmd); + + int perms = 0; + + while (reader.Read()) + { + perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]); + } + + reader.Close(); + CloseReaderCommand(cmd); + + return perms; + } + } +} From 4799f1ce9220eb9ff65ea81f1476f804b5e85144 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 03:13:19 +0000 Subject: [PATCH 03/21] Add the unfinished XInventoryConnector. Intermediate commit, will NOT compile! --- .../Inventory/XInventoryConnector.cs | 317 ++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs new file mode 100644 index 0000000000..6e1d65751a --- /dev/null +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -0,0 +1,317 @@ +/* + * 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 System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Nini.Config; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Services.Interfaces; +using OpenSim.Server.Base; +using OpenMetaverse; + +namespace OpenSim.Services.Connectors +{ + public class XInventoryServicesConnector : IInventoryService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private string m_ServerURI = String.Empty; + + public XInventoryServicesConnector() + { + } + + public XInventoryServicesConnector(string serverURI) + { + m_ServerURI = serverURI.TrimEnd('/'); + } + + public XInventoryServicesConnector(IConfigSource source) + { + Initialise(source); + } + + public virtual void Initialise(IConfigSource source) + { + IConfig assetConfig = source.Configs["InventoryService"]; + if (assetConfig == null) + { + m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpanSim.ini"); + throw new Exception("Inventory connector init error"); + } + + string serviceURI = assetConfig.GetString("InventoryServerURI", + String.Empty); + + if (serviceURI == String.Empty) + { + m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); + throw new Exception("Inventory connector init error"); + } + m_ServerURI = serviceURI; + } + + public bool CreateUserInventory(UUID principalID) + { + Dictionary ret = MakeRequest("CREATEUSERINVENTORY", + new Dictionary { + { "PRINCIPAL", principalID.ToString() } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public List GetInventorySkeleton(UUID userId) + { + return null; + } + + public InventoryFolderBase GetRootFolder(UUID principalID) + { + return null; + } + + public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) + { + return null; + } + + public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) + { + return null; + } + + public List GetFolderItems(UUID principalID, UUID folderID) + { + return null; + } + + public bool AddFolder(InventoryFolderBase folder) + { + Dictionary ret = MakeRequest("ADDFOLDER", + new Dictionary { + { "ParentID", folder.ParentID.ToString() }, + { "Type", folder.Type.ToString() }, + { "Version", folder.Version.ToString() }, + { "Name", folder.Name.ToString() }, + { "Owner", folder.Owner.ToString() }, + { "ID", folder.ID.ToString() } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool UpdateFolder(InventoryFolderBase folder) + { + Dictionary ret = MakeRequest("UPDATEFOLDER", + new Dictionary { + { "ParentID", folder.ParentID.ToString() }, + { "Type", folder.Type.ToString() }, + { "Version", folder.Version.ToString() }, + { "Name", folder.Name.ToString() }, + { "Owner", folder.Owner.ToString() }, + { "ID", folder.ID.ToString() } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool MoveFolder(InventoryFolderBase folder) + { + Dictionary ret = MakeRequest("MOVEFOLDER", + new Dictionary { + { "ParentID", folder.ParentID.ToString() }, + { "ID", folder.ID.ToString() } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool DeleteFolders(UUID principalID, List folderIDs) + { + List slist = new List(); + + foreach (UUID f in folderIDs) + slist.Add(f.ToString()); + + Dictionary ret = MakeRequest("DELETEFOLDERS", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDERS", slist } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool PurgeFolder(InventoryFolderBase folder) + { + Dictionary ret = MakeRequest("PURGEFOLDER", + new Dictionary { + { "ID", folder.ID.ToString() } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool AddItem(InventoryItemBase item) + { + Dictionary ret = MakeRequest("CREATEUSERINVENTORY", + new Dictionary { + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool UpdateItem(InventoryItemBase item) + { + Dictionary ret = MakeRequest("CREATEUSERINVENTORY", + new Dictionary { + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool MoveItems(UUID ownerID, List items) + { + return false; + } + + public bool DeleteItems(UUID principalID, List itemIDs) + { + List slist = new List(); + + foreach (UUID f in itemIDs) + slist.Add(f.ToString()); + + Dictionary ret = MakeRequest("DELETEITEMS", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "ITEMS", slist } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public InventoryItemBase GetItem(InventoryItemBase item) + { + return null; + } + + public InventoryFolderBase GetFolder(InventoryFolderBase folder) + { + return null; + } + + public List GetActiveGestures(UUID userId) + { + return null; + } + + public int GetAssetPermissions(UUID principalID, UUID assetID) + { + Dictionary ret = MakeRequest("GETASSETPERMISSIONS", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "ASSET", assetID.ToString() } + }); + + if (ret == null) + return false; + + return int.Parse(ret["RESULT"].ToString()); + } + + + // These are either obsolete or unused + // + public InventoryCollection GetUserInventory(UUID principalID) + { + return null; + } + + public void GetUserInventory(UUID principalID, InventoryReceiptCallback callback) + { + } + + public bool HasInventoryForUser(UUID principalID) + { + return false; + } + + // Helpers + // + private Dictionary MakeRequest(string method, + Dictionary sendData) + { + sendData["METHOD"] = method; + + string reply = SynchronousRestFormsRequester.MakeRequest("POST", + m_ServerURI + "/xinventory", + ServerUtils.BuildQueryString(sendData)); + + Dictionary replyData = ServerUtils.ParseXmlResponse( + reply); + + return replyData; + } + } +} From cbe434149e79304da9251bfe946f43f6a08c1393 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 03:31:53 +0000 Subject: [PATCH 04/21] Change the signature of the forms requester data in preparation to getting to where lists can be sent as requests --- OpenSim/Server/Base/ServerUtils.cs | 12 +-- .../AuthenticationServerPostHandler.cs | 14 +-- .../Handlers/Grid/GridServerPostHandler.cs | 92 +++++++++---------- .../Presence/PresenceServerPostHandler.cs | 8 +- .../AuthenticationServiceConnector.cs | 6 +- .../Connectors/Grid/GridServiceConnector.cs | 16 ++-- 6 files changed, 74 insertions(+), 74 deletions(-) diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0964caaed7..413a078063 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -160,9 +160,9 @@ namespace OpenSim.Server.Base } } - public static Dictionary ParseQueryString(string query) + public static Dictionary ParseQueryString(string query) { - Dictionary result = new Dictionary(); + Dictionary result = new Dictionary(); string[] terms = query.Split(new char[] {'&'}); if (terms.Length == 0) @@ -186,17 +186,17 @@ namespace OpenSim.Server.Base return result; } - public static string BuildQueryString(Dictionary data) + public static string BuildQueryString(Dictionary data) { string qstring = String.Empty; - foreach (KeyValuePair kvp in data) + foreach (KeyValuePair kvp in data) { string part; - if (kvp.Value != String.Empty) + if (kvp.Value.ToString() != String.Empty) { part = System.Web.HttpUtility.UrlEncode(kvp.Key) + - "=" + System.Web.HttpUtility.UrlEncode(kvp.Value); + "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); } else { diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 490a13a30f..47bc860207 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -86,14 +86,14 @@ namespace OpenSim.Server.Handlers.Authentication private byte[] DoPlainMethods(string body) { - Dictionary request = + Dictionary request = ServerUtils.ParseQueryString(body); int lifetime = 30; if (request.ContainsKey("LIFETIME")) { - lifetime = Convert.ToInt32(request["LIFETIME"]); + lifetime = Convert.ToInt32(request["LIFETIME"].ToString()); if (lifetime > 30) lifetime = 30; } @@ -103,12 +103,12 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("PRINCIPAL")) return FailureResult(); - string method = request["METHOD"]; + string method = request["METHOD"].ToString(); UUID principalID; string token; - if (!UUID.TryParse(request["PRINCIPAL"], out principalID)) + if (!UUID.TryParse(request["PRINCIPAL"].ToString(), out principalID)) return FailureResult(); switch (method) @@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("PASSWORD")) return FailureResult(); - token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"], lifetime); + token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime); if (token != String.Empty) return SuccessResult(token); @@ -126,7 +126,7 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("TOKEN")) return FailureResult(); - if (m_AuthenticationService.Verify(principalID, request["TOKEN"], lifetime)) + if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime)) return SuccessResult(); return FailureResult(); @@ -134,7 +134,7 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("TOKEN")) return FailureResult(); - if (m_AuthenticationService.Release(principalID, request["TOKEN"])) + if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString())) return SuccessResult(); return FailureResult(); diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 433ed0b700..d99b791a1b 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -69,13 +69,13 @@ namespace OpenSim.Server.Handlers.Grid try { - Dictionary request = + Dictionary request = ServerUtils.ParseQueryString(body); if (!request.ContainsKey("METHOD")) return FailureResult(); - string method = request["METHOD"]; + string method = request["METHOD"].ToString(); switch (method) { @@ -117,22 +117,22 @@ namespace OpenSim.Server.Handlers.Grid #region Method-specific handlers - byte[] Register(Dictionary request) + byte[] Register(Dictionary request) { UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPEID")) - UUID.TryParse(request["SCOPEID"], out scopeID); + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); int versionNumberMin = 0, versionNumberMax = 0; if (request.ContainsKey("VERSIONMIN")) - Int32.TryParse(request["VERSIONMIN"], out versionNumberMin); + Int32.TryParse(request["VERSIONMIN"].ToString(), out versionNumberMin); else m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region"); if (request.ContainsKey("VERSIONMAX")) - Int32.TryParse(request["VERSIONMAX"], out versionNumberMax); + Int32.TryParse(request["VERSIONMAX"].ToString(), out versionNumberMax); else m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region"); @@ -147,8 +147,8 @@ namespace OpenSim.Server.Handlers.Grid GridRegion rinfo = null; try { - foreach (KeyValuePair kvp in request) - rinfoData[kvp.Key] = kvp.Value; + foreach (KeyValuePair kvp in request) + rinfoData[kvp.Key] = kvp.Value.ToString(); rinfo = new GridRegion(rinfoData); } catch (Exception e) @@ -166,11 +166,11 @@ namespace OpenSim.Server.Handlers.Grid return FailureResult(); } - byte[] Deregister(Dictionary request) + byte[] Deregister(Dictionary request) { UUID regionID = UUID.Zero; - if (request["REGIONID"] != null) - UUID.TryParse(request["REGIONID"], out regionID); + if (request.ContainsKey("REGIONID")) + UUID.TryParse(request["REGIONID"].ToString(), out regionID); else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region"); @@ -183,17 +183,17 @@ namespace OpenSim.Server.Handlers.Grid } - byte[] GetNeighbours(Dictionary request) + byte[] GetNeighbours(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); UUID regionID = UUID.Zero; - if (request["REGIONID"] != null) - UUID.TryParse(request["REGIONID"], out regionID); + if (request.ContainsKey("REGIONID")) + UUID.TryParse(request["REGIONID"].ToString(), out regionID); else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); @@ -221,17 +221,17 @@ namespace OpenSim.Server.Handlers.Grid } - byte[] GetRegionByUUID(Dictionary request) + byte[] GetRegionByUUID(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); UUID regionID = UUID.Zero; - if (request["REGIONID"] != null) - UUID.TryParse(request["REGIONID"], out regionID); + if (request.ContainsKey("REGIONID")) + UUID.TryParse(request["REGIONID"].ToString(), out regionID); else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); @@ -250,21 +250,21 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionByPosition(Dictionary request) + byte[] GetRegionByPosition(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position"); int x = 0, y = 0; - if (request["X"] != null) - Int32.TryParse(request["X"], out x); + if (request.ContainsKey("X")) + Int32.TryParse(request["X"].ToString(), out x); else m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position"); - if (request["Y"] != null) - Int32.TryParse(request["Y"], out y); + if (request.ContainsKey("Y")) + Int32.TryParse(request["Y"].ToString(), out y); else m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); @@ -283,17 +283,17 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionByName(Dictionary request) + byte[] GetRegionByName(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); string regionName = string.Empty; - if (request["NAME"] != null) - regionName = request["NAME"]; + if (request.ContainsKey("NAME")) + regionName = request["NAME"].ToString(); else m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); @@ -312,23 +312,23 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionsByName(Dictionary request) + byte[] GetRegionsByName(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name"); string regionName = string.Empty; - if (request["NAME"] != null) - regionName = request["NAME"]; + if (request.ContainsKey("NAME")) + regionName = request["NAME"].ToString(); else m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name"); int max = 0; - if (request["MAX"] != null) - Int32.TryParse(request["MAX"], out max); + if (request.ContainsKey("MAX")) + Int32.TryParse(request["MAX"].ToString(), out max); else m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name"); @@ -355,30 +355,30 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionRange(Dictionary request) + byte[] GetRegionRange(Dictionary request) { //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPEID")) - UUID.TryParse(request["SCOPEID"], out scopeID); + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); int xmin = 0, xmax = 0, ymin = 0, ymax = 0; if (request.ContainsKey("XMIN")) - Int32.TryParse(request["XMIN"], out xmin); + Int32.TryParse(request["XMIN"].ToString(), out xmin); else m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); if (request.ContainsKey("XMAX")) - Int32.TryParse(request["XMAX"], out xmax); + Int32.TryParse(request["XMAX"].ToString(), out xmax); else m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); if (request.ContainsKey("YMIN")) - Int32.TryParse(request["YMIN"], out ymin); + Int32.TryParse(request["YMIN"].ToString(), out ymin); else m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); if (request.ContainsKey("YMAX")) - Int32.TryParse(request["YMAX"], out ymax); + Int32.TryParse(request["YMAX"].ToString(), out ymax); else m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 2558fa0aaf..b1c6bcf296 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -68,13 +68,13 @@ namespace OpenSim.Server.Handlers.Presence try { - Dictionary request = + Dictionary request = ServerUtils.ParseQueryString(body); if (!request.ContainsKey("METHOD")) return FailureResult(); - string method = request["METHOD"]; + string method = request["METHOD"].ToString(); switch (method) { @@ -92,12 +92,12 @@ namespace OpenSim.Server.Handlers.Presence } - byte[] Report(Dictionary request) + byte[] Report(Dictionary request) { PresenceInfo info = new PresenceInfo(); info.Data = new Dictionary(); - if (request["PrincipalID"] == null || request["RegionID"] == null) + if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("RegionID")) return FailureResult(); if (!UUID.TryParse(request["PrincipalID"].ToString(), diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs index 50e817e064..19bb3e24cf 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs @@ -84,7 +84,7 @@ namespace OpenSim.Services.Connectors public string Authenticate(UUID principalID, string password, int lifetime) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["LIFETIME"] = lifetime.ToString(); sendData["PRINCIPAL"] = principalID.ToString(); sendData["PASSWORD"] = password; @@ -106,7 +106,7 @@ namespace OpenSim.Services.Connectors public bool Verify(UUID principalID, string token, int lifetime) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["LIFETIME"] = lifetime.ToString(); sendData["PRINCIPAL"] = principalID.ToString(); sendData["TOKEN"] = token; @@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors public bool Release(UUID principalID, string token) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["PRINCIPAL"] = principalID.ToString(); sendData["TOKEN"] = token; diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 02f2b79cfb..99aa3fb15c 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -89,7 +89,7 @@ namespace OpenSim.Services.Connectors public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) { Dictionary rinfo = regionInfo.ToKeyValuePairs(); - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); foreach (KeyValuePair kvp in rinfo) sendData[kvp.Key] = (string)kvp.Value; @@ -130,7 +130,7 @@ namespace OpenSim.Services.Connectors public virtual bool DeregisterRegion(UUID regionID) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["REGIONID"] = regionID.ToString(); @@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors public virtual List GetNeighbours(UUID scopeID, UUID regionID) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); @@ -212,7 +212,7 @@ namespace OpenSim.Services.Connectors public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); @@ -258,7 +258,7 @@ namespace OpenSim.Services.Connectors public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["X"] = x.ToString(); @@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["NAME"] = regionName; @@ -344,7 +344,7 @@ namespace OpenSim.Services.Connectors public virtual List GetRegionsByName(UUID scopeID, string name, int maxNumber) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["NAME"] = name; @@ -396,7 +396,7 @@ namespace OpenSim.Services.Connectors public virtual List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["XMIN"] = xmin.ToString(); From be41ba66700e46503001dfb4c2c87f9b2aad21c6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 21:46:16 +0000 Subject: [PATCH 05/21] Allow lists to be embedded in query strings --- OpenSim/Server/Base/ServerUtils.cs | 65 +++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 11 deletions(-) diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 413a078063..a5d28a413d 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -180,7 +180,31 @@ namespace OpenSim.Server.Base if (elems.Length > 1) value = System.Web.HttpUtility.UrlDecode(elems[1]); - result[name] = value; + if (name.EndsWith("[]")) + { + if (result.ContainsKey(name)) + { + if (!(result[name] is List)) + continue; + + List l = (List)result[name]; + + l.Add(value); + } + else + { + List newList = new List(); + + newList.Add(value); + + result[name] = newList; + } + } + else + { + if (!result.ContainsKey(name)) + result[name] = value; + } } return result; @@ -190,23 +214,42 @@ namespace OpenSim.Server.Base { string qstring = String.Empty; + string part; + foreach (KeyValuePair kvp in data) { - string part; - if (kvp.Value.ToString() != String.Empty) + if (kvp.Value is List) { - part = System.Web.HttpUtility.UrlEncode(kvp.Key) + - "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); + List l = (List)kvp.Value; + + foreach (string s in l) + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key) + + "[]=" + System.Web.HttpUtility.UrlEncode(s); + + if (qstring != String.Empty) + qstring += "&"; + + qstring += part; + } } else { - part = System.Web.HttpUtility.UrlEncode(kvp.Key); + if (kvp.Value.ToString() != String.Empty) + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key) + + "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); + } + else + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key); + } + + if (qstring != String.Empty) + qstring += "&"; + + qstring += part; } - - if (qstring != String.Empty) - qstring += "&"; - - qstring += part; } return qstring; From aca01f541552b0f6e7521e98f5e8350175b89334 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 04:22:03 +0000 Subject: [PATCH 06/21] Add the XInventoryServicesConnector, a new inventory connector without the cruft of the old one that makes inventory crash on folder creation. This is just the connector part, the handler is still ont he todo list. --- .../Presence/PresenceServerPostHandler.cs | 4 +- .../Inventory/XInventoryConnector.cs | 198 ++++++++++++++++-- 2 files changed, 187 insertions(+), 15 deletions(-) diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index b1c6bcf296..b5ae54a715 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -108,14 +108,14 @@ namespace OpenSim.Server.Handlers.Presence out info.RegionID)) return FailureResult(); - foreach (KeyValuePair kvp in request) + foreach (KeyValuePair kvp in request) { if (kvp.Key == "METHOD" || kvp.Key == "PrincipalID" || kvp.Key == "RegionID") continue; - info.Data[kvp.Key] = kvp.Value; + info.Data[kvp.Key] = kvp.Value.ToString(); } if (m_PresenceService.Report(info)) diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 6e1d65751a..aac1a83eae 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -96,19 +96,55 @@ namespace OpenSim.Services.Connectors return bool.Parse(ret["RESULT"].ToString()); } - public List GetInventorySkeleton(UUID userId) + public List GetInventorySkeleton(UUID principalID) { - return null; + Dictionary ret = MakeRequest("GETINVENTORYSKELETON", + new Dictionary { + { "PRINCIPAL", principalID.ToString() } + }); + + if (ret == null) + return null; + + List folders = new List(); + + foreach (Object o in ret.Values) + folders.Add(BuildFolder((Dictionary)o)); + + return folders; } public InventoryFolderBase GetRootFolder(UUID principalID) { - return null; + Dictionary ret = MakeRequest("GETROOTFOLDER", + new Dictionary { + { "PRINCIPAL", principalID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildFolder(ret); } public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { - return null; + Dictionary ret = MakeRequest("GETFOLDERFORTYPE", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "TYPE", ((int)type).ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildFolder(ret); } public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) @@ -205,8 +241,28 @@ namespace OpenSim.Services.Connectors public bool AddItem(InventoryItemBase item) { - Dictionary ret = MakeRequest("CREATEUSERINVENTORY", + Dictionary ret = MakeRequest("ADDITEM", new Dictionary { + { "AssetID", item.AssetID.ToString() }, + { "AssetType", item.AssetType.ToString() }, + { "Name", item.Name.ToString() }, + { "Owner", item.Owner.ToString() }, + { "ID", item.ID.ToString() }, + { "InvType", item.InvType.ToString() }, + { "Folder", item.Folder.ToString() }, + { "CreatorId", item.CreatorId.ToString() }, + { "Description", item.Description.ToString() }, + { "NextPermissions", item.NextPermissions.ToString() }, + { "CurrentPermissions", item.CurrentPermissions.ToString() }, + { "BasePermissions", item.BasePermissions.ToString() }, + { "EveryOnePermissions", item.EveryOnePermissions.ToString() }, + { "GroupPermissions", item.GroupPermissions.ToString() }, + { "GroupID", item.GroupID.ToString() }, + { "GroupOwned", item.GroupOwned.ToString() }, + { "SalePrice", item.SalePrice.ToString() }, + { "SaleType", item.SaleType.ToString() }, + { "Flags", item.Flags.ToString() }, + { "CreationDate", item.CreationDate.ToString() } }); if (ret == null) @@ -217,8 +273,28 @@ namespace OpenSim.Services.Connectors public bool UpdateItem(InventoryItemBase item) { - Dictionary ret = MakeRequest("CREATEUSERINVENTORY", + Dictionary ret = MakeRequest("UPDATEITEM", new Dictionary { + { "AssetID", item.AssetID.ToString() }, + { "AssetType", item.AssetType.ToString() }, + { "Name", item.Name.ToString() }, + { "Owner", item.Owner.ToString() }, + { "ID", item.ID.ToString() }, + { "InvType", item.InvType.ToString() }, + { "Folder", item.Folder.ToString() }, + { "CreatorId", item.CreatorId.ToString() }, + { "Description", item.Description.ToString() }, + { "NextPermissions", item.NextPermissions.ToString() }, + { "CurrentPermissions", item.CurrentPermissions.ToString() }, + { "BasePermissions", item.BasePermissions.ToString() }, + { "EveryOnePermissions", item.EveryOnePermissions.ToString() }, + { "GroupPermissions", item.GroupPermissions.ToString() }, + { "GroupID", item.GroupID.ToString() }, + { "GroupOwned", item.GroupOwned.ToString() }, + { "SalePrice", item.SalePrice.ToString() }, + { "SaleType", item.SaleType.ToString() }, + { "Flags", item.Flags.ToString() }, + { "CreationDate", item.CreationDate.ToString() } }); if (ret == null) @@ -227,9 +303,28 @@ namespace OpenSim.Services.Connectors return bool.Parse(ret["RESULT"].ToString()); } - public bool MoveItems(UUID ownerID, List items) + public bool MoveItems(UUID principalID, List items) { - return false; + List idlist = new List(); + List destlist = new List(); + + foreach (InventoryItemBase item in items) + { + idlist.Add(item.ID.ToString()); + destlist.Add(item.Folder.ToString()); + } + + Dictionary ret = MakeRequest("MOVEITEMS", + new Dictionary { + { "PrincipalID", principalID.ToString() }, + { "IDLIST", idlist }, + { "DESTLIST", destlist } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); } public bool DeleteItems(UUID principalID, List itemIDs) @@ -253,17 +348,52 @@ namespace OpenSim.Services.Connectors public InventoryItemBase GetItem(InventoryItemBase item) { - return null; + Dictionary ret = MakeRequest("GETITEM", + new Dictionary { + { "ID", item.ID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildItem(ret); } public InventoryFolderBase GetFolder(InventoryFolderBase folder) { - return null; + Dictionary ret = MakeRequest("GETFOLDER", + new Dictionary { + { "ID", folder.ID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildFolder(ret); } - public List GetActiveGestures(UUID userId) + public List GetActiveGestures(UUID principalID) { - return null; + Dictionary ret = MakeRequest("GETACTIVEGESTURES", + new Dictionary { + { "PRINCIPAL", principalID.ToString() } + }); + + if (ret == null) + return null; + + List items = new List(); + + foreach (Object o in ret.Values) + items.Add(BuildItem((Dictionary)o)); + + return items; } public int GetAssetPermissions(UUID principalID, UUID assetID) @@ -275,7 +405,7 @@ namespace OpenSim.Services.Connectors }); if (ret == null) - return false; + return 0; return int.Parse(ret["RESULT"].ToString()); } @@ -313,5 +443,47 @@ namespace OpenSim.Services.Connectors return replyData; } + + InventoryFolderBase BuildFolder(Dictionary data) + { + InventoryFolderBase folder = new InventoryFolderBase(); + + folder.ParentID = new UUID(data["ParentID"].ToString()); + folder.Type = short.Parse(data["Type"].ToString()); + folder.Version = ushort.Parse(data["Version"].ToString()); + folder.Name = data["Name"].ToString(); + folder.Owner = new UUID(data["Owner"].ToString()); + folder.ID = new UUID(data["ID"].ToString()); + + return folder; + } + + InventoryItemBase BuildItem(Dictionary data) + { + InventoryItemBase item = new InventoryItemBase(); + + item.AssetID = new UUID(data["AssetID"].ToString()); + item.AssetType = int.Parse(data["AssetType"].ToString()); + item.Name = data["Name"].ToString(); + item.Owner = new UUID(data["Owner"].ToString()); + item.ID = new UUID(data["ID"].ToString()); + item.InvType = int.Parse(data["InvType"].ToString()); + item.Folder = new UUID(data["Folder"].ToString()); + item.CreatorId = data["CreatorId"].ToString(); + item.Description = data["Description"].ToString(); + item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); + item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); + item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); + item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); + item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); + item.GroupID = new UUID(data["GroupID"].ToString()); + item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); + item.SalePrice = int.Parse(data["SalePrice"].ToString()); + item.SaleType = byte.Parse(data["SaleType"].ToString()); + item.Flags = uint.Parse(data["Flags"].ToString()); + item.CreationDate = int.Parse(data["CreationDate"].ToString()); + + return item; + } } } From a542871c1590e9d6d42fb3b1e099a8d6204e8e4d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 15:39:53 +0000 Subject: [PATCH 07/21] Allow estate managers (if estate_owner_is_god is set) to actually enter god mode. Allow god modification of objects if the object owner is the same god that wants to modify, this allows you to regain perms on your own objects after IAR import messed them up. --- .../CoreModules/World/Permissions/PermissionsModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index e837e9adcb..f66f01f0d3 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -596,7 +596,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions return objectOwnerMask; // Estate users should be able to edit anything in the sim - if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner)) + if (IsEstateManager(user) && m_RegionOwnerIsGod && (!IsAdministrator(objectOwner)) || objectOwner == user) return objectOwnerMask; // Admin should be able to edit anything in the sim (including admin objects) @@ -888,6 +888,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; + if (IsEstateManager(user) && m_RegionOwnerIsGod) + return true; + return IsAdministrator(user); } From 68eba8973c0d7aaaa2947bc7092edfa58e07f1e9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jan 2010 19:16:43 +0000 Subject: [PATCH 08/21] Adding a skeleton for the XInventoryInConnector, counterpart to the already done XInventoryConnector. No functionality yet. --- .../Inventory/XInventoryInConnector.cs | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs new file mode 100644 index 0000000000..8c6eca7411 --- /dev/null +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -0,0 +1,167 @@ +/* + * 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.Reflection; +using System.Text; +using System.Xml; +using System.Collections.Generic; +using System.IO; +using Nini.Config; +using OpenSim.Framework; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; +using log4net; + +namespace OpenSim.Server.Handlers.Asset +{ + public class XInventoryInConnector : ServiceConnector + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IInventoryService m_InventoryService; + private string m_ConfigName = "InventoryService"; + + public XInventoryInConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); + + string inventoryService = serverConfig.GetString("LocalServiceModule", + String.Empty); + + if (inventoryService == String.Empty) + throw new Exception("No InventoryService in config file"); + + Object[] args = new Object[] { config }; + m_InventoryService = + ServerUtils.LoadPlugin(inventoryService, args); + + server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService)); + } + } + + public class XInventoryConnectorPostHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IInventoryService m_InventoryService; + + public XInventoryConnectorPostHandler(IInventoryService service) : + base("POST", "/xinventory") + { + m_InventoryService = service; + } + + public override byte[] Handle(string path, Stream requestData, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + StreamReader sr = new StreamReader(requestData); + string body = sr.ReadToEnd(); + sr.Close(); + body = body.Trim(); + + //m_log.DebugFormat("[XXX]: query String: {0}", body); + + try + { + Dictionary request = + ServerUtils.ParseQueryString(body); + + if (!request.ContainsKey("METHOD")) + return FailureResult(); + + string method = request["METHOD"].ToString(); + request.Remove("METHOD"); + + switch (method) + { + case "TEST": + return HandleTest(request); + } + m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); + } + catch (Exception e) + { + m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e); + } + + return FailureResult(); + } + + private byte[] FailureResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "RESULT", ""); + result.AppendChild(doc.CreateTextNode("False")); + + rootElement.AppendChild(result); + + return DocToBytes(doc); + } + + private byte[] DocToBytes(XmlDocument doc) + { + MemoryStream ms = new MemoryStream(); + XmlTextWriter xw = new XmlTextWriter(ms, null); + xw.Formatting = Formatting.Indented; + doc.WriteTo(xw); + xw.Flush(); + + return ms.ToArray(); + } + + byte[] HandleTest(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + } +} From 6d061d9f398adfa193f25c43604b517ad0d756a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jan 2010 22:00:19 +0000 Subject: [PATCH 09/21] Complete the XInventoryConnector. Flesh out the skeleton for the XInventoryInConnector --- .../Inventory/XInventoryInConnector.cs | 225 +++++++++++++++++- .../Inventory/XInventoryConnector.cs | 50 +++- 2 files changed, 268 insertions(+), 7 deletions(-) diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 8c6eca7411..b48e30e342 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -92,7 +92,7 @@ namespace OpenSim.Server.Handlers.Asset sr.Close(); body = body.Trim(); - //m_log.DebugFormat("[XXX]: query String: {0}", body); + m_log.DebugFormat("[XXX]: query String: {0}", body); try { @@ -107,8 +107,44 @@ namespace OpenSim.Server.Handlers.Asset switch (method) { - case "TEST": - return HandleTest(request); + case "CREATEUSERINVENTORY": + return HandleCreateUserInventory(request); + case "GETINVENTORYSKELETON": + return HandleGetInventorySkeleton(request); + case "GETROOTFOLDER": + return HandleGetRootFolder(request); + case "GETFOLDERFORTYPE": + return HandleGetFolderForType(request); + case "GETFOLDERCONTENT": + return HandleGetFolderContent(request); + case "GETFOLDERITEMS": + return HandleGetFolderItems(request); + case "ADDFOLDER": + return HandleAddFolder(request); + case "UPDATEFOLDER": + return HandleUpdateFolder(request); + case "MOVEFOLDER": + return HandleMoveFolder(request); + case "DELETEFOLDERS": + return HandleDeleteFolders(request); + case "PURGEFOLDER": + return HandlePurgeFolder(request); + case "ADDITEM": + return HandleAddItem(request); + case "UPDATEITEM": + return HandleUpdateItem(request); + case "MOVEITEMS": + return HandleMoveItems(request); + case "DELETEITEMS": + return HandleDeleteItems(request); + case "GETITEM": + return HandleGetItem(request); + case "GETFOLDER": + return HandleGetFolder(request); + case "GETACTIVEGESTURES": + return HandleGetActiveGestures(request); + case "GETASSETPERMISSIONS": + return HandleGetAssetPermissions(request); } m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); } @@ -153,15 +189,194 @@ namespace OpenSim.Server.Handlers.Asset return ms.ToArray(); } - byte[] HandleTest(Dictionary request) + byte[] HandleCreateUserInventory(Dictionary request) { Dictionary result = new Dictionary(); string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(xmlString); } + byte[] HandleGetInventorySkeleton(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetRootFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolderForType(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolderContent(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolderItems(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleAddFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleUpdateFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleMoveFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleDeleteFolders(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandlePurgeFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleAddItem(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleUpdateItem(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleMoveItems(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleDeleteItems(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetItem(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetActiveGestures(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetAssetPermissions(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } } } diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index aac1a83eae..40acd6d20f 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -149,12 +149,58 @@ namespace OpenSim.Services.Connectors public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) { - return null; + Dictionary ret = MakeRequest("GETFOLDERCONTENT", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDER", folderID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + + InventoryCollection inventory = new InventoryCollection(); + inventory.Folders = new List(); + inventory.Items = new List(); + inventory.UserID = principalID; + + Dictionary folders = + (Dictionary)ret["FOLDERS"]; + Dictionary items = + (Dictionary)ret["ITEMS"]; + + foreach (Object o in folders.Values) + inventory.Folders.Add(BuildFolder((Dictionary)o)); + foreach (Object o in items.Values) + inventory.Items.Add(BuildItem((Dictionary)o)); + + return inventory; } public List GetFolderItems(UUID principalID, UUID folderID) { - return null; + Dictionary ret = MakeRequest("GETFOLDERCONTENT", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDER", folderID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + + List items = new List(); + + foreach (Object o in ret.Values) + items.Add(BuildItem((Dictionary)o)); + + return items; } public bool AddFolder(InventoryFolderBase folder) From b4c83bc203147e9381d004074a026fd189d5fead Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 6 Jan 2010 21:19:00 -0600 Subject: [PATCH 10/21] Fixes the Collision errors and adds more to llGetStatus --- .../Framework/Scenes/SceneObjectPart.cs | 119 +++++++++++------- 1 file changed, 74 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 22a8ca121c..d1bc351b3d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -139,7 +139,16 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampTerse; [XmlIgnore] - public UUID FromItemID; + public UUID FromItemID; + + [XmlIgnore] + public int STATUS_ROTATE_X; + + [XmlIgnore] + public int STATUS_ROTATE_Y; + + [XmlIgnore] + public int STATUS_ROTATE_Z; [XmlIgnore] private Dictionary m_CollisionFilter = new Dictionary(); @@ -1671,6 +1680,19 @@ namespace OpenSim.Region.Framework.Scenes return false; return m_parentGroup.RootPart.DIE_AT_EDGE; + } + + public int GetAxisRotation(int axis) + { + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + return STATUS_ROTATE_X; + if (axis == 4)//STATUS_ROTATE_Y + return STATUS_ROTATE_Y; + if (axis == 8)//STATUS_ROTATE_Z + return STATUS_ROTATE_Z; + + return 0; } public double GetDistanceTo(Vector3 a, Vector3 b) @@ -1914,24 +1936,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj._ownerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj._groupID; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work + if (found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = obj.UUID; + detobj.nameStr = obj.Name; + detobj.ownerUUID = obj._ownerID; + detobj.posVector = obj.AbsolutePosition; + detobj.rotQuat = obj.GetWorldRotation(); + detobj.velVector = obj.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = obj._groupID; + colliding.Add(detobj); + } } } else @@ -1943,8 +1965,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -1965,24 +1987,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work + if (!found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = av.UUID; + detobj.nameStr = av.ControllingClient.Name; + detobj.ownerUUID = av.UUID; + detobj.posVector = av.AbsolutePosition; + detobj.rotQuat = av.Rotation; + detobj.velVector = av.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = av.ControllingClient.ActiveGroupId; + colliding.Add(detobj); + } } } @@ -2079,8 +2101,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -2106,7 +2128,7 @@ namespace OpenSim.Region.Framework.Scenes { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = av.UUID; @@ -2210,8 +2232,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -2237,7 +2259,7 @@ namespace OpenSim.Region.Framework.Scenes { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = av.UUID; @@ -2270,7 +2292,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); } } - } + } } public void PhysicsOutOfBounds(Vector3 pos) @@ -2736,7 +2758,14 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) { m_parentGroup.SetAxisRotation(axis, rotate); - } + } + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + STATUS_ROTATE_X = rotate; + if (axis == 4)//STATUS_ROTATE_Y + STATUS_ROTATE_Y = rotate; + if (axis == 8)//STATUS_ROTATE_Z + STATUS_ROTATE_Z = rotate; } public void SetBuoyancy(float fvalue) From 7dd43bef8cc75cd0364abdd763a972ef9ed6f990 Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 6 Jan 2010 21:19:00 -0600 Subject: [PATCH 11/21] Fixes the Collision errors and adds more to llGetStatus Signed-off-by: Melanie --- .../Framework/Scenes/SceneObjectPart.cs | 119 +++++++++++------- 1 file changed, 74 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 22a8ca121c..d1bc351b3d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -139,7 +139,16 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampTerse; [XmlIgnore] - public UUID FromItemID; + public UUID FromItemID; + + [XmlIgnore] + public int STATUS_ROTATE_X; + + [XmlIgnore] + public int STATUS_ROTATE_Y; + + [XmlIgnore] + public int STATUS_ROTATE_Z; [XmlIgnore] private Dictionary m_CollisionFilter = new Dictionary(); @@ -1671,6 +1680,19 @@ namespace OpenSim.Region.Framework.Scenes return false; return m_parentGroup.RootPart.DIE_AT_EDGE; + } + + public int GetAxisRotation(int axis) + { + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + return STATUS_ROTATE_X; + if (axis == 4)//STATUS_ROTATE_Y + return STATUS_ROTATE_Y; + if (axis == 8)//STATUS_ROTATE_Z + return STATUS_ROTATE_Z; + + return 0; } public double GetDistanceTo(Vector3 a, Vector3 b) @@ -1914,24 +1936,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj._ownerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj._groupID; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work + if (found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = obj.UUID; + detobj.nameStr = obj.Name; + detobj.ownerUUID = obj._ownerID; + detobj.posVector = obj.AbsolutePosition; + detobj.rotQuat = obj.GetWorldRotation(); + detobj.velVector = obj.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = obj._groupID; + colliding.Add(detobj); + } } } else @@ -1943,8 +1965,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -1965,24 +1987,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work + if (!found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = av.UUID; + detobj.nameStr = av.ControllingClient.Name; + detobj.ownerUUID = av.UUID; + detobj.posVector = av.AbsolutePosition; + detobj.rotQuat = av.Rotation; + detobj.velVector = av.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = av.ControllingClient.ActiveGroupId; + colliding.Add(detobj); + } } } @@ -2079,8 +2101,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -2106,7 +2128,7 @@ namespace OpenSim.Region.Framework.Scenes { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = av.UUID; @@ -2210,8 +2232,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -2237,7 +2259,7 @@ namespace OpenSim.Region.Framework.Scenes { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = av.UUID; @@ -2270,7 +2292,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); } } - } + } } public void PhysicsOutOfBounds(Vector3 pos) @@ -2736,7 +2758,14 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) { m_parentGroup.SetAxisRotation(axis, rotate); - } + } + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + STATUS_ROTATE_X = rotate; + if (axis == 4)//STATUS_ROTATE_Y + STATUS_ROTATE_Y = rotate; + if (axis == 8)//STATUS_ROTATE_Z + STATUS_ROTATE_Z = rotate; } public void SetBuoyancy(float fvalue) From b67470af9106da24ed67db75cfe4787e58759385 Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 6 Jan 2010 19:52:10 -0600 Subject: [PATCH 12/21] Fixes the newly added packets as per Melanie's request. Provisionally applied to fix the naming. Signatures are still subject to change. Signed-off-by: Melanie --- .../Client/MXP/ClientStack/MXPClientView.cs | 20 +-- .../ClientStack/SirikataClientView.cs | 20 +-- .../VWoHTTP/ClientStack/VWHClientView.cs | 20 +-- OpenSim/Framework/IClientAPI.cs | 22 ++-- .../ClientStack/LindenUDP/LLClientView.cs | 124 +++++++++--------- .../Avatar/Friends/FriendsModule.cs | 4 +- .../Examples/SimpleModule/MyNpcCharacter.cs | 20 +-- .../Server/IRCClientView.cs | 20 +-- .../OptionalModules/World/NPC/NPCAvatar.cs | 20 +-- OpenSim/Tests/Common/Mock/TestClient.cs | 20 +-- 10 files changed, 147 insertions(+), 143 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index dbb9611a3a..f84b2968b7 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -756,25 +756,25 @@ namespace OpenSim.Client.MXP.ClientStack public event AvatarNotesUpdate OnAvatarNotesUpdate; public event MuteListRequest OnMuteListRequest; public event AvatarInterestUpdate OnAvatarInterestUpdate; - public event FindAgentUpdate OnFindAgentEvent; - public event TrackAgentUpdate OnTrackAgentEvent; - public event NewUserReport OnUserReportEvent; - public event SaveStateHandler OnSaveStateEvent; + public event FindAgentUpdate OnFindAgent; + public event TrackAgentUpdate OnTrackAgent; + public event NewUserReport OnUserReport; + public event SaveStateHandler OnSaveState; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - public event FreezeUserUpdate OnParcelFreezeUserEvent; - public event EjectUserUpdate OnParcelEjectUserEvent; + public event FreezeUserUpdate OnParcelFreezeUser; + public event EjectUserUpdate OnParcelEjectUser; public event ParcelBuyPass OnParcelBuyPass; public event ParcelGodMark OnParcelGodMark; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent; - public event GodlikeMessage onGodlikeMessageEvent; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + public event MuteListEntryUpdate OnUpdateMuteListEntry; + public event MuteListEntryRemove OnRemoveMuteListEntry; + public event GodlikeMessage onGodlikeMessage; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; public event PlacesQuery OnPlacesQuery; diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index 66c0eb25c8..e1eed9bad9 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -401,25 +401,25 @@ namespace OpenSim.Client.Sirikata.ClientStack public event GrantUserFriendRights OnGrantUserRights; public event MuteListRequest OnMuteListRequest; public event PlacesQuery OnPlacesQuery; - public event FindAgentUpdate OnFindAgentEvent; - public event TrackAgentUpdate OnTrackAgentEvent; - public event NewUserReport OnUserReportEvent; - public event SaveStateHandler OnSaveStateEvent; + public event FindAgentUpdate OnFindAgent; + public event TrackAgentUpdate OnTrackAgent; + public event NewUserReport OnUserReport; + public event SaveStateHandler OnSaveState; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - public event FreezeUserUpdate OnParcelFreezeUserEvent; - public event EjectUserUpdate OnParcelEjectUserEvent; + public event FreezeUserUpdate OnParcelFreezeUser; + public event EjectUserUpdate OnParcelEjectUser; public event ParcelBuyPass OnParcelBuyPass; public event ParcelGodMark OnParcelGodMark; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent; - public event GodlikeMessage onGodlikeMessageEvent; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + public event MuteListEntryUpdate OnUpdateMuteListEntry; + public event MuteListEntryRemove OnRemoveMuteListEntry; + public event GodlikeMessage onGodlikeMessage; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; public void SetDebugPacketLevel(int newDebug) { throw new System.NotImplementedException(); diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 6f6d23170a..7ca57b031c 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -405,25 +405,25 @@ namespace OpenSim.Client.VWoHTTP.ClientStack public event MuteListRequest OnMuteListRequest = delegate { }; public event AvatarInterestUpdate OnAvatarInterestUpdate = delegate { }; public event PlacesQuery OnPlacesQuery = delegate { }; - public event FindAgentUpdate OnFindAgentEvent = delegate { }; - public event TrackAgentUpdate OnTrackAgentEvent = delegate { }; - public event NewUserReport OnUserReportEvent = delegate { }; - public event SaveStateHandler OnSaveStateEvent = delegate { }; + public event FindAgentUpdate OnFindAgent = delegate { }; + public event TrackAgentUpdate OnTrackAgent = delegate { }; + public event NewUserReport OnUserReport = delegate { }; + public event SaveStateHandler OnSaveState = delegate { }; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest = delegate { }; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest = delegate { }; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest = delegate { }; - public event FreezeUserUpdate OnParcelFreezeUserEvent = delegate { }; - public event EjectUserUpdate OnParcelEjectUserEvent = delegate { }; + public event FreezeUserUpdate OnParcelFreezeUser = delegate { }; + public event EjectUserUpdate OnParcelEjectUser = delegate { }; public event ParcelBuyPass OnParcelBuyPass = delegate { }; public event ParcelGodMark OnParcelGodMark = delegate { }; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest = delegate { }; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest = delegate { }; public event SimWideDeletesDelegate OnSimWideDeletes = delegate { }; public event SendPostcard OnSendPostcard = delegate { }; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent = delegate { }; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent = delegate { }; - public event GodlikeMessage onGodlikeMessageEvent = delegate { }; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent = delegate { }; + public event MuteListEntryUpdate OnUpdateMuteListEntry = delegate { }; + public event MuteListEntryRemove OnRemoveMuteListEntry = delegate { }; + public event GodlikeMessage onGodlikeMessage = delegate { }; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate = delegate { }; diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 60c1ac773f..eb5b0341d0 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -467,7 +467,7 @@ namespace OpenSim.Framework public delegate void EjectUserUpdate(IClientAPI client, UUID parcelowner,uint flags, UUID target); - public delegate void NewUserReport(IClientAPI client, string regionName,UUID abuserID, byte catagory, byte checkflags, string details, UUID objectID, Vector3 postion, byte reportType ,UUID screenshotID, string summery, UUID reporter); + public delegate void NewUserReport(IClientAPI client, string regionName,UUID abuserID, byte catagory, byte checkflags, string details, UUID objectID, Vector3 postion, byte reportType ,UUID screenshotID, string Summary, UUID reporter); public delegate void GodUpdateRegionInfoUpdate(IClientAPI client, float BillableFactor, ulong EstateID, ulong RegionFlags, byte[] SimName,int RedirectX, int RedirectY); @@ -1069,25 +1069,25 @@ namespace OpenSim.Framework event PlacesQuery OnPlacesQuery; - event FindAgentUpdate OnFindAgentEvent; - event TrackAgentUpdate OnTrackAgentEvent; - event NewUserReport OnUserReportEvent; - event SaveStateHandler OnSaveStateEvent; + event FindAgentUpdate OnFindAgent; + event TrackAgentUpdate OnTrackAgent; + event NewUserReport OnUserReport; + event SaveStateHandler OnSaveState; event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - event FreezeUserUpdate OnParcelFreezeUserEvent; - event EjectUserUpdate OnParcelEjectUserEvent; + event FreezeUserUpdate OnParcelFreezeUser; + event EjectUserUpdate OnParcelEjectUser; event ParcelBuyPass OnParcelBuyPass; event ParcelGodMark OnParcelGodMark; event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; event SimWideDeletesDelegate OnSimWideDeletes; event SendPostcard OnSendPostcard; - event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - event MuteListEntryRemove OnRemoveMuteListEntryEvent; - event GodlikeMessage onGodlikeMessageEvent; - event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + event MuteListEntryUpdate OnUpdateMuteListEntry; + event MuteListEntryRemove OnRemoveMuteListEntry; + event GodlikeMessage onGodlikeMessage; + event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; /// /// Set the debug level at which packet output should be printed to console. diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 9944852c4e..5eaaf12514 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -298,25 +298,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event AvatarInterestUpdate OnAvatarInterestUpdate; public event PlacesQuery OnPlacesQuery; public event AgentFOV OnAgentFOV; - public event FindAgentUpdate OnFindAgentEvent; - public event TrackAgentUpdate OnTrackAgentEvent; - public event NewUserReport OnUserReportEvent; - public event SaveStateHandler OnSaveStateEvent; + public event FindAgentUpdate OnFindAgent; + public event TrackAgentUpdate OnTrackAgent; + public event NewUserReport OnUserReport; + public event SaveStateHandler OnSaveState; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - public event FreezeUserUpdate OnParcelFreezeUserEvent; - public event EjectUserUpdate OnParcelEjectUserEvent; + public event FreezeUserUpdate OnParcelFreezeUser; + public event EjectUserUpdate OnParcelEjectUser; public event ParcelBuyPass OnParcelBuyPass; public event ParcelGodMark OnParcelGodMark; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent; - public event GodlikeMessage onGodlikeMessageEvent; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + public event MuteListEntryUpdate OnUpdateMuteListEntry; + public event MuteListEntryRemove OnRemoveMuteListEntry; + public event GodlikeMessage onGodlikeMessage; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; #endregion Events @@ -826,32 +826,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(gmp, ThrottleOutPacketType.Task); } - public void SendGroupActiveProposals(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, Dictionary VoteID, Dictionary VoteInitiator, Dictionary Majority, Dictionary Quorum, Dictionary TerseDateID, Dictionary StartDateTime, Dictionary EndDateTime, Dictionary ProposalText) - { - foreach (KeyValuePair Blank in VoteID) + public void SendGroupActiveProposals(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, string[] VoteID, string[] VoteInitiator, string[] Majority, string[] Quorum, string[] TerseDateID, string[] StartDateTime, string[] EndDateTime, string[] ProposalText) + { + int i = 0; + foreach (string voteID in VoteID) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); GAPIRP.AgentData.AgentID = agentID; GAPIRP.AgentData.GroupID = groupID; GAPIRP.TransactionData.TransactionID = transactionID; - GAPIRP.TransactionData.TotalNumItems = 1; + GAPIRP.TransactionData.TotalNumItems = ((uint)i+1); GroupActiveProposalItemReplyPacket.ProposalDataBlock ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock(); GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[1]; ProposalData.VoteCast = Utils.StringToBytes("false"); - ProposalData.VoteID = new UUID(VoteID[Blank.Key]); - ProposalData.VoteInitiator = new UUID(VoteInitiator[Blank.Key]); - ProposalData.Majority = (float)Convert.ToInt32(Majority[Blank.Key]); - ProposalData.Quorum = Convert.ToInt32(Quorum[Blank.Key]); - ProposalData.TerseDateID = Utils.StringToBytes(TerseDateID[Blank.Key]); - ProposalData.StartDateTime = Utils.StringToBytes(StartDateTime[Blank.Key]); - ProposalData.EndDateTime = Utils.StringToBytes(EndDateTime[Blank.Key]); - ProposalData.ProposalText = Utils.StringToBytes(ProposalText[Blank.Key]); + ProposalData.VoteID = new UUID(VoteID[i]); + ProposalData.VoteInitiator = new UUID(VoteInitiator[i]); + ProposalData.Majority = (float)Convert.ToInt32(Majority[i]); + ProposalData.Quorum = Convert.ToInt32(Quorum[i]); + ProposalData.TerseDateID = Utils.StringToBytes(TerseDateID[i]); + ProposalData.StartDateTime = Utils.StringToBytes(StartDateTime[i]); + ProposalData.EndDateTime = Utils.StringToBytes(EndDateTime[i]); + ProposalData.ProposalText = Utils.StringToBytes(ProposalText[i]); ProposalData.AlreadyVoted = false; - GAPIRP.ProposalData[0] = ProposalData; + GAPIRP.ProposalData[i] = ProposalData; OutPacket(GAPIRP, ThrottleOutPacketType.Task); + i++; } - if (VoteID.Count == 0) + if (VoteID.Length == 0) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); @@ -876,35 +878,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public void SendGroupVoteHistory(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, Dictionary VoteID, Dictionary VoteInitiator, Dictionary Majority, Dictionary Quorum, Dictionary TerseDateID, Dictionary StartDateTime, Dictionary EndDateTime, Dictionary VoteType, Dictionary VoteResult, Dictionary ProposalText) - { - foreach (KeyValuePair Blank in VoteID) + public void SendGroupVoteHistory(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, string[] VoteID, string[] VoteInitiator, string[] Majority, string[] Quorum, string[] TerseDateID, string[] StartDateTime, string[] EndDateTime, string[] VoteType, string[] VoteResult, string[] ProposalText) + { + int i = 0; + foreach (string voteID in VoteID) { - GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); + GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); - GVHIRP.AgentData.AgentID = agentID; - GVHIRP.AgentData.GroupID = groupID; - GVHIRP.TransactionData.TransactionID = transactionID; - GVHIRP.TransactionData.TotalNumItems = 1; - GVHIRP.HistoryItemData.VoteID = new UUID(VoteID[Blank.Key]); - GVHIRP.HistoryItemData.VoteInitiator = new UUID(VoteInitiator[Blank.Key]); - GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Majority[Blank.Key]); - GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Quorum[Blank.Key]); - GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(TerseDateID[Blank.Key]); - GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(StartDateTime[Blank.Key]); - GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(EndDateTime[Blank.Key]); - GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(VoteType[Blank.Key]); - GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(VoteResult[Blank.Key]); - GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(ProposalText[Blank.Key]); - GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock(); - GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1]; - VoteItem.CandidateID = UUID.Zero; - VoteItem.NumVotes = 0; //TODO: FIX THIS!!! - VoteItem.VoteCast = Utils.StringToBytes("Yes"); - GVHIRP.VoteItem[0] = VoteItem; - OutPacket(GVHIRP, ThrottleOutPacketType.Task); + GVHIRP.AgentData.AgentID = agentID; + GVHIRP.AgentData.GroupID = groupID; + GVHIRP.TransactionData.TransactionID = transactionID; + GVHIRP.TransactionData.TotalNumItems = ((uint)i+1); + GVHIRP.HistoryItemData.VoteID = new UUID(VoteID[i]); + GVHIRP.HistoryItemData.VoteInitiator = new UUID(VoteInitiator[i]); + GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Majority[i]); + GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Quorum[i]); + GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(TerseDateID[i]); + GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(StartDateTime[i]); + GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(EndDateTime[i]); + GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(VoteType[i]); + GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(VoteResult[i]); + GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(ProposalText[i]); + GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock(); + GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1]; + VoteItem.CandidateID = UUID.Zero; + VoteItem.NumVotes = 0; //TODO: FIX THIS!!! + VoteItem.VoteCast = Utils.StringToBytes("Yes"); + GVHIRP.VoteItem[i] = VoteItem; + OutPacket(GVHIRP, ThrottleOutPacketType.Task); + i++; } - if (VoteID.Count == 0) + if (VoteID.Length == 0) { GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); @@ -4892,7 +4896,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; - FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUserEvent; + FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser; if (FreezeUserHandler != null) { FreezeUserHandler(this, @@ -4909,7 +4913,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EjectUserPacket EjectUser = (EjectUserPacket)Packet; - EjectUserUpdate EjectUserHandler = OnParcelEjectUserEvent; + EjectUserUpdate EjectUserHandler = OnParcelEjectUser; if (EjectUserHandler != null) { EjectUserHandler(this, @@ -5308,7 +5312,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP FindAgentPacket FindAgent = (FindAgentPacket)Packet; - FindAgentUpdate FindAgentHandler = OnFindAgentEvent; + FindAgentUpdate FindAgentHandler = OnFindAgent; if (FindAgentHandler != null) { FindAgentHandler(this,FindAgent.AgentBlock.Hunter,FindAgent.AgentBlock.Prey); @@ -5322,7 +5326,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TrackAgentPacket TrackAgent = (TrackAgentPacket)Packet; - TrackAgentUpdate TrackAgentHandler = OnTrackAgentEvent; + TrackAgentUpdate TrackAgentHandler = OnTrackAgent; if (TrackAgentHandler != null) { TrackAgentHandler(this, @@ -8608,7 +8612,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP GodUpdateRegionInfoPacket GodUpdateRegionInfo = (GodUpdateRegionInfoPacket)Packet; - GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdateEvent; + GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdate; if (handlerGodUpdateRegionInfo != null) { handlerGodUpdateRegionInfo(this, @@ -8641,7 +8645,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP GodlikeMessagePacket GodlikeMessage = (GodlikeMessagePacket)Packet; - GodlikeMessage handlerGodlikeMessage = onGodlikeMessageEvent; + GodlikeMessage handlerGodlikeMessage = onGodlikeMessage; if (handlerGodlikeMessage != null) { handlerGodlikeMessage(this, @@ -8657,7 +8661,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { StateSavePacket SaveStateMessage = (StateSavePacket)Packet; - SaveStateHandler handlerSaveStatePacket = OnSaveStateEvent; + SaveStateHandler handlerSaveStatePacket = OnSaveState; if (handlerSaveStatePacket != null) { handlerSaveStatePacket(this,SaveStateMessage.AgentData.AgentID); @@ -9021,7 +9025,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { UpdateMuteListEntryPacket UpdateMuteListEntry = (UpdateMuteListEntryPacket)Packet; - MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntryEvent; + MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntry; if (handlerUpdateMuteListEntry != null) { handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, @@ -9037,7 +9041,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { RemoveMuteListEntryPacket RemoveMuteListEntry = (RemoveMuteListEntryPacket)Packet; - MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntryEvent; + MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntry; if (handlerRemoveMuteListEntry != null) { handlerRemoveMuteListEntry(this, @@ -9054,7 +9058,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP UserReportPacket UserReport = (UserReportPacket)Packet; - NewUserReport handlerUserReport = OnUserReportEvent; + NewUserReport handlerUserReport = OnUserReport; if (handlerUserReport != null) { handlerUserReport(this, diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index a4a649c43b..086d4fe69a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -397,8 +397,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends client.OnLogout += OnLogout; client.OnGrantUserRights += GrantUserFriendRights; - client.OnTrackAgentEvent += FindAgent; - client.OnFindAgentEvent += FindAgent; + client.OnTrackAgent += FindAgent; + client.OnFindAgent += FindAgent; } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 27fad61b39..7699aa2f41 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -274,25 +274,25 @@ namespace OpenSim.Region.Examples.SimpleModule public event PlacesQuery OnPlacesQuery; - public event FindAgentUpdate OnFindAgentEvent; - public event TrackAgentUpdate OnTrackAgentEvent; - public event NewUserReport OnUserReportEvent; - public event SaveStateHandler OnSaveStateEvent; + public event FindAgentUpdate OnFindAgent; + public event TrackAgentUpdate OnTrackAgent; + public event NewUserReport OnUserReport; + public event SaveStateHandler OnSaveState; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - public event FreezeUserUpdate OnParcelFreezeUserEvent; - public event EjectUserUpdate OnParcelEjectUserEvent; + public event FreezeUserUpdate OnParcelFreezeUser; + public event EjectUserUpdate OnParcelEjectUser; public event ParcelBuyPass OnParcelBuyPass; public event ParcelGodMark OnParcelGodMark; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent; - public event GodlikeMessage onGodlikeMessageEvent; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + public event MuteListEntryUpdate OnUpdateMuteListEntry; + public event MuteListEntryRemove OnRemoveMuteListEntry; + public event GodlikeMessage onGodlikeMessage; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; #pragma warning restore 67 diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 5d97a12868..10b352f2a8 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -836,25 +836,25 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event MuteListRequest OnMuteListRequest; public event AvatarInterestUpdate OnAvatarInterestUpdate; public event PlacesQuery OnPlacesQuery; - public event FindAgentUpdate OnFindAgentEvent; - public event TrackAgentUpdate OnTrackAgentEvent; - public event NewUserReport OnUserReportEvent; - public event SaveStateHandler OnSaveStateEvent; + public event FindAgentUpdate OnFindAgent; + public event TrackAgentUpdate OnTrackAgent; + public event NewUserReport OnUserReport; + public event SaveStateHandler OnSaveState; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - public event FreezeUserUpdate OnParcelFreezeUserEvent; - public event EjectUserUpdate OnParcelEjectUserEvent; + public event FreezeUserUpdate OnParcelFreezeUser; + public event EjectUserUpdate OnParcelEjectUser; public event ParcelBuyPass OnParcelBuyPass; public event ParcelGodMark OnParcelGodMark; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent; - public event GodlikeMessage onGodlikeMessageEvent; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + public event MuteListEntryUpdate OnUpdateMuteListEntry; + public event MuteListEntryRemove OnRemoveMuteListEntry; + public event GodlikeMessage onGodlikeMessage; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; #pragma warning restore 67 diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index e3392c83ee..daefd70220 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -380,25 +380,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event PlacesQuery OnPlacesQuery; - public event FindAgentUpdate OnFindAgentEvent; - public event TrackAgentUpdate OnTrackAgentEvent; - public event NewUserReport OnUserReportEvent; - public event SaveStateHandler OnSaveStateEvent; + public event FindAgentUpdate OnFindAgent; + public event TrackAgentUpdate OnTrackAgent; + public event NewUserReport OnUserReport; + public event SaveStateHandler OnSaveState; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - public event FreezeUserUpdate OnParcelFreezeUserEvent; - public event EjectUserUpdate OnParcelEjectUserEvent; + public event FreezeUserUpdate OnParcelFreezeUser; + public event EjectUserUpdate OnParcelEjectUser; public event ParcelBuyPass OnParcelBuyPass; public event ParcelGodMark OnParcelGodMark; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent; - public event GodlikeMessage onGodlikeMessageEvent; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + public event MuteListEntryUpdate OnUpdateMuteListEntry; + public event MuteListEntryRemove OnRemoveMuteListEntry; + public event GodlikeMessage onGodlikeMessage; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; #pragma warning restore 67 diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 1a22bdc9e7..b78433f8e7 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -288,25 +288,25 @@ namespace OpenSim.Tests.Common.Mock public event PlacesQuery OnPlacesQuery; - public event FindAgentUpdate OnFindAgentEvent; - public event TrackAgentUpdate OnTrackAgentEvent; - public event NewUserReport OnUserReportEvent; - public event SaveStateHandler OnSaveStateEvent; + public event FindAgentUpdate OnFindAgent; + public event TrackAgentUpdate OnTrackAgent; + public event NewUserReport OnUserReport; + public event SaveStateHandler OnSaveState; public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; - public event FreezeUserUpdate OnParcelFreezeUserEvent; - public event EjectUserUpdate OnParcelEjectUserEvent; + public event FreezeUserUpdate OnParcelFreezeUser; + public event EjectUserUpdate OnParcelEjectUser; public event ParcelBuyPass OnParcelBuyPass; public event ParcelGodMark OnParcelGodMark; public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; - public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; - public event MuteListEntryRemove OnRemoveMuteListEntryEvent; - public event GodlikeMessage onGodlikeMessageEvent; - public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; + public event MuteListEntryUpdate OnUpdateMuteListEntry; + public event MuteListEntryRemove OnRemoveMuteListEntry; + public event GodlikeMessage onGodlikeMessage; + public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; #pragma warning restore 67 From 1e899704c1c19a8c42ff313677a13f35b46605da Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 7 Jan 2010 11:28:38 -0800 Subject: [PATCH 13/21] Adds config option "ForwardOfflineGroupMessages" to allow disabling of group messages forwarded while offline. Addresses Mantis #4457 --- .../Avatar/InstantMessage/OfflineMessageModule.cs | 7 ++++++- bin/OpenSim.ini.example | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 1614b70b9f..450897c77e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private bool enabled = true; private List m_SceneList = new List(); private string m_RestURL = String.Empty; + private bool m_ForwardOfflineGroupMessages = true; public void Initialise(Scene scene, IConfigSource config) { @@ -67,6 +68,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } + if (cnf != null) + m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages); + lock (m_SceneList) { if (m_SceneList.Count == 0) @@ -182,7 +186,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private void UndeliveredMessage(GridInstantMessage im) { - if (im.offline != 0) + if ((im.offline != 0) + && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { bool success = SynchronousRestObjectPoster.BeginPostObject( "POST", m_RestURL+"/SaveMessage/", im); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 1cf96b0d1b..0667047bfb 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -473,6 +473,7 @@ ; OfflineMessageURL = http://yourserver/Offline.php ; MuteListModule = MuteListModule ; MuteListURL = http://yourserver/Mute.php + ; ForwardOfflineGroupMessages = true [ODEPhysicsSettings] From 452be5e54616f6e43acb08588d04d34f809bcd25 Mon Sep 17 00:00:00 2001 From: Revolution Date: Thu, 7 Jan 2010 23:14:26 -0600 Subject: [PATCH 14/21] Second Fix to the new Packets as per Melanie's request. Signed-off-by: Melanie --- .../ClientStack/LindenUDP/LLClientView.cs | 100 +++++++++++------- 1 file changed, 61 insertions(+), 39 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5eaaf12514..195e9aa99a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -824,40 +824,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); } OutPacket(gmp, ThrottleOutPacketType.Task); - } - - public void SendGroupActiveProposals(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, string[] VoteID, string[] VoteInitiator, string[] Majority, string[] Quorum, string[] TerseDateID, string[] StartDateTime, string[] EndDateTime, string[] ProposalText) + } + public struct GroupActiveProposals { - int i = 0; - foreach (string voteID in VoteID) + public string VoteID; + public string VoteInitiator; + public string Majority; + public string Quorum; + public string TerseDateID; + public string StartDateTime; + public string EndDateTime; + public string ProposalText; + } + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { + int i = 0; + foreach (GroupActiveProposals Proposal in Proposals) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); - GAPIRP.AgentData.AgentID = agentID; + GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.GroupID = groupID; GAPIRP.TransactionData.TransactionID = transactionID; GAPIRP.TransactionData.TotalNumItems = ((uint)i+1); GroupActiveProposalItemReplyPacket.ProposalDataBlock ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock(); GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[1]; - ProposalData.VoteCast = Utils.StringToBytes("false"); - ProposalData.VoteID = new UUID(VoteID[i]); - ProposalData.VoteInitiator = new UUID(VoteInitiator[i]); - ProposalData.Majority = (float)Convert.ToInt32(Majority[i]); - ProposalData.Quorum = Convert.ToInt32(Quorum[i]); - ProposalData.TerseDateID = Utils.StringToBytes(TerseDateID[i]); - ProposalData.StartDateTime = Utils.StringToBytes(StartDateTime[i]); - ProposalData.EndDateTime = Utils.StringToBytes(EndDateTime[i]); - ProposalData.ProposalText = Utils.StringToBytes(ProposalText[i]); + ProposalData.VoteCast = Utils.StringToBytes("false"); + ProposalData.VoteID = new UUID(Proposal.VoteID); + ProposalData.VoteInitiator = new UUID(Proposal.VoteInitiator); + ProposalData.Majority = (float)Convert.ToInt32(Proposal.Majority); + ProposalData.Quorum = Convert.ToInt32(Proposal.Quorum); + ProposalData.TerseDateID = Utils.StringToBytes(Proposal.TerseDateID); + ProposalData.StartDateTime = Utils.StringToBytes(Proposal.StartDateTime); + ProposalData.EndDateTime = Utils.StringToBytes(Proposal.EndDateTime); + ProposalData.ProposalText = Utils.StringToBytes(Proposal.ProposalText); ProposalData.AlreadyVoted = false; GAPIRP.ProposalData[i] = ProposalData; OutPacket(GAPIRP, ThrottleOutPacketType.Task); i++; - } - if (VoteID.Length == 0) + } + if (Proposals.Length == 0) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); - GAPIRP.AgentData.AgentID = agentID; + GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.GroupID = groupID; GAPIRP.TransactionData.TransactionID = transactionID; GAPIRP.TransactionData.TotalNumItems = 1; @@ -876,29 +886,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP GAPIRP.ProposalData[0] = ProposalData; OutPacket(GAPIRP, ThrottleOutPacketType.Task); } - } - - public void SendGroupVoteHistory(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, string[] VoteID, string[] VoteInitiator, string[] Majority, string[] Quorum, string[] TerseDateID, string[] StartDateTime, string[] EndDateTime, string[] VoteType, string[] VoteResult, string[] ProposalText) + } + public struct GroupVoteHistory { - int i = 0; - foreach (string voteID in VoteID) + public string VoteID; + public string VoteInitiator; + public string Majority; + public string Quorum; + public string TerseDateID; + public string StartDateTime; + public string EndDateTime; + public string VoteType; + public string VoteResult; + public string ProposalText; + } + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + int i = 0; + foreach (GroupVoteHistory Vote in Votes) { - GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); - - GVHIRP.AgentData.AgentID = agentID; + GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); + + GVHIRP.AgentData.AgentID = AgentId; GVHIRP.AgentData.GroupID = groupID; GVHIRP.TransactionData.TransactionID = transactionID; - GVHIRP.TransactionData.TotalNumItems = ((uint)i+1); - GVHIRP.HistoryItemData.VoteID = new UUID(VoteID[i]); - GVHIRP.HistoryItemData.VoteInitiator = new UUID(VoteInitiator[i]); - GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Majority[i]); - GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Quorum[i]); - GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(TerseDateID[i]); - GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(StartDateTime[i]); - GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(EndDateTime[i]); - GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(VoteType[i]); - GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(VoteResult[i]); - GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(ProposalText[i]); + GVHIRP.TransactionData.TotalNumItems = ((uint)i+1); + GVHIRP.HistoryItemData.VoteID = new UUID(Vote.VoteID); + GVHIRP.HistoryItemData.VoteInitiator = new UUID(Vote.VoteInitiator); + GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Vote.Majority); + GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Vote.Quorum); + GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(Vote.TerseDateID); + GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(Vote.StartDateTime); + GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(Vote.EndDateTime); + GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(Vote.VoteType); + GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(Vote.VoteResult); + GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(Vote.ProposalText); GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock(); GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1]; VoteItem.CandidateID = UUID.Zero; @@ -908,11 +930,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(GVHIRP, ThrottleOutPacketType.Task); i++; } - if (VoteID.Length == 0) + if (Votes.Length == 0) { GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); - GVHIRP.AgentData.AgentID = agentID; + GVHIRP.AgentData.AgentID = AgentId; GVHIRP.AgentData.GroupID = groupID; GVHIRP.TransactionData.TransactionID = transactionID; GVHIRP.TransactionData.TotalNumItems = 0; From 17efecd6c57c7abf6cc67bd9e347ec6176caab27 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Jan 2010 05:29:29 +0000 Subject: [PATCH 15/21] Moving the new group data structures out of LLClientView into GroupData. The new methods are still not in IClientAPI, so some work remains to be done. --- OpenSim/Framework/GroupData.cs | 26 +++++++ .../ClientStack/LindenUDP/LLClientView.cs | 78 +++++++------------ 2 files changed, 54 insertions(+), 50 deletions(-) diff --git a/OpenSim/Framework/GroupData.cs b/OpenSim/Framework/GroupData.cs index 247420e27b..e3b86265d6 100644 --- a/OpenSim/Framework/GroupData.cs +++ b/OpenSim/Framework/GroupData.cs @@ -135,4 +135,30 @@ namespace OpenSim.Framework public bool HasAttachment; public byte AssetType; } + + public struct GroupVoteHistory + { + public string VoteID; + public string VoteInitiator; + public string Majority; + public string Quorum; + public string TerseDateID; + public string StartDateTime; + public string EndDateTime; + public string VoteType; + public string VoteResult; + public string ProposalText; + } + + public struct GroupActiveProposals + { + public string VoteID; + public string VoteInitiator; + public string Majority; + public string Quorum; + public string TerseDateID; + public string StartDateTime; + public string EndDateTime; + public string ProposalText; + } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 195e9aa99a..7d90a68d93 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -824,21 +824,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); } OutPacket(gmp, ThrottleOutPacketType.Task); - } - public struct GroupActiveProposals - { - public string VoteID; - public string VoteInitiator; - public string Majority; - public string Quorum; - public string TerseDateID; - public string StartDateTime; - public string EndDateTime; - public string ProposalText; } + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) - { - int i = 0; + { + int i = 0; foreach (GroupActiveProposals Proposal in Proposals) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); @@ -849,20 +839,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP GAPIRP.TransactionData.TotalNumItems = ((uint)i+1); GroupActiveProposalItemReplyPacket.ProposalDataBlock ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock(); GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[1]; - ProposalData.VoteCast = Utils.StringToBytes("false"); - ProposalData.VoteID = new UUID(Proposal.VoteID); - ProposalData.VoteInitiator = new UUID(Proposal.VoteInitiator); - ProposalData.Majority = (float)Convert.ToInt32(Proposal.Majority); - ProposalData.Quorum = Convert.ToInt32(Proposal.Quorum); - ProposalData.TerseDateID = Utils.StringToBytes(Proposal.TerseDateID); - ProposalData.StartDateTime = Utils.StringToBytes(Proposal.StartDateTime); - ProposalData.EndDateTime = Utils.StringToBytes(Proposal.EndDateTime); + ProposalData.VoteCast = Utils.StringToBytes("false"); + ProposalData.VoteID = new UUID(Proposal.VoteID); + ProposalData.VoteInitiator = new UUID(Proposal.VoteInitiator); + ProposalData.Majority = (float)Convert.ToInt32(Proposal.Majority); + ProposalData.Quorum = Convert.ToInt32(Proposal.Quorum); + ProposalData.TerseDateID = Utils.StringToBytes(Proposal.TerseDateID); + ProposalData.StartDateTime = Utils.StringToBytes(Proposal.StartDateTime); + ProposalData.EndDateTime = Utils.StringToBytes(Proposal.EndDateTime); ProposalData.ProposalText = Utils.StringToBytes(Proposal.ProposalText); ProposalData.AlreadyVoted = false; GAPIRP.ProposalData[i] = ProposalData; OutPacket(GAPIRP, ThrottleOutPacketType.Task); i++; - } + } if (Proposals.Length == 0) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); @@ -886,40 +876,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP GAPIRP.ProposalData[0] = ProposalData; OutPacket(GAPIRP, ThrottleOutPacketType.Task); } - } - public struct GroupVoteHistory - { - public string VoteID; - public string VoteInitiator; - public string Majority; - public string Quorum; - public string TerseDateID; - public string StartDateTime; - public string EndDateTime; - public string VoteType; - public string VoteResult; - public string ProposalText; } + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) - { - int i = 0; + { + int i = 0; foreach (GroupVoteHistory Vote in Votes) { - GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); - + GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); + GVHIRP.AgentData.AgentID = AgentId; GVHIRP.AgentData.GroupID = groupID; GVHIRP.TransactionData.TransactionID = transactionID; - GVHIRP.TransactionData.TotalNumItems = ((uint)i+1); - GVHIRP.HistoryItemData.VoteID = new UUID(Vote.VoteID); - GVHIRP.HistoryItemData.VoteInitiator = new UUID(Vote.VoteInitiator); - GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Vote.Majority); - GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Vote.Quorum); - GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(Vote.TerseDateID); - GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(Vote.StartDateTime); - GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(Vote.EndDateTime); - GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(Vote.VoteType); - GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(Vote.VoteResult); + GVHIRP.TransactionData.TotalNumItems = ((uint)i+1); + GVHIRP.HistoryItemData.VoteID = new UUID(Vote.VoteID); + GVHIRP.HistoryItemData.VoteInitiator = new UUID(Vote.VoteInitiator); + GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Vote.Majority); + GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Vote.Quorum); + GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(Vote.TerseDateID); + GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(Vote.StartDateTime); + GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(Vote.EndDateTime); + GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(Vote.VoteType); + GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(Vote.VoteResult); GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(Vote.ProposalText); GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock(); GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1]; @@ -927,7 +905,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP VoteItem.NumVotes = 0; //TODO: FIX THIS!!! VoteItem.VoteCast = Utils.StringToBytes("Yes"); GVHIRP.VoteItem[i] = VoteItem; - OutPacket(GVHIRP, ThrottleOutPacketType.Task); + OutPacket(GVHIRP, ThrottleOutPacketType.Task); i++; } if (Votes.Length == 0) From 3bf69aa5a3f76610412801857245a7aa6408e091 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Jan 2010 11:02:39 +0000 Subject: [PATCH 16/21] Change ConsoleClient to allow quoted values to be passed through. This allows setting the login message remotely on the user server console --- OpenSim/ConsoleClient/ConsoleClient.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs index 783adef559..d195d25296 100644 --- a/OpenSim/ConsoleClient/ConsoleClient.cs +++ b/OpenSim/ConsoleClient/ConsoleClient.cs @@ -82,7 +82,13 @@ namespace OpenSim.ConsoleClient private static void SendCommand(string module, string[] cmd) { - string sendCmd = String.Join(" ", cmd); + string sendCmd = cmd[0]; + if (cmd.Length > 1) + { + Array.Copy(cmd, 1, cmd, 0, cmd.Length-1); + Array.Resize(ref cmd, cmd.Length-1); + sendCmd += "\"" + String.Join("\" \"", cmd) + "\""; + } Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply); } From 22b1ffdc6ce59e3d8108ef26522dfce815b1a921 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 8 Jan 2010 14:45:40 +0000 Subject: [PATCH 17/21] Fix repeated ArgumentOutOfRangeException when a local OpenSim console is resized under mono May fix mantises 3186, 3270, 4022, 4238 --- OpenSim/Framework/Console/CommandConsole.cs | 8 +- OpenSim/Framework/Console/LocalConsole.cs | 106 ++++++++++++++------ 2 files changed, 79 insertions(+), 35 deletions(-) diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 9671bc2375..66f483cf22 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -552,8 +552,9 @@ namespace OpenSim.Framework.Console } } - // A console that processes commands internally - // + /// + /// A console that processes commands internally + /// public class CommandConsole : ConsoleBase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -574,6 +575,9 @@ namespace OpenSim.Framework.Console Output(s); } + /// + /// Display a command prompt on the console and wait for user input + /// public void Prompt() { string line = ReadLine(m_defaultPrompt + "# ", true, true); diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 39edd2aac2..b7e191b969 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -36,8 +36,9 @@ using log4net; namespace OpenSim.Framework.Console { - // A console that uses cursor control and color - // + /// + /// A console that uses cursor control and color + /// public class LocalConsole : CommandConsole { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -85,30 +86,70 @@ namespace OpenSim.Framework.Console history.Add(text); } + /// + /// Set the cursor row. + /// + /// + /// + /// Row to set. If this is below 0, then the row is set to 0. If it is equal to the buffer height or greater + /// then it is set to one less than the height. + /// + /// + /// The new cursor row. + /// private int SetCursorTop(int top) { - if (top >= 0 && top < System.Console.BufferHeight) - { - System.Console.CursorTop = top; - return top; - } - else - { - return System.Console.CursorTop; - } + // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try + // to set a cursor row position with a currently invalid column, mono will throw an exception. + // Therefore, we need to make sure that the column position is valid first. + int left = System.Console.CursorLeft; + + if (left < 0) + System.Console.CursorLeft = 0; + else if (left >= System.Console.BufferWidth) + System.Console.CursorLeft = System.Console.BufferWidth - 1; + + if (top < 0) + top = 0; + if (top >= System.Console.BufferHeight) + top = System.Console.BufferHeight - 1; + + System.Console.CursorTop = top; + + return top; } + /// + /// Set the cursor column. + /// + /// + /// + /// Column to set. If this is below 0, then the column is set to 0. If it is equal to the buffer width or greater + /// then it is set to one less than the width. + /// + /// + /// The new cursor column. + /// private int SetCursorLeft(int left) { - if (left >= 0 && left < System.Console.BufferWidth) - { - System.Console.CursorLeft = left; - return left; - } - else - { - return System.Console.CursorLeft; - } + // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try + // to set a cursor column position with a currently invalid row, mono will throw an exception. + // Therefore, we need to make sure that the row position is valid first. + int top = System.Console.CursorTop; + + if (top < 0) + System.Console.CursorTop = 0; + else if (top >= System.Console.BufferHeight) + System.Console.CursorTop = System.Console.BufferHeight - 1; + + if (left < 0) + left = 0; + if (left >= System.Console.BufferWidth) + left = System.Console.BufferWidth - 1; + + System.Console.CursorLeft = left; + + return left; } private void Show() @@ -128,21 +169,21 @@ namespace OpenSim.Framework.Console { y--; new_y--; - System.Console.CursorLeft = 0; - System.Console.CursorTop = System.Console.BufferHeight-1; + SetCursorLeft(0); + SetCursorTop(System.Console.BufferHeight - 1); System.Console.WriteLine(" "); } - y=SetCursorTop(y); - System.Console.CursorLeft = 0; + y = SetCursorTop(y); + SetCursorLeft(0); if (echo) System.Console.Write("{0}{1}", prompt, cmdline); else System.Console.Write("{0}", prompt); - SetCursorLeft(new_x); SetCursorTop(new_y); + SetCursorLeft(new_x); } } @@ -162,8 +203,7 @@ namespace OpenSim.Framework.Console System.Console.Write(" "); y = SetCursorTop(y); - System.Console.CursorLeft = 0; - + SetCursorLeft(0); } } catch (Exception) @@ -252,7 +292,7 @@ namespace OpenSim.Framework.Console } y = SetCursorTop(y); - System.Console.CursorLeft = 0; + SetCursorLeft(0); int count = cmdline.Length + prompt.Length; @@ -260,7 +300,7 @@ namespace OpenSim.Framework.Console System.Console.Write(" "); y = SetCursorTop(y); - System.Console.CursorLeft = 0; + SetCursorLeft(0); WriteLocalText(text, level); @@ -299,7 +339,7 @@ namespace OpenSim.Framework.Console echo = e; int historyLine = history.Count; - System.Console.CursorLeft = 0; // Needed for mono + SetCursorLeft(0); // Needed for mono System.Console.Write(" "); // Needed for mono lock (cmdline) @@ -339,7 +379,7 @@ namespace OpenSim.Framework.Console cmdline.Remove(cp-1, 1); cp--; - System.Console.CursorLeft = 0; + SetCursorLeft(0); y = SetCursorTop(y); System.Console.Write("{0}{1} ", prompt, cmdline); @@ -387,7 +427,7 @@ namespace OpenSim.Framework.Console cp++; break; case ConsoleKey.Enter: - System.Console.CursorLeft = 0; + SetCursorLeft(0); y = SetCursorTop(y); System.Console.WriteLine("{0}{1}", prompt, cmdline); @@ -424,4 +464,4 @@ namespace OpenSim.Framework.Console } } } -} +} \ No newline at end of file From c76c80a28aabeb1cb0556ea2ebd89f6241bb7026 Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 8 Jan 2010 12:44:26 -0600 Subject: [PATCH 18/21] Adds IClientAPI voids for GroupProposals. Signed-off-by: Melanie --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 10 +++++++++- .../Client/Sirikata/ClientStack/SirikataClientView.cs | 10 +++++++++- OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | 10 +++++++++- OpenSim/Framework/IClientAPI.cs | 7 ++++++- OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 10 +++++++++- .../InternetRelayClientView/Server/IRCClientView.cs | 10 +++++++++- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 10 +++++++++- OpenSim/Tests/Common/Mock/TestClient.cs | 8 ++++++++ 8 files changed, 68 insertions(+), 7 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index f84b2968b7..6bf976c228 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1688,7 +1688,15 @@ namespace OpenSim.Client.MXP.ClientStack } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index e1eed9bad9..8e5efe493f 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -1177,7 +1177,15 @@ namespace OpenSim.Client.Sirikata.ClientStack } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } #endregion diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 7ca57b031c..f23acdc264 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -1194,7 +1194,15 @@ namespace OpenSim.Client.VWoHTTP.ClientStack } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index eb5b0341d0..0efc2a4c83 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1446,7 +1446,12 @@ namespace OpenSim.Framework void SendUserInfoReply(bool imViaEmail, bool visible, string email); void SendUseCachedMuteList(); - void SendMuteListUpdate(string filename); + + void SendMuteListUpdate(string filename); + + void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals); + + void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes); void KillEndDone(); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 7699aa2f41..d5218b553e 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -1133,7 +1133,15 @@ namespace OpenSim.Region.Examples.SimpleModule } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 10b352f2a8..55bbed9285 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1657,7 +1657,15 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index daefd70220..fa47d16324 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -1138,7 +1138,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index b78433f8e7..93cab0e817 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -1194,6 +1194,14 @@ namespace OpenSim.Tests.Common.Mock public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } From bc68390b14ec582093dc322c2f45c32491924406 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Jan 2010 22:51:37 +0000 Subject: [PATCH 19/21] The first 2 handlers for the XInventory system. --- .../Inventory/XInventoryInConnector.cs | 74 +++++++++++++++++++ .../Inventory/XInventoryConnector.cs | 4 +- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index b48e30e342..c7d5ff1d3a 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -38,6 +38,7 @@ using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; using log4net; +using OpenMetaverse; namespace OpenSim.Server.Handlers.Asset { @@ -193,6 +194,14 @@ namespace OpenSim.Server.Handlers.Asset { Dictionary result = new Dictionary(); + if (!request.ContainsKey("PRINCIPAL")) + return FailureResult(); + + if(m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString()))) + result["RESULT"] = "True"; + else + result["RESULT"] = "False"; + string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); @@ -203,6 +212,15 @@ namespace OpenSim.Server.Handlers.Asset { Dictionary result = new Dictionary(); + if (!request.ContainsKey("PRINCIPAL")) + return FailureResult(); + + + List folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); + + foreach (InventoryFolderBase f in folders) + result[f.ID.ToString()] = EncodeFolder(f); + string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); @@ -378,5 +396,61 @@ namespace OpenSim.Server.Handlers.Asset UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(xmlString); } + + private Dictionary EncodeFolder(InventoryFolderBase f) + { + Dictionary ret = new Dictionary(); + + ret["ParentID"] = f.ParentID.ToString(); + ret["Type"] = f.Type.ToString(); + ret["Version"] = f.Version.ToString(); + ret["Name"] = f.Name; + ret["Owner"] = f.Owner.ToString(); + ret["ID"] = f.ID.ToString(); + + return ret; + } + + private InventoryFolderBase BuildFolder(Dictionary data) + { + InventoryFolderBase folder = new InventoryFolderBase(); + + folder.ParentID = new UUID(data["ParentID"].ToString()); + folder.Type = short.Parse(data["Type"].ToString()); + folder.Version = ushort.Parse(data["Version"].ToString()); + folder.Name = data["Name"].ToString(); + folder.Owner = new UUID(data["Owner"].ToString()); + folder.ID = new UUID(data["ID"].ToString()); + + return folder; + } + + private InventoryItemBase BuildItem(Dictionary data) + { + InventoryItemBase item = new InventoryItemBase(); + + item.AssetID = new UUID(data["AssetID"].ToString()); + item.AssetType = int.Parse(data["AssetType"].ToString()); + item.Name = data["Name"].ToString(); + item.Owner = new UUID(data["Owner"].ToString()); + item.ID = new UUID(data["ID"].ToString()); + item.InvType = int.Parse(data["InvType"].ToString()); + item.Folder = new UUID(data["Folder"].ToString()); + item.CreatorId = data["CreatorId"].ToString(); + item.Description = data["Description"].ToString(); + item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); + item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); + item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); + item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); + item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); + item.GroupID = new UUID(data["GroupID"].ToString()); + item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); + item.SalePrice = int.Parse(data["SalePrice"].ToString()); + item.SaleType = byte.Parse(data["SaleType"].ToString()); + item.Flags = uint.Parse(data["Flags"].ToString()); + item.CreationDate = int.Parse(data["CreationDate"].ToString()); + + return item; + } } } diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 40acd6d20f..b9ccd7ea12 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -490,7 +490,7 @@ namespace OpenSim.Services.Connectors return replyData; } - InventoryFolderBase BuildFolder(Dictionary data) + private InventoryFolderBase BuildFolder(Dictionary data) { InventoryFolderBase folder = new InventoryFolderBase(); @@ -504,7 +504,7 @@ namespace OpenSim.Services.Connectors return folder; } - InventoryItemBase BuildItem(Dictionary data) + private InventoryItemBase BuildItem(Dictionary data) { InventoryItemBase item = new InventoryItemBase(); From b297913e2b4831a7dbc57c867f7ad6a46bd65f44 Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 8 Jan 2010 22:58:01 -0800 Subject: [PATCH 20/21] Add some notes to OpenSim.ini.example suggesting to use MySQL with Mono installations --- bin/OpenSim.ini.example | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 0667047bfb..15623de5b8 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -126,11 +126,16 @@ ;storage_plugin = "OpenSim.Data.Null.dll" ; --- To use sqlite as region storage: + ; NOTE: SQLite and OpenSim are not functioning properly with Mono 2.4.3 or greater. + ; If you are using Mono you probably should be using MySQL storage_plugin = "OpenSim.Data.SQLite.dll" storage_connection_string="URI=file:OpenSim.db,version=3"; - ; --- To use MySQL storage, supply your own connectionstring (this is only an example): + ; --- To use MySQL storage, supply your own connection string (this is only an example): ; note that the supplied account needs create privilegies if you want it to auto-create needed tables. + ; + ; -->>> There are multiple connection strings defined in several places in this file. Check it carefully! + ; ; storage_plugin="OpenSim.Data.MySQL.dll" ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; ; If you want to use a different database/server for estate data, then From b3d6c85126fe8cf3e84ca023c41b0ed4a2664c15 Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 8 Jan 2010 23:09:38 -0800 Subject: [PATCH 21/21] Add some configuration hints and references to README.txt --- README.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index d276c6ec19..339d6872c1 100644 --- a/README.txt +++ b/README.txt @@ -13,10 +13,14 @@ If it breaks, you get to keep *both* pieces. == Installation on Windows == Prereqs: - + * runprebuild.bat * Load OpenSim.sln into Visual Studio .NET and build the solution. * chdir bin + * edit OpenSim.ini and appropriate files in bin/config-include * OpenSim.exe + + Helpful resources: +* http://opensimulator.org/wiki/Build_Instructions See configuring OpenSim @@ -31,11 +35,16 @@ From the distribution type: * ./runprebuild.sh * nant * cd bin + * edit OpenSim.ini and appropriate files in bin/config-include * mono ./OpenSim.exe See configuring OpenSim == Configuring OpenSim == + Helpful resources: +* http://opensimulator.org/wiki/Configuration +* http://opensimulator.org/wiki/Configuring_Regions +* http://opensimulator.org/wiki/Mysql-config When OpenSim starts for the first time, you will be prompted with a series of questions that look something like: