diff --git a/BUILDING.txt b/BUILDING.txt new file mode 100644 index 0000000000..03fb482226 --- /dev/null +++ b/BUILDING.txt @@ -0,0 +1,30 @@ +== Building OpenSim == + +=== Building on Windows === + +Steps: + * runprebuild.bat + * Load OpenSim.sln into Visual Studio .NET and build the solution. + * chdir bin + * copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include + * run OpenSim.exe + +=== Building on Linux === + +Prereqs: + * Mono >= 2.4.2 + * Nant >= 0.85 + * On some Linux distributions you may need to install additional packages. + See http://opensimulator.org/wiki/Dependencies for more information. + +From the distribution type: + * ./runprebuild.sh + * nant + * cd bin + * copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include + * run mono OpenSim.exe + +=== References === + +Helpful resources: +* http://opensimulator.org/wiki/Build_Instructions diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index a31e0c02c7..2d80d83e9a 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; @@ -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 } @@ -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 66c0eb25c8..30d157565f 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(); @@ -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(); } @@ -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 6f6d23170a..6a119bd372 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 { }; @@ -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(); } @@ -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/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs index 783adef559..d195d25296 100644 --- a/OpenSim/ConsoleClient/ConsoleClient.cs +++ b/OpenSim/ConsoleClient/ConsoleClient.cs @@ -82,7 +82,13 @@ namespace OpenSim.ConsoleClient private static void SendCommand(string module, string[] cmd) { - string sendCmd = String.Join(" ", cmd); + string sendCmd = cmd[0]; + if (cmd.Length > 1) + { + Array.Copy(cmd, 1, cmd, 0, cmd.Length-1); + Array.Resize(ref cmd, cmd.Length-1); + sendCmd += "\"" + String.Join("\" \"", cmd) + "\""; + } Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply); } diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs new file mode 100644 index 0000000000..12b2750d2d --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteFramework.cs @@ -0,0 +1,83 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using OpenMetaverse; +using OpenSim.Framework; +using Mono.Data.SqliteClient; + +namespace OpenSim.Data.SQLite +{ + /// + /// A database interface class to a user profile storage system + /// + public class SQLiteFramework + { + protected SqliteConnection m_Connection; + + protected SQLiteFramework(string connectionString) + { + m_Connection = new SqliteConnection(connectionString); + m_Connection.Open(); + } + + ////////////////////////////////////////////////////////////// + // + // All non queries are funneled through one connection + // to increase performance a little + // + protected int ExecuteNonQuery(SqliteCommand cmd) + { + lock (m_Connection) + { + cmd.Connection = m_Connection; + + return cmd.ExecuteNonQuery(); + } + } + + protected IDataReader ExecuteReader(SqliteCommand cmd) + { + SqliteConnection newConnection = + (SqliteConnection)((ICloneable)m_Connection).Clone(); + newConnection.Open(); + + cmd.Connection = newConnection; + return cmd.ExecuteReader(); + } + + protected void CloseReaderCommand(SqliteCommand cmd) + { + cmd.Connection.Close(); + cmd.Connection.Dispose(); + cmd.Dispose(); + } + } +} diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs new file mode 100644 index 0000000000..6b67ec6fd7 --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs @@ -0,0 +1,253 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Reflection; +using log4net; +using Mono.Data.SqliteClient; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; + +namespace OpenSim.Data.SQLite +{ + public class SQLiteGenericTableHandler : SQLiteFramework where T: class, new() + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + + protected Dictionary m_Fields = + new Dictionary(); + + protected List m_ColumnNames = null; + protected string m_Realm; + protected FieldInfo m_DataField = null; + + public SQLiteGenericTableHandler(string connectionString, + string realm, string storeName) : base(connectionString) + { + m_Realm = realm; + if (storeName != String.Empty) + { + Assembly assem = GetType().Assembly; + + Migration m = new Migration(m_Connection, assem, storeName); + m.Update(); + } + + Type t = typeof(T); + FieldInfo[] fields = t.GetFields(BindingFlags.Public | + BindingFlags.Instance | + BindingFlags.DeclaredOnly); + + if (fields.Length == 0) + return; + + foreach (FieldInfo f in fields) + { + if (f.Name != "Data") + m_Fields[f.Name] = f; + else + m_DataField = f; + } + } + + private void CheckColumnNames(IDataReader reader) + { + if (m_ColumnNames != null) + return; + + m_ColumnNames = new List(); + + DataTable schemaTable = reader.GetSchemaTable(); + foreach (DataRow row in schemaTable.Rows) + { + if (row["ColumnName"] != null && + (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) + m_ColumnNames.Add(row["ColumnName"].ToString()); + } + } + + public T[] Get(string field, string key) + { + return Get(new string[] { field }, new string[] { key }); + } + + public T[] Get(string[] fields, string[] keys) + { + if (fields.Length != keys.Length) + return new T[0]; + + List terms = new List(); + + SqliteCommand cmd = new SqliteCommand(); + + for (int i = 0 ; i < fields.Length ; i++) + { + cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i])); + terms.Add("`" + fields[i] + "` = :" + fields[i]); + } + + string where = String.Join(" and ", terms.ToArray()); + + string query = String.Format("select * from {0} where {1}", + m_Realm, where); + + cmd.CommandText = query; + + return DoQuery(cmd); + } + + protected T[] DoQuery(SqliteCommand cmd) + { + IDataReader reader = ExecuteReader(cmd); + if (reader == null) + return new T[0]; + + CheckColumnNames(reader); + + List result = new List(); + + while (reader.Read()) + { + T row = new T(); + + foreach (string name in m_Fields.Keys) + { + if (m_Fields[name].GetValue(row) is bool) + { + int v = Convert.ToInt32(reader[name]); + m_Fields[name].SetValue(row, v != 0 ? true : false); + } + else if (m_Fields[name].GetValue(row) is UUID) + { + UUID uuid = UUID.Zero; + + UUID.TryParse(reader[name].ToString(), out uuid); + m_Fields[name].SetValue(row, uuid); + } + else if (m_Fields[name].GetValue(row) is int) + { + int v = Convert.ToInt32(reader[name]); + m_Fields[name].SetValue(row, v); + } + else + { + m_Fields[name].SetValue(row, reader[name]); + } + } + + if (m_DataField != null) + { + Dictionary data = + new Dictionary(); + + foreach (string col in m_ColumnNames) + { + data[col] = reader[col].ToString(); + if (data[col] == null) + data[col] = String.Empty; + } + + m_DataField.SetValue(row, data); + } + + result.Add(row); + } + + CloseReaderCommand(cmd); + + return result.ToArray(); + } + + public T[] Get(string where) + { + SqliteCommand cmd = new SqliteCommand(); + + string query = String.Format("select * from {0} where {1}", + m_Realm, where); + + cmd.CommandText = query; + + return DoQuery(cmd); + } + + public bool Store(T row) + { + SqliteCommand cmd = new SqliteCommand(); + + string query = ""; + List names = new List(); + List values = new List(); + + foreach (FieldInfo fi in m_Fields.Values) + { + names.Add(fi.Name); + values.Add(":" + fi.Name); + cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString())); + } + + if (m_DataField != null) + { + Dictionary data = + (Dictionary)m_DataField.GetValue(row); + + foreach (KeyValuePair kvp in data) + { + names.Add(kvp.Key); + values.Add(":" + kvp.Key); + cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value)); + } + } + + query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")"; + + cmd.CommandText = query; + + if (ExecuteNonQuery(cmd) > 0) + return true; + + return false; + } + + public bool Delete(string field, string val) + { + SqliteCommand cmd = new SqliteCommand(); + + cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field); + cmd.Parameters.Add(new SqliteParameter(field, val)); + + if (ExecuteNonQuery(cmd) > 0) + return true; + + return false; + } + } +} diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs new file mode 100644 index 0000000000..97625a74c5 --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -0,0 +1,156 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Data; +using System.Reflection; +using System.Collections.Generic; +using Mono.Data.SqliteClient; +using log4net; +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Data.SQLite +{ + /// + /// A MySQL Interface for the Asset Server + /// + public class SQLiteXInventoryData : IXInventoryData + { + private static readonly ILog m_log = LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private SQLiteGenericTableHandler m_Folders; + private SqliteItemHandler m_Items; + + public SQLiteXInventoryData(string conn, string realm) + { + m_Folders = new SQLiteGenericTableHandler( + conn, "inventoryfolders", "InventoryStore"); + m_Items = new SqliteItemHandler( + conn, "inventoryitems", String.Empty); + } + + public XInventoryFolder[] GetFolders(string[] fields, string[] vals) + { + return m_Folders.Get(fields, vals); + } + + public XInventoryItem[] GetItems(string[] fields, string[] vals) + { + return m_Items.Get(fields, vals); + } + + public bool StoreFolder(XInventoryFolder folder) + { + return m_Folders.Store(folder); + } + + public bool StoreItem(XInventoryItem item) + { + return m_Items.Store(item); + } + + public bool DeleteFolders(string field, string val) + { + return m_Folders.Delete(field, val); + } + + public bool DeleteItems(string field, string val) + { + return m_Items.Delete(field, val); + } + + public bool MoveItem(string id, string newParent) + { + return m_Items.MoveItem(id, newParent); + } + + public XInventoryItem[] GetActiveGestures(UUID principalID) + { + return m_Items.GetActiveGestures(principalID); + } + + public int GetAssetPermissions(UUID principalID, UUID assetID) + { + return m_Items.GetAssetPermissions(principalID, assetID); + } + } + + public class SqliteItemHandler : SQLiteGenericTableHandler + { + public SqliteItemHandler(string c, string t, string m) : + base(c, t, m) + { + } + + public bool MoveItem(string id, string newParent) + { + SqliteCommand cmd = new SqliteCommand(); + + cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm); + cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent)); + cmd.Parameters.Add(new SqliteParameter(":InventoryID", id)); + + return ExecuteNonQuery(cmd) == 0 ? false : true; + } + + public XInventoryItem[] GetActiveGestures(UUID principalID) + { + SqliteCommand cmd = new SqliteCommand(); + cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm); + + cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture)); + + return DoQuery(cmd); + } + + public int GetAssetPermissions(UUID principalID, UUID assetID) + { + SqliteCommand cmd = new SqliteCommand(); + + cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm); + cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString())); + + IDataReader reader = ExecuteReader(cmd); + + int perms = 0; + + while (reader.Read()) + { + perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]); + } + + reader.Close(); + CloseReaderCommand(cmd); + + return perms; + } + } +} diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs index 7b9ec68966..660bc327de 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; + } } } diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 9671bc2375..66f483cf22 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -552,8 +552,9 @@ namespace OpenSim.Framework.Console } } - // A console that processes commands internally - // + /// + /// A console that processes commands internally + /// public class CommandConsole : ConsoleBase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -574,6 +575,9 @@ namespace OpenSim.Framework.Console Output(s); } + /// + /// Display a command prompt on the console and wait for user input + /// public void Prompt() { string line = ReadLine(m_defaultPrompt + "# ", true, true); diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 39edd2aac2..b7e191b969 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -36,8 +36,9 @@ using log4net; namespace OpenSim.Framework.Console { - // A console that uses cursor control and color - // + /// + /// A console that uses cursor control and color + /// public class LocalConsole : CommandConsole { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -85,30 +86,70 @@ namespace OpenSim.Framework.Console history.Add(text); } + /// + /// Set the cursor row. + /// + /// + /// + /// Row to set. If this is below 0, then the row is set to 0. If it is equal to the buffer height or greater + /// then it is set to one less than the height. + /// + /// + /// The new cursor row. + /// private int SetCursorTop(int top) { - if (top >= 0 && top < System.Console.BufferHeight) - { - System.Console.CursorTop = top; - return top; - } - else - { - return System.Console.CursorTop; - } + // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try + // to set a cursor row position with a currently invalid column, mono will throw an exception. + // Therefore, we need to make sure that the column position is valid first. + int left = System.Console.CursorLeft; + + if (left < 0) + System.Console.CursorLeft = 0; + else if (left >= System.Console.BufferWidth) + System.Console.CursorLeft = System.Console.BufferWidth - 1; + + if (top < 0) + top = 0; + if (top >= System.Console.BufferHeight) + top = System.Console.BufferHeight - 1; + + System.Console.CursorTop = top; + + return top; } + /// + /// Set the cursor column. + /// + /// + /// + /// Column to set. If this is below 0, then the column is set to 0. If it is equal to the buffer width or greater + /// then it is set to one less than the width. + /// + /// + /// The new cursor column. + /// private int SetCursorLeft(int left) { - if (left >= 0 && left < System.Console.BufferWidth) - { - System.Console.CursorLeft = left; - return left; - } - else - { - return System.Console.CursorLeft; - } + // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try + // to set a cursor column position with a currently invalid row, mono will throw an exception. + // Therefore, we need to make sure that the row position is valid first. + int top = System.Console.CursorTop; + + if (top < 0) + System.Console.CursorTop = 0; + else if (top >= System.Console.BufferHeight) + System.Console.CursorTop = System.Console.BufferHeight - 1; + + if (left < 0) + left = 0; + if (left >= System.Console.BufferWidth) + left = System.Console.BufferWidth - 1; + + System.Console.CursorLeft = left; + + return left; } private void Show() @@ -128,21 +169,21 @@ namespace OpenSim.Framework.Console { y--; new_y--; - System.Console.CursorLeft = 0; - System.Console.CursorTop = System.Console.BufferHeight-1; + SetCursorLeft(0); + SetCursorTop(System.Console.BufferHeight - 1); System.Console.WriteLine(" "); } - y=SetCursorTop(y); - System.Console.CursorLeft = 0; + y = SetCursorTop(y); + SetCursorLeft(0); if (echo) System.Console.Write("{0}{1}", prompt, cmdline); else System.Console.Write("{0}", prompt); - SetCursorLeft(new_x); SetCursorTop(new_y); + SetCursorLeft(new_x); } } @@ -162,8 +203,7 @@ namespace OpenSim.Framework.Console System.Console.Write(" "); y = SetCursorTop(y); - System.Console.CursorLeft = 0; - + SetCursorLeft(0); } } catch (Exception) @@ -252,7 +292,7 @@ namespace OpenSim.Framework.Console } y = SetCursorTop(y); - System.Console.CursorLeft = 0; + SetCursorLeft(0); int count = cmdline.Length + prompt.Length; @@ -260,7 +300,7 @@ namespace OpenSim.Framework.Console System.Console.Write(" "); y = SetCursorTop(y); - System.Console.CursorLeft = 0; + SetCursorLeft(0); WriteLocalText(text, level); @@ -299,7 +339,7 @@ namespace OpenSim.Framework.Console echo = e; int historyLine = history.Count; - System.Console.CursorLeft = 0; // Needed for mono + SetCursorLeft(0); // Needed for mono System.Console.Write(" "); // Needed for mono lock (cmdline) @@ -339,7 +379,7 @@ namespace OpenSim.Framework.Console cmdline.Remove(cp-1, 1); cp--; - System.Console.CursorLeft = 0; + SetCursorLeft(0); y = SetCursorTop(y); System.Console.Write("{0}{1} ", prompt, cmdline); @@ -387,7 +427,7 @@ namespace OpenSim.Framework.Console cp++; break; case ConsoleKey.Enter: - System.Console.CursorLeft = 0; + SetCursorLeft(0); y = SetCursorTop(y); System.Console.WriteLine("{0}{1}", prompt, cmdline); @@ -424,4 +464,4 @@ namespace OpenSim.Framework.Console } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 632431fb3f..5757061efc 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/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index deced98c97..b4b5808ad3 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/GroupData.cs b/OpenSim/Framework/GroupData.cs index 247420e27b..e3b86265d6 100644 --- a/OpenSim/Framework/GroupData.cs +++ b/OpenSim/Framework/GroupData.cs @@ -135,4 +135,30 @@ namespace OpenSim.Framework public bool HasAttachment; public byte AssetType; } + + public struct GroupVoteHistory + { + public string VoteID; + public string VoteInitiator; + public string Majority; + public string Quorum; + public string TerseDateID; + public string StartDateTime; + public string EndDateTime; + public string VoteType; + public string VoteResult; + public string ProposalText; + } + + public struct GroupActiveProposals + { + public string VoteID; + public string VoteInitiator; + public string Majority; + public string Quorum; + public string TerseDateID; + public string StartDateTime; + public string EndDateTime; + public string ProposalText; + } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 60c1ac773f..3489af122d 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. @@ -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); @@ -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/Framework/ILoginServiceToRegionsConnector.cs b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs index 2aee88e557..5a155c1127 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/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 7da4893b62..84cc05eb74 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 546a1d123b..299f519eb5 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; @@ -66,6 +67,7 @@ namespace OpenSim base.ReadExtraConfigSettings(); IConfig startupConfig = m_config.Source.Configs["Startup"]; + IConfig networkConfig = m_config.Source.Configs["Network"]; int stpMaxThreads = 15; @@ -79,6 +81,8 @@ namespace OpenSim else m_consoleType= startupConfig.GetString("console", String.Empty); + if (networkConfig != null) + m_consolePort = (uint)networkConfig.GetInt("console_port", 0); m_timedScript = startupConfig.GetString("timer_Script", "disabled"); if (m_logFileAppender != null) { @@ -156,7 +160,16 @@ namespace OpenSim MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); 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)) @@ -292,18 +305,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); @@ -553,42 +554,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 f3f715a16e..f265769642 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -200,12 +200,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(); } @@ -275,31 +269,6 @@ namespace OpenSim m_sceneManager.OnRestartSim += handleRestartRegion; } - /// - /// 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/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b937226618..ae0bd7948f 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 @@ -825,37 +825,39 @@ 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) + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) { - foreach (KeyValuePair Blank in VoteID) + 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 = 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(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[0] = ProposalData; + GAPIRP.ProposalData[i] = ProposalData; OutPacket(GAPIRP, ThrottleOutPacketType.Task); + i++; } - if (VoteID.Count == 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; @@ -875,40 +877,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(GAPIRP, ThrottleOutPacketType.Task); } } - - 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) + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) { - foreach (KeyValuePair Blank in VoteID) + int i = 0; + foreach (GroupVoteHistory Vote in Votes) { - 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); + 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.HistoryItemData.ProposalText = Utils.StringToBytes(Vote.ProposalText); + GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock(); + GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1]; + VoteItem.CandidateID = UUID.Zero; + VoteItem.NumVotes = 0; //TODO: FIX THIS!!! + VoteItem.VoteCast = Utils.StringToBytes("Yes"); + GVHIRP.VoteItem[i] = VoteItem; + OutPacket(GVHIRP, ThrottleOutPacketType.Task); + i++; } - if (VoteID.Count == 0) + if (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; @@ -3908,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(); @@ -3917,26 +3922,36 @@ 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("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 = 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); } @@ -4887,7 +4902,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; - FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUserEvent; + FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser; if (FreezeUserHandler != null) { FreezeUserHandler(this, @@ -4904,7 +4919,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EjectUserPacket EjectUser = (EjectUserPacket)Packet; - EjectUserUpdate EjectUserHandler = OnParcelEjectUserEvent; + EjectUserUpdate EjectUserHandler = OnParcelEjectUser; if (EjectUserHandler != null) { EjectUserHandler(this, @@ -5303,7 +5318,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); @@ -5317,7 +5332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TrackAgentPacket TrackAgent = (TrackAgentPacket)Packet; - TrackAgentUpdate TrackAgentHandler = OnTrackAgentEvent; + TrackAgentUpdate TrackAgentHandler = OnTrackAgent; if (TrackAgentHandler != null) { TrackAgentHandler(this, @@ -8606,7 +8621,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP GodUpdateRegionInfoPacket GodUpdateRegionInfo = (GodUpdateRegionInfoPacket)Packet; - GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdateEvent; + GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdate; if (handlerGodUpdateRegionInfo != null) { handlerGodUpdateRegionInfo(this, @@ -8639,7 +8654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP GodlikeMessagePacket GodlikeMessage = (GodlikeMessagePacket)Packet; - GodlikeMessage handlerGodlikeMessage = onGodlikeMessageEvent; + GodlikeMessage handlerGodlikeMessage = onGodlikeMessage; if (handlerGodlikeMessage != null) { handlerGodlikeMessage(this, @@ -8655,7 +8670,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { StateSavePacket SaveStateMessage = (StateSavePacket)Packet; - SaveStateHandler handlerSaveStatePacket = OnSaveStateEvent; + SaveStateHandler handlerSaveStatePacket = OnSaveState; if (handlerSaveStatePacket != null) { handlerSaveStatePacket(this,SaveStateMessage.AgentData.AgentID); @@ -9019,7 +9034,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { UpdateMuteListEntryPacket UpdateMuteListEntry = (UpdateMuteListEntryPacket)Packet; - MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntryEvent; + MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntry; if (handlerUpdateMuteListEntry != null) { handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, @@ -9035,7 +9050,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { RemoveMuteListEntryPacket RemoveMuteListEntry = (RemoveMuteListEntryPacket)Packet; - MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntryEvent; + MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntry; if (handlerRemoveMuteListEntry != null) { handlerRemoveMuteListEntry(this, @@ -9052,7 +9067,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/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index a835c52751..e48b078343 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -48,6 +48,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private List m_SceneList = new List(); private string m_RestURL = String.Empty; IMessageTransferModule m_TransferModule = null; + private bool m_ForwardOfflineGroupMessages = true; public void Initialise(IConfigSource config) { @@ -71,6 +72,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage enabled = false; return; } + + m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages); } public void AddRegion(Scene scene) @@ -192,7 +195,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private void UndeliveredMessage(GridInstantMessage im) { - if (im.offline != 0) + if ((im.offline != 0) + && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { bool success = SynchronousRestObjectPoster.BeginPostObject( "POST", m_RestURL+"/SaveMessage/", im); diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index f980c24264..106e87c88a 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -65,6 +65,7 @@ \ \ \ + \ diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 8ec20eb46f..de71b56e0b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs @@ -195,7 +195,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)) @@ -210,12 +210,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 } @@ -465,7 +465,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; @@ -706,8 +706,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; UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID); if (account != null) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index f0081fca28..86a8c13e3c 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 72c00fc02d..391e7c84f5 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/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs new file mode 100644 index 0000000000..8b5a413761 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -0,0 +1,157 @@ +/* + * 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.Console; +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); + + 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() + { + } + + public void Close() + { + } + + public string Name + { + get { return "AccessModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + 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; + } + } +} diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 2109336c5c..189efdcef5 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -72,10 +72,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); @@ -228,127 +239,176 @@ namespace OpenSim.Region.CoreModules.World.Estate if (user == m_scene.RegionInfo.EstateSettings.EstateOwner) return; // never process EO - switch (estateAccessType) + if ((estateAccessType & 4) != 0) // User add { - case 64: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + 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"); + } + + } + 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(); + + 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.EstateGroups, 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(); + + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, 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; + + bool alreadyInList = false; + + for (int i = 0; i < banlistcheck.Length; i++) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - - bool alreadyInList = false; - - for (int i = 0; i < banlistcheck.Length; i++) + if (user == banlistcheck[i].BannedUserID) { - if (user == banlistcheck[i].BannedUserID) - { - alreadyInList = true; - break; - } - + alreadyInList = true; + break; } - if (!alreadyInList) - { - 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"; - - m_scene.RegionInfo.EstateSettings.AddBan(item); - m_scene.RegionInfo.EstateSettings.Save(); - - ScenePresence s = m_scene.GetScenePresence(user); - if (s != null) - { - if (!s.IsChildAgent) - { - s.ControllingClient.SendTeleportLocationStart(); - m_scene.TeleportClientHome(user, s.ControllingClient); - } - } - - } - else - { - remote_client.SendAlertMessage("User is already 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 + if (!alreadyInList) { - 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()) - { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - bool alreadyInList = false; - EstateBan listitem = null; + EstateBan item = new EstateBan(); - for (int i = 0; i < banlistcheck.Length; i++) - { - if (user == banlistcheck[i].BannedUserID) - { - alreadyInList = true; - listitem = banlistcheck[i]; - break; - } + item.BannedUserID = user; + item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; + item.BannedHostAddress = "0.0.0.0"; + item.BannedHostIPMask = "0.0.0.0"; - } - 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"); - } - break; - case 256: - - 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 - { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); - } - - break; - case 512: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) - { - m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + m_scene.RegionInfo.EstateSettings.AddBan(item); m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + ScenePresence s = m_scene.GetScenePresence(user); + if (s != null) + { + if (!s.IsChildAgent) + { + s.ControllingClient.SendTeleportLocationStart(); + m_scene.TeleportClientHome(user, s.ControllingClient); + } + } + } else { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + remote_client.SendAlertMessage("User is already on the region ban list"); } - 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"); + } + } + 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; - default: + bool alreadyInList = false; + EstateBan listitem = null; - m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); - break; + for (int i = 0; i < banlistcheck.Length; i++) + { + if (user == banlistcheck[i].BannedUserID) + { + alreadyInList = true; + listitem = banlistcheck[i]; + break; + } + + } + 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"); + } + } + 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(); + + 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/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 3d7516d119..8fa0c65336 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -607,7 +607,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) @@ -899,6 +899,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); } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 27fad61b39..1dfa1b1b76 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 @@ -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) { } @@ -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/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs index 5cdf1911b2..d7fa316668 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); } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 753344d1a0..399379ea2c 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -183,12 +183,24 @@ namespace OpenSim.Region.Framework.Scenes 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); public event ScriptColliding OnScriptColliderStart; 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; @@ -380,6 +392,8 @@ namespace OpenSim.Region.Framework.Scenes private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; private ScriptAtTargetEvent handlerScriptAtTargetEvent = 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; @@ -439,6 +453,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; @@ -844,6 +861,24 @@ namespace OpenSim.Region.Framework.Scenes } } + 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) { handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; @@ -1034,6 +1069,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/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 62734ff413..7b582a95be 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes protected AgentCircuitManager m_authenticateHandler; protected SceneCommunicationService m_sceneGridService; - public bool loginsdisabled = true; + public bool LoginsDisabled = true; public new float TimeDilation { @@ -1366,15 +1366,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) @@ -1649,9 +1653,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); @@ -3404,7 +3408,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; @@ -3577,8 +3581,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); diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index a67b42a3da..f1813a592b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -60,12 +60,7 @@ namespace OpenSim.Region.Framework.Scenes protected RegionCommsListener regionCommsHost; - public bool RegionLoginsEnabled - { - get { return m_regionLoginsEnabled; } - set { m_regionLoginsEnabled = value; } - } - private bool m_regionLoginsEnabled = false; + protected List m_agentsInTransit; /// /// An agent is crossing into this region diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 34d8b49c83..ec41ac76c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -57,6 +57,7 @@ namespace OpenSim.Region.Framework.Scenes land_collision_end = 4096, land_collision_start = 8192, at_target = 16384, + at_rot_target = 16777216, listen = 32768, money = 65536, moving_end = 131072, @@ -81,6 +82,13 @@ namespace OpenSim.Region.Framework.Scenes public uint handle; } + struct scriptRotTarget + { + public Quaternion targetRot; + public float tolerance; + public uint handle; + } + public delegate void PrimCountTaintedDelegate(); /// @@ -166,10 +174,14 @@ namespace OpenSim.Region.Framework.Scenes // private Dictionary m_scriptEvents = 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_notAtRotTarget = false; + internal Dictionary m_savedScriptState = null; #region Properties @@ -1262,6 +1274,15 @@ namespace OpenSim.Region.Framework.Scenes 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(); } @@ -3158,6 +3179,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) { @@ -3264,6 +3309,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]); + } + } + } + } } public float GetMass() diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 22a8ca121c..56b2f13f3d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -140,6 +140,15 @@ namespace OpenSim.Region.Framework.Scenes [XmlIgnore] 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(); @@ -1673,6 +1682,19 @@ namespace OpenSim.Region.Framework.Scenes 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) { float dx = a.X - b.X; @@ -1831,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 @@ -1882,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; @@ -1919,7 +1939,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; @@ -1944,7 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes 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 @@ -1970,7 +1990,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; @@ -2017,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; @@ -2055,7 +2075,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; @@ -2080,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes 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 +2126,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; @@ -2149,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) @@ -2186,7 +2206,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; @@ -2211,7 +2231,7 @@ namespace OpenSim.Region.Framework.Scenes 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 +2257,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; @@ -2271,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) @@ -2737,6 +2871,13 @@ namespace OpenSim.Region.Framework.Scenes { 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) @@ -3669,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) ) { @@ -3873,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) ) { @@ -3933,6 +4080,23 @@ namespace OpenSim.Region.Framework.Scenes } } + 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) { m_cameraAtOffset = v; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 5d97a12868..6785c08ce9 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 @@ -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) { } @@ -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/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index e11cbd7851..66265d84b7 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); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index e3392c83ee..4a4c51557b 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 @@ -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) { } @@ -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/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d5562f21c2..ee2a94ce12 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2110,14 +2110,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llRotTarget(LSL_Rotation rot, double error) { m_host.AddScriptLPS(1); - NotImplemented("llRotTarget"); - return 0; + 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.unregisterRotTargetWaypoint(number); } public void llMoveToTarget(LSL_Vector target, double tau) @@ -7286,23 +7285,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; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0ed7f51ee0..7462ba0d5d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1981,6 +1981,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return (int)pws; } + public void osSetSpeed(string UUID, float SpeedModifier) { CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); @@ -1988,6 +1989,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"); @@ -2008,6 +2010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + public void osCauseDamage(string avatar, double damage) { CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); @@ -2035,6 +2038,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + public void osCauseHealing(string avatar, double healing) { CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); @@ -2059,4 +2063,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs index 7f67599c92..96153156cb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs @@ -62,6 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase land_collision_end = 4096, land_collision_start = 8192, at_target = 16384, + at_rot_target = 16777216, listen = 32768, money = 65536, moving_end = 131072, @@ -203,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } m_eventFlagsMap.Add("attach", scriptEvents.attach); - // m_eventFlagsMap.Add("at_rot_target",(long)scriptEvents.at_rot_target); + 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 8195f33663..16309efca4 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -59,10 +59,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine 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.OnScriptControlEvent += control; 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 +290,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 @@ -353,14 +392,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine new DetectParams[0])); } - public void at_rot_target(uint localID, UUID itemID) + public void at_rot_target(uint localID, uint handle, Quaternion targetrot, + Quaternion atrot) { myScriptEngine.PostObjectEvent(localID, new EventParams( - "at_rot_target",new object[0], + "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], diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index ed0210f190..77184a498a 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)); } } } diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 16015758f6..318ce85c22 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -162,14 +162,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) @@ -508,6 +508,11 @@ namespace OpenSim.Server.Handlers.Grid } private byte[] FailureResult() + { + return FailureResult(String.Empty); + } + + private byte[] FailureResult(string msg) { XmlDocument doc = new XmlDocument(); @@ -526,6 +531,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/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs new file mode 100644 index 0000000000..c7d5ff1d3a --- /dev/null +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -0,0 +1,456 @@ +/* + * 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; +using OpenMetaverse; + +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 "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); + } + 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[] HandleCreateUserInventory(Dictionary request) + { + 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(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetInventorySkeleton(Dictionary request) + { + 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(); + 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); + } + + 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/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs index a1c032ec64..4eb4bd2470 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) diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index cf112e119b..a1ca58edb9 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]: Registration failed: {0}", replyData["Message"].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/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs new file mode 100644 index 0000000000..b9ccd7ea12 --- /dev/null +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -0,0 +1,535 @@ +/* + * 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 principalID) + { + 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) + { + 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) + { + 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) + { + 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) + { + 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) + { + 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("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) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool UpdateItem(InventoryItemBase item) + { + 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) + return false; + + return bool.Parse(ret["RESULT"].ToString()); + } + + public bool MoveItems(UUID principalID, List items) + { + 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) + { + 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) + { + 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) + { + 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 principalID) + { + 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) + { + Dictionary ret = MakeRequest("GETASSETPERMISSIONS", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "ASSET", assetID.ToString() } + }); + + if (ret == null) + return 0; + + 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; + } + + 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/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 5c55c0b473..e9127051e4 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -52,6 +52,7 @@ namespace OpenSim.Services.GridService protected IConfigSource m_config; protected IAuthenticationService m_AuthenticationService = null; + protected bool m_AllowDuplicateNames = false; public GridService(IConfigSource config) : base(config) @@ -71,6 +72,7 @@ namespace OpenSim.Services.GridService Object[] args = new Object[] { config }; m_AuthenticationService = ServerUtils.LoadPlugin(authService, args); } + m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); } if (m_RootInstance == null) @@ -95,7 +97,7 @@ namespace OpenSim.Services.GridService #region IGridService - public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) + public string RegisterRegion(UUID scopeID, GridRegion regionInfos) { IConfig gridConfig = m_config.Configs["GridService"]; // This needs better sanity testing. What if regionInfo is registering in @@ -116,7 +118,7 @@ namespace OpenSim.Services.GridService // Regions reserved for the null key cannot be taken. // if (region.Data["PrincipalID"] == UUID.Zero.ToString()) - return false; + return "Region location us reserved"; // Treat it as an auth request // @@ -132,12 +134,10 @@ namespace OpenSim.Services.GridService // Can we authenticate at all? // if (m_AuthenticationService == null) - return false; + return "No authentication possible"; if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30)) - return false; - - return false; + return "Bad authentication"; } } @@ -145,13 +145,13 @@ 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))) { if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) - return false; + return "Can't move this region"; // Region reregistering in other coordinates. Delete the old entry m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", @@ -167,6 +167,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 "Duplicate region name"; + } + } + } + } + // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; @@ -175,7 +192,7 @@ namespace OpenSim.Services.GridService { int oldFlags = Convert.ToInt32(region.Data["flags"]); if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) - return false; + return "Region locked out"; oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; @@ -211,7 +228,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 6b6b34797a..6186d80f2d 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 972c0aa3bf..8e3337319b 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"); diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 1a22bdc9e7..8b79502127 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 @@ -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) { } @@ -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) + { } } } diff --git a/README.txt b/README.txt index d276c6ec19..ed59bf56b7 100644 --- a/README.txt +++ b/README.txt @@ -10,30 +10,36 @@ C#, and can run under Mono or the Microsoft .NET runtimes. This is considered an alpha release. Some stuff works, a lot doesn't. If it breaks, you get to keep *both* pieces. -== Installation on Windows == +== Compiling OpenSim == -Prereqs: +Please see BUILDING.txt if you downloaded a source distribution and +need to build OpenSim before running it. - * Load OpenSim.sln into Visual Studio .NET and build the solution. - * chdir bin - * OpenSim.exe +== Running OpenSim on Windows == -See configuring OpenSim +We recommend that you run OpenSim from a command prompt on Windows in order +to capture any errors, though you can also run it by double-clicking +bin/OpenSim.exe -== Installation on Linux == +To run OpenSim from a command prompt -Prereqs: - * Mono >= 2.4.2 - * Nant >= 0.86 beta 1 (if building with the .NET framework on Windows), 0.85 (if building with the mono framework) - * sqlite3 or mysql 5.x (you'll need a backend database) + * cd to the bin/ directory where you unpacked OpenSim + * run OpenSim.exe + +Now see the "Configuring OpenSim" section + +== Running OpenSim on Linux == + +You will need Mono >= 2.4.2 to run OpenSim. On some Linux distributions you +may need to install additional packages. See http://opensimulator.org/wiki/Dependencies +for more information. + +To run OpenSim, from the unpacked distribution type: -From the distribution type: - * ./runprebuild.sh - * nant * cd bin * mono ./OpenSim.exe -See configuring OpenSim +Now see the "Configuring OpenSim" section == Configuring OpenSim == @@ -53,11 +59,21 @@ Once you are presented with a prompt that looks like: You have successfully started OpenSim. +Before you can log in you will need to create a user account. You can do +this by running the "create user" command on the OpenSim console. This will +ask you a series of questions such as first name, last name and password. + +Helpful resources: + * http://opensimulator.org/wiki/Configuration + * http://opensimulator.org/wiki/Configuring_Regions + * http://opensimulator.org/wiki/Mysql-config + == Connecting to your OpenSim == By default your sim will be running on http://127.0.0.1:9000. To use your OpenSim add -loginuri http://127.0.0.1:9000 to your second life -client (running on the same machine as your OpenSim). +client (running on the same machine as your OpenSim). To login, use the +same avatar details that you gave to the "create user" console command. == Bug reports == diff --git a/addon-modules/README b/addon-modules/README index 19f268fa52..b5bf2e007e 100644 --- a/addon-modules/README +++ b/addon-modules/README @@ -3,3 +3,7 @@ In this directory you can place addon modules for OpenSim Each module should be in it's own tree and the root of the tree should contain a file named "prebuild.xml", which will be included in the main prebuild file. + +The prebuild.xml should only contain and associated child tags. +The , , and tags should not be +included since the add-on modules prebuild.xml will be inserted directly into the main prebuild.xml diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index b13e739604..3d2a5ba0a8 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example @@ -23,6 +23,7 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S ; * Leave commented to diable logins to the console ;ConsoleUser = Test ;ConsolePass = secret +;ConsolePort = 0 ; * As an example, the below configuration precisely mimicks the legacy ; * asset server. It is read by the asset IN connector (defined above) @@ -55,11 +56,12 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" Realm = "regions" + ; AllowDuplicateNames = "True" ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" - ;; where can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut + ;; where can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut,Reservation,NoMove,Authenticate ;; For example: - Region_Welcome_Area = "DefaultRegion, FallbackRegion" + ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" ; * This is the configuration for the freeswitch server in grid mode [FreeswitchService] @@ -99,7 +101,6 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S GridService = "OpenSim.Services.GridService.dll:GridService" InventoryService = "OpenSim.Services.InventoryService.dll:InventoryService" - [PresenceService] ; for the server connector LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 971dfc433e..3b560de5b2 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -126,11 +126,16 @@ ;storage_plugin = "OpenSim.Data.Null.dll" ; --- To use sqlite as region storage: + ; NOTE: SQLite and OpenSim are not functioning properly with Mono 2.4.3 or greater. + ; If you are using Mono you probably should be using MySQL storage_plugin = "OpenSim.Data.SQLite.dll" storage_connection_string="URI=file:OpenSim.db,version=3"; - ; --- To use MySQL storage, supply your own connectionstring (this is only an example): + ; --- To use MySQL storage, supply your own connection string (this is only an example): ; note that the supplied account needs create privilegies if you want it to auto-create needed tables. + ; + ; -->>> There are multiple connection strings defined in several places in this file. Check it carefully! + ; ; storage_plugin="OpenSim.Data.MySQL.dll" ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; ; If you want to use a different database/server for estate data, then @@ -263,6 +268,9 @@ ; Enable JSON simulator data by setting a URI name (case sensitive) ; Stats_URI = "jsonSimStats" + ; Make OpenSim start all regions woth logins disabled. They will need + ; to be enabled from the console if this is set + ; StartDisabled = false [SMTP] enabled=false @@ -282,7 +290,18 @@ [StandAlone] + ; If this is set to true then OpenSim only allows in users who already have accounts. + ; An account can be created using the "create user" console command. + ; + ; If this is set to false then an account is automatically created for a user who logs in + ; without one. PLEASE NOTE THAT IN THIS MODE NO PASSWORD CHECKS ARE PERFORMED. + ; Therefore, any user can log into any account. If accounts_authenticate is later switched to + ; true then the passwords will need to be reset (using the "reset user password" console command) since + ; automatically created accounts have their password set to the string "test". + ; + ; This setting applies to standalone mode only, not grid or other modes. Default is true. accounts_authenticate = true + welcome_message = "Welcome to OpenSimulator" ; Inventory database provider @@ -318,6 +337,7 @@ ConsoleUser = "Test" ConsolePass = "secret" http_listener_port = 9000 + console_port = 0 default_location_x = 1000 default_location_y = 1000 @@ -474,6 +494,9 @@ ; MuteListModule = MuteListModule ; MuteListURL = http://yourserver/Mute.php + ; Control whether group messages are forwarded to offline users. Default is true. + ; ForwardOfflineGroupMessages = true + [ODEPhysicsSettings] ;## @@ -977,6 +1000,11 @@ ; Compile debug info (line numbers) into the script assemblies CompileWithDebugInformation = true + ; Allow the user of mod* functions. This allows a script to pass messages + ; to a region module via the modSendCommand() function + ; Default is false + AllowMODFunctions = false + ; Allow the use of os* functions (some are dangerous) AllowOSFunctions = false