From 033a3da254d5acba8fff002bec921dc39752bff8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Jan 2010 23:30:38 +0000 Subject: Sqlite framework and generic handler. They compile. More I cannot say. --- OpenSim/Data/SQLite/SQLiteFramework.cs | 83 ++++++++ OpenSim/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 (limited to 'OpenSim') diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs new file mode 100644 index 0000000..12b2750 --- /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 0000000..6b67ec6 --- /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; + } + } +} -- cgit v1.1 From 28ba16ee531a6d21f793845f897828e7b1b3fdca Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 00:35:54 +0000 Subject: 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 (limited to 'OpenSim') diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs new file mode 100644 index 0000000..97625a7 --- /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; + } + } +} -- cgit v1.1 From 4799f1ce9220eb9ff65ea81f1476f804b5e85144 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 03:13:19 +0000 Subject: Add the unfinished XInventoryConnector. Intermediate commit, will NOT compile! --- .../Connectors/Inventory/XInventoryConnector.cs | 317 +++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs new file mode 100644 index 0000000..6e1d657 --- /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; + } + } +} -- cgit v1.1 From cbe434149e79304da9251bfe946f43f6a08c1393 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 03:31:53 +0000 Subject: 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 ++-- .../Server/Handlers/Grid/GridServerPostHandler.cs | 92 +++++++++++----------- .../Handlers/Presence/PresenceServerPostHandler.cs | 8 +- .../AuthenticationServiceConnector.cs | 6 +- .../Connectors/Grid/GridServiceConnector.cs | 16 ++-- 6 files changed, 74 insertions(+), 74 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0964caa..413a078 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 490a13a..47bc860 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 433ed0b..d99b791 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 2558fa0..b1c6bcf 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 50e817e..19bb3e2 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 02f2b79..99aa3fb 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(); -- cgit v1.1 From be41ba66700e46503001dfb4c2c87f9b2aad21c6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 21:46:16 +0000 Subject: Allow lists to be embedded in query strings --- OpenSim/Server/Base/ServerUtils.cs | 63 ++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 413a078..a5d28a4 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 += "&"; + if (qstring != String.Empty) + qstring += "&"; - qstring += part; + qstring += part; + } } return qstring; -- cgit v1.1 From aca01f541552b0f6e7521e98f5e8350175b89334 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 04:22:03 +0000 Subject: 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. --- .../Handlers/Presence/PresenceServerPostHandler.cs | 4 +- .../Connectors/Inventory/XInventoryConnector.cs | 198 +++++++++++++++++++-- 2 files changed, 187 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index b1c6bcf..b5ae54a 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 6e1d657..aac1a83 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; + } } } -- cgit v1.1 From a542871c1590e9d6d42fb3b1e099a8d6204e8e4d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jan 2010 15:39:53 +0000 Subject: 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. --- OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index e837e9a..f66f01f 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); } -- cgit v1.1 From 68eba8973c0d7aaaa2947bc7092edfa58e07f1e9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jan 2010 19:16:43 +0000 Subject: Adding a skeleton for the XInventoryInConnector, counterpart to the already done XInventoryConnector. No functionality yet. --- .../Handlers/Inventory/XInventoryInConnector.cs | 167 +++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs new file mode 100644 index 0000000..8c6eca7 --- /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); + } + + } +} -- cgit v1.1 From 6d061d9f398adfa193f25c43604b517ad0d756a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jan 2010 22:00:19 +0000 Subject: Complete the XInventoryConnector. Flesh out the skeleton for the XInventoryInConnector --- .../Handlers/Inventory/XInventoryInConnector.cs | 225 ++++++++++++++++++++- .../Connectors/Inventory/XInventoryConnector.cs | 50 ++++- 2 files changed, 268 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 8c6eca7..b48e30e 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 aac1a83..40acd6d 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) -- cgit v1.1 From 7dd43bef8cc75cd0364abdd763a972ef9ed6f990 Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 6 Jan 2010 21:19:00 -0600 Subject: Fixes the Collision errors and adds more to llGetStatus Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 119 +++++++++++++-------- 1 file changed, 74 insertions(+), 45 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 22a8ca1..d1bc351 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) -- cgit v1.1 From b67470af9106da24ed67db75cfe4787e58759385 Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 6 Jan 2010 19:52:10 -0600 Subject: 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 --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 20 ++-- .../Sirikata/ClientStack/SirikataClientView.cs | 20 ++-- .../Client/VWoHTTP/ClientStack/VWHClientView.cs | 20 ++-- OpenSim/Framework/IClientAPI.cs | 22 ++-- .../Region/ClientStack/LindenUDP/LLClientView.cs | 126 +++++++++++---------- .../CoreModules/Avatar/Friends/FriendsModule.cs | 4 +- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 20 ++-- .../Server/IRCClientView.cs | 20 ++-- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 20 ++-- OpenSim/Tests/Common/Mock/TestClient.cs | 20 ++-- 10 files changed, 148 insertions(+), 144 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index dbb9611..f84b296 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 66c0eb2..e1eed9b 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 6f6d231..7ca57b0 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 60c1ac7..eb5b034 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 9944852..5eaaf12 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); - } - if (VoteID.Count == 0) + 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.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 a4a649c..086d4fe 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 27fad61..7699aa2 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 5d97a12..10b352f 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 e3392c8..daefd70 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 1a22bdc..b78433f 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 -- cgit v1.1 From 1e899704c1c19a8c42ff313677a13f35b46605da Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 7 Jan 2010 11:28:38 -0800 Subject: Adds config option "ForwardOfflineGroupMessages" to allow disabling of group messages forwarded while offline. Addresses Mantis #4457 --- .../CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 1614b70..450897c 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); -- cgit v1.1 From 452be5e54616f6e43acb08588d04d34f809bcd25 Mon Sep 17 00:00:00 2001 From: Revolution Date: Thu, 7 Jan 2010 23:14:26 -0600 Subject: Second Fix to the new Packets as per Melanie's request. Signed-off-by: Melanie --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 100 +++++++++++++-------- 1 file changed, 61 insertions(+), 39 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5eaaf12..195e9aa 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; -- cgit v1.1 From 17efecd6c57c7abf6cc67bd9e347ec6176caab27 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Jan 2010 05:29:29 +0000 Subject: 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 ++++++++ .../Region/ClientStack/LindenUDP/LLClientView.cs | 78 ++++++++-------------- 2 files changed, 54 insertions(+), 50 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/GroupData.cs b/OpenSim/Framework/GroupData.cs index 247420e..e3b8626 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 195e9aa..7d90a68 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) -- cgit v1.1 From 3bf69aa5a3f76610412801857245a7aa6408e091 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Jan 2010 11:02:39 +0000 Subject: 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(-) (limited to 'OpenSim') diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs index 783adef..d195d25 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); } -- cgit v1.1 From 22b1ffdc6ce59e3d8108ef26522dfce815b1a921 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 8 Jan 2010 14:45:40 +0000 Subject: 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(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 9671bc2..66f483c 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 39edd2a..b7e191b 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 -- cgit v1.1 From c76c80a28aabeb1cb0556ea2ebd89f6241bb7026 Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 8 Jan 2010 12:44:26 -0600 Subject: Adds IClientAPI voids for GroupProposals. Signed-off-by: Melanie --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 10 +++++++++- OpenSim/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 +++++++++- .../Agent/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(-) (limited to 'OpenSim') diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index f84b296..6bf976c 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 e1eed9b..8e5efe4 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 7ca57b0..f23acdc 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 eb5b034..0efc2a4 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 7699aa2..d5218b5 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 10b352f..55bbed9 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 daefd70..fa47d16 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 b78433f..93cab0e 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) + { } } } -- cgit v1.1 From bc68390b14ec582093dc322c2f45c32491924406 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Jan 2010 22:51:37 +0000 Subject: The first 2 handlers for the XInventory system. --- .../Handlers/Inventory/XInventoryInConnector.cs | 74 ++++++++++++++++++++++ .../Connectors/Inventory/XInventoryConnector.cs | 4 +- 2 files changed, 76 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index b48e30e..c7d5ff1 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 40acd6d..b9ccd7e 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(); -- cgit v1.1 From 063f106cbbc2a805dc210fe16c30741ab24876cb Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 14:17:44 +0000 Subject: Add functionality to estate "Allowed Users" and "Allowed Groups". Allowed users will be honored now, while allowed groups will not. This requires additional groups module integration work --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 2 +- .../Sirikata/ClientStack/SirikataClientView.cs | 2 +- .../Client/VWoHTTP/ClientStack/VWHClientView.cs | 2 +- OpenSim/Framework/EstateSettings.cs | 28 +++ OpenSim/Framework/IClientAPI.cs | 2 +- .../Region/ClientStack/LindenUDP/LLClientView.cs | 17 +- .../World/Estate/EstateManagementModule.cs | 244 +++++++++++++-------- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +- .../Server/IRCClientView.cs | 2 +- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 11 files changed, 197 insertions(+), 108 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 6bf976c..3c98229 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1217,7 +1217,7 @@ namespace OpenSim.Client.MXP.ClientStack // Need to translate to MXP somehow } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { // Need to translate to MXP somehow } diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index 8e5efe4..30d1575 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -760,7 +760,7 @@ namespace OpenSim.Client.Sirikata.ClientStack throw new System.NotImplementedException(); } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index f23acdc..6a119bd 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -767,7 +767,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack throw new System.NotImplementedException(); } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index deced98..b4b5808 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -300,6 +300,34 @@ namespace OpenSim.Framework OnSave(this); } + public void AddEstateUser(UUID avatarID) + { + if (avatarID == UUID.Zero) + return; + if (!l_EstateAccess.Contains(avatarID)) + l_EstateAccess.Add(avatarID); + } + + public void RemoveEstateUser(UUID avatarID) + { + if (l_EstateAccess.Contains(avatarID)) + l_EstateAccess.Remove(avatarID); + } + + public void AddEstateGroup(UUID avatarID) + { + if (avatarID == UUID.Zero) + return; + if (!l_EstateGroups.Contains(avatarID)) + l_EstateGroups.Add(avatarID); + } + + public void RemoveEstateGroup(UUID avatarID) + { + if (l_EstateGroups.Contains(avatarID)) + l_EstateGroups.Remove(avatarID); + } + public void AddEstateManager(UUID avatarID) { if (avatarID == UUID.Zero) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0efc2a4..3489af1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1271,7 +1271,7 @@ namespace OpenSim.Framework void SendHealth(float health); - void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID); + void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID); void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7d90a68..3d3c324 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3912,7 +3912,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) + { EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); packet.AgentData.TransactionID = UUID.Random(); @@ -3921,26 +3922,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.MethodData.Invoice = invoice; packet.MethodData.Method = Utils.StringToBytes("setaccess"); - EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length]; + EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length]; - for (int i = 0; i < (6 + EstateManagers.Length); i++) + for (int i = 0; i < (6 + Data.Length); i++) { returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); } int j = 0; returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateManagers).ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes(code.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes(EstateManagers.Length.ToString()); j++; - for (int i = 0; i < EstateManagers.Length; i++) + returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); j++; + for (int i = 0; i < Data.Length; i++) { - returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++; + returnblock[j].Parameter = Data[i].GetBytes(); j++; } packet.ParamList = returnblock; - packet.Header.Reliable = false; + packet.Header.Reliable = true; OutPacket(packet, ThrottleOutPacketType.Task); } diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index b1dcb14..deade6b 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -75,10 +75,21 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.EstateSettings.AbuseEmail, estateOwner); - remote_client.SendEstateManagersList(invoice, + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.AccessOptions, + m_scene.RegionInfo.EstateSettings.EstateAccess, + m_scene.RegionInfo.EstateSettings.EstateID); + + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.AllowedGroups, + m_scene.RegionInfo.EstateSettings.EstateGroups, + m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); @@ -233,127 +244,176 @@ namespace OpenSim.Region.CoreModules.World.Estate if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID) return; // never process owner - switch (estateAccessType) + if ((estateAccessType & 4) != 0) // User add { - case 64: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) - { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - - bool alreadyInList = false; - - for (int i = 0; i < banlistcheck.Length; i++) - { - if (user == banlistcheck[i].BannedUserID) - { - alreadyInList = true; - break; - } - - } - if (!alreadyInList) - { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateUser(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } - EstateBan item = new EstateBan(); + } + if ((estateAccessType & 8) != 0) // User remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); + m_scene.RegionInfo.EstateSettings.Save(); - item.BannedUserID = user; - item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; - item.BannedHostAddress = "0.0.0.0"; - item.BannedHostIPMask = "0.0.0.0"; + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 16) != 0) // Group add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 32) != 0) // Group remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); + m_scene.RegionInfo.EstateSettings.Save(); - m_scene.RegionInfo.EstateSettings.AddBan(item); - m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 64) != 0) // Ban add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + { + EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - ScenePresence s = m_scene.GetScenePresence(user); - if (s != null) - { - if (!s.IsChildAgent) - { - s.ControllingClient.SendTeleportLocationStart(); - m_scene.TeleportClientHome(user, s.ControllingClient); - } - } + bool alreadyInList = false; - } - else + for (int i = 0; i < banlistcheck.Length; i++) + { + if (user == banlistcheck[i].BannedUserID) { - remote_client.SendAlertMessage("User is already on the region ban list"); + alreadyInList = true; + break; } - //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); - } - else - { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } - break; - case 128: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + if (!alreadyInList) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - bool alreadyInList = false; - EstateBan listitem = null; + EstateBan item = new EstateBan(); + + item.BannedUserID = user; + item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; + item.BannedHostAddress = "0.0.0.0"; + item.BannedHostIPMask = "0.0.0.0"; - for (int i = 0; i < banlistcheck.Length; i++) + m_scene.RegionInfo.EstateSettings.AddBan(item); + m_scene.RegionInfo.EstateSettings.Save(); + + ScenePresence s = m_scene.GetScenePresence(user); + if (s != null) { - if (user == banlistcheck[i].BannedUserID) + if (!s.IsChildAgent) { - alreadyInList = true; - listitem = banlistcheck[i]; - break; + s.ControllingClient.SendTeleportLocationStart(); + m_scene.TeleportClientHome(user, s.ControllingClient); } - } - if (alreadyInList && listitem != null) - { - m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); - m_scene.RegionInfo.EstateSettings.Save(); - } - else - { - remote_client.SendAlertMessage("User is not on the region ban list"); - } - //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } else { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + remote_client.SendAlertMessage("User is already on the region ban list"); } - break; - case 256: + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 128) != 0) // Ban remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + { + EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) - { - m_scene.RegionInfo.EstateSettings.AddEstateManager(user); - m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); - } - else + bool alreadyInList = false; + EstateBan listitem = null; + + for (int i = 0; i < banlistcheck.Length; i++) { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); - } + if (user == banlistcheck[i].BannedUserID) + { + alreadyInList = true; + listitem = banlistcheck[i]; + break; + } - break; - case 512: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + } + if (alreadyInList && listitem != null) { - m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); m_scene.RegionInfo.EstateSettings.Save(); - - remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); } else { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + remote_client.SendAlertMessage("User is not on the region ban list"); } - break; - - default: + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 256) != 0) // Manager add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateManager(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 512) != 0) // Manager remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + m_scene.RegionInfo.EstateSettings.Save(); - m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); - break; + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index d5218b5..1dfa1b1 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -879,7 +879,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 55bbed9..6785c08 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1220,7 +1220,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index fa47d16..4a4c515 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -897,7 +897,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 93cab0e..8b79502 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -924,7 +924,7 @@ namespace OpenSim.Tests.Common.Mock { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } -- cgit v1.1 From 332463ca94c24bf6706cd40d4c2fa89b1cd13199 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 15:28:52 +0000 Subject: Fix up the weird Lindenish "setaccess" message. Talk about strange.... --- OpenSim/Framework/Constants.cs | 8 ++++---- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 632431f..5757061 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -36,10 +36,10 @@ namespace OpenSim.Framework public enum EstateAccessCodex : uint { - AccessOptions = 17, - AllowedGroups = 18, - EstateBans = 20, - EstateManagers = 24 + AccessOptions = 1, + AllowedGroups = 2, + EstateBans = 4, + EstateManagers = 8 } [Flags]public enum TeleportFlags : uint diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3d3c324..515d0ea 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3935,7 +3935,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + + j = 2; // Agents + if ((code & 2) != 0) + j = 3; // Groups + if ((code & 8) != 0) + j = 5; // Managers + + returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); + j = 6; + for (int i = 0; i < Data.Length; i++) { returnblock[j].Parameter = Data[i].GetBytes(); j++; -- cgit v1.1 From 673a52fa7a0cef508396cfc2185825e72cf96507 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 15:58:18 +0000 Subject: Implement the groups module query to make the estate allowed groups work --- OpenSim/Region/Framework/Scenes/Scene.cs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 764ac60..183d811 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3525,8 +3525,35 @@ namespace OpenSim.Region.Framework.Scenes return false; } + IGroupsModule groupsModule = + RequestModuleInterface(); + + List agentGroups = new List(); + + if (groupsModule != null) + { + GroupMembershipData[] GroupMembership = + groupsModule.GetMembershipData(agent.AgentID); + + for (int i = 0; i < GroupMembership.Length; i++) + agentGroups.Add(GroupMembership[i].GroupID); + } + + bool groupAccess = false; + UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups; + + foreach (UUID group in estateGroups) + { + if (agentGroups.Contains(group)) + { + groupAccess = true; + break; + } + } + if (!m_regInfo.EstateSettings.PublicAccess && - !m_regInfo.EstateSettings.HasAccess(agent.AgentID)) + !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && + !groupAccess) { m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); -- cgit v1.1 From bc558788c2b52b6ec9143b1697806624b9fb7977 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 16:32:14 +0000 Subject: A last fix for estate access by group. One should send the correct list. --- OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index deade6b..695cced 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); } else { @@ -292,7 +292,7 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); } else { -- cgit v1.1 From 49c09ef24c37637c023d1ae22865d546efc4d0d0 Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 8 Jan 2010 12:37:10 -0600 Subject: Fixes prim to prim collision. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d1bc351..cadb19f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1941,7 +1941,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 object, so this other object will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = obj.UUID; @@ -2077,7 +2077,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 object, so this other object will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = obj.UUID; @@ -2208,7 +2208,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 object, so this other object will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = obj.UUID; -- cgit v1.1 From 81d5a4b6d8d8548dde98cbf827d171bb1ebf96ba Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:03:18 +0000 Subject: Remove "login disable", "login enable" and "login status" commands. --- OpenSim/Client/Linden/LLProxyLoginModule.cs | 103 ++++++++------------- OpenSim/Client/Linden/LLStandaloneLoginModule.cs | 15 --- OpenSim/Client/Linden/LLStandaloneLoginService.cs | 19 ++-- .../Communications/Tests/LoginServiceTests.cs | 10 +- .../Framework/ILoginServiceToRegionsConnector.cs | 1 - OpenSim/Region/Application/OpenSim.cs | 48 ---------- OpenSim/Region/Application/OpenSimBase.cs | 31 ------- .../Hypergrid/HGStandaloneLoginModule.cs | 15 --- .../ServiceConnectorsOut/Grid/HGGridConnector.cs | 2 - .../Framework/Scenes/SceneCommunicationService.cs | 7 -- 10 files changed, 45 insertions(+), 206 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index 9075f15..14ce682 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -60,21 +60,6 @@ namespace OpenSim.Client.Linden m_port = port; } - protected bool RegionLoginsEnabled - { - get - { - if (m_firstScene != null) - { - return m_firstScene.SceneGridService.RegionLoginsEnabled; - } - else - { - return false; - } - } - } - protected List m_scenes = new List(); protected Scene m_firstScene; @@ -239,67 +224,53 @@ namespace OpenSim.Client.Linden agentData.child = false; } - if (!RegionLoginsEnabled) - { - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", - agentData.firstname, agentData.lastname); + bool success = false; + string denyMess = ""; - Hashtable respdata = new Hashtable(); - respdata["success"] = "FALSE"; - respdata["reason"] = "region login currently disabled"; - resp.Value = respdata; - } - else + Scene scene; + if (TryGetRegion(regionHandle, out scene)) { - bool success = false; - string denyMess = ""; - - Scene scene; - if (TryGetRegion(regionHandle, out scene)) + if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) + { + denyMess = "User is banned from this region"; + m_log.InfoFormat( + "[CLIENT]: Denying access for user {0} {1} because user is banned", + agentData.firstname, agentData.lastname); + } + else { - if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) + string reason; + if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) { - denyMess = "User is banned from this region"; - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because user is banned", - agentData.firstname, agentData.lastname); + success = true; } else { - string reason; - if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) - { - success = true; - } - else - { - denyMess = String.Format("Login refused by region: {0}", reason); - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", - agentData.firstname, agentData.lastname); - } + denyMess = String.Format("Login refused by region: {0}", reason); + m_log.InfoFormat( + "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", + agentData.firstname, agentData.lastname); } - - } - else - { - denyMess = "Region not found"; } - if (success) - { - Hashtable respdata = new Hashtable(); - respdata["success"] = "TRUE"; - resp.Value = respdata; - } - else - { - Hashtable respdata = new Hashtable(); - respdata["success"] = "FALSE"; - respdata["reason"] = denyMess; - resp.Value = respdata; - } + } + else + { + denyMess = "Region not found"; + } + + if (success) + { + Hashtable respdata = new Hashtable(); + respdata["success"] = "TRUE"; + resp.Value = respdata; + } + else + { + Hashtable respdata = new Hashtable(); + respdata["success"] = "FALSE"; + respdata["reason"] = denyMess; + resp.Value = respdata; } } catch (Exception e) diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs index 8047f74..e51eace 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs @@ -56,21 +56,6 @@ namespace OpenSim.Client.Linden protected bool authenticate; protected string welcomeMessage; - public bool RegionLoginsEnabled - { - get - { - if (m_firstScene != null) - { - return m_firstScene.SceneGridService.RegionLoginsEnabled; - } - else - { - return false; - } - } - } - protected LLStandaloneLoginService m_loginService; #region IRegionModule Members diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs index 122110d..9ab043a 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs @@ -202,20 +202,15 @@ namespace OpenSim.Client.Linden agent.Appearance = new AvatarAppearance(agent.AgentID); } - if (m_regionsConnector.RegionLoginsEnabled) + string reason; + bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); + if (!success) { - string reason; - bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); - if (!success) - { - response.ErrorReason = "key"; - response.ErrorMessage = reason; - } - return success; - // return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); + response.ErrorReason = "key"; + response.ErrorMessage = reason; } - - return false; + return success; + // return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); } public override void LogOffUser(UserProfileData theUser, string message) diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 60f0ba8..a274ae7 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -388,12 +388,6 @@ namespace OpenSim.Framework.Communications.Tests } } - #region ILoginRegionsConnector Members - public bool RegionLoginsEnabled - { - get { return true; } - } - public void LogOffUserFromGrid(ulong regionHandle, OpenMetaverse.UUID AvatarID, OpenMetaverse.UUID RegionSecret, string message) { } @@ -454,8 +448,6 @@ namespace OpenSim.Framework.Communications.Tests return null; } - - #endregion } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs index 2aee88e..5a155c1 100644 --- a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs +++ b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs @@ -32,7 +32,6 @@ namespace OpenSim.Framework { public interface ILoginServiceToRegionsConnector { - bool RegionLoginsEnabled { get; } void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message); bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason); RegionInfo RequestClosestRegion(string region); diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 82b2fd4..c9f2cfa 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -287,18 +287,6 @@ namespace OpenSim "create region", "Create a new region", HandleCreateRegion); - m_console.Commands.AddCommand("region", false, "login enable", - "login enable", - "Enable logins to the simulator", HandleLoginEnable); - - m_console.Commands.AddCommand("region", false, "login disable", - "login disable", - "Disable logins to the simulator", HandleLoginDisable); - - m_console.Commands.AddCommand("region", false, "login status", - "login status", - "Display status of logins", HandleLoginStatus); - m_console.Commands.AddCommand("region", false, "restart", "restart", "Restart all sims in this instance", RunCommand); @@ -559,42 +547,6 @@ namespace OpenSim } /// - /// Enable logins - /// - /// - /// - private void HandleLoginEnable(string module, string[] cmd) - { - ProcessLogin(true); - } - - - /// - /// Disable logins - /// - /// - /// - private void HandleLoginDisable(string module, string[] cmd) - { - ProcessLogin(false); - } - - /// - /// Log login status to the console - /// - /// - /// - private void HandleLoginStatus(string module, string[] cmd) - { - if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false) - - m_log.Info("[ Login ] Login are disabled "); - else - m_log.Info("[ Login ] Login are enabled"); - } - - - /// /// Change and load configuration file data. /// /// diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 391856b..cf2ab65 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -203,12 +203,6 @@ namespace OpenSim plugin.PostInitialise(); } - // Only enable logins to the regions once we have completely finished starting up (apart from scripts) - if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null)) - { - SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true; - } - AddPluginCommands(); } @@ -279,31 +273,6 @@ namespace OpenSim } /// - /// Initialises the asset cache. This supports legacy configuration values - /// to ensure consistent operation, but values outside of that namespace - /// are handled by the more generic resolution mechanism provided by - /// the ResolveAssetServer virtual method. If extended resolution fails, - /// then the normal default action is taken. - /// Creation of the AssetCache is handled by ResolveAssetCache. This - /// function accepts a reference to the instantiated AssetServer and - /// returns an IAssetCache implementation, if possible. This is a virtual - /// method. - /// - public void ProcessLogin(bool LoginEnabled) - { - if (LoginEnabled) - { - m_log.Info("[LOGIN]: Login is now enabled."); - SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true; - } - else - { - m_log.Info("[LOGIN]: Login is now disabled."); - SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false; - } - } - - /// /// Execute the region creation process. This includes setting up scene infrastructure. /// /// diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index 46ee3c0..0b54746 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs @@ -55,21 +55,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid protected bool m_enabled = false; // Module is only enabled if running in standalone mode - public bool RegionLoginsEnabled - { - get - { - if (m_firstScene != null) - { - return m_firstScene.SceneGridService.RegionLoginsEnabled; - } - else - { - return false; - } - } - } - protected HGLoginAuthService m_loginService; #region IRegionModule Members diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 93cb60c..f9cd90f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs @@ -696,8 +696,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome) { comingHome = false; - if (!m_aScene.SceneGridService.RegionLoginsEnabled) - return false; CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID); if (uinfo != null) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index f49d072..6164368 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -65,13 +65,6 @@ namespace OpenSim.Region.Framework.Scenes protected List m_agentsInTransit; - public bool RegionLoginsEnabled - { - get { return m_regionLoginsEnabled; } - set { m_regionLoginsEnabled = value; } - } - private bool m_regionLoginsEnabled = false; - /// /// An agent is crossing into this region /// -- cgit v1.1 From b0a7bcb2c814554dff4fc6dcdcd45ccf700601e9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:17:40 +0000 Subject: Add "StartDisabled" to [Startup] to make all regions start up with logins disabled until enabled from the console. Add the AccessModule (WIP) --- .../Resources/CoreModulePlugin.addin.xml | 1 + .../CoreModules/World/Access/AccessModule.cs | 82 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 14 ++-- 3 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Access/AccessModule.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index beb2307..ebc7f59 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -47,6 +47,7 @@ \ \ + \ diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs new file mode 100644 index 0000000..108dcfb --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; + +namespace OpenSim.Region.CoreModules.World +{ + public class AccessModule : ISharedRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + public void Initialise(IConfigSource config) + { + } + + public void PostInitialise() + { + } + + public void Close() + { + } + + public string Name + { + get { return "AccessModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { + } + } +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 183d811..da0b8e4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes public CommunicationsManager CommsManager; protected SceneCommunicationService m_sceneGridService; - public bool loginsdisabled = true; + public bool LoginsDisabled = true; public new float TimeDilation { @@ -1275,15 +1275,19 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); } - if (loginsdisabled && m_frame > 20) + if (LoginsDisabled && m_frame > 20) { // In 99.9% of cases it is a bad idea to manually force garbage collection. However, // this is a rare case where we know we have just went through a long cycle of heap // allocations, and there is no more work to be done until someone logs in GC.Collect(); - m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); - loginsdisabled = false; + IConfig startupConfig = m_config.Configs["Startup"]; + if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) + { + m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); + LoginsDisabled = false; + } } } catch (NotImplementedException) @@ -3348,7 +3352,7 @@ namespace OpenSim.Region.Framework.Scenes // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport - if (loginsdisabled) + if (LoginsDisabled) { reason = "Logins Disabled"; return false; -- cgit v1.1 From b9e6f4583cbfc10f566f702f70cecb5348fec023 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:48:10 +0000 Subject: Implement access module commands --- .../CoreModules/World/Access/AccessModule.cs | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index 108dcfb..dfa8df6 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -32,6 +32,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -45,8 +46,30 @@ namespace OpenSim.Region.CoreModules.World LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + private List m_SceneList = new List(); + public void Initialise(IConfigSource config) { + MainConsole.Instance.Commands.AddCommand("access", true, + "login enable", + "login enable", + "Enable simulator logins", + String.Empty, + HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("access", true, + "login disable", + "login disable", + "Disable simulator logins", + String.Empty, + HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("access", true, + "login status", + "login status", + "Show login status", + String.Empty, + HandleLoginCommand); } public void PostInitialise() @@ -69,14 +92,67 @@ namespace OpenSim.Region.CoreModules.World public void AddRegion(Scene scene) { + if (!m_SceneList.Contains(scene)) + m_SceneList.Add(scene); } public void RemoveRegion(Scene scene) { + m_SceneList.Remove(scene); } public void RegionLoaded(Scene scene) { } + + public void HandleLoginCommand(string module, string[] cmd) + { + if ((Scene)MainConsole.Instance.ConsoleScene == null) + { + foreach (Scene s in m_SceneList) + { + if(!ProcessCommand(s, cmd)) + break; + } + } + else + { + ProcessCommand((Scene)MainConsole.Instance.ConsoleScene, cmd); + } + } + + bool ProcessCommand(Scene scene, string[] cmd) + { + if (cmd.Length < 2) + { + MainConsole.Instance.Output("Syntax: login enable|disable|status"); + return false; + } + + switch (cmd[1]) + { + case "enable": + if (scene.LoginsDisabled) + MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName)); + scene.LoginsDisabled = false; + break; + case "disable": + if (!scene.LoginsDisabled) + MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName)); + scene.LoginsDisabled = true; + break; + case "status": + if (scene.LoginsDisabled) + MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName)); + else + MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName)); + break; + default: + MainConsole.Instance.Output("Syntax: login enable|disable|status"); + return false; + } + + return true; + } } } -- cgit v1.1 From 45b19e5e2da33813de07c2be2e46c1f28cbf9b38 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 04:05:19 +0000 Subject: Fix a small bug in login disable code --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index da0b8e4..bc9301b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1275,7 +1275,7 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); } - if (LoginsDisabled && m_frame > 20) + if (LoginsDisabled && m_frame == 20) { // In 99.9% of cases it is a bad idea to manually force garbage collection. However, // this is a rare case where we know we have just went through a long cycle of heap -- cgit v1.1 From 038ec133e648ab99643f5738e4ab85e450e5aa45 Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 10 Jan 2010 14:28:53 -0600 Subject: Adds land collision events. CRs cleaned from patch Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/EventManager.cs | 28 +++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 138 +++++++++++++++++++-- .../Region/ScriptEngine/XEngine/EventManager.cs | 71 ++++++++--- 3 files changed, 210 insertions(+), 27 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 753344d..4dd6f32 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -189,6 +189,10 @@ namespace OpenSim.Region.Framework.Scenes public event ScriptColliding OnScriptColliding; public event ScriptColliding OnScriptCollidingEnd; + public event ScriptColliding OnScriptLandColliderStart; + public event ScriptColliding OnScriptLandColliding; + public event ScriptColliding OnScriptLandColliderEnd; + public delegate void OnMakeChildAgentDelegate(ScenePresence presence); public event OnMakeChildAgentDelegate OnMakeChildAgent; @@ -439,6 +443,9 @@ namespace OpenSim.Region.Framework.Scenes private ScriptColliding handlerCollidingStart = null; private ScriptColliding handlerColliding = null; private ScriptColliding handlerCollidingEnd = null; + private ScriptColliding handlerLandCollidingStart = null; + private ScriptColliding handlerLandColliding = null; + private ScriptColliding handlerLandCollidingEnd = null; private GetScriptRunning handlerGetScriptRunning = null; private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; @@ -1034,6 +1041,27 @@ namespace OpenSim.Region.Framework.Scenes handlerCollidingEnd(localId, colliders); } + public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) + { + handlerLandCollidingStart = OnScriptLandColliderStart; + if (handlerLandCollidingStart != null) + handlerLandCollidingStart(localId, colliders); + } + + public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) + { + handlerLandColliding = OnScriptLandColliding; + if (handlerLandColliding != null) + handlerLandColliding(localId, colliders); + } + + public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) + { + handlerLandCollidingEnd = OnScriptLandColliderEnd; + if (handlerLandCollidingEnd != null) + handlerLandCollidingEnd(localId, colliders); + } + public void TriggerSetRootAgentScene(UUID agentID, Scene scene) { handlerSetRootAgentScene = OnSetRootAgentScene; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cadb19f..a427f12 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1853,16 +1853,12 @@ namespace OpenSim.Region.Framework.Scenes // and build up list of colliders this time foreach (uint localid in collissionswith.Keys) { - if (localid != 0) + thisHitColliders.Add(localid); + if (!m_lastColliders.Contains(localid)) { - thisHitColliders.Add(localid); - if (!m_lastColliders.Contains(localid)) - { - startedColliders.Add(localid); - } - - //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); + startedColliders.Add(localid); } + //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); } // calculate things that ended colliding @@ -1904,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes List colliding = new List(); foreach (uint localId in startedColliders) { + if (localId == 0) + return; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) return; @@ -2039,7 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes { // always running this check because if the user deletes the object it would return a null reference. if (localId == 0) - continue; + return; if (m_parentGroup == null) return; @@ -2171,7 +2169,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in endedColliders) { if (localId == 0) - continue; + return; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) @@ -2293,6 +2291,120 @@ namespace OpenSim.Region.Framework.Scenes } } } + if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) + { + if (startedColliders.Count > 0) + { + ColliderArgs LandStartCollidingMessage = new ColliderArgs(); + List colliding = new List(); + foreach (uint localId in startedColliders) + { + if (localId == 0) + { + //Hope that all is left is ground! + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = UUID.Zero; + detobj.nameStr = ""; + detobj.ownerUUID = UUID.Zero; + detobj.posVector = m_parentGroup.RootPart.AbsolutePosition; + detobj.rotQuat = Quaternion.Identity; + detobj.velVector = Vector3.Zero; + detobj.colliderType = 0; + detobj.groupUUID = UUID.Zero; + colliding.Add(detobj); + } + } + + if (colliding.Count > 0) + { + LandStartCollidingMessage.Colliders = colliding; + // always running this check because if the user deletes the object it would return a null reference. + if (m_parentGroup == null) + return; + + if (m_parentGroup.Scene == null) + return; + + m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage); + } + } + } + if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) + { + if (m_lastColliders.Count > 0) + { + ColliderArgs LandCollidingMessage = new ColliderArgs(); + List colliding = new List(); + foreach (uint localId in startedColliders) + { + if (localId == 0) + { + //Hope that all is left is ground! + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = UUID.Zero; + detobj.nameStr = ""; + detobj.ownerUUID = UUID.Zero; + detobj.posVector = m_parentGroup.RootPart.AbsolutePosition; + detobj.rotQuat = Quaternion.Identity; + detobj.velVector = Vector3.Zero; + detobj.colliderType = 0; + detobj.groupUUID = UUID.Zero; + colliding.Add(detobj); + } + } + + if (colliding.Count > 0) + { + LandCollidingMessage.Colliders = colliding; + // always running this check because if the user deletes the object it would return a null reference. + if (m_parentGroup == null) + return; + + if (m_parentGroup.Scene == null) + return; + + m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage); + } + } + } + if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) + { + if (endedColliders.Count > 0) + { + ColliderArgs LandEndCollidingMessage = new ColliderArgs(); + List colliding = new List(); + foreach (uint localId in startedColliders) + { + if (localId == 0) + { + //Hope that all is left is ground! + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = UUID.Zero; + detobj.nameStr = ""; + detobj.ownerUUID = UUID.Zero; + detobj.posVector = m_parentGroup.RootPart.AbsolutePosition; + detobj.rotQuat = Quaternion.Identity; + detobj.velVector = Vector3.Zero; + detobj.colliderType = 0; + detobj.groupUUID = UUID.Zero; + colliding.Add(detobj); + } + } + + if (colliding.Count > 0) + { + LandEndCollidingMessage.Colliders = colliding; + // always running this check because if the user deletes the object it would return a null reference. + if (m_parentGroup == null) + return; + + if (m_parentGroup.Scene == null) + return; + + m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage); + } + } + } } public void PhysicsOutOfBounds(Vector3 pos) @@ -3698,6 +3810,9 @@ namespace OpenSim.Region.Framework.Scenes ((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || (CollisionSound != UUID.Zero) ) { @@ -3902,6 +4017,9 @@ namespace OpenSim.Region.Framework.Scenes ((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || (CollisionSound != UUID.Zero) ) { diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 8195f33..b2eab45 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -63,6 +63,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; + myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start; + myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision; + myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end; IMoneyModule money=myScriptEngine.World.RequestModuleInterface(); if (money != null) { @@ -285,29 +288,63 @@ namespace OpenSim.Region.ScriptEngine.XEngine det.ToArray())); } - public void land_collision_start(uint localID, UUID itemID) - { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "land_collision_start", - new object[0], - new DetectParams[0])); + public void land_collision_start(uint localID, ColliderArgs col) + { + List det = new List(); + + foreach (DetectedObject detobj in col.Colliders) + { + DetectParams d = new DetectParams(); + d.Position = new LSL_Types.Vector3(detobj.posVector.X, + detobj.posVector.Y, + detobj.posVector.Z); + d.Populate(myScriptEngine.World); + det.Add(d); + myScriptEngine.PostObjectEvent(localID, new EventParams( + "land_collision_start", + new Object[] { new LSL_Types.Vector3(d.Position) }, + det.ToArray())); + } + } - public void land_collision(uint localID, UUID itemID) + public void land_collision(uint localID, ColliderArgs col) { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "land_collision", - new object[0], - new DetectParams[0])); + List det = new List(); + + foreach (DetectedObject detobj in col.Colliders) + { + DetectParams d = new DetectParams(); + d.Position = new LSL_Types.Vector3(detobj.posVector.X, + detobj.posVector.Y, + detobj.posVector.Z); + d.Populate(myScriptEngine.World); + det.Add(d); + myScriptEngine.PostObjectEvent(localID, new EventParams( + "land_collision", + new Object[] { new LSL_Types.Vector3(d.Position) }, + det.ToArray())); + } } - public void land_collision_end(uint localID, UUID itemID) + public void land_collision_end(uint localID, ColliderArgs col) { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "land_collision_end", - new object[0], - new DetectParams[0])); - } + List det = new List(); + + foreach (DetectedObject detobj in col.Colliders) + { + DetectParams d = new DetectParams(); + d.Position = new LSL_Types.Vector3(detobj.posVector.X, + detobj.posVector.Y, + detobj.posVector.Z); + d.Populate(myScriptEngine.World); + det.Add(d); + myScriptEngine.PostObjectEvent(localID, new EventParams( + "land_collision_end", + new Object[] { new LSL_Types.Vector3(d.Position) }, + det.ToArray())); + } + } // timer: not handled here // listen: not handled here -- cgit v1.1 From 2bf49cc1bb2d87877476f68daec2d515f475406d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 19:58:44 +0000 Subject: Clean CRs from previous patch --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 134 ++++++++++----------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a427f12..73f79b3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -139,15 +139,15 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampTerse; [XmlIgnore] - public UUID FromItemID; - - [XmlIgnore] - public int STATUS_ROTATE_X; - - [XmlIgnore] - public int STATUS_ROTATE_Y; - - [XmlIgnore] + public UUID FromItemID; + + [XmlIgnore] + public int STATUS_ROTATE_X; + + [XmlIgnore] + public int STATUS_ROTATE_Y; + + [XmlIgnore] public int STATUS_ROTATE_Z; [XmlIgnore] @@ -1680,19 +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 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) @@ -1934,24 +1934,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 @@ -1963,7 +1963,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { + { 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); @@ -1985,24 +1985,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); + } } } @@ -2099,7 +2099,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { + { 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); @@ -2230,7 +2230,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { + { 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); @@ -2290,7 +2290,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); } } - } + } if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) { if (startedColliders.Count > 0) @@ -2870,13 +2870,13 @@ 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 + } + //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; } -- cgit v1.1 From a0859754c03324be9a4a2b9c9f26928e64cb5a6f Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 10 Jan 2010 20:20:00 -0600 Subject: Adds llRotTarget and the events at_rot_target and not_at_rot_target. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/EventManager.cs | 32 ++++- .../Region/Framework/Scenes/SceneObjectGroup.cs | 130 ++++++++++++++++++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 +++ .../Shared/Api/Implementation/LSL_Api.cs | 9 +- .../ScriptEngine/Shared/Api/Runtime/Executor.cs | 7 +- .../Region/ScriptEngine/XEngine/EventManager.cs | 22 ++-- 6 files changed, 196 insertions(+), 21 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4dd6f32..76d5cb6 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -181,7 +181,15 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ScriptNotAtTargetEvent(uint localID); - public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; + public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; + + public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); + + public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; + + public delegate void ScriptNotAtRotTargetEvent(uint localID); + + public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; public delegate void ScriptColliding(uint localID, ColliderArgs colliders); @@ -383,7 +391,9 @@ namespace OpenSim.Region.Framework.Scenes private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; - private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; + private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; + private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; + private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; private ClientMovement handlerClientMovement = null; //OnClientMovement; private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole; @@ -849,6 +859,24 @@ namespace OpenSim.Region.Framework.Scenes { handlerScriptNotAtTargetEvent(localID); } + } + + public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) + { + handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; + if (handlerScriptAtRotTargetEvent != null) + { + handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); + } + } + + public void TriggerNotAtRotTargetEvent(uint localID) + { + handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; + if (handlerScriptNotAtRotTargetEvent != null) + { + handlerScriptNotAtRotTargetEvent(localID); + } } public void TriggerRequestChangeWaterHeight(float height) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 34d8b49..8050bf6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -56,7 +56,8 @@ namespace OpenSim.Region.Framework.Scenes land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, + at_rot_target = 16777216, listen = 32768, money = 65536, moving_end = 131072, @@ -79,6 +80,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 targetPos; public float tolerance; public uint handle; + } + + struct scriptRotTarget + { + public Quaternion targetRot; + public float tolerance; + public uint handle; } public delegate void PrimCountTaintedDelegate(); @@ -165,10 +173,14 @@ namespace OpenSim.Region.Framework.Scenes protected SceneObjectPart m_rootPart; // private Dictionary m_scriptEvents = new Dictionary(); - private Dictionary m_targets = new Dictionary(); + private Dictionary m_targets = new Dictionary(); + private Dictionary m_rotTargets = new Dictionary(); private bool m_scriptListens_atTarget = false; - private bool m_scriptListens_notAtTarget = false; + private bool m_scriptListens_notAtTarget = false; + + private bool m_scriptListens_atRotTarget = false; + private bool m_scriptListens_notAtRotTarget = false; internal Dictionary m_savedScriptState = null; @@ -1261,6 +1273,15 @@ namespace OpenSim.Region.Framework.Scenes lock (m_targets) m_targets.Clear(); m_scene.RemoveGroupTarget(this); + } + m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0); + m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0); + + if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget) + { + lock (m_rotTargets) + m_rotTargets.Clear(); + m_scene.RemoveGroupTarget(this); } ScheduleGroupForFullUpdate(); @@ -3157,6 +3178,30 @@ namespace OpenSim.Region.Framework.Scenes } } + } + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + scriptRotTarget waypoint = new scriptRotTarget(); + waypoint.targetRot = target; + waypoint.tolerance = tolerance; + uint handle = m_scene.AllocateLocalId(); + waypoint.handle = handle; + lock (m_rotTargets) + { + m_rotTargets.Add(handle, waypoint); + } + m_scene.AddGroupTarget(this); + return (int)handle; + } + + public void unregisterRotTargetWaypoint(int handle) + { + lock (m_targets) + { + m_rotTargets.Remove((uint)handle); + if (m_targets.Count == 0) + m_scene.RemoveGroupTarget(this); + } } public int registerTargetWaypoint(Vector3 target, float tolerance) @@ -3263,6 +3308,85 @@ namespace OpenSim.Region.Framework.Scenes } } } + } + if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) + { + if (m_rotTargets.Count > 0) + { + bool at_Rottarget = false; + Dictionary atRotTargets = new Dictionary(); + lock (m_rotTargets) + { + foreach (uint idx in m_rotTargets.Keys) + { + scriptRotTarget target = m_rotTargets[idx]; + double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; + if (angle < 0) angle = -angle; + if (angle > Math.PI) angle = (Math.PI * 2 - angle); + if (angle <= target.tolerance) + { + // trigger at_rot_target + if (m_scriptListens_atRotTarget) + { + at_Rottarget = true; + scriptRotTarget att = new scriptRotTarget(); + att.targetRot = target.targetRot; + att.tolerance = target.tolerance; + att.handle = target.handle; + atRotTargets.Add(idx, att); + } + } + } + } + + if (atRotTargets.Count > 0) + { + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + foreach (uint target in atRotTargets.Keys) + { + scriptRotTarget att = atRotTargets[target]; + m_scene.EventManager.TriggerAtRotTargetEvent( + localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset); + } + } + + return; + } + + if (m_scriptListens_notAtRotTarget && !at_Rottarget) + { + //trigger not_at_target + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]); + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 73f79b3..177de47 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4078,6 +4078,23 @@ namespace OpenSim.Region.Framework.Scenes { m_parentGroup.unregisterTargetWaypoint(handle); } + } + + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + if (m_parentGroup != null) + { + return m_parentGroup.registerRotTargetWaypoint(target, tolerance); + } + return 0; + } + + public void unregisterRotTargetWaypoint(int handle) + { + if (m_parentGroup != null) + { + m_parentGroup.unregisterRotTargetWaypoint(handle); + } } public void SetCameraAtOffset(Vector3 v) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 39b597e..856f8b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2108,15 +2108,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llRotTarget(LSL_Rotation rot, double error) { - m_host.AddScriptLPS(1); - NotImplemented("llRotTarget"); - return 0; + m_host.AddScriptLPS(1); + return m_host.registerRotTargetWaypoint(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error); } public void llRotTargetRemove(int number) { - m_host.AddScriptLPS(1); - NotImplemented("llRotTargetRemove"); + m_host.AddScriptLPS(1); + m_host.unregisterRotTargetWaypoint(number); } public void llMoveToTarget(LSL_Vector target, double tau) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs index 7f67599..fb86850 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs @@ -61,7 +61,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, + at_rot_target = 16777216, listen = 32768, money = 65536, moving_end = 131072, @@ -202,8 +203,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return; } - m_eventFlagsMap.Add("attach", scriptEvents.attach); - // m_eventFlagsMap.Add("at_rot_target",(long)scriptEvents.at_rot_target); + m_eventFlagsMap.Add("attach", scriptEvents.attach); + m_eventFlagsMap.Add("at_rot_target", scriptEvents.at_rot_target); m_eventFlagsMap.Add("at_target", scriptEvents.at_target); // m_eventFlagsMap.Add("changed",(long)scriptEvents.changed); m_eventFlagsMap.Add("collision", scriptEvents.collision); diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index b2eab45..ce22ba5 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -58,7 +58,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; - myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; + myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; + myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; + myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; myScriptEngine.World.EventManager.OnScriptControlEvent += control; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; @@ -388,16 +390,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.PostObjectEvent(localID, new EventParams( "not_at_target",new object[0], new DetectParams[0])); - } - - public void at_rot_target(uint localID, UUID itemID) - { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "at_rot_target",new object[0], + } + + public void at_rot_target(uint localID, uint handle, Quaternion targetrot, + Quaternion atrot) + { + myScriptEngine.PostObjectEvent(localID, new EventParams( + "at_rot_target", new object[] { + new LSL_Types.LSLInteger(handle), + new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W), + new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) }, new DetectParams[0])); } - public void not_at_rot_target(uint localID, UUID itemID) + public void not_at_rot_target(uint localID) { myScriptEngine.PostObjectEvent(localID, new EventParams( "not_at_rot_target",new object[0], -- cgit v1.1 From 2320b17ca92d0c922d78ad72933fe3903f2108d0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 02:04:05 +0000 Subject: Whitespace cleanup --- OpenSim/Region/Framework/Scenes/EventManager.cs | 56 ++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 248 ++++++++++----------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 34 +-- .../Shared/Api/Implementation/LSL_Api.cs | 4 +- .../ScriptEngine/Shared/Api/Runtime/Executor.cs | 4 +- .../Region/ScriptEngine/XEngine/EventManager.cs | 20 +- 6 files changed, 183 insertions(+), 183 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 76d5cb6..399379e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -181,14 +181,14 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ScriptNotAtTargetEvent(uint localID); - public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; - - public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); - - public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; - - public delegate void ScriptNotAtRotTargetEvent(uint localID); - + public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; + + public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); + + public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; + + public delegate void ScriptNotAtRotTargetEvent(uint localID); + public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; public delegate void ScriptColliding(uint localID, ColliderArgs colliders); @@ -391,8 +391,8 @@ namespace OpenSim.Region.Framework.Scenes private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; - private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; - private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; + private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; + private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; private ClientMovement handlerClientMovement = null; //OnClientMovement; private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; @@ -859,24 +859,24 @@ namespace OpenSim.Region.Framework.Scenes { handlerScriptNotAtTargetEvent(localID); } - } - - public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) - { - handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; - if (handlerScriptAtRotTargetEvent != null) - { - handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); - } - } - - public void TriggerNotAtRotTargetEvent(uint localID) - { - handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; - if (handlerScriptNotAtRotTargetEvent != null) - { - handlerScriptNotAtRotTargetEvent(localID); - } + } + + public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) + { + handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; + if (handlerScriptAtRotTargetEvent != null) + { + handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); + } + } + + public void TriggerNotAtRotTargetEvent(uint localID) + { + handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; + if (handlerScriptNotAtRotTargetEvent != null) + { + handlerScriptNotAtRotTargetEvent(localID); + } } public void TriggerRequestChangeWaterHeight(float height) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8050bf6..ec41ac7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Scenes land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, at_rot_target = 16777216, listen = 32768, money = 65536, @@ -80,13 +80,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 targetPos; public float tolerance; public uint handle; - } - - struct scriptRotTarget - { - public Quaternion targetRot; - public float tolerance; - public uint handle; + } + + struct scriptRotTarget + { + public Quaternion targetRot; + public float tolerance; + public uint handle; } public delegate void PrimCountTaintedDelegate(); @@ -173,13 +173,13 @@ namespace OpenSim.Region.Framework.Scenes protected SceneObjectPart m_rootPart; // private Dictionary m_scriptEvents = new Dictionary(); - private Dictionary m_targets = new Dictionary(); + private Dictionary m_targets = new Dictionary(); private Dictionary m_rotTargets = new Dictionary(); private bool m_scriptListens_atTarget = false; - private bool m_scriptListens_notAtTarget = false; - - private bool m_scriptListens_atRotTarget = false; + private bool m_scriptListens_notAtTarget = false; + + private bool m_scriptListens_atRotTarget = false; private bool m_scriptListens_notAtRotTarget = false; internal Dictionary m_savedScriptState = null; @@ -1273,15 +1273,15 @@ namespace OpenSim.Region.Framework.Scenes lock (m_targets) m_targets.Clear(); m_scene.RemoveGroupTarget(this); - } - m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0); - m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0); - - if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget) - { - lock (m_rotTargets) - m_rotTargets.Clear(); - m_scene.RemoveGroupTarget(this); + } + m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0); + m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0); + + if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget) + { + lock (m_rotTargets) + m_rotTargets.Clear(); + m_scene.RemoveGroupTarget(this); } ScheduleGroupForFullUpdate(); @@ -3178,30 +3178,30 @@ namespace OpenSim.Region.Framework.Scenes } } - } - public int registerRotTargetWaypoint(Quaternion target, float tolerance) - { - scriptRotTarget waypoint = new scriptRotTarget(); - waypoint.targetRot = target; - waypoint.tolerance = tolerance; - uint handle = m_scene.AllocateLocalId(); - waypoint.handle = handle; - lock (m_rotTargets) - { - m_rotTargets.Add(handle, waypoint); - } - m_scene.AddGroupTarget(this); - return (int)handle; - } - - public void unregisterRotTargetWaypoint(int handle) - { - lock (m_targets) - { - m_rotTargets.Remove((uint)handle); - if (m_targets.Count == 0) - m_scene.RemoveGroupTarget(this); - } + } + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + scriptRotTarget waypoint = new scriptRotTarget(); + waypoint.targetRot = target; + waypoint.tolerance = tolerance; + uint handle = m_scene.AllocateLocalId(); + waypoint.handle = handle; + lock (m_rotTargets) + { + m_rotTargets.Add(handle, waypoint); + } + m_scene.AddGroupTarget(this); + return (int)handle; + } + + public void unregisterRotTargetWaypoint(int handle) + { + lock (m_targets) + { + m_rotTargets.Remove((uint)handle); + if (m_targets.Count == 0) + m_scene.RemoveGroupTarget(this); + } } public int registerTargetWaypoint(Vector3 target, float tolerance) @@ -3308,85 +3308,85 @@ namespace OpenSim.Region.Framework.Scenes } } } - } - if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) - { - if (m_rotTargets.Count > 0) - { - bool at_Rottarget = false; - Dictionary atRotTargets = new Dictionary(); - lock (m_rotTargets) - { - foreach (uint idx in m_rotTargets.Keys) - { - scriptRotTarget target = m_rotTargets[idx]; - double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; - if (angle < 0) angle = -angle; - if (angle > Math.PI) angle = (Math.PI * 2 - angle); - if (angle <= target.tolerance) - { - // trigger at_rot_target - if (m_scriptListens_atRotTarget) - { - at_Rottarget = true; - scriptRotTarget att = new scriptRotTarget(); - att.targetRot = target.targetRot; - att.tolerance = target.tolerance; - att.handle = target.handle; - atRotTargets.Add(idx, att); - } - } - } - } - - if (atRotTargets.Count > 0) - { - uint[] localids = new uint[0]; - lock (m_parts) - { - localids = new uint[m_parts.Count]; - int cntr = 0; - foreach (SceneObjectPart part in m_parts.Values) - { - localids[cntr] = part.LocalId; - cntr++; - } - } - - for (int ctr = 0; ctr < localids.Length; ctr++) - { - foreach (uint target in atRotTargets.Keys) - { - scriptRotTarget att = atRotTargets[target]; - m_scene.EventManager.TriggerAtRotTargetEvent( - localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset); - } - } - - return; - } - - if (m_scriptListens_notAtRotTarget && !at_Rottarget) - { - //trigger not_at_target - uint[] localids = new uint[0]; - lock (m_parts) - { - localids = new uint[m_parts.Count]; - int cntr = 0; - foreach (SceneObjectPart part in m_parts.Values) - { - localids[cntr] = part.LocalId; - cntr++; - } - } - - for (int ctr = 0; ctr < localids.Length; ctr++) - { - m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]); - } - } - } + } + if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) + { + if (m_rotTargets.Count > 0) + { + bool at_Rottarget = false; + Dictionary atRotTargets = new Dictionary(); + lock (m_rotTargets) + { + foreach (uint idx in m_rotTargets.Keys) + { + scriptRotTarget target = m_rotTargets[idx]; + double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; + if (angle < 0) angle = -angle; + if (angle > Math.PI) angle = (Math.PI * 2 - angle); + if (angle <= target.tolerance) + { + // trigger at_rot_target + if (m_scriptListens_atRotTarget) + { + at_Rottarget = true; + scriptRotTarget att = new scriptRotTarget(); + att.targetRot = target.targetRot; + att.tolerance = target.tolerance; + att.handle = target.handle; + atRotTargets.Add(idx, att); + } + } + } + } + + if (atRotTargets.Count > 0) + { + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + foreach (uint target in atRotTargets.Keys) + { + scriptRotTarget att = atRotTargets[target]; + m_scene.EventManager.TriggerAtRotTargetEvent( + localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset); + } + } + + return; + } + + if (m_scriptListens_notAtRotTarget && !at_Rottarget) + { + //trigger not_at_target + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]); + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 177de47..56b2f13 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4078,23 +4078,23 @@ namespace OpenSim.Region.Framework.Scenes { m_parentGroup.unregisterTargetWaypoint(handle); } - } - - public int registerRotTargetWaypoint(Quaternion target, float tolerance) - { - if (m_parentGroup != null) - { - return m_parentGroup.registerRotTargetWaypoint(target, tolerance); - } - return 0; - } - - public void unregisterRotTargetWaypoint(int handle) - { - if (m_parentGroup != null) - { - m_parentGroup.unregisterRotTargetWaypoint(handle); - } + } + + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + if (m_parentGroup != null) + { + return m_parentGroup.registerRotTargetWaypoint(target, tolerance); + } + return 0; + } + + public void unregisterRotTargetWaypoint(int handle) + { + if (m_parentGroup != null) + { + m_parentGroup.unregisterRotTargetWaypoint(handle); + } } public void SetCameraAtOffset(Vector3 v) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 856f8b6..1985e72 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2108,13 +2108,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llRotTarget(LSL_Rotation rot, double error) { - m_host.AddScriptLPS(1); + m_host.AddScriptLPS(1); return m_host.registerRotTargetWaypoint(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error); } public void llRotTargetRemove(int number) { - m_host.AddScriptLPS(1); + m_host.AddScriptLPS(1); m_host.unregisterRotTargetWaypoint(number); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs index fb86850..9615315 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, at_rot_target = 16777216, listen = 32768, money = 65536, @@ -203,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return; } - m_eventFlagsMap.Add("attach", scriptEvents.attach); + m_eventFlagsMap.Add("attach", scriptEvents.attach); m_eventFlagsMap.Add("at_rot_target", scriptEvents.at_rot_target); m_eventFlagsMap.Add("at_target", scriptEvents.at_target); // m_eventFlagsMap.Add("changed",(long)scriptEvents.changed); diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index ce22ba5..16309ef 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -58,9 +58,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; - myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; - myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; - myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; + myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; + myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; + myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; myScriptEngine.World.EventManager.OnScriptControlEvent += control; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; @@ -390,16 +390,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.PostObjectEvent(localID, new EventParams( "not_at_target",new object[0], new DetectParams[0])); - } - - public void at_rot_target(uint localID, uint handle, Quaternion targetrot, - Quaternion atrot) - { - myScriptEngine.PostObjectEvent(localID, new EventParams( + } + + public void at_rot_target(uint localID, uint handle, Quaternion targetrot, + Quaternion atrot) + { + myScriptEngine.PostObjectEvent(localID, new EventParams( "at_rot_target", new object[] { new LSL_Types.LSLInteger(handle), new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W), - new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) }, + new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) }, new DetectParams[0])); } -- cgit v1.1 From e966e51b89bdc0fc36482621f8954e5faffc8fbf Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 03:29:24 +0000 Subject: Add a console_port setting to let the rest console use a different port from the region server --- OpenSim/Framework/MainServer.cs | 4 ++-- OpenSim/Region/Application/OpenSim.cs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 7da4893..84cc05e 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -32,7 +32,7 @@ namespace OpenSim.Framework { public class MainServer { - private static BaseHttpServer instance; + private static BaseHttpServer instance = null; private static Dictionary m_Servers = new Dictionary(); @@ -46,7 +46,7 @@ namespace OpenSim.Framework { if (port == 0) return Instance; - if (port == Instance.Port) + if (instance != null && port == Instance.Port) return Instance; if (m_Servers.ContainsKey(port)) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index c9f2cfa..cfa94ea 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -53,6 +53,7 @@ namespace OpenSim protected string m_shutdownCommandsFile; protected bool m_gui = false; protected string m_consoleType = "local"; + protected uint m_consolePort = 0; private string m_timedScript = "disabled"; private Timer m_scriptTimer; @@ -79,6 +80,7 @@ namespace OpenSim else m_consoleType= startupConfig.GetString("console", String.Empty); + m_consolePort = (uint)startupConfig.GetInt("console_port", 0); m_timedScript = startupConfig.GetString("timer_Script", "disabled"); if (m_logFileAppender != null) { @@ -151,7 +153,16 @@ namespace OpenSim base.StartupSpecific(); if (m_console is RemoteConsole) - ((RemoteConsole)m_console).SetServer(m_httpServer); + { + if (m_consolePort == 0) + { + ((RemoteConsole)m_console).SetServer(m_httpServer); + } + else + { + ((RemoteConsole)m_console).SetServer(MainServer.GetHttpServer(m_consolePort)); + } + } //Run Startup Commands if (String.IsNullOrEmpty(m_startupCommandsFile)) -- cgit v1.1 From 2b478a61d09a75f0c7e575b7e43807a6c9328e73 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 03:49:05 +0000 Subject: Add the console port setting to ROBUST, too --- OpenSim/Server/Base/HttpServerBase.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index ed0210f..77184a4 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -49,6 +49,7 @@ namespace OpenSim.Server.Base protected uint m_Port = 0; protected Dictionary m_Servers = new Dictionary(); + protected uint m_consolePort = 0; public IHttpServer HttpServer { @@ -98,6 +99,7 @@ namespace OpenSim.Server.Base Thread.CurrentThread.Abort(); } + m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); m_Port = port; m_HttpServer = new BaseHttpServer(port); @@ -111,7 +113,10 @@ namespace OpenSim.Server.Base if (MainConsole.Instance is RemoteConsole) { - ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); + if (m_consolePort == 0) + ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); + else + ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort)); } } } -- cgit v1.1 From ff55ae0eb210e542d483d04779a9c96210f01691 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 07:59:13 +0000 Subject: Make console_port work. --- OpenSim/Region/Application/OpenSim.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index cfa94ea..e09d730 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -67,6 +67,7 @@ namespace OpenSim base.ReadExtraConfigSettings(); IConfig startupConfig = m_config.Source.Configs["Startup"]; + IConfig networkConfig = m_config.Source.Configs["Network"]; int stpMaxThreads = 15; @@ -80,7 +81,8 @@ namespace OpenSim else m_consoleType= startupConfig.GetString("console", String.Empty); - m_consolePort = (uint)startupConfig.GetInt("console_port", 0); + if (networkConfig != null) + m_consolePort = (uint)networkConfig.GetInt("console_port", 0); m_timedScript = startupConfig.GetString("timer_Script", "disabled"); if (m_logFileAppender != null) { -- cgit v1.1 From 9c668558d43f4eeac10c1753825ad643fe4b8721 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Jan 2010 15:00:16 +0000 Subject: minor: formatting --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d8b9159..2c8b0ea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1983,6 +1983,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return (int)pws; } + public void osSetSpeed(string UUID, float SpeedModifier) { CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); @@ -1990,6 +1991,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); avatar.SpeedModifier = SpeedModifier; } + public void osKickAvatar(string FirstName,string SurName,string alert) { CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); @@ -2010,6 +2012,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + public void osCauseDamage(string avatar, double damage) { CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); @@ -2037,6 +2040,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + public void osCauseHealing(string avatar, double healing) { CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); @@ -2061,4 +2065,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } -} +} \ No newline at end of file -- cgit v1.1 From d86c0d406a3fcabae2fe2c70f76507796152eb74 Mon Sep 17 00:00:00 2001 From: dr scofield (aka dirk husemann) Date: Mon, 11 Jan 2010 17:15:49 +0100 Subject: more specific config error logging --- OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index 3c5e8c9..b3fa07f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs @@ -220,8 +220,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat // Fail if fundamental information is still missing - if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) - throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}", cs.idn, rs.Region)); + if (cs.Server == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: server missing", cs.idn, rs.Region)); + else if (cs.IrcChannel == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: channel missing", cs.idn, rs.Region)); + else if (cs.BaseNickname == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: nick missing", cs.idn, rs.Region)); + else if (cs.User == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: user missing", cs.idn, rs.Region)); m_log.InfoFormat("[IRC-Channel-{0}] Configuration for Region {1} is valid", cs.idn, rs.Region); m_log.InfoFormat("[IRC-Channel-{0}] Server = {1}", cs.idn, cs.Server); -- cgit v1.1 From b88bee9d48c2f953867737520f9ed731dc84cc2a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Jan 2010 17:17:58 +0000 Subject: add interface/method documentatio nto IScriptModuleComms --- .../Framework/Interfaces/IScriptModuleComms.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs index 5cdf191..d7fa316 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs @@ -32,13 +32,29 @@ namespace OpenSim.Region.Framework.Interfaces { public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); + /// + /// Interface for communication between OpenSim modules and in-world scripts + /// + /// + /// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages + /// from scripts in OpenSim modules. public interface IScriptModuleComms { + /// + /// Modules can subscribe to this event to receive command invocations from in-world scripts + /// event ScriptCommand OnScriptCommand; - void DispatchReply(UUID script, int code, string text, string k); + /// + /// Send a link_message event to an in-world script + /// + /// + /// + /// + /// + void DispatchReply(UUID scriptId, int code, string text, string key); // For use ONLY by the script API - void RaiseEvent(UUID script, string id, string module, string command, string k); + void RaiseEvent(UUID script, string id, string module, string command, string key); } } -- cgit v1.1 From 7467a471ca2d3e6066f89d8bca4ba956e07fbb6b Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 22:52:05 +0000 Subject: Add the option to reject duplicate region names --- OpenSim/Services/GridService/GridService.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 86815e5..a500593 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected bool m_AllowDuplicateNames = false; + public GridService(IConfigSource config) : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); + + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); + } } #region IGridService @@ -82,6 +90,23 @@ namespace OpenSim.Services.GridService } } + if (!m_AllowDuplicateNames) + { + List dupe = m_Database.Get(regionInfos.RegionName, scopeID); + if (dupe != null && dupe.Count > 0) + { + foreach (RegionData d in dupe) + { + if (d.RegionID != regionInfos.RegionID) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", + regionInfos.RegionName, regionInfos.RegionID); + return false; + } + } + } + } + // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; -- cgit v1.1 From a4a0512011d53a0d8ed64151fd8500481768e2c7 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Mon, 11 Jan 2010 17:28:27 -0800 Subject: Bug in llGetNumberOfPrims always returns to script when no clients are connected to the simulator. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 39b597e..b9defbe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7286,23 +7286,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetNumberOfPrims() { m_host.AddScriptLPS(1); - ScenePresence[] presences = World.GetScenePresences(); - if (presences.Length == 0) - return 0; - int avatarCount = 0; - for (int i = 0; i < presences.Length; i++) + World.ForEachScenePresence(delegate(ScenePresence presence) { - ScenePresence presence = presences[i]; - - if (!presence.IsChildAgent && presence.ParentID != 0) - { - if (m_host.ParentGroup.HasChildPrim(presence.ParentID)) - { + if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) avatarCount++; - } - } - } + }); return m_host.ParentGroup.PrimCount + avatarCount; } -- cgit v1.1 From e3a04fcb7b6510b46bc4e24b9a1bc6e321774ac3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 13 Jan 2010 03:08:34 +0000 Subject: Change the error messages on region region registration. This changes URM and region. The non-error case should be compatible, so no version bump. Untested. --- .../ServiceConnectorsOut/Grid/HGGridConnector.cs | 8 ++++---- .../Grid/LocalGridServiceConnector.cs | 2 +- .../Grid/RemoteGridServiceConnector.cs | 8 +++++--- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++--- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 16 +++++++++++++--- .../Services/Connectors/Grid/GridServiceConnector.cs | 18 +++++++++++++++--- OpenSim/Services/GridService/GridService.cs | 8 ++++---- OpenSim/Services/Interfaces/IGridService.cs | 2 +- OpenSim/Tests/Clients/Grid/GridClient.cs | 17 +++++++++-------- 9 files changed, 55 insertions(+), 30 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index f9cd90f..131febd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs @@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region IGridService - public bool RegisterRegion(UUID scopeID, GridRegion regionInfo) + public string RegisterRegion(UUID scopeID, GridRegion regionInfo) { // Region doesn't exist here. Trying to link remote region if (regionInfo.RegionID.Equals(UUID.Zero)) @@ -215,12 +215,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid // Try get the map image m_HypergridServiceConnector.GetMapImage(regionInfo); - return true; + return String.Empty; } else { m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")"); - return false; + return "No such region"; } // Note that these remote regions aren't registered in localBackend, so return null, no local listeners } @@ -469,7 +469,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid } // Finally, link it - if (!RegisterRegion(UUID.Zero, regInfo)) + if (RegisterRegion(UUID.Zero, regInfo) != String.Empty) { m_log.Warn("[HGrid]: Unable to link region"); return false; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 1c72488..144b5a4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region IGridService - public bool RegisterRegion(UUID scopeID, GridRegion regionInfo) + public string RegisterRegion(UUID scopeID, GridRegion regionInfo) { return m_GridService.RegisterRegion(scopeID, regionInfo); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 72c00fc..391e7c8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -135,12 +135,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region IGridService - public override bool RegisterRegion(UUID scopeID, GridRegion regionInfo) + public override string RegisterRegion(UUID scopeID, GridRegion regionInfo) { - if (m_LocalGridService.RegisterRegion(scopeID, regionInfo)) + string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo); + + if (msg == String.Empty) return base.RegisterRegion(scopeID, regionInfo); - return false; + return msg; } public override bool DeregisterRegion(UUID regionID) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bc9301b..234554e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1562,9 +1562,9 @@ namespace OpenSim.Region.Framework.Scenes //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); GridRegion region = new GridRegion(RegionInfo); - bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region); - if (!success) - throw new Exception("Can't register with grid"); + string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); + if (error != String.Empty) + throw new Exception(error); m_sceneGridService.SetScene(this); m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index d99b791..85a8738 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -156,14 +156,14 @@ namespace OpenSim.Server.Handlers.Grid m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e); } - bool result = false; + string result = "Error communicating with grid service"; if (rinfo != null) result = m_GridService.RegisterRegion(scopeID, rinfo); - if (result) + if (result == String.Empty) return SuccessResult(); else - return FailureResult(); + return FailureResult(result); } byte[] Deregister(Dictionary request) @@ -432,6 +432,11 @@ namespace OpenSim.Server.Handlers.Grid private byte[] FailureResult() { + return FailureResult(String.Empty); + } + + private byte[] FailureResult(string msg) + { XmlDocument doc = new XmlDocument(); XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, @@ -449,6 +454,11 @@ namespace OpenSim.Server.Handlers.Grid rootElement.AppendChild(result); + XmlElement message = doc.CreateElement("", "Message", ""); + message.AppendChild(doc.CreateTextNode(msg)); + + rootElement.AppendChild(message); + return DocToBytes(doc); } diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 99aa3fb..1ba7344 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors #region IGridService - public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) + public virtual string RegisterRegion(UUID scopeID, GridRegion regionInfo) { Dictionary rinfo = regionInfo.ToKeyValuePairs(); Dictionary sendData = new Dictionary(); @@ -110,11 +110,23 @@ namespace OpenSim.Services.Connectors Dictionary replyData = ServerUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success")) - return true; + { + return String.Empty; + } + else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure")) + { + m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); + return replyData["Message"].ToString(); + } else if (!replyData.ContainsKey("Result")) + { m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field"); + } else + { m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); + return "Unexpected result "+replyData["Result"].ToString(); + } } else @@ -125,7 +137,7 @@ namespace OpenSim.Services.Connectors m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); } - return false; + return "Error communicating with grid service"; } public virtual bool DeregisterRegion(UUID regionID) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a500593..7749c37 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -62,7 +62,7 @@ namespace OpenSim.Services.GridService #region IGridService - public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) + public string RegisterRegion(UUID scopeID, GridRegion regionInfos) { // This needs better sanity testing. What if regionInfo is registering in // overlapping coords? @@ -71,7 +71,7 @@ namespace OpenSim.Services.GridService { m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); - return false; + return "Region overlaps another region"; } if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) @@ -101,7 +101,7 @@ namespace OpenSim.Services.GridService { m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", regionInfos.RegionName, regionInfos.RegionID); - return false; + return "Duplicate region name"; } } } @@ -122,7 +122,7 @@ namespace OpenSim.Services.GridService m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); - return true; + return String.Empty; } public bool DeregisterRegion(UUID regionID) diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index e69e4cd..5135f6d 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -42,7 +42,7 @@ namespace OpenSim.Services.Interfaces /// /// /// Thrown if region registration failed - bool RegisterRegion(UUID scopeID, GridRegion regionInfos); + string RegisterRegion(UUID scopeID, GridRegion regionInfos); /// /// Deregister a region with the grid service. diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs index 972c0aa..8e33373 100644 --- a/OpenSim/Tests/Clients/Grid/GridClient.cs +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -63,27 +63,28 @@ namespace OpenSim.Tests.Clients.GridClient GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000); Console.WriteLine("[GRID CLIENT]: *** Registering region 1"); - bool success = m_Connector.RegisterRegion(UUID.Zero, r1); - if (success) + string msg = m_Connector.RegisterRegion(UUID.Zero, r1); + if (msg == String.Empty) Console.WriteLine("[GRID CLIENT]: Successfully registered region 1"); else Console.WriteLine("[GRID CLIENT]: region 1 failed to register"); Console.WriteLine("[GRID CLIENT]: *** Registering region 2"); - success = m_Connector.RegisterRegion(UUID.Zero, r2); - if (success) + msg = m_Connector.RegisterRegion(UUID.Zero, r2); + if (msg == String.Empty) Console.WriteLine("[GRID CLIENT]: Successfully registered region 2"); else Console.WriteLine("[GRID CLIENT]: region 2 failed to register"); Console.WriteLine("[GRID CLIENT]: *** Registering region 3"); - success = m_Connector.RegisterRegion(UUID.Zero, r3); - if (success) + msg = m_Connector.RegisterRegion(UUID.Zero, r3); + if (msg == String.Empty) Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); else Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); + bool success; Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3"); success = m_Connector.DeregisterRegion(r3.RegionID); if (success) @@ -91,8 +92,8 @@ namespace OpenSim.Tests.Clients.GridClient else Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister"); Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again"); - success = m_Connector.RegisterRegion(UUID.Zero, r3); - if (success) + msg = m_Connector.RegisterRegion(UUID.Zero, r3); + if (msg == String.Empty) Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); else Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); -- cgit v1.1 From 482dcb7e89a7e1834970f18f301f13af6d4851a6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 13 Jan 2010 03:59:35 +0000 Subject: Fix a bad error message --- OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 1ba7344..04c7c53 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -115,7 +115,7 @@ namespace OpenSim.Services.Connectors } else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure")) { - m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); + m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString()); return replyData["Message"].ToString(); } else if (!replyData.ContainsKey("Result")) -- cgit v1.1 From 5dcb14726da1ae60d1f740708e568194056cee04 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 14 Jan 2010 02:42:15 +0000 Subject: Make the auth module silent when there is no configuration for it --- .../Services/Connectors/Authorization/AuthorizationServiceConnector.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs index a1c032e..4eb4bd2 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs @@ -67,7 +67,7 @@ namespace OpenSim.Services.Connectors IConfig authorizationConfig = source.Configs["AuthorizationService"]; if (authorizationConfig == null) { - m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini"); + //m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini"); throw new Exception("Authorization connector init error"); } @@ -86,6 +86,7 @@ namespace OpenSim.Services.Connectors bool responseOnFailure = authorizationConfig.GetBoolean("ResponseOnFailure",true); m_ResponseOnFailure = responseOnFailure; + m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService initialized"); } public bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID, out string message) -- cgit v1.1 From 88d2adc93cd91baa9b2c9899ebe727672c914ec3 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 14 Jan 2010 02:16:40 -0800 Subject: add an agent position field to AgentUpdateArgs for use by some non-LL clients --- OpenSim/Framework/AgentUpdateArgs.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs index 7b9ec68..660bc32 100644 --- a/OpenSim/Framework/AgentUpdateArgs.cs +++ b/OpenSim/Framework/AgentUpdateArgs.cs @@ -78,5 +78,13 @@ namespace OpenSim.Framework /// public UUID SessionID; public byte State; + + public Vector3 ClientAgentPosition; + public bool UseClientAgentPosition; + + public AgentUpdateArgs() + { + UseClientAgentPosition = false; + } } } -- cgit v1.1