diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 1ad1fcee9f..358a839c22 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; @@ -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 108eab1df6..87db85b194 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(); @@ -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 e1418d8afd..5268e426cc 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 { }; @@ -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/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/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 defbbb9fb0..861d05ed7e 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. @@ -1446,7 +1446,12 @@ namespace OpenSim.Framework void SendUserInfoReply(bool imViaEmail, bool visible, string email); void SendUseCachedMuteList(); - void SendMuteListUpdate(string filename); + + void SendMuteListUpdate(string filename); + + void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals); + + void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes); void KillEndDone(); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0eed284cd3..f3fd2498fd 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; @@ -4876,7 +4880,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; - FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUserEvent; + FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser; if (FreezeUserHandler != null) { FreezeUserHandler(this, @@ -4893,7 +4897,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EjectUserPacket EjectUser = (EjectUserPacket)Packet; - EjectUserUpdate EjectUserHandler = OnParcelEjectUserEvent; + EjectUserUpdate EjectUserHandler = OnParcelEjectUser; if (EjectUserHandler != null) { EjectUserHandler(this, @@ -5292,7 +5296,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); @@ -5306,7 +5310,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TrackAgentPacket TrackAgent = (TrackAgentPacket)Packet; - TrackAgentUpdate TrackAgentHandler = OnTrackAgentEvent; + TrackAgentUpdate TrackAgentHandler = OnTrackAgent; if (TrackAgentHandler != null) { TrackAgentHandler(this, @@ -8592,7 +8596,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP GodUpdateRegionInfoPacket GodUpdateRegionInfo = (GodUpdateRegionInfoPacket)Packet; - GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdateEvent; + GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdate; if (handlerGodUpdateRegionInfo != null) { handlerGodUpdateRegionInfo(this, @@ -8625,7 +8629,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP GodlikeMessagePacket GodlikeMessage = (GodlikeMessagePacket)Packet; - GodlikeMessage handlerGodlikeMessage = onGodlikeMessageEvent; + GodlikeMessage handlerGodlikeMessage = onGodlikeMessage; if (handlerGodlikeMessage != null) { handlerGodlikeMessage(this, @@ -8641,7 +8645,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { StateSavePacket SaveStateMessage = (StateSavePacket)Packet; - SaveStateHandler handlerSaveStatePacket = OnSaveStateEvent; + SaveStateHandler handlerSaveStatePacket = OnSaveState; if (handlerSaveStatePacket != null) { handlerSaveStatePacket(this,SaveStateMessage.AgentData.AgentID); @@ -9005,7 +9009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { UpdateMuteListEntryPacket UpdateMuteListEntry = (UpdateMuteListEntryPacket)Packet; - MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntryEvent; + MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntry; if (handlerUpdateMuteListEntry != null) { handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, @@ -9021,7 +9025,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { RemoveMuteListEntryPacket RemoveMuteListEntry = (RemoveMuteListEntryPacket)Packet; - MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntryEvent; + MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntry; if (handlerRemoveMuteListEntry != null) { handlerRemoveMuteListEntry(this, @@ -9038,7 +9042,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP UserReportPacket UserReport = (UserReportPacket)Packet; - NewUserReport handlerUserReport = OnUserReportEvent; + NewUserReport handlerUserReport = OnUserReport; if (handlerUserReport != null) { handlerUserReport(this, diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index a4a649c43b..086d4fe69a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -397,8 +397,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends client.OnLogout += OnLogout; client.OnGrantUserRights += GrantUserFriendRights; - client.OnTrackAgentEvent += FindAgent; - client.OnFindAgentEvent += FindAgent; + client.OnTrackAgent += FindAgent; + client.OnFindAgent += FindAgent; } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 7f9e5afc9c..257c221e88 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private bool enabled = true; private List m_SceneList = new List(); private string m_RestURL = String.Empty; + private bool m_ForwardOfflineGroupMessages = true; public void Initialise(Scene scene, IConfigSource config) { @@ -67,6 +68,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } + if (cnf != null) + m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages); + lock (m_SceneList) { if (m_SceneList.Count == 0) @@ -185,7 +189,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/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 4cdc33d479..3659711bd6 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 @@ -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/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a14e3adbbc..e5fc027c97 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -139,7 +139,16 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampTerse; [XmlIgnore] - public UUID FromItemID; + public UUID FromItemID; + + [XmlIgnore] + public int STATUS_ROTATE_X; + + [XmlIgnore] + public int STATUS_ROTATE_Y; + + [XmlIgnore] + public int STATUS_ROTATE_Z; [XmlIgnore] private Dictionary m_CollisionFilter = new Dictionary(); @@ -1675,6 +1684,19 @@ namespace OpenSim.Region.Framework.Scenes return false; return m_parentGroup.RootPart.DIE_AT_EDGE; + } + + public int GetAxisRotation(int axis) + { + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + return STATUS_ROTATE_X; + if (axis == 4)//STATUS_ROTATE_Y + return STATUS_ROTATE_Y; + if (axis == 8)//STATUS_ROTATE_Z + return STATUS_ROTATE_Z; + + return 0; } public double GetDistanceTo(Vector3 a, Vector3 b) @@ -1923,24 +1945,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj._ownerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj._groupID; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work + if (found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = obj.UUID; + detobj.nameStr = obj.Name; + detobj.ownerUUID = obj._ownerID; + detobj.posVector = obj.AbsolutePosition; + detobj.rotQuat = obj.GetWorldRotation(); + detobj.velVector = obj.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = obj._groupID; + colliding.Add(detobj); + } } } else @@ -1952,8 +1974,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -1974,24 +1996,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work + if (!found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = av.UUID; + detobj.nameStr = av.ControllingClient.Name; + detobj.ownerUUID = av.UUID; + detobj.posVector = av.AbsolutePosition; + detobj.rotQuat = av.Rotation; + detobj.velVector = av.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = av.ControllingClient.ActiveGroupId; + colliding.Add(detobj); + } } } @@ -2088,8 +2110,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -2115,7 +2137,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; @@ -2219,8 +2241,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { - if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) + { + if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this avatar @@ -2246,7 +2268,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; @@ -2279,7 +2301,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); } } - } + } } public void PhysicsOutOfBounds(Vector3 pos) @@ -2747,7 +2769,14 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) { m_parentGroup.SetAxisRotation(axis, rotate); - } + } + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + STATUS_ROTATE_X = rotate; + if (axis == 4)//STATUS_ROTATE_Y + STATUS_ROTATE_Y = rotate; + if (axis == 8)//STATUS_ROTATE_Z + STATUS_ROTATE_Z = rotate; } public void SetBuoyancy(float fvalue) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 7907570503..671cfef20c 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 @@ -1657,7 +1657,15 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index c862821310..1639b7ed29 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 @@ -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/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0964caaed7..a5d28a413d 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -160,9 +160,9 @@ namespace OpenSim.Server.Base } } - public static Dictionary ParseQueryString(string query) + public static Dictionary ParseQueryString(string query) { - Dictionary result = new Dictionary(); + Dictionary result = new Dictionary(); string[] terms = query.Split(new char[] {'&'}); if (terms.Length == 0) @@ -180,33 +180,76 @@ namespace OpenSim.Server.Base if (elems.Length > 1) value = System.Web.HttpUtility.UrlDecode(elems[1]); - result[name] = value; + if (name.EndsWith("[]")) + { + if (result.ContainsKey(name)) + { + if (!(result[name] is List)) + continue; + + List l = (List)result[name]; + + l.Add(value); + } + else + { + List newList = new List(); + + newList.Add(value); + + result[name] = newList; + } + } + else + { + if (!result.ContainsKey(name)) + result[name] = value; + } } return result; } - public static string BuildQueryString(Dictionary data) + public static string BuildQueryString(Dictionary data) { string qstring = String.Empty; - foreach (KeyValuePair kvp in data) + string part; + + foreach (KeyValuePair kvp in data) { - string part; - if (kvp.Value != String.Empty) + if (kvp.Value is List) { - part = System.Web.HttpUtility.UrlEncode(kvp.Key) + - "=" + System.Web.HttpUtility.UrlEncode(kvp.Value); + List l = (List)kvp.Value; + + foreach (string s in l) + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key) + + "[]=" + System.Web.HttpUtility.UrlEncode(s); + + if (qstring != String.Empty) + qstring += "&"; + + qstring += part; + } } else { - part = System.Web.HttpUtility.UrlEncode(kvp.Key); + if (kvp.Value.ToString() != String.Empty) + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key) + + "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); + } + else + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key); + } + + if (qstring != String.Empty) + qstring += "&"; + + qstring += part; } - - if (qstring != String.Empty) - qstring += "&"; - - qstring += part; } return qstring; diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 490a13a30f..47bc860207 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -86,14 +86,14 @@ namespace OpenSim.Server.Handlers.Authentication private byte[] DoPlainMethods(string body) { - Dictionary request = + Dictionary request = ServerUtils.ParseQueryString(body); int lifetime = 30; if (request.ContainsKey("LIFETIME")) { - lifetime = Convert.ToInt32(request["LIFETIME"]); + lifetime = Convert.ToInt32(request["LIFETIME"].ToString()); if (lifetime > 30) lifetime = 30; } @@ -103,12 +103,12 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("PRINCIPAL")) return FailureResult(); - string method = request["METHOD"]; + string method = request["METHOD"].ToString(); UUID principalID; string token; - if (!UUID.TryParse(request["PRINCIPAL"], out principalID)) + if (!UUID.TryParse(request["PRINCIPAL"].ToString(), out principalID)) return FailureResult(); switch (method) @@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("PASSWORD")) return FailureResult(); - token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"], lifetime); + token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime); if (token != String.Empty) return SuccessResult(token); @@ -126,7 +126,7 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("TOKEN")) return FailureResult(); - if (m_AuthenticationService.Verify(principalID, request["TOKEN"], lifetime)) + if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime)) return SuccessResult(); return FailureResult(); @@ -134,7 +134,7 @@ namespace OpenSim.Server.Handlers.Authentication if (!request.ContainsKey("TOKEN")) return FailureResult(); - if (m_AuthenticationService.Release(principalID, request["TOKEN"])) + if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString())) return SuccessResult(); return FailureResult(); diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 433ed0b700..d99b791a1b 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -69,13 +69,13 @@ namespace OpenSim.Server.Handlers.Grid try { - Dictionary request = + Dictionary request = ServerUtils.ParseQueryString(body); if (!request.ContainsKey("METHOD")) return FailureResult(); - string method = request["METHOD"]; + string method = request["METHOD"].ToString(); switch (method) { @@ -117,22 +117,22 @@ namespace OpenSim.Server.Handlers.Grid #region Method-specific handlers - byte[] Register(Dictionary request) + byte[] Register(Dictionary request) { UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPEID")) - UUID.TryParse(request["SCOPEID"], out scopeID); + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); int versionNumberMin = 0, versionNumberMax = 0; if (request.ContainsKey("VERSIONMIN")) - Int32.TryParse(request["VERSIONMIN"], out versionNumberMin); + Int32.TryParse(request["VERSIONMIN"].ToString(), out versionNumberMin); else m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region"); if (request.ContainsKey("VERSIONMAX")) - Int32.TryParse(request["VERSIONMAX"], out versionNumberMax); + Int32.TryParse(request["VERSIONMAX"].ToString(), out versionNumberMax); else m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region"); @@ -147,8 +147,8 @@ namespace OpenSim.Server.Handlers.Grid GridRegion rinfo = null; try { - foreach (KeyValuePair kvp in request) - rinfoData[kvp.Key] = kvp.Value; + foreach (KeyValuePair kvp in request) + rinfoData[kvp.Key] = kvp.Value.ToString(); rinfo = new GridRegion(rinfoData); } catch (Exception e) @@ -166,11 +166,11 @@ namespace OpenSim.Server.Handlers.Grid return FailureResult(); } - byte[] Deregister(Dictionary request) + byte[] Deregister(Dictionary request) { UUID regionID = UUID.Zero; - if (request["REGIONID"] != null) - UUID.TryParse(request["REGIONID"], out regionID); + if (request.ContainsKey("REGIONID")) + UUID.TryParse(request["REGIONID"].ToString(), out regionID); else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region"); @@ -183,17 +183,17 @@ namespace OpenSim.Server.Handlers.Grid } - byte[] GetNeighbours(Dictionary request) + byte[] GetNeighbours(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); UUID regionID = UUID.Zero; - if (request["REGIONID"] != null) - UUID.TryParse(request["REGIONID"], out regionID); + if (request.ContainsKey("REGIONID")) + UUID.TryParse(request["REGIONID"].ToString(), out regionID); else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); @@ -221,17 +221,17 @@ namespace OpenSim.Server.Handlers.Grid } - byte[] GetRegionByUUID(Dictionary request) + byte[] GetRegionByUUID(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); UUID regionID = UUID.Zero; - if (request["REGIONID"] != null) - UUID.TryParse(request["REGIONID"], out regionID); + if (request.ContainsKey("REGIONID")) + UUID.TryParse(request["REGIONID"].ToString(), out regionID); else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); @@ -250,21 +250,21 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionByPosition(Dictionary request) + byte[] GetRegionByPosition(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position"); int x = 0, y = 0; - if (request["X"] != null) - Int32.TryParse(request["X"], out x); + if (request.ContainsKey("X")) + Int32.TryParse(request["X"].ToString(), out x); else m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position"); - if (request["Y"] != null) - Int32.TryParse(request["Y"], out y); + if (request.ContainsKey("Y")) + Int32.TryParse(request["Y"].ToString(), out y); else m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); @@ -283,17 +283,17 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionByName(Dictionary request) + byte[] GetRegionByName(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); string regionName = string.Empty; - if (request["NAME"] != null) - regionName = request["NAME"]; + if (request.ContainsKey("NAME")) + regionName = request["NAME"].ToString(); else m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); @@ -312,23 +312,23 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionsByName(Dictionary request) + byte[] GetRegionsByName(Dictionary request) { UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) - UUID.TryParse(request["SCOPEID"], out scopeID); + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name"); string regionName = string.Empty; - if (request["NAME"] != null) - regionName = request["NAME"]; + if (request.ContainsKey("NAME")) + regionName = request["NAME"].ToString(); else m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name"); int max = 0; - if (request["MAX"] != null) - Int32.TryParse(request["MAX"], out max); + if (request.ContainsKey("MAX")) + Int32.TryParse(request["MAX"].ToString(), out max); else m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name"); @@ -355,30 +355,30 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } - byte[] GetRegionRange(Dictionary request) + byte[] GetRegionRange(Dictionary request) { //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPEID")) - UUID.TryParse(request["SCOPEID"], out scopeID); + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); int xmin = 0, xmax = 0, ymin = 0, ymax = 0; if (request.ContainsKey("XMIN")) - Int32.TryParse(request["XMIN"], out xmin); + Int32.TryParse(request["XMIN"].ToString(), out xmin); else m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); if (request.ContainsKey("XMAX")) - Int32.TryParse(request["XMAX"], out xmax); + Int32.TryParse(request["XMAX"].ToString(), out xmax); else m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); if (request.ContainsKey("YMIN")) - Int32.TryParse(request["YMIN"], out ymin); + Int32.TryParse(request["YMIN"].ToString(), out ymin); else m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); if (request.ContainsKey("YMAX")) - Int32.TryParse(request["YMAX"], out ymax); + Int32.TryParse(request["YMAX"].ToString(), out ymax); else m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); diff --git a/OpenSim/Server/Handlers/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/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 2558fa0aaf..b5ae54a715 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -68,13 +68,13 @@ namespace OpenSim.Server.Handlers.Presence try { - Dictionary request = + Dictionary request = ServerUtils.ParseQueryString(body); if (!request.ContainsKey("METHOD")) return FailureResult(); - string method = request["METHOD"]; + string method = request["METHOD"].ToString(); switch (method) { @@ -92,12 +92,12 @@ namespace OpenSim.Server.Handlers.Presence } - byte[] Report(Dictionary request) + byte[] Report(Dictionary request) { PresenceInfo info = new PresenceInfo(); info.Data = new Dictionary(); - if (request["PrincipalID"] == null || request["RegionID"] == null) + if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("RegionID")) return FailureResult(); if (!UUID.TryParse(request["PrincipalID"].ToString(), @@ -108,14 +108,14 @@ namespace OpenSim.Server.Handlers.Presence out info.RegionID)) return FailureResult(); - foreach (KeyValuePair kvp in request) + foreach (KeyValuePair kvp in request) { if (kvp.Key == "METHOD" || kvp.Key == "PrincipalID" || kvp.Key == "RegionID") continue; - info.Data[kvp.Key] = kvp.Value; + info.Data[kvp.Key] = kvp.Value.ToString(); } if (m_PresenceService.Report(info)) diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs index 50e817e064..19bb3e24cf 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs @@ -84,7 +84,7 @@ namespace OpenSim.Services.Connectors public string Authenticate(UUID principalID, string password, int lifetime) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["LIFETIME"] = lifetime.ToString(); sendData["PRINCIPAL"] = principalID.ToString(); sendData["PASSWORD"] = password; @@ -106,7 +106,7 @@ namespace OpenSim.Services.Connectors public bool Verify(UUID principalID, string token, int lifetime) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["LIFETIME"] = lifetime.ToString(); sendData["PRINCIPAL"] = principalID.ToString(); sendData["TOKEN"] = token; @@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors public bool Release(UUID principalID, string token) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["PRINCIPAL"] = principalID.ToString(); sendData["TOKEN"] = token; diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 02f2b79cfb..99aa3fb15c 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -89,7 +89,7 @@ namespace OpenSim.Services.Connectors public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) { Dictionary rinfo = regionInfo.ToKeyValuePairs(); - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); foreach (KeyValuePair kvp in rinfo) sendData[kvp.Key] = (string)kvp.Value; @@ -130,7 +130,7 @@ namespace OpenSim.Services.Connectors public virtual bool DeregisterRegion(UUID regionID) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["REGIONID"] = regionID.ToString(); @@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors public virtual List GetNeighbours(UUID scopeID, UUID regionID) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); @@ -212,7 +212,7 @@ namespace OpenSim.Services.Connectors public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); @@ -258,7 +258,7 @@ namespace OpenSim.Services.Connectors public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["X"] = x.ToString(); @@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["NAME"] = regionName; @@ -344,7 +344,7 @@ namespace OpenSim.Services.Connectors public virtual List GetRegionsByName(UUID scopeID, string name, int maxNumber) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["NAME"] = name; @@ -396,7 +396,7 @@ namespace OpenSim.Services.Connectors public virtual List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) { - Dictionary sendData = new Dictionary(); + Dictionary sendData = new Dictionary(); sendData["SCOPEID"] = scopeID.ToString(); sendData["XMIN"] = xmin.ToString(); 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/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 2134200870..8c4eb3f4e8 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 @@ -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..339d6872c1 100644 --- a/README.txt +++ b/README.txt @@ -13,10 +13,14 @@ If it breaks, you get to keep *both* pieces. == Installation on Windows == Prereqs: - + * runprebuild.bat * Load OpenSim.sln into Visual Studio .NET and build the solution. * chdir bin + * edit OpenSim.ini and appropriate files in bin/config-include * OpenSim.exe + + Helpful resources: +* http://opensimulator.org/wiki/Build_Instructions See configuring OpenSim @@ -31,11 +35,16 @@ From the distribution type: * ./runprebuild.sh * nant * cd bin + * edit OpenSim.ini and appropriate files in bin/config-include * mono ./OpenSim.exe See configuring OpenSim == Configuring OpenSim == + Helpful resources: +* http://opensimulator.org/wiki/Configuration +* http://opensimulator.org/wiki/Configuring_Regions +* http://opensimulator.org/wiki/Mysql-config When OpenSim starts for the first time, you will be prompted with a series of questions that look something like: diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index af9632e4f0..9b9fadd3c0 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 @@ -476,6 +481,7 @@ ; OfflineMessageURL = http://yourserver/Offline.php ; MuteListModule = MuteListModule ; MuteListURL = http://yourserver/Mute.php + ; ForwardOfflineGroupMessages = true [ODEPhysicsSettings]