Merge branch 'presence-refactor' of ssh://opensimulator.org/var/git/opensim into presence-refactor

slimupdates
John Hurliman 2010-02-22 14:10:19 -08:00
commit 71c6559a91
94 changed files with 1068 additions and 14387 deletions

View File

@ -128,6 +128,7 @@ what it is today.
* YZh
* Zackary Geers aka Kunnis Basiat
* Zha Ewry
* ziah
= LSL Devs =

View File

@ -1,155 +0,0 @@
/*
* 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 OpenSim.Framework;
namespace OpenSim.Data
{
/// <summary>
/// A static class containing methods for obtaining handles to database
/// storage objects.
/// </summary>
public static class DataPluginFactory
{
/// <summary>
/// Based on <typeparam name="T" />, returns the appropriate
/// PluginInitialiserBase instance in <paramref name="init" /> and
/// extension point path in <paramref name="path" />.
/// </summary>
/// <param name="connect">
/// The DB connection string used when creating a new
/// PluginInitialiserBase, returned in <paramref name="init" />.
/// </param>
/// <param name="init">
/// A reference to a PluginInitialiserBase object in which the proper
/// initialiser will be returned.
/// </param>
/// <param name="path">
/// A string in which the proper extension point path will be returned.
/// </param>
/// <typeparam name="T">
/// The type of data plugin requested.
/// </typeparam>
/// <exception cref="NotImplementedException">
/// Thrown if <typeparamref name="T" /> is not one of the expected data
/// interfaces.
/// </exception>
private static void PluginLoaderParamFactory<T>(string connect, out PluginInitialiserBase init, out string path) where T : IPlugin
{
Type type = typeof(T);
if (type == typeof(IInventoryDataPlugin))
{
init = new InventoryDataInitialiser(connect);
path = "/OpenSim/InventoryData";
}
else if (type == typeof(IUserDataPlugin))
{
init = new UserDataInitialiser(connect);
path = "/OpenSim/UserData";
}
else if (type == typeof(IGridDataPlugin))
{
init = new GridDataInitialiser(connect);
path = "/OpenSim/GridData";
}
else if (type == typeof(ILogDataPlugin))
{
init = new LogDataInitialiser(connect);
path = "/OpenSim/LogData";
}
else if (type == typeof(IAssetDataPlugin))
{
init = new AssetDataInitialiser(connect);
path = "/OpenSim/AssetData";
}
else
{
// We don't support this data plugin.
throw new NotImplementedException(String.Format("The type '{0}' is not a valid data plugin.", type));
}
}
/// <summary>
/// Returns a list of new <typeparamref name="T" /> data plugins.
/// Plugins will be requested in the order they were added.
/// </summary>
/// <param name="provider">
/// The filename of the inventory server plugin DLL.
/// </param>
/// <param name="connect">
/// The connection string for the storage backend.
/// </param>
/// <typeparam name="T">
/// The type of data plugin requested.
/// </typeparam>
/// <returns>
/// A list of all loaded plugins matching <typeparamref name="T" />.
/// </returns>
public static List<T> LoadDataPlugins<T>(string provider, string connect) where T : IPlugin
{
PluginInitialiserBase pluginInitialiser;
string extensionPointPath;
PluginLoaderParamFactory<T>(connect, out pluginInitialiser, out extensionPointPath);
using (PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser))
{
// loader will try to load all providers (MySQL, MSSQL, etc)
// unless it is constrainted to the correct "Provider" entry in the addin.xml
loader.Add(extensionPointPath, new PluginProviderFilter(provider));
loader.Load();
return loader.Plugins;
}
}
/// <summary>
/// Returns a new <typeparamref name="T" /> data plugin instance if
/// only one was loaded, otherwise returns null (<c>default(T)</c>).
/// </summary>
/// <param name="provider">
/// The filename of the inventory server plugin DLL.
/// </param>
/// <param name="connect">
/// The connection string for the storage backend.
/// </param>
/// <typeparam name="T">
/// The type of data plugin requested.
/// </typeparam>
/// <returns>
/// A list of all loaded plugins matching <typeparamref name="T" />.
/// </returns>
public static T LoadDataPlugin<T>(string provider, string connect) where T : IPlugin
{
List<T> plugins = LoadDataPlugins<T>(provider, connect);
return (plugins.Count == 1) ? plugins[0] : default(T);
}
}
}

View File

@ -1,52 +0,0 @@
/*
* 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.Collections.Generic;
using OpenMetaverse;
namespace OpenSim.Data
{
public abstract class GridDataBase : IGridDataPlugin
{
public abstract RegionProfileData GetProfileByHandle(ulong regionHandle);
public abstract RegionProfileData GetProfileByUUID(UUID UUID);
public abstract RegionProfileData GetProfileByString(string regionName);
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
public abstract DataResponse StoreProfile(RegionProfileData profile);
public abstract ReservationData GetReservationAtPoint(uint x, uint y);
public abstract DataResponse DeleteProfile(string uuid);
public abstract void Initialise();
public abstract void Initialise(string connect);
public abstract void Dispose();
public abstract string Name { get; }
public abstract string Version { get; }
}
}

View File

@ -1,134 +0,0 @@
/*
* 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.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data
{
public enum DataResponse
{
RESPONSE_OK,
RESPONSE_AUTHREQUIRED,
RESPONSE_INVALIDCREDENTIALS,
RESPONSE_ERROR
}
/// <summary>
/// A standard grid interface
/// </summary>
public interface IGridDataPlugin : IPlugin
{
/// <summary>
/// Initialises the interface
/// </summary>
void Initialise(string connect);
/// <summary>
/// Returns a sim profile from a regionHandle
/// </summary>
/// <param name="regionHandle">A 64bit Region Handle</param>
/// <returns>A simprofile</returns>
RegionProfileData GetProfileByHandle(ulong regionHandle);
/// <summary>
/// Returns a sim profile from a UUID
/// </summary>
/// <param name="UUID">A 128bit UUID</param>
/// <returns>A sim profile</returns>
RegionProfileData GetProfileByUUID(UUID UUID);
/// <summary>
/// Returns a sim profile from a string match
/// </summary>
/// <param name="regionName">A string for a partial region name match</param>
/// <returns>A sim profile</returns>
RegionProfileData GetProfileByString(string regionName);
/// <summary>
/// Returns all profiles within the specified range
/// </summary>
/// <param name="Xmin">Minimum sim coordinate (X)</param>
/// <param name="Ymin">Minimum sim coordinate (Y)</param>
/// <param name="Xmax">Maximum sim coordinate (X)</param>
/// <param name="Ymin">Maximum sim coordinate (Y)</param>
/// <returns>An array containing all the sim profiles in the specified range</returns>
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
/// <summary>
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
/// </summary>
/// <param name="name">The name to match against</param>
/// <param name="maxNum">Maximum number of profiles to return</param>
/// <returns>A list of sim profiles</returns>
List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
/// <summary>
/// Authenticates a sim by use of its recv key.
/// WARNING: Insecure
/// </summary>
/// <param name="UUID">The UUID sent by the sim</param>
/// <param name="regionHandle">The regionhandle sent by the sim</param>
/// <param name="simrecvkey">The receiving key sent by the sim</param>
/// <returns>Whether the sim has been authenticated</returns>
bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
/// <summary>
/// Adds or updates a profile in the database
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>RESPONSE_OK if successful, error if not.</returns>
DataResponse StoreProfile(RegionProfileData profile);
/// <summary>
/// Remove a profile from the database
/// </summary>
/// <param name="UUID">ID of profile to remove</param>
/// <returns></returns>
DataResponse DeleteProfile(string UUID);
/// <summary>
/// Function not used????
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
ReservationData GetReservationAtPoint(uint x, uint y);
}
public class GridDataInitialiser : PluginInitialiserBase
{
private string connect;
public GridDataInitialiser (string s) { connect = s; }
public override void Initialise (IPlugin plugin)
{
IGridDataPlugin p = plugin as IGridDataPlugin;
p.Initialise (connect);
}
}
}

View File

@ -1,87 +0,0 @@
/*
* 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 OpenSim.Framework;
namespace OpenSim.Data
{
/// <summary>
/// The severity of an individual log message
/// </summary>
public enum LogSeverity : int
{
/// <summary>
/// Critical: systems failure
/// </summary>
CRITICAL = 1,
/// <summary>
/// Major: warning prior to systems failure
/// </summary>
MAJOR = 2,
/// <summary>
/// Medium: an individual non-critical task failed
/// </summary>
MEDIUM = 3,
/// <summary>
/// Low: Informational warning
/// </summary>
LOW = 4,
/// <summary>
/// Info: Information
/// </summary>
INFO = 5,
/// <summary>
/// Verbose: Debug Information
/// </summary>
VERBOSE = 6
}
/// <summary>
/// An interface to a LogData storage system
/// </summary>
public interface ILogDataPlugin : IPlugin
{
void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
string logMessage);
/// <summary>
/// Initialises the interface
/// </summary>
void Initialise(string connect);
}
public class LogDataInitialiser : PluginInitialiserBase
{
private string connect;
public LogDataInitialiser (string s) { connect = s; }
public override void Initialise (IPlugin plugin)
{
ILogDataPlugin p = plugin as ILogDataPlugin;
p.Initialise (connect);
}
}
}

View File

@ -1,100 +0,0 @@
/*
* 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.Text;
using OpenMetaverse;
namespace OpenSim.Data
{
public interface IRegionProfileService
{
/// <summary>
/// Returns a region by argument
/// </summary>
/// <param name="uuid">A UUID key of the region to return</param>
/// <returns>A SimProfileData for the region</returns>
RegionProfileData GetRegion(UUID uuid);
/// <summary>
/// Returns a region by argument
/// </summary>
/// <param name="uuid">A regionHandle of the region to return</param>
/// <returns>A SimProfileData for the region</returns>
RegionProfileData GetRegion(ulong handle);
/// <summary>
/// Returns a region by argument
/// </summary>
/// <param name="regionName">A partial regionName of the region to return</param>
/// <returns>A SimProfileData for the region</returns>
RegionProfileData GetRegion(string regionName);
List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax);
List<RegionProfileData> GetRegions(string name, int maxNum);
DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim);
DataResponse DeleteRegion(string uuid);
}
public interface IRegionProfileRouter
{
/// <summary>
/// Request sim profile information from a grid server, by Region UUID
/// </summary>
/// <param name="regionId">The region UUID to look for</param>
/// <param name="gridserverUrl"></param>
/// <param name="gridserverSendkey"></param>
/// <param name="gridserverRecvkey"></param>
/// <returns>The sim profile. Null if there was a request failure</returns>
/// <remarks>This method should be statics</remarks>
RegionProfileData RequestSimProfileData(UUID regionId, Uri gridserverUrl,
string gridserverSendkey, string gridserverRecvkey);
/// <summary>
/// Request sim profile information from a grid server, by Region Handle
/// </summary>
/// <param name="regionHandle">the region handle to look for</param>
/// <param name="gridserverUrl"></param>
/// <param name="gridserverSendkey"></param>
/// <param name="gridserverRecvkey"></param>
/// <returns>The sim profile. Null if there was a request failure</returns>
RegionProfileData RequestSimProfileData(ulong regionHandle, Uri gridserverUrl,
string gridserverSendkey, string gridserverRecvkey);
/// <summary>
/// Request sim profile information from a grid server, by Region Name
/// </summary>
/// <param name="regionName">the region name to look for</param>
/// <param name="gridserverUrl"></param>
/// <param name="gridserverSendkey"></param>
/// <param name="gridserverRecvkey"></param>
/// <returns>The sim profile. Null if there was a request failure</returns>
RegionProfileData RequestSimProfileData(string regionName, Uri gridserverUrl,
string gridserverSendkey, string gridserverRecvkey);
}
}

View File

@ -1,209 +0,0 @@
/*
* 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 OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data
{
/// <summary>
/// An interface for connecting to user storage servers.
/// </summary>
public interface IUserDataPlugin : IPlugin
{
/// <summary>
/// Returns a user profile from a database via their UUID
/// </summary>
/// <param name="user">The user's UUID</param>
/// <returns>The user data profile. Returns null if no user is found</returns>
UserProfileData GetUserByUUID(UUID user);
/// <summary>
/// Returns a users profile by searching their username parts
/// </summary>
/// <param name="fname">Account firstname</param>
/// <param name="lname">Account lastname</param>
/// <returns>The user data profile. Null if no user is found</returns>
UserProfileData GetUserByName(string fname, string lname);
/// <summary>
/// Get a user from a given uri.
/// </summary>
/// <param name="uri"></param>
/// <returns>The user data profile. Null if no user is found.</returns>
UserProfileData GetUserByUri(Uri uri);
/// <summary>
/// Returns a list of UUIDs firstnames and lastnames that match string query entered into the avatar picker.
/// </summary>
/// <param name="queryID">ID associated with the user's query. This must match what the client sent</param>
/// <param name="query">The filtered contents of the search box when the user hit search.</param>
/// <returns>A list of user details. If there are no results than either an empty list or null</returns>
List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query);
/// <summary>
/// Returns the current agent for a user searching by it's UUID
/// </summary>
/// <param name="user">The users UUID</param>
/// <returns>The current agent session. Null if no session was found</returns>
UserAgentData GetAgentByUUID(UUID user);
/// <summary>
/// Returns the current session agent for a user searching by username
/// </summary>
/// <param name="name">The users account name</param>
/// <returns>The current agent session</returns>
UserAgentData GetAgentByName(string name);
/// <summary>
/// Returns the current session agent for a user searching by username parts
/// </summary>
/// <param name="fname">The users first account name</param>
/// <param name="lname">The users account surname</param>
/// <returns>The current agent session</returns>
UserAgentData GetAgentByName(string fname, string lname);
/// <summary>
/// Stores new web-login key for user during web page login
/// </summary>
/// <param name="webLoginKey"></param>
void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
/// <summary>
/// Adds a new User profile to the database
/// </summary>
/// <param name="user">UserProfile to add</param>
void AddNewUserProfile(UserProfileData user);
/// <summary>
/// Adds a temporary user profile. A temporary userprofile is one that should exist only for the lifetime of
/// the process.
/// </summary>
/// <param name="userProfile"></param>
void AddTemporaryUserProfile(UserProfileData userProfile);
/// <summary>
/// Updates an existing user profile
/// </summary>
/// <param name="user">UserProfile to update</param>
bool UpdateUserProfile(UserProfileData user);
/// <summary>
/// Adds a new agent to the database
/// </summary>
/// <param name="agent">The agent to add</param>
void AddNewUserAgent(UserAgentData agent);
/// <summary>
/// Adds a new friend to the database for XUser
/// </summary>
/// <param name="friendlistowner">The agent that who's friends list is being added to</param>
/// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
/// <summary>
/// Delete friend on friendlistowner's friendlist.
/// </summary>
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
/// <param name="friend">The Ex-friend agent</param>
void RemoveUserFriend(UUID friendlistowner, UUID friend);
/// <summary>
/// Update permissions for friend on friendlistowner's friendlist.
/// </summary>
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
/// <param name="friend">The agent that is getting or loosing permissions</param>
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
/// <summary>
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
/// </summary>
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
/// <returns>The user's friends. If there are no results than either an empty list or null</returns>
List<FriendListItem> GetUserFriendList(UUID friendlistowner);
/// <summary>
/// Returns a list of <see cref="FriendRegionInfo/>s for the specified UUIDs.
/// </summary>
/// <param name="uuids">
/// A <see cref="List"/> of <see cref="UUID/>s to fetch info for
/// </param>
/// <returns>
/// A <see cref="Dictionary"/>, mapping the <see cref="UUID"/>s to <see cref="FriendRegionInfo"/>s.
/// </returns>
Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids);
/// <summary>
/// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
/// </summary>
/// <param name="from">The account to transfer from</param>
/// <param name="to">The account to transfer to</param>
/// <param name="amount">The amount to transfer</param>
/// <returns>Successful?</returns>
bool MoneyTransferRequest(UUID from, UUID to, uint amount);
/// <summary>
/// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
/// </summary>
/// <param name="from">User to transfer from</param>
/// <param name="to">User to transfer to</param>
/// <param name="inventory">Specified inventory item</param>
/// <returns>Successful?</returns>
bool InventoryTransferRequest(UUID from, UUID to, UUID inventory);
/// <summary>
/// Initialises the plugin (artificial constructor)
/// </summary>
void Initialise(string connect);
/// <summary>
/// Gets the user appearance
/// </summer>
AvatarAppearance GetUserAppearance(UUID user);
void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
void ResetAttachments(UUID userID);
void LogoutUsers(UUID regionID);
}
public class UserDataInitialiser : PluginInitialiserBase
{
private string connect;
public UserDataInitialiser (string s) { connect = s; }
public override void Initialise (IPlugin plugin)
{
IUserDataPlugin p = plugin as IUserDataPlugin;
p.Initialise (connect);
}
}
}

View File

@ -1,587 +0,0 @@
/*
* 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.Data.SqlClient;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MSSQL
{
/// <summary>
/// A grid data interface for MSSQL Server
/// </summary>
public class MSSQLGridData : GridDataBase
{
private const string _migrationStore = "GridStore";
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Database manager
/// </summary>
private MSSQLManager database;
private string m_regionsTableName = "regions";
#region IPlugin Members
// [Obsolete("Cannot be default-initialized!")]
override public void Initialise()
{
m_log.Info("[GRID DB]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException(Name);
}
/// <summary>
/// Initialises the Grid Interface
/// </summary>
/// <param name="connectionString">connect string</param>
/// <remarks>use mssql_connection.ini</remarks>
override public void Initialise(string connectionString)
{
if (!string.IsNullOrEmpty(connectionString))
{
database = new MSSQLManager(connectionString);
}
else
{
// TODO: make the connect string actually do something
IniFile iniFile = new IniFile("mssql_connection.ini");
string settingDataSource = iniFile.ParseFileReadValue("data_source");
string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
string settingUserId = iniFile.ParseFileReadValue("user_id");
string settingPassword = iniFile.ParseFileReadValue("password");
m_regionsTableName = iniFile.ParseFileReadValue("regionstablename");
if (m_regionsTableName == null)
{
m_regionsTableName = "regions";
}
database =
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
settingPassword);
}
//New migrations check of store
database.CheckMigration(_migrationStore);
}
/// <summary>
/// Shuts down the grid interface
/// </summary>
override public void Dispose()
{
database = null;
}
/// <summary>
/// The name of this DB provider.
/// </summary>
/// <returns>A string containing the storage system name</returns>
override public string Name
{
get { return "MSSQL OpenGridData"; }
}
/// <summary>
/// Database provider version.
/// </summary>
/// <returns>A string containing the storage system version</returns>
override public string Version
{
get { return "0.1"; }
}
#endregion
#region Public override GridDataBase methods
/// <summary>
/// Returns a list of regions within the specified ranges
/// </summary>
/// <param name="xmin">minimum X coordinate</param>
/// <param name="ymin">minimum Y coordinate</param>
/// <param name="xmax">maximum X coordinate</param>
/// <param name="ymax">maximum Y coordinate</param>
/// <returns>null</returns>
/// <remarks>always return null</remarks>
override public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
{
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM regions WHERE locX >= @xmin AND locX <= @xmax AND locY >= @ymin AND locY <= @ymax"))
{
command.Parameters.Add(database.CreateParameter("xmin", xmin));
command.Parameters.Add(database.CreateParameter("ymin", ymin));
command.Parameters.Add(database.CreateParameter("xmax", xmax));
command.Parameters.Add(database.CreateParameter("ymax", ymax));
List<RegionProfileData> rows = new List<RegionProfileData>();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
rows.Add(ReadSimRow(reader));
}
}
if (rows.Count > 0)
{
return rows.ToArray();
}
}
m_log.Info("[GRID DB] : Found no regions within range.");
return null;
}
/// <summary>
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
/// </summary>
/// <param name="namePrefix">The name to match against</param>
/// <param name="maxNum">Maximum number of profiles to return</param>
/// <returns>A list of sim profiles</returns>
override public List<RegionProfileData> GetRegionsByName (string namePrefix, uint maxNum)
{
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM regions WHERE regionName LIKE @name"))
{
command.Parameters.Add(database.CreateParameter("name", namePrefix + "%"));
List<RegionProfileData> rows = new List<RegionProfileData>();
using (SqlDataReader reader = command.ExecuteReader())
{
while (rows.Count < maxNum && reader.Read())
{
rows.Add(ReadSimRow(reader));
}
}
return rows;
}
}
/// <summary>
/// Returns a sim profile from its location
/// </summary>
/// <param name="handle">Region location handle</param>
/// <returns>Sim profile</returns>
override public RegionProfileData GetProfileByHandle(ulong handle)
{
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE regionHandle = @handle"))
{
command.Parameters.Add(database.CreateParameter("handle", handle));
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
return ReadSimRow(reader);
}
}
}
m_log.InfoFormat("[GRID DB] : No region found with handle : {0}", handle);
return null;
}
/// <summary>
/// Returns a sim profile from its UUID
/// </summary>
/// <param name="uuid">The region UUID</param>
/// <returns>The sim profile</returns>
override public RegionProfileData GetProfileByUUID(UUID uuid)
{
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE uuid = @uuid"))
{
command.Parameters.Add(database.CreateParameter("uuid", uuid));
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
return ReadSimRow(reader);
}
}
}
m_log.InfoFormat("[GRID DB] : No region found with UUID : {0}", uuid);
return null;
}
/// <summary>
/// Returns a sim profile from it's Region name string
/// </summary>
/// <param name="regionName">The region name search query</param>
/// <returns>The sim profile</returns>
override public RegionProfileData GetProfileByString(string regionName)
{
if (regionName.Length > 2)
{
using (AutoClosingSqlCommand command = database.Query("SELECT top 1 * FROM " + m_regionsTableName + " WHERE regionName like @regionName order by regionName"))
{
command.Parameters.Add(database.CreateParameter("regionName", regionName + "%"));
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
return ReadSimRow(reader);
}
}
}
m_log.InfoFormat("[GRID DB] : No region found with regionName : {0}", regionName);
return null;
}
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
return null;
}
/// <summary>
/// Adds a new specified region to the database
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>A dataresponse enum indicating success</returns>
override public DataResponse StoreProfile(RegionProfileData profile)
{
if (GetProfileByUUID(profile.UUID) == null)
{
if (InsertRegionRow(profile))
{
return DataResponse.RESPONSE_OK;
}
}
else
{
if (UpdateRegionRow(profile))
{
return DataResponse.RESPONSE_OK;
}
}
return DataResponse.RESPONSE_ERROR;
}
/// <summary>
/// Deletes a sim profile from the database
/// </summary>
/// <param name="uuid">the sim UUID</param>
/// <returns>Successful?</returns>
//public DataResponse DeleteProfile(RegionProfileData profile)
override public DataResponse DeleteProfile(string uuid)
{
using (AutoClosingSqlCommand command = database.Query("DELETE FROM regions WHERE uuid = @uuid;"))
{
command.Parameters.Add(database.CreateParameter("uuid", uuid));
try
{
command.ExecuteNonQuery();
return DataResponse.RESPONSE_OK;
}
catch (Exception e)
{
m_log.DebugFormat("[GRID DB] : Error deleting region info, error is : {0}", e.Message);
return DataResponse.RESPONSE_ERROR;
}
}
}
#endregion
#region Methods that are not used or deprecated (still needed because of base class)
/// <summary>
/// DEPRECATED. Attempts to authenticate a region by comparing a shared secret.
/// </summary>
/// <param name="uuid">The UUID of the challenger</param>
/// <param name="handle">The attempted regionHandle of the challenger</param>
/// <param name="authkey">The secret</param>
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
override public bool AuthenticateSim(UUID uuid, ulong handle, string authkey)
{
bool throwHissyFit = false; // Should be true by 1.0
if (throwHissyFit)
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
RegionProfileData data = GetProfileByUUID(uuid);
return (handle == data.regionHandle && authkey == data.regionSecret);
}
/// <summary>
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
/// </summary>
/// <remarks>This requires a security audit.</remarks>
/// <param name="uuid"></param>
/// <param name="handle"></param>
/// <param name="authhash"></param>
/// <param name="challenge"></param>
/// <returns></returns>
public bool AuthenticateSim(UUID uuid, ulong handle, string authhash, string challenge)
{
// SHA512Managed HashProvider = new SHA512Managed();
// Encoding TextProvider = new UTF8Encoding();
// byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
// byte[] hash = HashProvider.ComputeHash(stream);
return false;
}
/// <summary>
/// NOT IMPLEMENTED
/// WHEN IS THIS GONNA BE IMPLEMENTED.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns>null</returns>
override public ReservationData GetReservationAtPoint(uint x, uint y)
{
return null;
}
#endregion
#region private methods
/// <summary>
/// Reads a region row from a database reader
/// </summary>
/// <param name="reader">An active database reader</param>
/// <returns>A region profile</returns>
private static RegionProfileData ReadSimRow(IDataRecord reader)
{
RegionProfileData retval = new RegionProfileData();
// Region Main gotta-have-or-we-return-null parts
UInt64 tmp64;
if (!UInt64.TryParse(reader["regionHandle"].ToString(), out tmp64))
{
return null;
}
retval.regionHandle = tmp64;
// UUID tmp_uuid;
// if (!UUID.TryParse((string)reader["uuid"], out tmp_uuid))
// {
// return null;
// }
retval.UUID = new UUID((Guid)reader["uuid"]); // tmp_uuid;
// non-critical parts
retval.regionName = reader["regionName"].ToString();
retval.originUUID = new UUID((Guid)reader["originUUID"]);
// Secrets
retval.regionRecvKey = reader["regionRecvKey"].ToString();
retval.regionSecret = reader["regionSecret"].ToString();
retval.regionSendKey = reader["regionSendKey"].ToString();
// Region Server
retval.regionDataURI = reader["regionDataURI"].ToString();
retval.regionOnline = false; // Needs to be pinged before this can be set.
retval.serverIP = reader["serverIP"].ToString();
retval.serverPort = Convert.ToUInt32(reader["serverPort"]);
retval.serverURI = reader["serverURI"].ToString();
retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString());
retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString());
// Location
retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString());
retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString());
retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString());
// Neighbours - 0 = No Override
retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString());
retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString());
retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString());
retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
// Assets
retval.regionAssetURI = reader["regionAssetURI"].ToString();
retval.regionAssetRecvKey = reader["regionAssetRecvKey"].ToString();
retval.regionAssetSendKey = reader["regionAssetSendKey"].ToString();
// Userserver
retval.regionUserURI = reader["regionUserURI"].ToString();
retval.regionUserRecvKey = reader["regionUserRecvKey"].ToString();
retval.regionUserSendKey = reader["regionUserSendKey"].ToString();
// World Map Addition
retval.regionMapTextureID = new UUID((Guid)reader["regionMapTexture"]);
retval.owner_uuid = new UUID((Guid)reader["owner_uuid"]);
retval.maturity = Convert.ToUInt32(reader["access"]);
return retval;
}
/// <summary>
/// Update the specified region in the database
/// </summary>
/// <param name="profile">The profile to update</param>
/// <returns>success ?</returns>
private bool UpdateRegionRow(RegionProfileData profile)
{
bool returnval = false;
//Insert new region
string sql =
"UPDATE " + m_regionsTableName + @" SET
[regionHandle]=@regionHandle, [regionName]=@regionName,
[regionRecvKey]=@regionRecvKey, [regionSecret]=@regionSecret, [regionSendKey]=@regionSendKey,
[regionDataURI]=@regionDataURI, [serverIP]=@serverIP, [serverPort]=@serverPort, [serverURI]=@serverURI,
[locX]=@locX, [locY]=@locY, [locZ]=@locZ, [eastOverrideHandle]=@eastOverrideHandle,
[westOverrideHandle]=@westOverrideHandle, [southOverrideHandle]=@southOverrideHandle,
[northOverrideHandle]=@northOverrideHandle, [regionAssetURI]=@regionAssetURI,
[regionAssetRecvKey]=@regionAssetRecvKey, [regionAssetSendKey]=@regionAssetSendKey,
[regionUserURI]=@regionUserURI, [regionUserRecvKey]=@regionUserRecvKey, [regionUserSendKey]=@regionUserSendKey,
[regionMapTexture]=@regionMapTexture, [serverHttpPort]=@serverHttpPort,
[serverRemotingPort]=@serverRemotingPort, [owner_uuid]=@owner_uuid , [originUUID]=@originUUID
where [uuid]=@uuid";
using (AutoClosingSqlCommand command = database.Query(sql))
{
command.Parameters.Add(database.CreateParameter("regionHandle", profile.regionHandle));
command.Parameters.Add(database.CreateParameter("regionName", profile.regionName));
command.Parameters.Add(database.CreateParameter("uuid", profile.UUID));
command.Parameters.Add(database.CreateParameter("regionRecvKey", profile.regionRecvKey));
command.Parameters.Add(database.CreateParameter("regionSecret", profile.regionSecret));
command.Parameters.Add(database.CreateParameter("regionSendKey", profile.regionSendKey));
command.Parameters.Add(database.CreateParameter("regionDataURI", profile.regionDataURI));
command.Parameters.Add(database.CreateParameter("serverIP", profile.serverIP));
command.Parameters.Add(database.CreateParameter("serverPort", profile.serverPort));
command.Parameters.Add(database.CreateParameter("serverURI", profile.serverURI));
command.Parameters.Add(database.CreateParameter("locX", profile.regionLocX));
command.Parameters.Add(database.CreateParameter("locY", profile.regionLocY));
command.Parameters.Add(database.CreateParameter("locZ", profile.regionLocZ));
command.Parameters.Add(database.CreateParameter("eastOverrideHandle", profile.regionEastOverrideHandle));
command.Parameters.Add(database.CreateParameter("westOverrideHandle", profile.regionWestOverrideHandle));
command.Parameters.Add(database.CreateParameter("northOverrideHandle", profile.regionNorthOverrideHandle));
command.Parameters.Add(database.CreateParameter("southOverrideHandle", profile.regionSouthOverrideHandle));
command.Parameters.Add(database.CreateParameter("regionAssetURI", profile.regionAssetURI));
command.Parameters.Add(database.CreateParameter("regionAssetRecvKey", profile.regionAssetRecvKey));
command.Parameters.Add(database.CreateParameter("regionAssetSendKey", profile.regionAssetSendKey));
command.Parameters.Add(database.CreateParameter("regionUserURI", profile.regionUserURI));
command.Parameters.Add(database.CreateParameter("regionUserRecvKey", profile.regionUserRecvKey));
command.Parameters.Add(database.CreateParameter("regionUserSendKey", profile.regionUserSendKey));
command.Parameters.Add(database.CreateParameter("regionMapTexture", profile.regionMapTextureID));
command.Parameters.Add(database.CreateParameter("serverHttpPort", profile.httpPort));
command.Parameters.Add(database.CreateParameter("serverRemotingPort", profile.remotingPort));
command.Parameters.Add(database.CreateParameter("owner_uuid", profile.owner_uuid));
command.Parameters.Add(database.CreateParameter("originUUID", profile.originUUID));
try
{
command.ExecuteNonQuery();
returnval = true;
}
catch (Exception e)
{
m_log.Error("[GRID DB] : Error updating region, error: " + e.Message);
}
}
return returnval;
}
/// <summary>
/// Creates a new region in the database
/// </summary>
/// <param name="profile">The region profile to insert</param>
/// <returns>Successful?</returns>
private bool InsertRegionRow(RegionProfileData profile)
{
bool returnval = false;
//Insert new region
string sql =
"INSERT INTO " + m_regionsTableName + @" ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI],
[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle],
[southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], [regionAssetSendKey],
[regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort],
[serverRemotingPort], [owner_uuid], [originUUID], [access])
VALUES (@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI,
@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle,
@southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, @regionAssetSendKey,
@regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort, @owner_uuid, @originUUID, @access);";
using (AutoClosingSqlCommand command = database.Query(sql))
{
command.Parameters.Add(database.CreateParameter("regionHandle", profile.regionHandle));
command.Parameters.Add(database.CreateParameter("regionName", profile.regionName));
command.Parameters.Add(database.CreateParameter("uuid", profile.UUID));
command.Parameters.Add(database.CreateParameter("regionRecvKey", profile.regionRecvKey));
command.Parameters.Add(database.CreateParameter("regionSecret", profile.regionSecret));
command.Parameters.Add(database.CreateParameter("regionSendKey", profile.regionSendKey));
command.Parameters.Add(database.CreateParameter("regionDataURI", profile.regionDataURI));
command.Parameters.Add(database.CreateParameter("serverIP", profile.serverIP));
command.Parameters.Add(database.CreateParameter("serverPort", profile.serverPort));
command.Parameters.Add(database.CreateParameter("serverURI", profile.serverURI));
command.Parameters.Add(database.CreateParameter("locX", profile.regionLocX));
command.Parameters.Add(database.CreateParameter("locY", profile.regionLocY));
command.Parameters.Add(database.CreateParameter("locZ", profile.regionLocZ));
command.Parameters.Add(database.CreateParameter("eastOverrideHandle", profile.regionEastOverrideHandle));
command.Parameters.Add(database.CreateParameter("westOverrideHandle", profile.regionWestOverrideHandle));
command.Parameters.Add(database.CreateParameter("northOverrideHandle", profile.regionNorthOverrideHandle));
command.Parameters.Add(database.CreateParameter("southOverrideHandle", profile.regionSouthOverrideHandle));
command.Parameters.Add(database.CreateParameter("regionAssetURI", profile.regionAssetURI));
command.Parameters.Add(database.CreateParameter("regionAssetRecvKey", profile.regionAssetRecvKey));
command.Parameters.Add(database.CreateParameter("regionAssetSendKey", profile.regionAssetSendKey));
command.Parameters.Add(database.CreateParameter("regionUserURI", profile.regionUserURI));
command.Parameters.Add(database.CreateParameter("regionUserRecvKey", profile.regionUserRecvKey));
command.Parameters.Add(database.CreateParameter("regionUserSendKey", profile.regionUserSendKey));
command.Parameters.Add(database.CreateParameter("regionMapTexture", profile.regionMapTextureID));
command.Parameters.Add(database.CreateParameter("serverHttpPort", profile.httpPort));
command.Parameters.Add(database.CreateParameter("serverRemotingPort", profile.remotingPort));
command.Parameters.Add(database.CreateParameter("owner_uuid", profile.owner_uuid));
command.Parameters.Add(database.CreateParameter("originUUID", profile.originUUID));
command.Parameters.Add(database.CreateParameter("access", profile.maturity));
try
{
command.ExecuteNonQuery();
returnval = true;
}
catch (Exception e)
{
m_log.Error("[GRID DB] : Error inserting region, error: " + e.Message);
}
}
return returnval;
}
#endregion
}
}

View File

@ -1,146 +0,0 @@
/*
* 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 log4net;
using OpenSim.Framework;
namespace OpenSim.Data.MSSQL
{
/// <summary>
/// An interface to the log database for MSSQL
/// </summary>
internal class MSSQLLogData : ILogDataPlugin
{
private const string _migrationStore = "LogStore";
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// The database manager
/// </summary>
public MSSQLManager database;
[Obsolete("Cannot be default-initialized!")]
public void Initialise()
{
m_log.Info("[LOG DB]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name);
}
/// <summary>
/// Artificial constructor called when the plugin is loaded
/// </summary>
public void Initialise(string connect)
{
if (!string.IsNullOrEmpty(connect))
{
database = new MSSQLManager(connect);
}
else
{
// TODO: do something with the connect string
IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini");
string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source");
string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog");
string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info");
string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id");
string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password");
database =
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
settingPassword);
}
//Updating mechanisme
database.CheckMigration(_migrationStore);
}
/// <summary>
/// Saves a log item to the database
/// </summary>
/// <param name="serverDaemon">The daemon triggering the event</param>
/// <param name="target">The target of the action (region / agent UUID, etc)</param>
/// <param name="methodCall">The method call where the problem occured</param>
/// <param name="arguments">The arguments passed to the method</param>
/// <param name="priority">How critical is this?</param>
/// <param name="logMessage">The message to log</param>
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
string logMessage)
{
string sql = "INSERT INTO logs ([target], [server], [method], [arguments], [priority], [message]) VALUES ";
sql += "(@target, @server, @method, @arguments, @priority, @message);";
using (AutoClosingSqlCommand command = database.Query(sql))
{
command.Parameters.Add(database.CreateParameter("server", serverDaemon));
command.Parameters.Add(database.CreateParameter("target",target));
command.Parameters.Add(database.CreateParameter("method", methodCall));
command.Parameters.Add(database.CreateParameter("arguments", arguments));
command.Parameters.Add(database.CreateParameter("priority", priority.ToString()));
command.Parameters.Add(database.CreateParameter("message", logMessage));
try
{
command.ExecuteNonQuery();
}
catch (Exception e)
{
//Are we not in a loop here
m_log.Error("[LOG DB] Error logging : " + e.Message);
}
}
}
/// <summary>
/// Returns the name of this DB provider
/// </summary>
/// <returns>A string containing the DB provider name</returns>
public string Name
{
get { return "MSSQL Logdata Interface"; }
}
/// <summary>
/// Closes the database provider
/// </summary>
public void Dispose()
{
database = null;
}
/// <summary>
/// Returns the version of this DB provider
/// </summary>
/// <returns>A string containing the provider version</returns>
public string Version
{
get { return "0.1"; }
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,422 +0,0 @@
/*
* 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 System.Threading;
using log4net;
using MySql.Data.MySqlClient;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MySQL
{
/// <summary>
/// A MySQL Interface for the Grid Server
/// </summary>
public class MySQLGridData : GridDataBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private MySQLManager m_database;
private object m_dbLock = new object();
private string m_connectionString;
override public void Initialise()
{
m_log.Info("[MySQLGridData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name);
}
/// <summary>
/// <para>Initialises Grid interface</para>
/// <para>
/// <list type="bullet">
/// <item>Loads and initialises the MySQL storage plugin</item>
/// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
/// <item>Check for migration</item>
/// </list>
/// </para>
/// </summary>
/// <param name="connect">connect string.</param>
override public void Initialise(string connect)
{
m_connectionString = connect;
m_database = new MySQLManager(connect);
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
Migration m = new Migration(dbcon, assem, "GridStore");
m.Update();
}
}
/// <summary>
/// Shuts down the grid interface
/// </summary>
override public void Dispose()
{
}
/// <summary>
/// Returns the plugin name
/// </summary>
/// <returns>Plugin name</returns>
override public string Name
{
get { return "MySql OpenGridData"; }
}
/// <summary>
/// Returns the plugin version
/// </summary>
/// <returns>Plugin version</returns>
override public string Version
{
get { return "0.1"; }
}
/// <summary>
/// Returns all the specified region profiles within coordates -- coordinates are inclusive
/// </summary>
/// <param name="xmin">Minimum X coordinate</param>
/// <param name="ymin">Minimum Y coordinate</param>
/// <param name="xmax">Maximum X coordinate</param>
/// <param name="ymax">Maximum Y coordinate</param>
/// <returns>Array of sim profiles</returns>
override public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?xmin"] = xmin.ToString();
param["?ymin"] = ymin.ToString();
param["?xmax"] = xmax.ToString();
param["?ymax"] = ymax.ToString();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon,
"SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
param))
{
using (IDataReader reader = result.ExecuteReader())
{
RegionProfileData row;
List<RegionProfileData> rows = new List<RegionProfileData>();
while ((row = m_database.readSimRow(reader)) != null)
rows.Add(row);
return rows.ToArray();
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
/// </summary>
/// <param name="name">The name to match against</param>
/// <param name="maxNum">Maximum number of profiles to return</param>
/// <returns>A list of sim profiles</returns>
override public List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?name"] = namePrefix + "%";
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon,
"SELECT * FROM regions WHERE regionName LIKE ?name",
param))
{
using (IDataReader reader = result.ExecuteReader())
{
RegionProfileData row;
List<RegionProfileData> rows = new List<RegionProfileData>();
while (rows.Count < maxNum && (row = m_database.readSimRow(reader)) != null)
rows.Add(row);
return rows;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Returns a sim profile from it's location
/// </summary>
/// <param name="handle">Region location handle</param>
/// <returns>Sim profile</returns>
override public RegionProfileData GetProfileByHandle(ulong handle)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?handle"] = handle.ToString();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon, "SELECT * FROM regions WHERE regionHandle = ?handle", param))
{
using (IDataReader reader = result.ExecuteReader())
{
RegionProfileData row = m_database.readSimRow(reader);
return row;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Returns a sim profile from it's UUID
/// </summary>
/// <param name="uuid">The region UUID</param>
/// <returns>The sim profile</returns>
override public RegionProfileData GetProfileByUUID(UUID uuid)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon, "SELECT * FROM regions WHERE uuid = ?uuid", param))
{
using (IDataReader reader = result.ExecuteReader())
{
RegionProfileData row = m_database.readSimRow(reader);
return row;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Returns a sim profile from it's Region name string
/// </summary>
/// <returns>The sim profile</returns>
override public RegionProfileData GetProfileByString(string regionName)
{
if (regionName.Length > 2)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
// Add % because this is a like query.
param["?regionName"] = regionName + "%";
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
// Order by statement will return shorter matches first. Only returns one record or no record.
using (IDbCommand result = m_database.Query(dbcon,
"SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1",
param))
{
using (IDataReader reader = result.ExecuteReader())
{
RegionProfileData row = m_database.readSimRow(reader);
return row;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
return null;
}
/// <summary>
/// Adds a new profile to the database
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>Successful?</returns>
override public DataResponse StoreProfile(RegionProfileData profile)
{
try
{
if (m_database.insertRegion(profile))
return DataResponse.RESPONSE_OK;
else
return DataResponse.RESPONSE_ERROR;
}
catch
{
return DataResponse.RESPONSE_ERROR;
}
}
/// <summary>
/// Deletes a sim profile from the database
/// </summary>
/// <param name="uuid">the sim UUID</param>
/// <returns>Successful?</returns>
//public DataResponse DeleteProfile(RegionProfileData profile)
override public DataResponse DeleteProfile(string uuid)
{
try
{
if (m_database.deleteRegion(uuid))
return DataResponse.RESPONSE_OK;
else
return DataResponse.RESPONSE_ERROR;
}
catch
{
return DataResponse.RESPONSE_ERROR;
}
}
/// <summary>
/// DEPRECATED. Attempts to authenticate a region by comparing a shared secret.
/// </summary>
/// <param name="uuid">The UUID of the challenger</param>
/// <param name="handle">The attempted regionHandle of the challenger</param>
/// <param name="authkey">The secret</param>
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
override public bool AuthenticateSim(UUID uuid, ulong handle, string authkey)
{
bool throwHissyFit = false; // Should be true by 1.0
if (throwHissyFit)
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
RegionProfileData data = GetProfileByUUID(uuid);
return (handle == data.regionHandle && authkey == data.regionSecret);
}
/// <summary>
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
/// </summary>
/// <remarks>This requires a security audit.</remarks>
/// <param name="uuid"></param>
/// <param name="handle"></param>
/// <param name="authhash"></param>
/// <param name="challenge"></param>
/// <returns></returns>
public bool AuthenticateSim(UUID uuid, ulong handle, string authhash, string challenge)
{
// SHA512Managed HashProvider = new SHA512Managed();
// Encoding TextProvider = new UTF8Encoding();
// byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
// byte[] hash = HashProvider.ComputeHash(stream);
return false;
}
/// <summary>
/// Adds a location reservation
/// </summary>
/// <param name="x">x coordinate</param>
/// <param name="y">y coordinate</param>
/// <returns></returns>
override public ReservationData GetReservationAtPoint(uint x, uint y)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?x"] = x.ToString();
param["?y"] = y.ToString();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon,
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
param))
{
using (IDataReader reader = result.ExecuteReader())
{
ReservationData row = m_database.readReservationRow(reader);
return row;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
}
}

View File

@ -1,166 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenSim.Framework;
namespace OpenSim.Data.MySQL
{
/// <summary>
/// An interface to the log database for MySQL
/// </summary>
internal class MySQLLogData : ILogDataPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// The database manager
/// </summary>
public MySQLManager database;
public void Initialise()
{
m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name);
}
/// <summary>
/// Artificial constructor called when the plugin is loaded
/// Uses the obsolete mysql_connection.ini if connect string is empty.
/// </summary>
/// <param name="connect">connect string</param>
public void Initialise(string connect)
{
if (connect != String.Empty)
{
database = new MySQLManager(connect);
}
else
{
m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword,
settingPooling, settingPort);
}
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
using (MySql.Data.MySqlClient.MySqlConnection dbcon = new MySql.Data.MySqlClient.MySqlConnection(connect))
{
dbcon.Open();
Migration m = new Migration(dbcon, assem, "LogStore");
// TODO: After rev 6000, remove this. People should have
// been rolled onto the new migration code by then.
TestTables(m);
m.Update();
}
}
/// <summary></summary>
/// <param name="m"></param>
private void TestTables(Migration m)
{
// under migrations, bail
if (m.Version > 0)
return;
Dictionary<string, string> tableList = new Dictionary<string, string>();
tableList["logs"] = null;
database.GetTableVersion(tableList);
// migrations will handle it
if (tableList["logs"] == null)
return;
// we have the table, so pretend like we did the first migration in the past
if (m.Version == 0)
m.Version = 1;
}
/// <summary>
/// Saves a log item to the database
/// </summary>
/// <param name="serverDaemon">The daemon triggering the event</param>
/// <param name="target">The target of the action (region / agent UUID, etc)</param>
/// <param name="methodCall">The method call where the problem occured</param>
/// <param name="arguments">The arguments passed to the method</param>
/// <param name="priority">How critical is this?</param>
/// <param name="logMessage">The message to log</param>
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
string logMessage)
{
try
{
database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage);
}
catch
{
}
}
/// <summary>
/// Returns the name of this DB provider
/// </summary>
/// <returns>A string containing the DB provider name</returns>
public string Name
{
get { return "MySQL Logdata Interface";}
}
/// <summary>
/// Closes the database provider
/// </summary>
/// <remarks>do nothing</remarks>
public void Dispose()
{
// Do nothing.
}
/// <summary>
/// Returns the version of this DB provider
/// </summary>
/// <returns>A string containing the provider version</returns>
public string Version
{
get { return "0.1"; }
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,52 +0,0 @@
/*
* 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.Threading;
namespace OpenSim.Data.MySQL
{
public class MySQLSuperManager
{
public bool Locked;
private readonly Mutex m_lock = new Mutex(false);
public MySQLManager Manager;
public string Running;
public void GetLock()
{
Locked = true;
m_lock.WaitOne();
}
public void Release()
{
m_lock.ReleaseMutex();
Locked = false;
}
}
}

View File

@ -1,766 +0,0 @@
/*
* 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 System.Reflection;
using System.Text.RegularExpressions;
using System.Threading;
using log4net;
using MySql.Data.MySqlClient;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MySQL
{
/// <summary>
/// A database interface class to a user profile storage system
/// </summary>
public class MySQLUserData : UserDataBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private MySQLManager m_database;
private string m_connectionString;
private object m_dbLock = new object();
public int m_maxConnections = 10;
public int m_lastConnect;
private string m_agentsTableName = "agents";
private string m_usersTableName = "users";
private string m_userFriendsTableName = "userfriends";
private string m_appearanceTableName = "avatarappearance";
private string m_attachmentsTableName = "avatarattachments";
public override void Initialise()
{
m_log.Info("[MySQLUserData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException(Name);
}
/// <summary>
/// Initialise User Interface
/// Loads and initialises the MySQL storage plugin
/// Warns and uses the obsolete mysql_connection.ini if connect string is empty.
/// Checks for migration
/// </summary>
/// <param name="connect">connect string.</param>
public override void Initialise(string connect)
{
m_connectionString = connect;
m_database = new MySQLManager(connect);
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
using (MySql.Data.MySqlClient.MySqlConnection dbcon = new MySql.Data.MySqlClient.MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, assem, "UserStore");
m.Update();
}
}
public override void Dispose()
{
}
// see IUserDataPlugin
public override UserProfileData GetUserByName(string user, string last)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?first"] = user;
param["?second"] = last;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon,
"SELECT * FROM " + m_usersTableName + " WHERE username = ?first AND lastname = ?second", param))
{
using (IDataReader reader = result.ExecuteReader())
{
UserProfileData row = m_database.readUserRow(reader);
return row;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
#region User Friends List Data
public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
int dtvalue = Util.UnixTimeSinceEpoch();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
param["?friendPerms"] = perms.ToString();
param["?datetimestamp"] = dtvalue.ToString();
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand adder = m_database.Query(dbcon,
"INSERT INTO `" + m_userFriendsTableName + "` " +
"(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " +
"VALUES " +
"(?ownerID,?friendID,?friendPerms,?datetimestamp)",
param))
{
adder.ExecuteNonQuery();
}
using (IDbCommand adder = m_database.Query(dbcon,
"INSERT INTO `" + m_userFriendsTableName + "` " +
"(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " +
"VALUES " +
"(?friendID,?ownerID,?friendPerms,?datetimestamp)",
param))
{
adder.ExecuteNonQuery();
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return;
}
}
public override void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand updater = m_database.Query(dbcon,
"delete from " + m_userFriendsTableName + " where ownerID = ?ownerID and friendID = ?friendID",
param))
{
updater.ExecuteNonQuery();
}
using (IDbCommand updater = m_database.Query(dbcon,
"delete from " + m_userFriendsTableName + " where ownerID = ?friendID and friendID = ?ownerID",
param))
{
updater.ExecuteNonQuery();
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return;
}
}
public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
param["?friendPerms"] = perms.ToString();
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand updater = m_database.Query(dbcon,
"update " + m_userFriendsTableName +
" SET friendPerms = ?friendPerms " +
"where ownerID = ?ownerID and friendID = ?friendID",
param))
{
updater.ExecuteNonQuery();
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return;
}
}
public override List<FriendListItem> GetUserFriendList(UUID friendlistowner)
{
List<FriendListItem> Lfli = new List<FriendListItem>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
//Left Join userfriends to itself
using (IDbCommand result = m_database.Query(dbcon,
"select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " +
m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" +
" where a.ownerID = ?ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID",
param))
{
using (IDataReader reader = result.ExecuteReader())
{
while (reader.Read())
{
FriendListItem fli = new FriendListItem();
fli.FriendListOwner = new UUID((string)reader["ownerID"]);
fli.Friend = new UUID((string)reader["friendID"]);
fli.FriendPerms = (uint)Convert.ToInt32(reader["friendPerms"]);
// This is not a real column in the database table, it's a joined column from the opposite record
fli.FriendListOwnerPerms = (uint)Convert.ToInt32(reader["ownerperms"]);
Lfli.Add(fli);
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return Lfli;
}
return Lfli;
}
override public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
{
Dictionary<UUID, FriendRegionInfo> infos = new Dictionary<UUID,FriendRegionInfo>();
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
foreach (UUID uuid in uuids)
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
using (IDbCommand result = m_database.Query(dbcon, "select agentOnline,currentHandle from " + m_agentsTableName +
" where UUID = ?uuid", param))
{
using (IDataReader reader = result.ExecuteReader())
{
while (reader.Read())
{
FriendRegionInfo fri = new FriendRegionInfo();
fri.isOnline = (sbyte)reader["agentOnline"] != 0;
fri.regionHandle = (ulong)reader["currentHandle"];
infos[uuid] = fri;
}
}
}
}
}
}
catch (Exception e)
{
m_log.Warn("[MYSQL]: Got exception on trying to find friends regions:", e);
m_log.Error(e.Message, e);
}
return infos;
}
#endregion
public override List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query)
{
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
string[] querysplit;
querysplit = query.Split(' ');
if (querysplit.Length > 1 && querysplit[1].Trim() != String.Empty)
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%";
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon,
"SELECT UUID,username,lastname FROM " + m_usersTableName +
" WHERE username like ?first AND lastname like ?second LIMIT 100",
param))
{
using (IDataReader reader = result.ExecuteReader())
{
while (reader.Read())
{
AvatarPickerAvatar user = new AvatarPickerAvatar();
user.AvatarID = new UUID((string)reader["UUID"]);
user.firstName = (string)reader["username"];
user.lastName = (string)reader["lastname"];
returnlist.Add(user);
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return returnlist;
}
}
else
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon,
"SELECT UUID,username,lastname FROM " + m_usersTableName +
" WHERE username like ?first OR lastname like ?first LIMIT 100",
param))
{
using (IDataReader reader = result.ExecuteReader())
{
while (reader.Read())
{
AvatarPickerAvatar user = new AvatarPickerAvatar();
user.AvatarID = new UUID((string)reader["UUID"]);
user.firstName = (string)reader["username"];
user.lastName = (string)reader["lastname"];
returnlist.Add(user);
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return returnlist;
}
}
return returnlist;
}
/// <summary>
/// See IUserDataPlugin
/// </summary>
/// <param name="uuid">User UUID</param>
/// <returns>User profile data</returns>
public override UserProfileData GetUserByUUID(UUID uuid)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon, "SELECT * FROM " + m_usersTableName + " WHERE UUID = ?uuid", param))
{
using (IDataReader reader = result.ExecuteReader())
{
UserProfileData row = m_database.readUserRow(reader);
return row;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Returns a user session searching by name
/// </summary>
/// <param name="name">The account name : "Username Lastname"</param>
/// <returns>The users session</returns>
public override UserAgentData GetAgentByName(string name)
{
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
/// <summary>
/// Returns a user session by account name
/// </summary>
/// <param name="user">First part of the users account name</param>
/// <param name="last">Second part of the users account name</param>
/// <returns>The users session</returns>
public override UserAgentData GetAgentByName(string user, string last)
{
UserProfileData profile = GetUserByName(user, last);
return GetAgentByUUID(profile.ID);
}
/// <summary>
/// </summary>
/// <param name="AgentID"></param>
/// <param name="WebLoginKey"></param>
/// <remarks>is it still used ?</remarks>
public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?UUID"] = AgentID.ToString();
param["?webLoginKey"] = WebLoginKey.ToString();
try
{
m_database.ExecuteParameterizedSql(
"update " + m_usersTableName + " SET webLoginKey = ?webLoginKey " +
"where UUID = ?UUID",
param);
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return;
}
}
/// <summary>
/// Returns an agent session by account UUID
/// </summary>
/// <param name="uuid">The accounts UUID</param>
/// <returns>The users session</returns>
public override UserAgentData GetAgentByUUID(UUID uuid)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon, "SELECT * FROM " + m_agentsTableName + " WHERE UUID = ?uuid", param))
{
using (IDataReader reader = result.ExecuteReader())
{
UserAgentData row = m_database.readAgentRow(reader);
return row;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Creates a new users profile
/// </summary>
/// <param name="user">The user profile to create</param>
public override void AddNewUserProfile(UserProfileData user)
{
UUID zero = UUID.Zero;
if (user.ID == zero)
{
return;
}
try
{
m_database.insertUserRow(
user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
user.HomeLocation.Z,
user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created,
user.LastLogin, user.UserInventoryURI, user.UserAssetURI,
user.CanDoMask, user.WantDoMask,
user.AboutText, user.FirstLifeAboutText, user.Image,
user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel, user.CustomType, user.Partner);
}
catch (Exception e)
{
m_log.Error(e.Message, e);
}
}
/// <summary>
/// Creates a new agent
/// </summary>
/// <param name="agent">The agent to create</param>
public override void AddNewUserAgent(UserAgentData agent)
{
UUID zero = UUID.Zero;
if (agent.ProfileID == zero || agent.SessionID == zero)
return;
try
{
m_database.insertAgentRow(agent);
}
catch (Exception e)
{
m_log.Error(e.Message, e);
}
}
/// <summary>
/// Updates a user profile stored in the DB
/// </summary>
/// <param name="user">The profile data to use to update the DB</param>
public override bool UpdateUserProfile(UserProfileData user)
{
try
{
m_database.updateUserRow(
user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
user.HomeLocation.Z, user.HomeLookAt.X,
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin,
user.UserInventoryURI,
user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText,
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey,
user.UserFlags, user.GodLevel, user.CustomType, user.Partner);
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Performs a money transfer request between two accounts
/// </summary>
/// <param name="from">The senders account ID</param>
/// <param name="to">The receivers account ID</param>
/// <param name="amount">The amount to transfer</param>
/// <returns>Success?</returns>
public override bool MoneyTransferRequest(UUID from, UUID to, uint amount)
{
return false;
}
/// <summary>
/// Performs an inventory transfer request between two accounts
/// </summary>
/// <remarks>TODO: Move to inventory server</remarks>
/// <param name="from">The senders account ID</param>
/// <param name="to">The receivers account ID</param>
/// <param name="item">The item to transfer</param>
/// <returns>Success?</returns>
public override bool InventoryTransferRequest(UUID from, UUID to, UUID item)
{
return false;
}
public override AvatarAppearance GetUserAppearance(UUID user)
{
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?owner"] = user.ToString();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon, "SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param))
{
using (IDataReader reader = result.ExecuteReader())
{
AvatarAppearance appearance = m_database.readAppearanceRow(reader);
if (appearance == null)
{
m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString());
return null;
}
else
{
appearance.SetAttachments(GetUserAttachments(user));
return appearance;
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Updates an avatar appearence
/// </summary>
/// <param name="user">The user UUID</param>
/// <param name="appearance">The avatar appearance</param>
// override
public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
{
try
{
appearance.Owner = user;
m_database.insertAppearanceRow(appearance);
UpdateUserAttachments(user, appearance.GetAttachments());
}
catch (Exception e)
{
m_log.Error(e.Message, e);
}
}
/// <summary>
/// Database provider name
/// </summary>
/// <returns>Provider name</returns>
public override string Name
{
get { return "MySQL Userdata Interface"; }
}
/// <summary>
/// Database provider version
/// </summary>
/// <returns>provider version</returns>
public override string Version
{
get { return "0.1"; }
}
public Hashtable GetUserAttachments(UUID agentID)
{
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = agentID.ToString();
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (IDbCommand result = m_database.Query(dbcon,
"SELECT attachpoint, item, asset from " + m_attachmentsTableName + " WHERE UUID = ?uuid", param))
{
using (IDataReader reader = result.ExecuteReader())
{
Hashtable ret = m_database.readAttachments(reader);
return ret;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
public void UpdateUserAttachments(UUID agentID, Hashtable data)
{
m_database.writeAttachments(agentID, data);
}
public override void ResetAttachments(UUID userID)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?uuid"] = userID.ToString();
m_database.ExecuteParameterizedSql(
"UPDATE " + m_attachmentsTableName +
" SET asset = '00000000-0000-0000-0000-000000000000' WHERE UUID = ?uuid",
param);
}
public override void LogoutUsers(UUID regionID)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?regionID"] = regionID.ToString();
try
{
m_database.ExecuteParameterizedSql(
"update " + m_agentsTableName + " SET agentOnline = 0 " +
"where currentRegion = ?regionID",
param);
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return;
}
}
}
}

View File

@ -31,6 +31,7 @@ using OpenSim.Data.Tests;
using log4net;
using System.Reflection;
using OpenSim.Tests.Common;
using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL.Tests
{
@ -39,7 +40,7 @@ namespace OpenSim.Data.MySQL.Tests
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string file;
public MySQLManager database;
private string m_connectionString;
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
[TestFixtureSetUp]
@ -52,7 +53,6 @@ namespace OpenSim.Data.MySQL.Tests
// tests.
try
{
database = new MySQLManager(connect);
db = new MySQLAssetData();
db.Initialise(connect);
}
@ -70,10 +70,22 @@ namespace OpenSim.Data.MySQL.Tests
{
db.Dispose();
}
if (database != null)
ExecuteSql("drop table migrations");
ExecuteSql("drop table assets");
}
/// <summary>
/// Execute a MySqlCommand
/// </summary>
/// <param name="sql">sql string to execute</param>
private void ExecuteSql(string sql)
{
using (MySqlConnection dbcon = new MySqlConnection(connect))
{
database.ExecuteSql("drop table migrations");
database.ExecuteSql("drop table assets");
dbcon.Open();
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
cmd.ExecuteNonQuery();
}
}
}

View File

@ -31,6 +31,8 @@ using OpenSim.Data.Tests;
using log4net;
using System.Reflection;
using OpenSim.Tests.Common;
using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL.Tests
{
@ -39,7 +41,6 @@ namespace OpenSim.Data.MySQL.Tests
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string file;
public MySQLManager database;
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
[TestFixtureSetUp]
@ -52,9 +53,8 @@ namespace OpenSim.Data.MySQL.Tests
// tests.
try
{
database = new MySQLManager(connect);
// clear db incase to ensure we are in a clean state
ClearDB(database);
ClearDB();
regionDb = new MySQLDataStore();
regionDb.Initialise(connect);
@ -75,29 +75,41 @@ namespace OpenSim.Data.MySQL.Tests
{
regionDb.Dispose();
}
ClearDB(database);
ClearDB();
}
private void ClearDB(MySQLManager manager)
private void ClearDB()
{
// if a new table is added, it has to be dropped here
if (manager != null)
ExecuteSql("drop table if exists migrations");
ExecuteSql("drop table if exists prims");
ExecuteSql("drop table if exists primshapes");
ExecuteSql("drop table if exists primitems");
ExecuteSql("drop table if exists terrain");
ExecuteSql("drop table if exists land");
ExecuteSql("drop table if exists landaccesslist");
ExecuteSql("drop table if exists regionban");
ExecuteSql("drop table if exists regionsettings");
ExecuteSql("drop table if exists estate_managers");
ExecuteSql("drop table if exists estate_groups");
ExecuteSql("drop table if exists estate_users");
ExecuteSql("drop table if exists estateban");
ExecuteSql("drop table if exists estate_settings");
ExecuteSql("drop table if exists estate_map");
}
/// <summary>
/// Execute a MySqlCommand
/// </summary>
/// <param name="sql">sql string to execute</param>
private void ExecuteSql(string sql)
{
using (MySqlConnection dbcon = new MySqlConnection(connect))
{
manager.ExecuteSql("drop table if exists migrations");
manager.ExecuteSql("drop table if exists prims");
manager.ExecuteSql("drop table if exists primshapes");
manager.ExecuteSql("drop table if exists primitems");
manager.ExecuteSql("drop table if exists terrain");
manager.ExecuteSql("drop table if exists land");
manager.ExecuteSql("drop table if exists landaccesslist");
manager.ExecuteSql("drop table if exists regionban");
manager.ExecuteSql("drop table if exists regionsettings");
manager.ExecuteSql("drop table if exists estate_managers");
manager.ExecuteSql("drop table if exists estate_groups");
manager.ExecuteSql("drop table if exists estate_users");
manager.ExecuteSql("drop table if exists estateban");
manager.ExecuteSql("drop table if exists estate_settings");
manager.ExecuteSql("drop table if exists estate_map");
dbcon.Open();
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
cmd.ExecuteNonQuery();
}
}
}

View File

@ -1,94 +0,0 @@
/*
* 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 NUnit.Framework;
using OpenSim.Data.Tests;
using log4net;
using System.Reflection;
using OpenSim.Tests.Common;
using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL.Tests
{
[TestFixture, DatabaseTest]
public class MySQLGridTest : BasicGridTest
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string file;
public MySQLManager database;
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
[TestFixtureSetUp]
public void Init()
{
SuperInit();
// If we manage to connect to the database with the user
// and password above it is our test database, and run
// these tests. If anything goes wrong, ignore these
// tests.
try
{
database = new MySQLManager(connect);
db = new MySQLGridData();
db.Initialise(connect);
}
catch (Exception e)
{
m_log.Error("Exception {0}", e);
Assert.Ignore();
}
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
using (MySqlConnection dbcon = new MySqlConnection(connect))
{
dbcon.Open();
Migration m = new Migration(dbcon, assem, "AssetStore");
m.Update();
}
}
[TestFixtureTearDown]
public void Cleanup()
{
m_log.Warn("Cleaning up.");
if (db != null)
{
db.Dispose();
}
// if a new table is added, it has to be dropped here
if (database != null)
{
database.ExecuteSql("drop table migrations");
database.ExecuteSql("drop table regions");
}
}
}
}

View File

@ -31,6 +31,8 @@ using OpenSim.Data.Tests;
using log4net;
using System.Reflection;
using OpenSim.Tests.Common;
using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL.Tests
{
@ -39,7 +41,6 @@ namespace OpenSim.Data.MySQL.Tests
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string file;
public MySQLManager database;
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
[TestFixtureSetUp]
@ -52,7 +53,6 @@ namespace OpenSim.Data.MySQL.Tests
// tests.
try
{
database = new MySQLManager(connect);
DropTables();
db = new MySQLInventoryData();
db.Initialise(connect);
@ -71,17 +71,29 @@ namespace OpenSim.Data.MySQL.Tests
{
db.Dispose();
}
if (database != null)
{
DropTables();
}
DropTables();
}
private void DropTables()
{
database.ExecuteSql("drop table IF EXISTS inventoryitems");
database.ExecuteSql("drop table IF EXISTS inventoryfolders");
database.ExecuteSql("drop table IF EXISTS migrations");
ExecuteSql("drop table IF EXISTS inventoryitems");
ExecuteSql("drop table IF EXISTS inventoryfolders");
ExecuteSql("drop table IF EXISTS migrations");
}
/// <summary>
/// Execute a MySqlCommand
/// </summary>
/// <param name="sql">sql string to execute</param>
private void ExecuteSql(string sql)
{
using (MySqlConnection dbcon = new MySqlConnection(connect))
{
dbcon.Open();
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
cmd.ExecuteNonQuery();
}
}
}
}

View File

@ -31,6 +31,7 @@ using OpenSim.Data.Tests;
using log4net;
using System.Reflection;
using OpenSim.Tests.Common;
using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL.Tests
{
@ -39,7 +40,6 @@ namespace OpenSim.Data.MySQL.Tests
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string file;
public MySQLManager database;
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
[TestFixtureSetUp]
@ -52,9 +52,8 @@ namespace OpenSim.Data.MySQL.Tests
// tests.
try
{
database = new MySQLManager(connect);
// this is important in case a previous run ended badly
ClearDB(database);
ClearDB();
db = new MySQLDataStore();
db.Initialise(connect);
@ -73,28 +72,40 @@ namespace OpenSim.Data.MySQL.Tests
{
db.Dispose();
}
ClearDB(database);
ClearDB();
}
private void ClearDB(MySQLManager manager)
private void ClearDB()
{
if (manager != null)
ExecuteSql("drop table if exists migrations");
ExecuteSql("drop table if exists prims");
ExecuteSql("drop table if exists primshapes");
ExecuteSql("drop table if exists primitems");
ExecuteSql("drop table if exists terrain");
ExecuteSql("drop table if exists land");
ExecuteSql("drop table if exists landaccesslist");
ExecuteSql("drop table if exists regionban");
ExecuteSql("drop table if exists regionsettings");
ExecuteSql("drop table if exists estate_managers");
ExecuteSql("drop table if exists estate_groups");
ExecuteSql("drop table if exists estate_users");
ExecuteSql("drop table if exists estateban");
ExecuteSql("drop table if exists estate_settings");
ExecuteSql("drop table if exists estate_map");
}
/// <summary>
/// Execute a MySqlCommand
/// </summary>
/// <param name="sql">sql string to execute</param>
private void ExecuteSql(string sql)
{
using (MySqlConnection dbcon = new MySqlConnection(connect))
{
manager.ExecuteSql("drop table if exists migrations");
manager.ExecuteSql("drop table if exists prims");
manager.ExecuteSql("drop table if exists primshapes");
manager.ExecuteSql("drop table if exists primitems");
manager.ExecuteSql("drop table if exists terrain");
manager.ExecuteSql("drop table if exists land");
manager.ExecuteSql("drop table if exists landaccesslist");
manager.ExecuteSql("drop table if exists regionban");
manager.ExecuteSql("drop table if exists regionsettings");
manager.ExecuteSql("drop table if exists estate_managers");
manager.ExecuteSql("drop table if exists estate_groups");
manager.ExecuteSql("drop table if exists estate_users");
manager.ExecuteSql("drop table if exists estateban");
manager.ExecuteSql("drop table if exists estate_settings");
manager.ExecuteSql("drop table if exists estate_map");
dbcon.Open();
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
cmd.ExecuteNonQuery();
}
}
}

View File

@ -43,16 +43,18 @@ namespace OpenSim.Data.Null
public NullPresenceData(string connectionString, string realm)
{
if (Instance == null)
{
Instance = this;
//Console.WriteLine("[XXX] NullRegionData constructor");
// Let's stick in a test presence
PresenceData p = new PresenceData();
p.SessionID = UUID.Zero;
p.UserID = UUID.Zero.ToString();
p.Data = new Dictionary<string, string>();
p.Data["Online"] = "true";
m_presenceData.Add(UUID.Zero, p);
//Console.WriteLine("[XXX] NullRegionData constructor");
// Let's stick in a test presence
PresenceData p = new PresenceData();
p.SessionID = UUID.Zero;
p.UserID = UUID.Zero.ToString();
p.Data = new Dictionary<string, string>();
p.Data["Online"] = true.ToString();
m_presenceData.Add(UUID.Zero, p);
}
}
public bool Store(PresenceData data)
@ -70,7 +72,9 @@ namespace OpenSim.Data.Null
return Instance.Get(sessionID);
if (m_presenceData.ContainsKey(sessionID))
{
return m_presenceData[sessionID];
}
return null;
}

View File

@ -1,337 +0,0 @@
/*
* 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 Nwc.XmlRpc;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data
{
/// <summary>
/// A class which contains information known to the grid server about a region
/// </summary>
[Serializable]
public class RegionProfileData
{
/// <summary>
/// The name of the region
/// </summary>
public string regionName = String.Empty;
/// <summary>
/// A 64-bit number combining map position into a (mostly) unique ID
/// </summary>
public ulong regionHandle;
/// <summary>
/// OGS/OpenSim Specific ID for a region
/// </summary>
public UUID UUID;
/// <summary>
/// Coordinates of the region
/// </summary>
public uint regionLocX;
public uint regionLocY;
public uint regionLocZ; // Reserved (round-robin, layers, etc)
/// <summary>
/// Authentication secrets
/// </summary>
/// <remarks>Not very secure, needs improvement.</remarks>
public string regionSendKey = String.Empty;
public string regionRecvKey = String.Empty;
public string regionSecret = String.Empty;
/// <summary>
/// Whether the region is online
/// </summary>
public bool regionOnline;
/// <summary>
/// Information about the server that the region is currently hosted on
/// </summary>
public string serverIP = String.Empty;
public uint serverPort;
public string serverURI = String.Empty;
public uint httpPort;
public uint remotingPort;
public string httpServerURI = String.Empty;
/// <summary>
/// Set of optional overrides. Can be used to create non-eulicidean spaces.
/// </summary>
public ulong regionNorthOverrideHandle;
public ulong regionSouthOverrideHandle;
public ulong regionEastOverrideHandle;
public ulong regionWestOverrideHandle;
/// <summary>
/// Optional: URI Location of the region database
/// </summary>
/// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
public string regionDataURI = String.Empty;
/// <summary>
/// Region Asset Details
/// </summary>
public string regionAssetURI = String.Empty;
public string regionAssetSendKey = String.Empty;
public string regionAssetRecvKey = String.Empty;
/// <summary>
/// Region Userserver Details
/// </summary>
public string regionUserURI = String.Empty;
public string regionUserSendKey = String.Empty;
public string regionUserRecvKey = String.Empty;
/// <summary>
/// Region Map Texture Asset
/// </summary>
public UUID regionMapTextureID = new UUID("00000000-0000-1111-9999-000000000006");
/// <summary>
/// this particular mod to the file provides support within the spec for RegionProfileData for the
/// owner_uuid for the region
/// </summary>
public UUID owner_uuid = UUID.Zero;
/// <summary>
/// OGS/OpenSim Specific original ID for a region after move/split
/// </summary>
public UUID originUUID;
/// <summary>
/// The Maturity rating of the region
/// </summary>
public uint maturity;
//Data Wrappers
public string RegionName
{
get { return regionName; }
set { regionName = value; }
}
public ulong RegionHandle
{
get { return regionHandle; }
set { regionHandle = value; }
}
public UUID Uuid
{
get { return UUID; }
set { UUID = value; }
}
public uint RegionLocX
{
get { return regionLocX; }
set { regionLocX = value; }
}
public uint RegionLocY
{
get { return regionLocY; }
set { regionLocY = value; }
}
public uint RegionLocZ
{
get { return regionLocZ; }
set { regionLocZ = value; }
}
public string RegionSendKey
{
get { return regionSendKey; }
set { regionSendKey = value; }
}
public string RegionRecvKey
{
get { return regionRecvKey; }
set { regionRecvKey = value; }
}
public string RegionSecret
{
get { return regionSecret; }
set { regionSecret = value; }
}
public bool RegionOnline
{
get { return regionOnline; }
set { regionOnline = value; }
}
public string ServerIP
{
get { return serverIP; }
set { serverIP = value; }
}
public uint ServerPort
{
get { return serverPort; }
set { serverPort = value; }
}
public string ServerURI
{
get { return serverURI; }
set { serverURI = value; }
}
public uint ServerHttpPort
{
get { return httpPort; }
set { httpPort = value; }
}
public uint ServerRemotingPort
{
get { return remotingPort; }
set { remotingPort = value; }
}
public ulong NorthOverrideHandle
{
get { return regionNorthOverrideHandle; }
set { regionNorthOverrideHandle = value; }
}
public ulong SouthOverrideHandle
{
get { return regionSouthOverrideHandle; }
set { regionSouthOverrideHandle = value; }
}
public ulong EastOverrideHandle
{
get { return regionEastOverrideHandle; }
set { regionEastOverrideHandle = value; }
}
public ulong WestOverrideHandle
{
get { return regionWestOverrideHandle; }
set { regionWestOverrideHandle = value; }
}
public string RegionDataURI
{
get { return regionDataURI; }
set { regionDataURI = value; }
}
public string RegionAssetURI
{
get { return regionAssetURI; }
set { regionAssetURI = value; }
}
public string RegionAssetSendKey
{
get { return regionAssetSendKey; }
set { regionAssetSendKey = value; }
}
public string RegionAssetRecvKey
{
get { return regionAssetRecvKey; }
set { regionAssetRecvKey = value; }
}
public string RegionUserURI
{
get { return regionUserURI; }
set { regionUserURI = value; }
}
public string RegionUserSendKey
{
get { return regionUserSendKey; }
set { regionUserSendKey = value; }
}
public string RegionUserRecvKey
{
get { return regionUserRecvKey; }
set { regionUserRecvKey = value; }
}
public UUID RegionMapTextureID
{
get { return regionMapTextureID; }
set { regionMapTextureID = value; }
}
public UUID Owner_uuid
{
get { return owner_uuid; }
set { owner_uuid = value; }
}
public UUID OriginUUID
{
get { return originUUID; }
set { originUUID = value; }
}
public uint Maturity
{
get { return maturity; }
set { maturity = value; }
}
public byte AccessLevel
{
get { return Util.ConvertMaturityToAccessLevel(maturity); }
}
public RegionInfo ToRegionInfo()
{
return RegionInfo.Create(UUID, regionName, regionLocX, regionLocY, serverIP, httpPort, serverPort, remotingPort, serverURI);
}
public static RegionProfileData FromRegionInfo(RegionInfo regionInfo)
{
if (regionInfo == null)
{
return null;
}
return Create(regionInfo.RegionID, regionInfo.RegionName, regionInfo.RegionLocX,
regionInfo.RegionLocY, regionInfo.ExternalHostName,
(uint) regionInfo.ExternalEndPoint.Port, regionInfo.HttpPort, regionInfo.RemotingPort,
regionInfo.ServerURI, regionInfo.AccessLevel);
}
public static RegionProfileData Create(UUID regionID, string regionName, uint locX, uint locY, string externalHostName, uint regionPort, uint httpPort, uint remotingPort, string serverUri, byte access)
{
RegionProfileData regionProfile;
regionProfile = new RegionProfileData();
regionProfile.regionLocX = locX;
regionProfile.regionLocY = locY;
regionProfile.regionHandle =
Utils.UIntsToLong((regionProfile.regionLocX * Constants.RegionSize),
(regionProfile.regionLocY*Constants.RegionSize));
regionProfile.serverIP = externalHostName;
regionProfile.serverPort = regionPort;
regionProfile.httpPort = httpPort;
regionProfile.remotingPort = remotingPort;
regionProfile.serverURI = serverUri;
regionProfile.httpServerURI = "http://" + externalHostName + ":" + httpPort + "/";
regionProfile.UUID = regionID;
regionProfile.regionName = regionName;
regionProfile.maturity = access;
return regionProfile;
}
}
}

View File

@ -1,119 +0,0 @@
/*
* 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.Text;
using Nwc.XmlRpc;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data
{
public class RegionProfileServiceProxy : IRegionProfileRouter
{
/// <summary>
/// Request sim data based on arbitrary key/value
/// </summary>
private RegionProfileData RequestSimData(Uri gridserverUrl, string gridserverSendkey, string keyField, string keyValue)
{
Hashtable requestData = new Hashtable();
requestData[keyField] = keyValue;
requestData["authkey"] = gridserverSendkey;
ArrayList SendParams = new ArrayList();
SendParams.Add(requestData);
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(gridserverUrl.ToString(), 3000);
Hashtable responseData = (Hashtable) GridResp.Value;
RegionProfileData simData = null;
if (!responseData.ContainsKey("error"))
{
uint locX = Convert.ToUInt32((string)responseData["region_locx"]);
uint locY = Convert.ToUInt32((string)responseData["region_locy"]);
string externalHostName = (string)responseData["sim_ip"];
uint simPort = Convert.ToUInt32((string)responseData["sim_port"]);
uint httpPort = Convert.ToUInt32((string)responseData["http_port"]);
uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
string serverUri = (string)responseData["server_uri"];
UUID regionID = new UUID((string)responseData["region_UUID"]);
string regionName = (string)responseData["region_name"];
byte access = Convert.ToByte((string)responseData["access"]);
simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri, access);
}
return simData;
}
/// <summary>
/// Request sim profile information from a grid server, by Region UUID
/// </summary>
/// <param name="regionId">The region UUID to look for</param>
/// <param name="gridserverUrl"></param>
/// <param name="gridserverSendkey"></param>
/// <param name="gridserverRecvkey"></param>
/// <returns>The sim profile. Null if there was a request failure</returns>
/// <remarks>This method should be statics</remarks>
public RegionProfileData RequestSimProfileData(UUID regionId, Uri gridserverUrl,
string gridserverSendkey, string gridserverRecvkey)
{
return RequestSimData(gridserverUrl, gridserverSendkey, "region_UUID", regionId.Guid.ToString());
}
/// <summary>
/// Request sim profile information from a grid server, by Region Handle
/// </summary>
/// <param name="regionHandle">the region handle to look for</param>
/// <param name="gridserverUrl"></param>
/// <param name="gridserverSendkey"></param>
/// <param name="gridserverRecvkey"></param>
/// <returns>The sim profile. Null if there was a request failure</returns>
public RegionProfileData RequestSimProfileData(ulong regionHandle, Uri gridserverUrl,
string gridserverSendkey, string gridserverRecvkey)
{
return RequestSimData(gridserverUrl, gridserverSendkey, "region_handle", regionHandle.ToString());
}
/// <summary>
/// Request sim profile information from a grid server, by Region Name
/// </summary>
/// <param name="regionName">the region name to look for</param>
/// <param name="gridserverUrl"></param>
/// <param name="gridserverSendkey"></param>
/// <param name="gridserverRecvkey"></param>
/// <returns>The sim profile. Null if there was a request failure</returns>
public RegionProfileData RequestSimProfileData(string regionName, Uri gridserverUrl,
string gridserverSendkey, string gridserverRecvkey)
{
return RequestSimData(gridserverUrl, gridserverSendkey, "region_name_search", regionName);
}
}
}

View File

@ -1,48 +0,0 @@
/*
* 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 OpenMetaverse;
namespace OpenSim.Data
{
public class ReservationData
{
public UUID userUUID = UUID.Zero;
public int reservationMinX = 0;
public int reservationMinY = 0;
public int reservationMaxX = 65536;
public int reservationMaxY = 65536;
public string reservationName = String.Empty;
public string reservationCompany = String.Empty;
public bool status = true;
public string gridSendKey = String.Empty;
public string gridRecvKey = String.Empty;
}
}

View File

@ -0,0 +1,18 @@
BEGIN TRANSACTION;
CREATE TABLE auth (
UUID char(36) NOT NULL,
passwordHash char(32) NOT NULL default '',
passwordSalt char(32) NOT NULL default '',
webLoginKey varchar(255) NOT NULL default '',
accountType VARCHAR(32) NOT NULL DEFAULT 'UserAccount',
PRIMARY KEY (`UUID`)
);
CREATE TABLE tokens (
UUID char(36) NOT NULL,
token varchar(255) NOT NULL,
validity datetime NOT NULL
);
COMMIT;

View File

@ -0,0 +1,9 @@
BEGIN TRANSACTION;
CREATE TABLE Avatars (
PrincipalID CHAR(36) NOT NULL,
Name VARCHAR(32) NOT NULL,
Value VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY(PrincipalID, Name));
COMMIT;

View File

@ -0,0 +1,17 @@
BEGIN TRANSACTION;
-- useraccounts table
CREATE TABLE UserAccounts (
PrincipalID CHAR(36) NOT NULL,
ScopeID CHAR(36) NOT NULL,
FirstName VARCHAR(64) NOT NULL,
LastName VARCHAR(64) NOT NULL,
Email VARCHAR(64),
ServiceURLs TEXT,
Created INT(11),
UserLevel integer NOT NULL DEFAULT 0,
UserFlags integer NOT NULL DEFAULT 0,
UserTitle varchar(64) NOT NULL DEFAULT ''
);
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN TRANSACTION;
INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users;
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN TRANSACTION;
INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users;
COMMIT;

View File

@ -0,0 +1,262 @@
/*
* 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
{
public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
{
private string m_Realm;
private List<string> m_ColumnNames;
private int m_LastExpire;
private string m_connectionString;
protected static SqliteConnection m_Connection;
private static bool m_initialized = false;
public SQLiteAuthenticationData(string connectionString, string realm)
: base(connectionString)
{
m_Realm = realm;
m_connectionString = connectionString;
if (!m_initialized)
{
m_Connection = new SqliteConnection(connectionString);
m_Connection.Open();
using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone())
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
m.Update();
dbcon.Close();
}
m_initialized = true;
}
}
public AuthenticationData Get(UUID principalID)
{
AuthenticationData ret = new AuthenticationData();
ret.Data = new Dictionary<string, object>();
SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID");
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
IDataReader result = ExecuteReader(cmd, m_Connection);
try
{
if (result.Read())
{
ret.PrincipalID = principalID;
if (m_ColumnNames == null)
{
m_ColumnNames = new List<string>();
DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
m_ColumnNames.Add(row["ColumnName"].ToString());
}
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
return ret;
}
else
{
return null;
}
}
catch
{
}
finally
{
CloseCommand(cmd);
}
return null;
}
public bool Store(AuthenticationData data)
{
if (data.Data.ContainsKey("UUID"))
data.Data.Remove("UUID");
string[] fields = new List<string>(data.Data.Keys).ToArray();
string[] values = new string[data.Data.Count];
int i = 0;
foreach (object o in data.Data.Values)
values[i++] = o.ToString();
SqliteCommand cmd = new SqliteCommand();
if (Get(data.PrincipalID) != null)
{
string update = "update `" + m_Realm + "` set ";
bool first = true;
foreach (string field in fields)
{
if (!first)
update += ", ";
update += "`" + field + "` = :" + field;
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
first = false;
}
update += " where UUID = :UUID";
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
cmd.CommandText = update;
try
{
if (ExecuteNonQuery(cmd, m_Connection) < 1)
{
CloseCommand(cmd);
return false;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
CloseCommand(cmd);
return false;
}
}
else
{
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
String.Join("`, `", fields) +
"`) values (:UUID, :" + String.Join(", :", fields) + ")";
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
foreach (string field in fields)
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
cmd.CommandText = insert;
try
{
if (ExecuteNonQuery(cmd, m_Connection) < 1)
{
CloseCommand(cmd);
return false;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
CloseCommand(cmd);
return false;
}
}
CloseCommand(cmd);
return true;
}
public bool SetDataItem(UUID principalID, string item, string value)
{
SqliteCommand cmd = new SqliteCommand("update `" + m_Realm +
"` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
return true;
return false;
}
public bool SetToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
"', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
{
cmd.Dispose();
return true;
}
cmd.Dispose();
return false;
}
public bool CheckToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now, 'localtime', '+" + lifetime.ToString() +
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
{
cmd.Dispose();
return true;
}
cmd.Dispose();
return false;
}
private void DoExpire()
{
SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')");
ExecuteNonQuery(cmd, m_Connection);
cmd.Dispose();
m_LastExpire = System.Environment.TickCount;
}
}
}

View File

@ -25,40 +25,50 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.IO;
using NUnit.Framework;
using OpenSim.Data.Tests;
using OpenSim.Tests.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Threading;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using Mono.Data.SqliteClient;
namespace OpenSim.Data.SQLite.Tests
namespace OpenSim.Data.SQLite
{
[TestFixture, DatabaseTest]
public class SQLiteUserTest : BasicUserTest
/// <summary>
/// A MySQL Interface for the Grid Server
/// </summary>
public class SQLiteAvatarData : SQLiteGenericTableHandler<AvatarBaseData>,
IAvatarData
{
public string file;
public string connect;
[TestFixtureSetUp]
public void Init()
{
// SQLite doesn't work on power or z linux
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
{
Assert.Ignore();
}
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
SuperInit();
file = Path.GetTempFileName() + ".db";
connect = "URI=file:" + file + ",version=3";
db = new SQLiteUserData();
db.Initialise(connect);
public SQLiteAvatarData(string connectionString, string realm) :
base(connectionString, realm, "Avatar")
{
}
[TestFixtureTearDown]
public void Cleanup()
public bool Delete(UUID principalID, string name)
{
db.Dispose();
File.Delete(file);
SqliteCommand cmd = new SqliteCommand();
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
cmd.Parameters.Add(":Name", name);
try
{
if (ExecuteNonQuery(cmd, m_Connection) > 0)
return true;
return false;
}
finally
{
CloseCommand(cmd);
}
}
}
}

View File

@ -40,12 +40,10 @@ namespace OpenSim.Data.SQLite
/// </summary>
public class SQLiteFramework
{
protected SqliteConnection m_Connection;
protected Object m_lockObject = new Object();
protected SQLiteFramework(string connectionString)
{
m_Connection = new SqliteConnection(connectionString);
m_Connection.Open();
}
//////////////////////////////////////////////////////////////
@ -53,27 +51,37 @@ namespace OpenSim.Data.SQLite
// All non queries are funneled through one connection
// to increase performance a little
//
protected int ExecuteNonQuery(SqliteCommand cmd)
protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection)
{
lock (m_Connection)
lock (connection)
{
cmd.Connection = m_Connection;
SqliteConnection newConnection =
(SqliteConnection)((ICloneable)connection).Clone();
newConnection.Open();
cmd.Connection = newConnection;
//Console.WriteLine("XXX " + cmd.CommandText);
return cmd.ExecuteNonQuery();
}
}
protected IDataReader ExecuteReader(SqliteCommand cmd)
{
SqliteConnection newConnection =
(SqliteConnection)((ICloneable)m_Connection).Clone();
newConnection.Open();
cmd.Connection = newConnection;
return cmd.ExecuteReader();
protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
{
lock (connection)
{
SqliteConnection newConnection =
(SqliteConnection)((ICloneable)connection).Clone();
newConnection.Open();
cmd.Connection = newConnection;
//Console.WriteLine("XXX " + cmd.CommandText);
return cmd.ExecuteReader();
}
}
protected void CloseReaderCommand(SqliteCommand cmd)
protected void CloseCommand(SqliteCommand cmd)
{
cmd.Connection.Close();
cmd.Connection.Dispose();

View File

@ -48,16 +48,33 @@ namespace OpenSim.Data.SQLite
protected string m_Realm;
protected FieldInfo m_DataField = null;
protected static SqliteConnection m_Connection;
private static bool m_initialized;
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();
if (!m_initialized)
{
m_Connection = new SqliteConnection(connectionString);
m_Connection.Open();
if (storeName != String.Empty)
{
Assembly assem = GetType().Assembly;
SqliteConnection newConnection =
(SqliteConnection)((ICloneable)m_Connection).Clone();
newConnection.Open();
Migration m = new Migration(newConnection, assem, storeName);
m.Update();
newConnection.Close();
newConnection.Dispose();
}
m_initialized = true;
}
Type t = typeof(T);
@ -125,7 +142,7 @@ namespace OpenSim.Data.SQLite
protected T[] DoQuery(SqliteCommand cmd)
{
IDataReader reader = ExecuteReader(cmd);
IDataReader reader = ExecuteReader(cmd, m_Connection);
if (reader == null)
return new T[0];
@ -180,7 +197,7 @@ namespace OpenSim.Data.SQLite
result.Add(row);
}
CloseReaderCommand(cmd);
CloseCommand(cmd);
return result.ToArray();
}
@ -229,7 +246,7 @@ namespace OpenSim.Data.SQLite
cmd.CommandText = query;
if (ExecuteNonQuery(cmd) > 0)
if (ExecuteNonQuery(cmd, m_Connection) > 0)
return true;
return false;
@ -242,7 +259,7 @@ namespace OpenSim.Data.SQLite
cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
cmd.Parameters.Add(new SqliteParameter(field, val));
if (ExecuteNonQuery(cmd) > 0)
if (ExecuteNonQuery(cmd, m_Connection) > 0)
return true;
return false;

View File

@ -1,286 +0,0 @@
/*
* 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 OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.SQLite
{
/// <summary>
/// A Grid Interface to the SQLite database
/// </summary>
public class SQLiteGridData : GridDataBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// SQLite database manager
/// </summary>
private SQLiteManager database;
override public void Initialise()
{
m_log.Info("[SQLite]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name);
}
/// <summary>
/// <list type="bullet">
/// <item>Initialises Inventory interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
/// <item>use default URI if connect string is empty.</item>
/// </list>
/// </summary>
/// <param name="dbconnect">connect string</param>
override public void Initialise(string connect)
{
database = new SQLiteManager(connect);
}
/// <summary>
/// Shuts down the grid interface
/// </summary>
override public void Dispose()
{
database.Close();
}
/// <summary>
/// Returns the name of this grid interface
/// </summary>
/// <returns>A string containing the grid interface</returns>
override public string Name
{
get { return "SQLite OpenGridData"; }
}
/// <summary>
/// Returns the version of this grid interface
/// </summary>
/// <returns>A string containing the version</returns>
override public string Version
{
get { return "0.1"; }
}
/// <summary>
/// Returns a list of regions within the specified ranges
/// </summary>
/// <param name="a">minimum X coordinate</param>
/// <param name="b">minimum Y coordinate</param>
/// <param name="c">maximum X coordinate</param>
/// <param name="d">maximum Y coordinate</param>
/// <returns>An array of region profiles</returns>
/// <remarks>NOT IMPLEMENTED ? always return null</remarks>
override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
{
return null;
}
/// <summary>
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
/// </summary>
/// <param name="name">The name to match against</param>
/// <param name="maxNum">Maximum number of profiles to return</param>
/// <returns>A list of sim profiles</returns>
override public List<RegionProfileData> GetRegionsByName (string namePrefix, uint maxNum)
{
return null;
}
/// <summary>
/// Returns a sim profile from it's handle
/// </summary>
/// <param name="handle">Region location handle</param>
/// <returns>Sim profile</returns>
override public RegionProfileData GetProfileByHandle(ulong handle)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["handle"] = handle.ToString();
IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param);
IDataReader reader = result.ExecuteReader();
RegionProfileData row = database.getRow(reader);
reader.Close();
result.Dispose();
return row;
}
/// <summary>
/// Returns a sim profile from it's Region name string
/// </summary>
/// <param name="regionName">The region name search query</param>
/// <returns>The sim profile</returns>
override public RegionProfileData GetProfileByString(string regionName)
{
if (regionName.Length > 2)
{
Dictionary<string, string> param = new Dictionary<string, string>();
// Add % because this is a like query.
param["?regionName"] = regionName + "%";
// Only returns one record or no record.
IDbCommand result = database.Query("SELECT * FROM regions WHERE regionName like ?regionName LIMIT 1", param);
IDataReader reader = result.ExecuteReader();
RegionProfileData row = database.getRow(reader);
reader.Close();
result.Dispose();
return row;
}
else
{
//m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters");
return null;
}
}
/// <summary>
/// Returns a sim profile from it's UUID
/// </summary>
/// <param name="uuid">The region UUID</param>
/// <returns>The sim profile</returns>
override public RegionProfileData GetProfileByUUID(UUID uuid)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["uuid"] = uuid.ToString();
IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
IDataReader reader = result.ExecuteReader();
RegionProfileData row = database.getRow(reader);
reader.Close();
result.Dispose();
return row;
}
/// <summary>
/// Returns a list of avatar and UUIDs that match the query
/// </summary>
/// <remarks>do nothing yet</remarks>
public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query)
{
//Do nothing yet
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
return returnlist;
}
/// <summary>
/// Adds a new specified region to the database
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>A dataresponse enum indicating success</returns>
override public DataResponse StoreProfile(RegionProfileData profile)
{
if (database.insertRow(profile))
{
return DataResponse.RESPONSE_OK;
}
else
{
return DataResponse.RESPONSE_ERROR;
}
}
/// <summary>
/// Deletes a sim profile from the database
/// </summary>
/// <param name="uuid">the sim UUID</param>
/// <returns>Successful?</returns>
override public DataResponse DeleteProfile(string uuid)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["uuid"] = uuid;
IDbCommand result = database.Query("DELETE FROM regions WHERE uuid = @uuid", param);
if (result.ExecuteNonQuery() > 0)
{
return DataResponse.RESPONSE_OK;
}
return DataResponse.RESPONSE_ERROR;
}
/// <summary>
/// DEPRECATED. Attempts to authenticate a region by comparing a shared secret.
/// </summary>
/// <param name="uuid">The UUID of the challenger</param>
/// <param name="handle">The attempted regionHandle of the challenger</param>
/// <param name="authkey">The secret</param>
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
override public bool AuthenticateSim(UUID uuid, ulong handle, string authkey)
{
bool throwHissyFit = false; // Should be true by 1.0
if (throwHissyFit)
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
RegionProfileData data = GetProfileByUUID(uuid);
return (handle == data.regionHandle && authkey == data.regionSecret);
}
/// <summary>
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
/// </summary>
/// <remarks>This requires a security audit.</remarks>
/// <param name="uuid"></param>
/// <param name="handle"></param>
/// <param name="authhash"></param>
/// <param name="challenge"></param>
/// <returns></returns>
public bool AuthenticateSim(UUID uuid, ulong handle, string authhash, string challenge)
{
// SHA512Managed HashProvider = new SHA512Managed();
// Encoding TextProvider = new UTF8Encoding();
// byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
// byte[] hash = HashProvider.ComputeHash(stream);
return false;
}
/// <summary>
/// NOT IMPLEMENTED
/// </summary>
/// <param name="x">x coordinate</param>
/// <param name="y">y coordinate</param>
/// <returns>always return null</returns>
override public ReservationData GetReservationAtPoint(uint x, uint y)
{
return null;
}
}
}

View File

@ -1,225 +0,0 @@
/*
* 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.Data.SQLite;
using System.Reflection;
using log4net;
using OpenMetaverse;
namespace OpenSim.Data.SQLite
{
/// <summary>
/// SQLite Manager
/// </summary>
internal class SQLiteManager : SQLiteUtil
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IDbConnection dbcon;
/// <summary>
/// <list type="bullet">
/// <item>Initialises and creates a new SQLite connection and maintains it.</item>
/// <item>use default URI if connect string is empty.</item>
/// </list>
/// </summary>
/// <param name="connect">connect string</param>
public SQLiteManager(string connect)
{
try
{
string connectionString = String.Empty;
if (connect != String.Empty)
{
connectionString = connect;
}
else
{
m_log.Warn("[SQLITE] grid db not specified, using default");
connectionString = "URI=file:GridServerSqlite.db;";
}
dbcon = new SQLiteConnection(connectionString);
dbcon.Open();
}
catch (Exception e)
{
throw new Exception("Error initialising SQLite Database: " + e.ToString());
}
}
/// <summary>
/// Shuts down the database connection
/// </summary>
public void Close()
{
dbcon.Close();
dbcon = null;
}
/// <summary>
/// Runs a query with protection against SQL Injection by using parameterised input.
/// </summary>
/// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
/// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
/// <returns>A SQLite DB Command</returns>
public IDbCommand Query(string sql, Dictionary<string, string> parameters)
{
SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql;
foreach (KeyValuePair<string, string> param in parameters)
{
SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value);
dbcommand.Parameters.Add(paramx);
}
return (IDbCommand) dbcommand;
}
/// <summary>
/// Reads a region row from a database reader
/// </summary>
/// <param name="reader">An active database reader</param>
/// <returns>A region profile</returns>
public RegionProfileData getRow(IDataReader reader)
{
RegionProfileData retval = new RegionProfileData();
if (reader.Read())
{
// Region Main
retval.regionHandle = (ulong) reader["regionHandle"];
retval.regionName = (string) reader["regionName"];
retval.UUID = new UUID((string) reader["uuid"]);
// Secrets
retval.regionRecvKey = (string) reader["regionRecvKey"];
retval.regionSecret = (string) reader["regionSecret"];
retval.regionSendKey = (string) reader["regionSendKey"];
// Region Server
retval.regionDataURI = (string) reader["regionDataURI"];
retval.regionOnline = false; // Needs to be pinged before this can be set.
retval.serverIP = (string) reader["serverIP"];
retval.serverPort = (uint) reader["serverPort"];
retval.serverURI = (string) reader["serverURI"];
// Location
retval.regionLocX = (uint) ((int) reader["locX"]);
retval.regionLocY = (uint) ((int) reader["locY"]);
retval.regionLocZ = (uint) ((int) reader["locZ"]);
// Neighbours - 0 = No Override
retval.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
retval.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
retval.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
retval.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
// Assets
retval.regionAssetURI = (string) reader["regionAssetURI"];
retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
retval.regionAssetSendKey = (string) reader["regionAssetSendKey"];
// Userserver
retval.regionUserURI = (string) reader["regionUserURI"];
retval.regionUserRecvKey = (string) reader["regionUserRecvKey"];
retval.regionUserSendKey = (string) reader["regionUserSendKey"];
}
else
{
throw new Exception("No rows to return");
}
return retval;
}
/// <summary>
/// Inserts a new region into the database
/// </summary>
/// <param name="profile">The region to insert</param>
/// <returns>Success?</returns>
public bool insertRow(RegionProfileData profile)
{
string sql =
"REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
sql +=
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
sql +=
"@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["regionHandle"] = profile.regionHandle.ToString();
parameters["regionName"] = profile.regionName;
parameters["uuid"] = profile.UUID.ToString();
parameters["regionRecvKey"] = profile.regionRecvKey;
parameters["regionSendKey"] = profile.regionSendKey;
parameters["regionDataURI"] = profile.regionDataURI;
parameters["serverIP"] = profile.serverIP;
parameters["serverPort"] = profile.serverPort.ToString();
parameters["serverURI"] = profile.serverURI;
parameters["locX"] = profile.regionLocX.ToString();
parameters["locY"] = profile.regionLocY.ToString();
parameters["locZ"] = profile.regionLocZ.ToString();
parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
parameters["regionAssetURI"] = profile.regionAssetURI;
parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
parameters["regionUserURI"] = profile.regionUserURI;
parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
parameters["regionUserSendKey"] = profile.regionUserSendKey;
bool returnval = false;
try
{
IDbCommand result = Query(sql, parameters);
if (result.ExecuteNonQuery() == 1)
returnval = true;
result.Dispose();
}
catch (Exception)
{
return false;
}
return returnval;
}
}
}

View File

@ -26,60 +26,56 @@
*/
using System;
using NUnit.Framework;
using OpenSim.Data.Tests;
using log4net;
using System.Reflection;
using OpenSim.Tests.Common;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
using Mono.Data.SqliteClient;
namespace OpenSim.Data.MySQL.Tests
namespace OpenSim.Data.SQLite
{
[TestFixture, DatabaseTest]
public class MySQLUserTest : BasicUserTest
public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string file;
public MySQLManager database;
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
[TestFixtureSetUp]
public void Init()
public SQLiteUserAccountData(string connectionString, string realm)
: base(connectionString, realm, "UserAccount")
{
SuperInit();
// If we manage to connect to the database with the user
// and password above it is our test database, and run
// these tests. If anything goes wrong, ignore these
// tests.
try
{
database = new MySQLManager(connect);
db = new MySQLUserData();
db.Initialise(connect);
}
catch (Exception e)
{
m_log.Error("Exception {0}", e);
Assert.Ignore();
}
}
[TestFixtureTearDown]
public void Cleanup()
public UserAccountData[] GetUsers(UUID scopeID, string query)
{
if (db != null)
string[] words = query.Split(new char[] {' '});
for (int i = 0 ; i < words.Length ; i++)
{
db.Dispose();
if (words[i].Length < 3)
{
if (i != words.Length - 1)
Array.Copy(words, i + 1, words, i, words.Length - i - 1);
Array.Resize(ref words, words.Length - 1);
}
}
// if a new table is added, it has to be dropped here
if (database != null)
if (words.Length == 0)
return new UserAccountData[0];
if (words.Length > 2)
return new UserAccountData[0];
SqliteCommand cmd = new SqliteCommand();
if (words.Length == 1)
{
database.ExecuteSql("drop table migrations");
database.ExecuteSql("drop table users");
database.ExecuteSql("drop table userfriends");
database.ExecuteSql("drop table agents");
database.ExecuteSql("drop table avatarappearance");
database.ExecuteSql("drop table avatarattachments");
cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
m_Realm, scopeID.ToString(), words[0]);
}
else
{
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')",
m_Realm, scopeID.ToString(), words[0], words[1]);
}
return DoQuery(cmd);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -115,7 +115,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
return ExecuteNonQuery(cmd) == 0 ? false : true;
return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true;
}
public XInventoryItem[] GetActiveGestures(UUID principalID)
@ -137,7 +137,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
IDataReader reader = ExecuteReader(cmd);
IDataReader reader = ExecuteReader(cmd, m_Connection);
int perms = 0;
@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite
}
reader.Close();
CloseReaderCommand(cmd);
CloseCommand(cmd);
return perms;
}

View File

@ -73,17 +73,23 @@ namespace OpenSim.Data.Tests
a2.Data = asset1;
a3.Data = asset1;
a1.Metadata.ContentType = "application/octet-stream";
a2.Metadata.ContentType = "application/octet-stream";
a3.Metadata.ContentType = "application/octet-stream";
PropertyScrambler<AssetBase> scrambler = new PropertyScrambler<AssetBase>()
.DontScramble(x => x.Data)
.DontScramble(x => x.ID)
.DontScramble(x => x.FullID)
.DontScramble(x => x.Metadata.ID)
.DontScramble(x => x.Metadata.ContentType)
.DontScramble(x => x.Metadata.FullID);
scrambler.Scramble(a1);
scrambler.Scramble(a2);
scrambler.Scramble(a3);
db.StoreAsset(a1);
db.StoreAsset(a2);
db.StoreAsset(a3);

View File

@ -1,173 +0,0 @@
/*
* 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.Text;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
namespace OpenSim.Data.Tests
{
public class BasicGridTest
{
public IGridDataPlugin db;
public UUID region1, region2, region3;
public UUID zero = UUID.Zero;
public static Random random = new Random();
[TearDown]
public void removeAllRegions()
{
// Clean up all the regions.
List<RegionProfileData> regions = db.GetRegionsByName("", 100);
if (regions != null)
{
foreach (RegionProfileData region in regions)
{
db.DeleteProfile(region.Uuid.ToString());
}
}
}
public void SuperInit()
{
OpenSim.Tests.Common.TestLogging.LogToConsole();
region1 = UUID.Random();
region2 = UUID.Random();
region3 = UUID.Random();
}
protected RegionProfileData createRegion(UUID regionUUID, string regionName)
{
RegionProfileData reg = new RegionProfileData();
new PropertyScrambler<RegionProfileData>().Scramble(reg);
reg.Uuid = regionUUID;
reg.RegionName = regionName;
db.StoreProfile(reg);
return reg;
}
[Test]
public void T001_LoadEmpty()
{
Assert.That(db.GetProfileByUUID(region1),Is.Null);
Assert.That(db.GetProfileByUUID(region2),Is.Null);
Assert.That(db.GetProfileByUUID(region3),Is.Null);
Assert.That(db.GetProfileByUUID(zero),Is.Null);
}
[Test]
public void T011_AddRetrieveCompleteTest()
{
RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|");
RegionProfileData retreg = db.GetProfileByUUID(region2);
Assert.That(retreg, Constraints.PropertyCompareConstraint(newreg).IgnoreProperty(x => x.RegionOnline));
retreg = db.GetProfileByHandle(newreg.RegionHandle);
Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))");
retreg = db.GetProfileByString(newreg.RegionName);
Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))");
RegionProfileData[] retregs = db.GetProfilesInRange(newreg.RegionLocX,newreg.RegionLocY,newreg.RegionLocX,newreg.RegionLocY);
Assert.That(retregs[0].Uuid, Is.EqualTo(region2), "Assert.That(retregs[0].Uuid, Is.EqualTo(region2))");
}
[Test]
public void T012_DeleteProfile()
{
createRegion(region1, "doesn't matter");
db.DeleteProfile(region1.ToString());
RegionProfileData retreg = db.GetProfileByUUID(region1);
Assert.That(retreg,Is.Null);
}
[Test]
public void T013_UpdateProfile()
{
createRegion(region2, "|<Goth@m Ci1y>|");
RegionProfileData retreg = db.GetProfileByUUID(region2);
retreg.regionName = "Gotham City";
db.StoreProfile(retreg);
retreg = db.GetProfileByUUID(region2);
Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))");
}
[Test]
public void T014_RegionList()
{
createRegion(region2, "Gotham City");
RegionProfileData retreg = db.GetProfileByUUID(region2);
retreg.RegionName = "Gotham Town";
retreg.Uuid = region1;
db.StoreProfile(retreg);
retreg = db.GetProfileByUUID(region2);
retreg.RegionName = "Gothan Town";
retreg.Uuid = region3;
db.StoreProfile(retreg);
List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10);
Assert.That(listreg.Count,Is.EqualTo(2), "Assert.That(listreg.Count,Is.EqualTo(2))");
Assert.That(listreg[0].Uuid,Is.Not.EqualTo(listreg[1].Uuid), "Assert.That(listreg[0].Uuid,Is.Not.EqualTo(listreg[1].Uuid))");
Assert.That(listreg[0].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[0].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))");
Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))");
}
[Test]
public void T999_StillNull()
{
Assert.That(db.GetProfileByUUID(zero), Is.Null);
}
protected static string RandomName()
{
StringBuilder name = new StringBuilder();
int size = random.Next(5,12);
char ch ;
for (int i=0; i<size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
name.Append(ch);
}
return name.ToString();
}
}
}

View File

@ -524,7 +524,7 @@ namespace OpenSim.Data.Tests
}
}
[Test]
//[Test]
public void T016_RandomSogWithSceneParts()
{
PropertyScrambler<SceneObjectPart> scrambler =

View File

@ -1,703 +0,0 @@
/*
* 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.
*/
// TODO: Money Transfer, Inventory Transfer and UpdateUserRegion once they exist
using System;
using System.Collections.Generic;
using System.Text;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using log4net;
using System.Reflection;
namespace OpenSim.Data.Tests
{
public class BasicUserTest
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public IUserDataPlugin db;
public UUID user1;
public UUID user2;
public UUID user3;
public UUID user4;
public UUID user5;
public UUID webkey;
public UUID zero = UUID.Zero;
public static Random random;
public UUID agent1;
public UUID agent2;
public UUID agent3;
public UUID agent4;
public UUID region1;
public string fname0;
public string lname0;
public string fname1;
public string lname1;
public string fname2;
public string lname2;
public string fname3;
public string lname3;
public void SuperInit()
{
OpenSim.Tests.Common.TestLogging.LogToConsole();
random = new Random();
user1 = UUID.Random();
user2 = UUID.Random();
user3 = UUID.Random();
user4 = UUID.Random();
user5 = UUID.Random();
agent1 = UUID.Random();
agent2 = UUID.Random();
agent3 = UUID.Random();
agent4 = UUID.Random();
webkey = UUID.Random();
region1 = UUID.Random();
fname0 = RandomName();
lname0 = RandomName();
fname1 = RandomName();
lname1 = RandomName();
fname2 = RandomName();
lname2 = RandomName();
fname3 = RandomName();
lname3 = RandomName();
}
[Test]
public void T001_LoadEmpty()
{
Assert.That(db.GetUserByUUID(zero), Is.Null);
Assert.That(db.GetUserByUUID(user1), Is.Null);
Assert.That(db.GetUserByUUID(user2), Is.Null);
Assert.That(db.GetUserByUUID(user3), Is.Null);
Assert.That(db.GetUserByUUID(UUID.Random()), Is.Null);
Assert.That(db.GetAgentByUUID(zero), Is.Null);
Assert.That(db.GetAgentByUUID(agent1), Is.Null);
Assert.That(db.GetAgentByUUID(agent2), Is.Null);
Assert.That(db.GetAgentByUUID(agent3), Is.Null);
Assert.That(db.GetAgentByUUID(UUID.Random()), Is.Null);
}
[Test]
public void T010_CreateUser()
{
UserProfileData u1 = NewUser(user1,fname1,lname1);
UserProfileData u2 = NewUser(user2,fname2,lname2);
UserProfileData u3 = NewUser(user3,fname3,lname3);
// this is used to check whether null works here
u3.Email = null;
db.AddNewUserProfile(u1);
db.AddNewUserProfile(u2);
db.AddNewUserProfile(u3);
UserProfileData u1a = db.GetUserByUUID(user1);
UserProfileData u2a = db.GetUserByUUID(user2);
UserProfileData u3a = db.GetUserByUUID(user3);
Assert.That(user1,Is.EqualTo(u1a.ID), "Assert.That(user1,Is.EqualTo(u1a.ID))");
Assert.That(user2,Is.EqualTo(u2a.ID), "Assert.That(user2,Is.EqualTo(u2a.ID))");
Assert.That(user3,Is.EqualTo(u3a.ID), "Assert.That(user3,Is.EqualTo(u3a.ID))");
// and one email test
Assert.That(u3.Email, Is.Null);
}
[Test]
public void T011_FetchUserByName()
{
UserProfileData u1 = db.GetUserByName(fname1,lname1);
UserProfileData u2 = db.GetUserByName(fname2,lname2);
UserProfileData u3 = db.GetUserByName(fname3,lname3);
Assert.That(user1,Is.EqualTo(u1.ID), "Assert.That(user1,Is.EqualTo(u1.ID))");
Assert.That(user2,Is.EqualTo(u2.ID), "Assert.That(user2,Is.EqualTo(u2.ID))");
Assert.That(user3,Is.EqualTo(u3.ID), "Assert.That(user3,Is.EqualTo(u3.ID))");
}
[Test]
public void T012_UpdateUserProfile()
{
UserProfileData u1 = db.GetUserByUUID(user1);
Assert.That(fname1,Is.EqualTo(u1.FirstName), "Assert.That(fname1,Is.EqualTo(u1.FirstName))");
u1.FirstName = "Ugly";
db.UpdateUserProfile(u1);
Assert.That("Ugly",Is.EqualTo(u1.FirstName), "Assert.That(\"Ugly\",Is.EqualTo(u1.FirstName))");
}
[Test]
public void T013_StoreUserWebKey()
{
UserProfileData u1 = db.GetUserByUUID(user1);
Assert.That(u1.WebLoginKey,Is.EqualTo(zero), "Assert.That(u1.WebLoginKey,Is.EqualTo(zero))");
db.StoreWebLoginKey(user1, webkey);
u1 = db.GetUserByUUID(user1);
Assert.That(u1.WebLoginKey,Is.EqualTo(webkey), "Assert.That(u1.WebLoginKey,Is.EqualTo(webkey))");
}
[Test]
public void T014_ExpectedNullReferenceReturns()
{
UserProfileData u0 = NewUser(zero,fname0,lname0);
UserProfileData u4 = NewUser(user4,fname2,lname2);
db.AddNewUserProfile(u0); //UserID 0 should fail to save.
db.AddNewUserProfile(u4); //The first name and last name are already in use (from T010), so this should fail too
Assert.That(db.GetUserByUUID(zero),Is.Null);
Assert.That(db.GetUserByUUID(user4),Is.Null);
}
[Test]
public void T015_UserPersistency()
{
UserProfileData u = new UserProfileData();
UUID id = user5;
string fname = RandomName();
string lname = RandomName();
string email = RandomName();
string passhash = RandomName();
string passsalt = RandomName();
UUID homeregion = UUID.Random();
UUID webloginkey = UUID.Random();
uint homeregx = (uint) random.Next();
uint homeregy = (uint) random.Next();
Vector3 homeloc
= new Vector3(
(float)Math.Round(random.NextDouble(), 5),
(float)Math.Round(random.NextDouble(), 5),
(float)Math.Round(random.NextDouble(), 5));
Vector3 homelookat
= new Vector3(
(float)Math.Round(random.NextDouble(), 5),
(float)Math.Round(random.NextDouble(), 5),
(float)Math.Round(random.NextDouble(), 5));
int created = random.Next();
int lastlogin = random.Next();
string userinvuri = RandomName();
string userasseturi = RandomName();
uint candomask = (uint) random.Next();
uint wantdomask = (uint) random.Next();
string abouttext = RandomName();
string flabouttext = RandomName();
UUID image = UUID.Random();
UUID firstimage = UUID.Random();
UserAgentData agent = NewAgent(id,UUID.Random());
int userflags = random.Next();
int godlevel = random.Next();
string customtype = RandomName();
UUID partner = UUID.Random();
//HomeRegionX and HomeRegionY must only use 24 bits
homeregx = ((homeregx << 8) >> 8);
homeregy = ((homeregy << 8) >> 8);
u.ID = id;
u.WebLoginKey = webloginkey;
u.HomeRegionID = homeregion;
u.FirstName = fname;
u.SurName = lname;
u.Email = email;
u.PasswordHash = passhash;
u.PasswordSalt = passsalt;
u.HomeRegionX = homeregx;
u.HomeRegionY = homeregy;
ulong homereg = u.HomeRegion;
u.HomeLocation = homeloc;
u.HomeLookAt = homelookat;
u.Created = created;
u.LastLogin = lastlogin;
u.UserInventoryURI = userinvuri;
u.UserAssetURI = userasseturi;
u.CanDoMask = candomask;
u.WantDoMask = wantdomask;
u.AboutText = abouttext;
u.FirstLifeAboutText = flabouttext;
u.Image = image;
u.FirstLifeImage = firstimage;
u.CurrentAgent = agent;
u.UserFlags = userflags;
u.GodLevel = godlevel;
u.CustomType = customtype;
u.Partner = partner;
db.AddNewUserProfile(u);
UserProfileData u1a = db.GetUserByUUID(id);
Assert.That(u1a,Is.Not.Null);
Assert.That(id,Is.EqualTo(u1a.ID), "Assert.That(id,Is.EqualTo(u1a.ID))");
Assert.That(homeregion,Is.EqualTo(u1a.HomeRegionID), "Assert.That(homeregion,Is.EqualTo(u1a.HomeRegionID))");
Assert.That(webloginkey,Is.EqualTo(u1a.WebLoginKey), "Assert.That(webloginkey,Is.EqualTo(u1a.WebLoginKey))");
Assert.That(fname,Is.EqualTo(u1a.FirstName), "Assert.That(fname,Is.EqualTo(u1a.FirstName))");
Assert.That(lname,Is.EqualTo(u1a.SurName), "Assert.That(lname,Is.EqualTo(u1a.SurName))");
Assert.That(email,Is.EqualTo(u1a.Email), "Assert.That(email,Is.EqualTo(u1a.Email))");
Assert.That(passhash,Is.EqualTo(u1a.PasswordHash), "Assert.That(passhash,Is.EqualTo(u1a.PasswordHash))");
Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt), "Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt))");
Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX), "Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX))");
Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY), "Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY))");
Assert.That(homereg,Is.EqualTo(u1a.HomeRegion), "Assert.That(homereg,Is.EqualTo(u1a.HomeRegion))");
Assert.That(homeloc,Is.EqualTo(u1a.HomeLocation), "Assert.That(homeloc,Is.EqualTo(u1a.HomeLocation))");
Assert.That(homelookat,Is.EqualTo(u1a.HomeLookAt), "Assert.That(homelookat,Is.EqualTo(u1a.HomeLookAt))");
Assert.That(created,Is.EqualTo(u1a.Created), "Assert.That(created,Is.EqualTo(u1a.Created))");
Assert.That(lastlogin,Is.EqualTo(u1a.LastLogin), "Assert.That(lastlogin,Is.EqualTo(u1a.LastLogin))");
Assert.That(userinvuri,Is.EqualTo(u1a.UserInventoryURI), "Assert.That(userinvuri,Is.EqualTo(u1a.UserInventoryURI))");
Assert.That(userasseturi,Is.EqualTo(u1a.UserAssetURI), "Assert.That(userasseturi,Is.EqualTo(u1a.UserAssetURI))");
Assert.That(candomask,Is.EqualTo(u1a.CanDoMask), "Assert.That(candomask,Is.EqualTo(u1a.CanDoMask))");
Assert.That(wantdomask,Is.EqualTo(u1a.WantDoMask), "Assert.That(wantdomask,Is.EqualTo(u1a.WantDoMask))");
Assert.That(abouttext,Is.EqualTo(u1a.AboutText), "Assert.That(abouttext,Is.EqualTo(u1a.AboutText))");
Assert.That(flabouttext,Is.EqualTo(u1a.FirstLifeAboutText), "Assert.That(flabouttext,Is.EqualTo(u1a.FirstLifeAboutText))");
Assert.That(image,Is.EqualTo(u1a.Image), "Assert.That(image,Is.EqualTo(u1a.Image))");
Assert.That(firstimage,Is.EqualTo(u1a.FirstLifeImage), "Assert.That(firstimage,Is.EqualTo(u1a.FirstLifeImage))");
Assert.That(u1a.CurrentAgent,Is.Null);
Assert.That(userflags,Is.EqualTo(u1a.UserFlags), "Assert.That(userflags,Is.EqualTo(u1a.UserFlags))");
Assert.That(godlevel,Is.EqualTo(u1a.GodLevel), "Assert.That(godlevel,Is.EqualTo(u1a.GodLevel))");
Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))");
Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))");
}
[Test]
public void T016_UserUpdatePersistency()
{
UUID id = user5;
UserProfileData u = db.GetUserByUUID(id);
string fname = RandomName();
string lname = RandomName();
string email = RandomName();
string passhash = RandomName();
string passsalt = RandomName();
UUID homeregionid = UUID.Random();
UUID webloginkey = UUID.Random();
uint homeregx = (uint) random.Next();
uint homeregy = (uint) random.Next();
Vector3 homeloc = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
Vector3 homelookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
int created = random.Next();
int lastlogin = random.Next();
string userinvuri = RandomName();
string userasseturi = RandomName();
uint candomask = (uint) random.Next();
uint wantdomask = (uint) random.Next();
string abouttext = RandomName();
string flabouttext = RandomName();
UUID image = UUID.Random();
UUID firstimage = UUID.Random();
UserAgentData agent = NewAgent(id,UUID.Random());
int userflags = random.Next();
int godlevel = random.Next();
string customtype = RandomName();
UUID partner = UUID.Random();
//HomeRegionX and HomeRegionY must only use 24 bits
homeregx = ((homeregx << 8) >> 8);
homeregy = ((homeregy << 8) >> 8);
u.WebLoginKey = webloginkey;
u.HomeRegionID = homeregionid;
u.FirstName = fname;
u.SurName = lname;
u.Email = email;
u.PasswordHash = passhash;
u.PasswordSalt = passsalt;
u.HomeRegionX = homeregx;
u.HomeRegionY = homeregy;
ulong homereg = u.HomeRegion;
u.HomeLocation = homeloc;
u.HomeLookAt = homelookat;
u.Created = created;
u.LastLogin = lastlogin;
u.UserInventoryURI = userinvuri;
u.UserAssetURI = userasseturi;
u.CanDoMask = candomask;
u.WantDoMask = wantdomask;
u.AboutText = abouttext;
u.FirstLifeAboutText = flabouttext;
u.Image = image;
u.FirstLifeImage = firstimage;
u.CurrentAgent = agent;
u.UserFlags = userflags;
u.GodLevel = godlevel;
u.CustomType = customtype;
u.Partner = partner;
db.UpdateUserProfile(u);
UserProfileData u1a = db.GetUserByUUID(id);
Assert.That(u1a,Is.Not.Null);
Assert.That(id,Is.EqualTo(u1a.ID), "Assert.That(id,Is.EqualTo(u1a.ID))");
Assert.That(homeregionid,Is.EqualTo(u1a.HomeRegionID), "Assert.That(homeregionid,Is.EqualTo(u1a.HomeRegionID))");
Assert.That(webloginkey,Is.EqualTo(u1a.WebLoginKey), "Assert.That(webloginkey,Is.EqualTo(u1a.WebLoginKey))");
Assert.That(fname,Is.EqualTo(u1a.FirstName), "Assert.That(fname,Is.EqualTo(u1a.FirstName))");
Assert.That(lname,Is.EqualTo(u1a.SurName), "Assert.That(lname,Is.EqualTo(u1a.SurName))");
Assert.That(email,Is.EqualTo(u1a.Email), "Assert.That(email,Is.EqualTo(u1a.Email))");
Assert.That(passhash,Is.EqualTo(u1a.PasswordHash), "Assert.That(passhash,Is.EqualTo(u1a.PasswordHash))");
Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt), "Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt))");
Assert.That(homereg,Is.EqualTo(u1a.HomeRegion), "Assert.That(homereg,Is.EqualTo(u1a.HomeRegion))");
Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX), "Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX))");
Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY), "Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY))");
Assert.That(homereg,Is.EqualTo(u1a.HomeRegion), "Assert.That(homereg,Is.EqualTo(u1a.HomeRegion))");
Assert.That(homeloc,Is.EqualTo(u1a.HomeLocation), "Assert.That(homeloc,Is.EqualTo(u1a.HomeLocation))");
Assert.That(homelookat,Is.EqualTo(u1a.HomeLookAt), "Assert.That(homelookat,Is.EqualTo(u1a.HomeLookAt))");
Assert.That(created,Is.EqualTo(u1a.Created), "Assert.That(created,Is.EqualTo(u1a.Created))");
Assert.That(lastlogin,Is.EqualTo(u1a.LastLogin), "Assert.That(lastlogin,Is.EqualTo(u1a.LastLogin))");
Assert.That(userasseturi,Is.EqualTo(u1a.UserAssetURI), "Assert.That(userasseturi,Is.EqualTo(u1a.UserAssetURI))");
Assert.That(candomask,Is.EqualTo(u1a.CanDoMask), "Assert.That(candomask,Is.EqualTo(u1a.CanDoMask))");
Assert.That(wantdomask,Is.EqualTo(u1a.WantDoMask), "Assert.That(wantdomask,Is.EqualTo(u1a.WantDoMask))");
Assert.That(abouttext,Is.EqualTo(u1a.AboutText), "Assert.That(abouttext,Is.EqualTo(u1a.AboutText))");
Assert.That(flabouttext,Is.EqualTo(u1a.FirstLifeAboutText), "Assert.That(flabouttext,Is.EqualTo(u1a.FirstLifeAboutText))");
Assert.That(image,Is.EqualTo(u1a.Image), "Assert.That(image,Is.EqualTo(u1a.Image))");
Assert.That(firstimage,Is.EqualTo(u1a.FirstLifeImage), "Assert.That(firstimage,Is.EqualTo(u1a.FirstLifeImage))");
Assert.That(u1a.CurrentAgent,Is.Null);
Assert.That(userflags,Is.EqualTo(u1a.UserFlags), "Assert.That(userflags,Is.EqualTo(u1a.UserFlags))");
Assert.That(godlevel,Is.EqualTo(u1a.GodLevel), "Assert.That(godlevel,Is.EqualTo(u1a.GodLevel))");
Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))");
Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))");
}
[Test]
public void T017_UserUpdateRandomPersistency()
{
UUID id = user5;
UserProfileData u = db.GetUserByUUID(id);
new PropertyScrambler<UserProfileData>().DontScramble(x=>x.ID).Scramble(u);
db.UpdateUserProfile(u);
UserProfileData u1a = db.GetUserByUUID(id);
Assert.That(u1a, Constraints.PropertyCompareConstraint(u)
.IgnoreProperty(x=>x.HomeRegionX)
.IgnoreProperty(x=>x.HomeRegionY)
);
}
[Test]
public void T020_CreateAgent()
{
UserAgentData a1 = NewAgent(user1,agent1);
UserAgentData a2 = NewAgent(user2,agent2);
UserAgentData a3 = NewAgent(user3,agent3);
db.AddNewUserAgent(a1);
db.AddNewUserAgent(a2);
db.AddNewUserAgent(a3);
UserAgentData a1a = db.GetAgentByUUID(user1);
UserAgentData a2a = db.GetAgentByUUID(user2);
UserAgentData a3a = db.GetAgentByUUID(user3);
Assert.That(agent1,Is.EqualTo(a1a.SessionID), "Assert.That(agent1,Is.EqualTo(a1a.SessionID))");
Assert.That(user1,Is.EqualTo(a1a.ProfileID), "Assert.That(user1,Is.EqualTo(a1a.ProfileID))");
Assert.That(agent2,Is.EqualTo(a2a.SessionID), "Assert.That(agent2,Is.EqualTo(a2a.SessionID))");
Assert.That(user2,Is.EqualTo(a2a.ProfileID), "Assert.That(user2,Is.EqualTo(a2a.ProfileID))");
Assert.That(agent3,Is.EqualTo(a3a.SessionID), "Assert.That(agent3,Is.EqualTo(a3a.SessionID))");
Assert.That(user3,Is.EqualTo(a3a.ProfileID), "Assert.That(user3,Is.EqualTo(a3a.ProfileID))");
}
[Test]
public void T021_FetchAgentByName()
{
String name3 = fname3 + " " + lname3;
UserAgentData a2 = db.GetAgentByName(fname2,lname2);
UserAgentData a3 = db.GetAgentByName(name3);
Assert.That(user2,Is.EqualTo(a2.ProfileID), "Assert.That(user2,Is.EqualTo(a2.ProfileID))");
Assert.That(user3,Is.EqualTo(a3.ProfileID), "Assert.That(user3,Is.EqualTo(a3.ProfileID))");
}
[Test]
public void T022_ExceptionalCases()
{
UserAgentData a0 = NewAgent(user4,zero);
UserAgentData a4 = NewAgent(zero,agent4);
db.AddNewUserAgent(a0);
db.AddNewUserAgent(a4);
Assert.That(db.GetAgentByUUID(user4),Is.Null);
Assert.That(db.GetAgentByUUID(zero),Is.Null);
}
[Test]
public void T023_AgentPersistency()
{
UUID user = user4;
UUID agent = agent4;
UUID secureagent = UUID.Random();
string agentip = RandomName();
uint agentport = (uint)random.Next();
bool agentonline = (random.NextDouble() > 0.5);
int logintime = random.Next();
int logouttime = random.Next();
UUID regionid = UUID.Random();
ulong regionhandle = (ulong) random.Next();
Vector3 currentpos = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
Vector3 currentlookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
UUID orgregionid = UUID.Random();
UserAgentData a = new UserAgentData();
a.ProfileID = user;
a.SessionID = agent;
a.SecureSessionID = secureagent;
a.AgentIP = agentip;
a.AgentPort = agentport;
a.AgentOnline = agentonline;
a.LoginTime = logintime;
a.LogoutTime = logouttime;
a.Region = regionid;
a.Handle = regionhandle;
a.Position = currentpos;
a.LookAt = currentlookat;
a.InitialRegion = orgregionid;
db.AddNewUserAgent(a);
UserAgentData a1 = db.GetAgentByUUID(user4);
Assert.That(user,Is.EqualTo(a1.ProfileID), "Assert.That(user,Is.EqualTo(a1.ProfileID))");
Assert.That(agent,Is.EqualTo(a1.SessionID), "Assert.That(agent,Is.EqualTo(a1.SessionID))");
Assert.That(secureagent,Is.EqualTo(a1.SecureSessionID), "Assert.That(secureagent,Is.EqualTo(a1.SecureSessionID))");
Assert.That(agentip,Is.EqualTo(a1.AgentIP), "Assert.That(agentip,Is.EqualTo(a1.AgentIP))");
Assert.That(agentport,Is.EqualTo(a1.AgentPort), "Assert.That(agentport,Is.EqualTo(a1.AgentPort))");
Assert.That(agentonline,Is.EqualTo(a1.AgentOnline), "Assert.That(agentonline,Is.EqualTo(a1.AgentOnline))");
Assert.That(logintime,Is.EqualTo(a1.LoginTime), "Assert.That(logintime,Is.EqualTo(a1.LoginTime))");
Assert.That(logouttime,Is.EqualTo(a1.LogoutTime), "Assert.That(logouttime,Is.EqualTo(a1.LogoutTime))");
Assert.That(regionid,Is.EqualTo(a1.Region), "Assert.That(regionid,Is.EqualTo(a1.Region))");
Assert.That(regionhandle,Is.EqualTo(a1.Handle), "Assert.That(regionhandle,Is.EqualTo(a1.Handle))");
Assert.That(currentpos,Is.EqualTo(a1.Position), "Assert.That(currentpos,Is.EqualTo(a1.Position))");
Assert.That(currentlookat,Is.EqualTo(a1.LookAt), "Assert.That(currentlookat,Is.EqualTo(a1.LookAt))");
}
[Test]
public void T030_CreateFriendList()
{
Dictionary<UUID, uint> perms = new Dictionary<UUID,uint>();
Dictionary<UUID, int> friends = new Dictionary<UUID,int>();
uint temp;
int tempu1, tempu2;
db.AddNewUserFriend(user1,user2, 1);
db.AddNewUserFriend(user1,user3, 2);
db.AddNewUserFriend(user1,user2, 4);
List<FriendListItem> fl1 = db.GetUserFriendList(user1);
Assert.That(fl1.Count,Is.EqualTo(2), "Assert.That(fl1.Count,Is.EqualTo(2))");
perms.Add(user2,1);
perms.Add(user3,2);
for (int i = 0; i < fl1.Count; i++)
{
Assert.That(user1,Is.EqualTo(fl1[i].FriendListOwner), "Assert.That(user1,Is.EqualTo(fl1[i].FriendListOwner))");
friends.Add(fl1[i].Friend,1);
temp = perms[fl1[i].Friend];
Assert.That(temp,Is.EqualTo(fl1[i].FriendPerms), "Assert.That(temp,Is.EqualTo(fl1[i].FriendPerms))");
}
tempu1 = friends[user2];
tempu2 = friends[user3];
Assert.That(1,Is.EqualTo(tempu1) & Is.EqualTo(tempu2), "Assert.That(1,Is.EqualTo(tempu1) & Is.EqualTo(tempu2))");
}
[Test]
public void T031_RemoveUserFriend()
// user1 has 2 friends, user2 and user3.
{
List<FriendListItem> fl1 = db.GetUserFriendList(user1);
List<FriendListItem> fl2 = db.GetUserFriendList(user2);
Assert.That(fl1.Count,Is.EqualTo(2), "Assert.That(fl1.Count,Is.EqualTo(2))");
Assert.That(fl1[0].Friend,Is.EqualTo(user2) | Is.EqualTo(user3), "Assert.That(fl1[0].Friend,Is.EqualTo(user2) | Is.EqualTo(user3))");
Assert.That(fl2[0].Friend,Is.EqualTo(user1), "Assert.That(fl2[0].Friend,Is.EqualTo(user1))");
db.RemoveUserFriend(user2, user1);
fl1 = db.GetUserFriendList(user1);
fl2 = db.GetUserFriendList(user2);
Assert.That(fl1.Count,Is.EqualTo(1), "Assert.That(fl1.Count,Is.EqualTo(1))");
Assert.That(fl1[0].Friend, Is.EqualTo(user3), "Assert.That(fl1[0].Friend, Is.EqualTo(user3))");
Assert.That(fl2, Is.Empty);
}
[Test]
public void T032_UpdateFriendPerms()
// user1 has 1 friend, user3, who has permission 2 in T030.
{
List<FriendListItem> fl1 = db.GetUserFriendList(user1);
Assert.That(fl1[0].FriendPerms,Is.EqualTo(2), "Assert.That(fl1[0].FriendPerms,Is.EqualTo(2))");
db.UpdateUserFriendPerms(user1, user3, 4);
fl1 = db.GetUserFriendList(user1);
Assert.That(fl1[0].FriendPerms,Is.EqualTo(4), "Assert.That(fl1[0].FriendPerms,Is.EqualTo(4))");
}
[Test]
public void T040_UserAppearance()
{
AvatarAppearance appear = new AvatarAppearance();
appear.Owner = user1;
db.UpdateUserAppearance(user1, appear);
AvatarAppearance user1app = db.GetUserAppearance(user1);
Assert.That(user1,Is.EqualTo(user1app.Owner), "Assert.That(user1,Is.EqualTo(user1app.Owner))");
}
[Test]
public void T041_UserAppearancePersistency()
{
AvatarAppearance appear = new AvatarAppearance();
UUID owner = UUID.Random();
int serial = random.Next();
byte[] visualp = new byte[218];
random.NextBytes(visualp);
UUID bodyitem = UUID.Random();
UUID bodyasset = UUID.Random();
UUID skinitem = UUID.Random();
UUID skinasset = UUID.Random();
UUID hairitem = UUID.Random();
UUID hairasset = UUID.Random();
UUID eyesitem = UUID.Random();
UUID eyesasset = UUID.Random();
UUID shirtitem = UUID.Random();
UUID shirtasset = UUID.Random();
UUID pantsitem = UUID.Random();
UUID pantsasset = UUID.Random();
UUID shoesitem = UUID.Random();
UUID shoesasset = UUID.Random();
UUID socksitem = UUID.Random();
UUID socksasset = UUID.Random();
UUID jacketitem = UUID.Random();
UUID jacketasset = UUID.Random();
UUID glovesitem = UUID.Random();
UUID glovesasset = UUID.Random();
UUID ushirtitem = UUID.Random();
UUID ushirtasset = UUID.Random();
UUID upantsitem = UUID.Random();
UUID upantsasset = UUID.Random();
UUID skirtitem = UUID.Random();
UUID skirtasset = UUID.Random();
Primitive.TextureEntry texture = AvatarAppearance.GetDefaultTexture();
float avatarheight = (float) (Math.Round(random.NextDouble(),5));
appear.Owner = owner;
appear.Serial = serial;
appear.VisualParams = visualp;
appear.BodyItem = bodyitem;
appear.BodyAsset = bodyasset;
appear.SkinItem = skinitem;
appear.SkinAsset = skinasset;
appear.HairItem = hairitem;
appear.HairAsset = hairasset;
appear.EyesItem = eyesitem;
appear.EyesAsset = eyesasset;
appear.ShirtItem = shirtitem;
appear.ShirtAsset = shirtasset;
appear.PantsItem = pantsitem;
appear.PantsAsset = pantsasset;
appear.ShoesItem = shoesitem;
appear.ShoesAsset = shoesasset;
appear.SocksItem = socksitem;
appear.SocksAsset = socksasset;
appear.JacketItem = jacketitem;
appear.JacketAsset = jacketasset;
appear.GlovesItem = glovesitem;
appear.GlovesAsset = glovesasset;
appear.UnderShirtItem = ushirtitem;
appear.UnderShirtAsset = ushirtasset;
appear.UnderPantsItem = upantsitem;
appear.UnderPantsAsset = upantsasset;
appear.SkirtItem = skirtitem;
appear.SkirtAsset = skirtasset;
appear.Texture = texture;
appear.AvatarHeight = avatarheight;
db.UpdateUserAppearance(owner, appear);
AvatarAppearance app = db.GetUserAppearance(owner);
Assert.That(owner,Is.EqualTo(app.Owner), "Assert.That(owner,Is.EqualTo(app.Owner))");
Assert.That(serial,Is.EqualTo(app.Serial), "Assert.That(serial,Is.EqualTo(app.Serial))");
Assert.That(visualp,Is.EqualTo(app.VisualParams), "Assert.That(visualp,Is.EqualTo(app.VisualParams))");
Assert.That(bodyitem,Is.EqualTo(app.BodyItem), "Assert.That(bodyitem,Is.EqualTo(app.BodyItem))");
Assert.That(bodyasset,Is.EqualTo(app.BodyAsset), "Assert.That(bodyasset,Is.EqualTo(app.BodyAsset))");
Assert.That(skinitem,Is.EqualTo(app.SkinItem), "Assert.That(skinitem,Is.EqualTo(app.SkinItem))");
Assert.That(skinasset,Is.EqualTo(app.SkinAsset), "Assert.That(skinasset,Is.EqualTo(app.SkinAsset))");
Assert.That(hairitem,Is.EqualTo(app.HairItem), "Assert.That(hairitem,Is.EqualTo(app.HairItem))");
Assert.That(hairasset,Is.EqualTo(app.HairAsset), "Assert.That(hairasset,Is.EqualTo(app.HairAsset))");
Assert.That(eyesitem,Is.EqualTo(app.EyesItem), "Assert.That(eyesitem,Is.EqualTo(app.EyesItem))");
Assert.That(eyesasset,Is.EqualTo(app.EyesAsset), "Assert.That(eyesasset,Is.EqualTo(app.EyesAsset))");
Assert.That(shirtitem,Is.EqualTo(app.ShirtItem), "Assert.That(shirtitem,Is.EqualTo(app.ShirtItem))");
Assert.That(shirtasset,Is.EqualTo(app.ShirtAsset), "Assert.That(shirtasset,Is.EqualTo(app.ShirtAsset))");
Assert.That(pantsitem,Is.EqualTo(app.PantsItem), "Assert.That(pantsitem,Is.EqualTo(app.PantsItem))");
Assert.That(pantsasset,Is.EqualTo(app.PantsAsset), "Assert.That(pantsasset,Is.EqualTo(app.PantsAsset))");
Assert.That(shoesitem,Is.EqualTo(app.ShoesItem), "Assert.That(shoesitem,Is.EqualTo(app.ShoesItem))");
Assert.That(shoesasset,Is.EqualTo(app.ShoesAsset), "Assert.That(shoesasset,Is.EqualTo(app.ShoesAsset))");
Assert.That(socksitem,Is.EqualTo(app.SocksItem), "Assert.That(socksitem,Is.EqualTo(app.SocksItem))");
Assert.That(socksasset,Is.EqualTo(app.SocksAsset), "Assert.That(socksasset,Is.EqualTo(app.SocksAsset))");
Assert.That(jacketitem,Is.EqualTo(app.JacketItem), "Assert.That(jacketitem,Is.EqualTo(app.JacketItem))");
Assert.That(jacketasset,Is.EqualTo(app.JacketAsset), "Assert.That(jacketasset,Is.EqualTo(app.JacketAsset))");
Assert.That(glovesitem,Is.EqualTo(app.GlovesItem), "Assert.That(glovesitem,Is.EqualTo(app.GlovesItem))");
Assert.That(glovesasset,Is.EqualTo(app.GlovesAsset), "Assert.That(glovesasset,Is.EqualTo(app.GlovesAsset))");
Assert.That(ushirtitem,Is.EqualTo(app.UnderShirtItem), "Assert.That(ushirtitem,Is.EqualTo(app.UnderShirtItem))");
Assert.That(ushirtasset,Is.EqualTo(app.UnderShirtAsset), "Assert.That(ushirtasset,Is.EqualTo(app.UnderShirtAsset))");
Assert.That(upantsitem,Is.EqualTo(app.UnderPantsItem), "Assert.That(upantsitem,Is.EqualTo(app.UnderPantsItem))");
Assert.That(upantsasset,Is.EqualTo(app.UnderPantsAsset), "Assert.That(upantsasset,Is.EqualTo(app.UnderPantsAsset))");
Assert.That(skirtitem,Is.EqualTo(app.SkirtItem), "Assert.That(skirtitem,Is.EqualTo(app.SkirtItem))");
Assert.That(skirtasset,Is.EqualTo(app.SkirtAsset), "Assert.That(skirtasset,Is.EqualTo(app.SkirtAsset))");
Assert.That(texture.ToString(),Is.EqualTo(app.Texture.ToString()), "Assert.That(texture.ToString(),Is.EqualTo(app.Texture.ToString()))");
Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight), "Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight))");
}
[Test]
public void T999_StillNull()
{
Assert.That(db.GetUserByUUID(zero), Is.Null);
Assert.That(db.GetAgentByUUID(zero), Is.Null);
}
public UserProfileData NewUser(UUID id,string fname,string lname)
{
UserProfileData u = new UserProfileData();
u.ID = id;
u.FirstName = fname;
u.SurName = lname;
u.PasswordHash = "NOTAHASH";
u.PasswordSalt = "NOTSALT";
// MUST specify at least these 5 parameters or an exception is raised
return u;
}
public UserAgentData NewAgent(UUID user_profile, UUID agent)
{
UserAgentData a = new UserAgentData();
a.ProfileID = user_profile;
a.SessionID = agent;
a.SecureSessionID = UUID.Random();
a.AgentIP = RandomName();
return a;
}
public static string RandomName()
{
StringBuilder name = new StringBuilder();
int size = random.Next(5,12);
char ch ;
for (int i=0; i<size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
name.Append(ch);
}
return name.ToString();
}
}
}

View File

@ -1,91 +0,0 @@
/*
* 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 OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data
{
public abstract class UserDataBase : IUserDataPlugin
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private Dictionary<UUID, AvatarAppearance> aplist = new Dictionary<UUID, AvatarAppearance>();
public abstract UserProfileData GetUserByUUID(UUID user);
public abstract UserProfileData GetUserByName(string fname, string lname);
public abstract UserAgentData GetAgentByUUID(UUID user);
public abstract UserAgentData GetAgentByName(string name);
public abstract UserAgentData GetAgentByName(string fname, string lname);
public UserProfileData GetUserByUri(Uri uri) { return null; }
public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
public abstract void AddNewUserProfile(UserProfileData user);
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
// Deliberately blank - database plugins shouldn't store temporary profiles.
}
public abstract bool UpdateUserProfile(UserProfileData user);
public abstract void AddNewUserAgent(UserAgentData agent);
public abstract void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
public abstract void RemoveUserFriend(UUID friendlistowner, UUID friend);
public abstract void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
public abstract List<FriendListItem> GetUserFriendList(UUID friendlistowner);
public abstract Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids);
public abstract bool MoneyTransferRequest(UUID from, UUID to, uint amount);
public abstract bool InventoryTransferRequest(UUID from, UUID to, UUID inventory);
public abstract List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query);
public abstract AvatarAppearance GetUserAppearance(UUID user);
public abstract void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
// public virtual AvatarAppearance GetUserAppearance(UUID user) {
// AvatarAppearance aa = null;
// try {
// aa = aplist[user];
// m_log.Info("[APPEARANCE] Found appearance for " + user.ToString() + aa.ToString());
// } catch (System.Collections.Generic.KeyNotFoundException e) {
// m_log.Info("[APPEARANCE] No appearance found for " + user.ToString());
// }
// return aa;
// }
// public virtual void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {
// aplist[user] = appearance;
// m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString());
// }
public abstract void ResetAttachments(UUID userID);
public abstract void LogoutUsers(UUID regionID);
public abstract string Version {get;}
public abstract string Name {get;}
public abstract void Initialise(string connect);
public abstract void Initialise();
public abstract void Dispose();
}
}

View File

@ -69,7 +69,7 @@ namespace OpenSim.Framework
private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66");
public readonly static int VISUALPARAM_COUNT = 218;
public readonly static int VISUALPARAM_COUNT = 218;
protected UUID m_owner;
@ -361,7 +361,7 @@ namespace OpenSim.Framework
// This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist
SetDefaultParams(m_visualparams);
SetDefaultWearables();
m_texture = GetDefaultTexture();
m_texture = GetDefaultTexture();
}
public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams)

View File

@ -1,104 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Data;
namespace OpenSim.Framework.Communications
{
/// <summary>
/// Plugin for managing temporary user profiles.
/// </summary>
public class TemporaryUserProfilePlugin : IUserDataPlugin
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<UUID, UserProfileData> m_profiles = new Dictionary<UUID, UserProfileData>();
public string Name { get { return "TemporaryUserProfilePlugin"; } }
public string Version { get { return "0.1"; } }
public void Initialise() {}
public void Initialise(string connect) {}
public void Dispose() {}
public UserProfileData GetUserByUUID(UUID user)
{
//m_log.DebugFormat("[TEMP USER PROFILE]: Received request for {0}", user);
lock (m_profiles)
{
if (m_profiles.ContainsKey(user))
return m_profiles[user];
else
return null;
}
}
public UserProfileData GetUserByName(string fname, string lname)
{
// We deliberately don't look up a temporary profile by name so that we don't obscure non-temporary
// profiles.
return null;
}
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
//m_log.DebugFormat("[TEMP USER PROFILE]: Adding {0} {1}", userProfile.Name, userProfile.ID);
lock (m_profiles)
{
m_profiles[userProfile.ID] = userProfile;
}
}
public UserProfileData GetUserByUri(Uri uri) { return null; }
public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; }
public UserAgentData GetAgentByUUID(UUID user) { return null; }
public UserAgentData GetAgentByName(string name) { return null; }
public UserAgentData GetAgentByName(string fname, string lname) { return null; }
public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {}
public void AddNewUserProfile(UserProfileData user) {}
public bool UpdateUserProfile(UserProfileData user) { return false; }
public void AddNewUserAgent(UserAgentData agent) {}
public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) {}
public void RemoveUserFriend(UUID friendlistowner, UUID friend) {}
public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {}
public List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return null; }
public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; }
public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; }
public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; }
public AvatarAppearance GetUserAppearance(UUID user) { return null; }
public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {}
public void ResetAttachments(UUID userID) {}
public void LogoutUsers(UUID regionID) {}
}
}

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
{
/// <summary>
/// A console that uses cursor control and color
/// </summary>
/// </summary>
public class LocalConsole : CommandConsole
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console
private int SetCursorTop(int top)
{
// 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.
// 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)
@ -129,12 +129,12 @@ namespace OpenSim.Framework.Console
/// </param>
/// <returns>
/// The new cursor column.
/// </returns>
/// </returns>
private int SetCursorLeft(int left)
{
// 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.
// 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)
@ -183,7 +183,7 @@ namespace OpenSim.Framework.Console
System.Console.Write("{0}", prompt);
SetCursorTop(new_y);
SetCursorLeft(new_x);
SetCursorLeft(new_x);
}
}

View File

@ -302,9 +302,9 @@ namespace OpenSim.Framework.Console
if (!UUID.TryParse(post["ID"].ToString(), out id))
return reply;
lock(m_Connections)
lock (m_Connections)
{
if(!m_Connections.ContainsKey(id))
if (!m_Connections.ContainsKey(id))
return reply;
}

View File

@ -483,7 +483,6 @@ namespace OpenSim.Framework
else
m_externalHostName = externalName;
m_regionType = config.GetString("RegionType", String.Empty);
// Prim stuff

View File

@ -589,11 +589,17 @@ namespace OpenSim.Framework
public static IPAddress GetLocalHost()
{
string dnsAddress = "localhost";
IPAddress[] iplist = GetLocalHosts();
IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList;
if (iplist.Length == 0) // No accessible external interfaces
{
IPAddress[] loopback = Dns.GetHostAddresses("localhost");
IPAddress localhost = loopback[0];
foreach (IPAddress host in hosts)
return localhost;
}
foreach (IPAddress host in iplist)
{
if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork)
{
@ -601,15 +607,15 @@ namespace OpenSim.Framework
}
}
if (hosts.Length > 0)
if (iplist.Length > 0)
{
foreach (IPAddress host in hosts)
foreach (IPAddress host in iplist)
{
if (host.AddressFamily == AddressFamily.InterNetwork)
return host;
}
// Well all else failed...
return hosts[0];
return iplist[0];
}
return null;

View File

@ -194,6 +194,8 @@ namespace OpenSim
PrintFileToConsole("startuplogo.txt");
m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString());
// For now, start at the 'root' level by default
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
ChangeSelectedRegion("region",
@ -417,7 +419,7 @@ namespace OpenSim
// kick client...
if (alert != null)
presence.ControllingClient.Kick(alert);
else
else
presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n");
// ...and close on our side
@ -624,7 +626,6 @@ namespace OpenSim
}
}
/// <summary>
/// Load, Unload, and list Region modules in use
/// </summary>
@ -924,7 +925,6 @@ namespace OpenSim
scene.RegionInfo.RegionLocX,
scene.RegionInfo.RegionLocY,
scene.RegionInfo.InternalEndPoint.Port));
});
break;

File diff suppressed because it is too large Load Diff

View File

@ -330,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Asset
//m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
if (name != Name)
return;
return;
long maxSize = DefaultMaxSize;
int maxCount = DefaultMaxCount;

View File

@ -69,7 +69,7 @@ namespace Flotsam.RegionModules.AssetCache
private readonly List<char> m_InvalidChars = new List<char>();
private int m_LogLevel = 1;
private int m_LogLevel = 0;
private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests
private static ulong m_Requests;
@ -156,7 +156,7 @@ namespace Flotsam.RegionModules.AssetCache
m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000);
#endif
m_LogLevel = assetConfig.GetInt("LogLevel", 1);
m_LogLevel = assetConfig.GetInt("LogLevel", 0);
m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1000);
m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));

View File

@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
avatar.Invulnerable = true;
}
}
catch (Exception ex)
catch (Exception)
{
}
}

View File

@ -131,7 +131,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (CheckPresence(userInfo.PrincipalID))
{
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute();
try
{
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute();
}
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
return false;
}
return true;
}
else
@ -156,7 +169,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (CheckPresence(userInfo.PrincipalID))
{
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute();
try
{
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute();
}
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
return false;
}
return true;
}
else
@ -181,8 +207,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (CheckPresence(userInfo.PrincipalID))
{
InventoryArchiveReadRequest request =
new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
InventoryArchiveReadRequest request;
try
{
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
}
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
return false;
}
UpdateClientWithLoadedNodes(userInfo, request.Execute());
return true;
@ -209,8 +249,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (CheckPresence(userInfo.PrincipalID))
{
InventoryArchiveReadRequest request =
new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
InventoryArchiveReadRequest request;
try
{
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
}
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
return false;
}
UpdateClientWithLoadedNodes(userInfo, request.Execute());
return true;

View File

@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
m_Cache.Cache(a);
// if (null == a)
// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
Util.FireAndForget(delegate { handler(assetID, s, a); });
});

View File

@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
config.AddConfig("GridService");
config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
m_LocalConnector = new LocalGridServicesConnector(config);
}
@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
r2.HttpPort = 9002;
r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
s = new Scene(new RegionInfo());
s.RegionInfo.RegionID = r1.RegionID;
s.RegionInfo.RegionID = r2.RegionID;
m_LocalConnector.AddRegion(s);
GridRegion r3 = new GridRegion();
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
r3.HttpPort = 9003;
r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
s = new Scene(new RegionInfo());
s.RegionInfo.RegionID = r1.RegionID;
s.RegionInfo.RegionID = r3.RegionID;
m_LocalConnector.AddRegion(s);
m_LocalConnector.RegisterRegion(UUID.Zero, r1);

View File

@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
item = m_InventoryService.GetItem(item);
if (null == item)
m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}");
m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", item.ID);
return item;
}

View File

@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
config.AddConfig("PresenceService");
config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
config.Configs["PresenceService"].Set("LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullPresenceData");
config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
m_LocalConnector = new LocalPresenceServicesConnector(config);
}

View File

@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.World
{
foreach (Scene s in m_SceneList)
{
if(!ProcessCommand(s, cmd))
if (!ProcessCommand(s, cmd))
break;
}
}

View File

@ -74,7 +74,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId)
{
m_scene = scene;
m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
try
{
m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
}
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
}
m_errorMessage = String.Empty;
m_merge = merge;
m_requestId = requestId;

View File

@ -65,7 +65,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId)
{
m_scene = scene;
m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress);
try
{
m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress);
}
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
}
m_requestId = requestId;
}

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule();
TerrainModule terrainModule = new TerrainModule();
m_scene = SceneSetupHelpers.SetupScene("scene1");
m_scene = SceneSetupHelpers.SetupScene("useraccounts");
SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
}
@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15);
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
}
protected SceneObjectPart CreateSceneObjectPart2()
@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
Vector3 offsetPosition = new Vector3(20, 25, 30);
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
}
}
/// <summary>
/// Test saving a V0.2 OpenSim Region Archive.
@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
foreach (string name in names)
{
if (name.EndsWith(".Resources.test-sound.wav"))
soundDataResourceName = name;
soundDataResourceName = name;
}
Assert.That(soundDataResourceName, Is.Not.Null);
@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
= new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName };
part1.Inventory.AddInventoryItem(item1, true);
}
}
}
m_scene.AddNewSceneObject(object1, false);
@ -306,15 +306,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
/// Test loading the region settings of a V0.2 OpenSim Region Archive.
/// </summary>
[Test]
public void TestLoadOarV0_2RegionSettings()
public void TestLoadOarV0_2RegionSettings()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
//log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
RegionSettings rs = new RegionSettings();
@ -329,11 +329,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
rs.DisablePhysics = true;
rs.DisableScripts = true;
rs.Elevation1NW = 15.9;
rs.Elevation1NE = 45.3;
rs.Elevation1NE = 45.3;
rs.Elevation1SE = 49;
rs.Elevation1SW = 1.9;
rs.Elevation2NW = 4.5;
rs.Elevation2NE = 19.2;
rs.Elevation2NE = 19.2;
rs.Elevation2SE = 9.2;
rs.Elevation2SW = 2.1;
rs.FixedSun = true;
@ -411,7 +411,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90);
// Vector3 part2OffsetPosition = new Vector3(20, 25, 30);
SceneObjectPart part2 = CreateSceneObjectPart2();
SceneObjectPart part2 = CreateSceneObjectPart2();
// Create an oar file that we can use for the merge
{
@ -420,9 +420,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
TerrainModule terrainModule = new TerrainModule();
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
// Write out this scene
scene.EventManager.OnOarFileSaved += SaveCompleted;

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
/// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
/// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
/// </returns>
/// </returns>
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
int updateTimer, bool SetBlending, byte AlphaValue);

View File

@ -150,7 +150,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns>
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
/// </returns>
IList<TaskInventoryItem> GetInventoryItems(string name);
/// <summary>

View File

@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="name">name to filter on</param>
/// <param name="id">key to filter on (user given, could be totally faked)</param>
/// <param name="msg">msg to filter on</param>
/// <returns>number of the scripts handle</returns>
/// <returns>number of the scripts handle</returns>
int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg);
/// <summary>
@ -77,19 +77,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="channel">channel to sent on</param>
/// <param name="name">name of sender (object or avatar)</param>
/// <param name="id">key of sender (object or avatar)</param>
/// <param name="msg">msg to sent</param>
/// <param name="msg">msg to sent</param>
void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg);
/// <summary>
/// Are there any listen events ready to be dispatched?
/// </summary>
/// <returns>boolean indication</returns>
/// <returns>boolean indication</returns>
bool HasMessages();
/// <summary>
/// Pop the first availlable listen event from the queue
/// </summary>
/// <returns>ListenerInfo with filter filled in</returns>
/// <returns>ListenerInfo with filter filled in</returns>
IWorldCommListenerInfo GetNextMessage();
void ListenControl(UUID itemID, int handle, int active);

View File

@ -209,7 +209,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Triggered when an object or attachment enters a scene
/// </summary>
public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
@ -413,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}
public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
{
@ -433,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnScriptChangedEvent(uint localID, uint change)
@ -454,7 +454,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnClientMovement(ScenePresence avatar)
@ -475,7 +475,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerPermissionError(UUID user, string reason)
@ -496,7 +496,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnPluginConsole(string[] args)
@ -517,7 +517,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnFrame()
@ -538,11 +538,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnNewClient(IClientAPI client)
{
{
OnNewClientDelegate handlerNewClient = OnNewClient;
if (handlerNewClient != null)
{
@ -559,10 +559,10 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
if (client is IClientCore)
{
{
OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect;
if (handlerClientConnect != null)
{
@ -579,7 +579,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
}
@ -601,11 +601,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnRemovePresence(UUID agentId)
{
{
OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence;
if (handlerRemovePresence != null)
{
@ -622,11 +622,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnBackup(IRegionDataStore dstore)
{
{
OnBackupDelegate handlerOnAttach = OnBackup;
if (handlerOnAttach != null)
{
@ -643,7 +643,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerParcelPrimCountUpdate()
@ -664,7 +664,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args)
@ -685,7 +685,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerTerrainTick()
@ -706,7 +706,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
@ -727,7 +727,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
@ -748,11 +748,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerShutdown()
{
{
OnShutdownDelegate handlerShutdown = OnShutdown;
if (handlerShutdown != null)
{
@ -769,11 +769,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
{
ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
if (handlerObjectGrab != null)
{
@ -790,11 +790,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
{
ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
if (handlerObjectGrabbing != null)
{
@ -811,11 +811,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
{
ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
if (handlerObjectDeGrab != null)
{
@ -832,11 +832,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptReset(uint localID, UUID itemID)
{
{
ScriptResetDelegate handlerScriptReset = OnScriptReset;
if (handlerScriptReset != null)
{
@ -853,11 +853,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
{
{
NewRezScript handlerRezScript = OnRezScript;
if (handlerRezScript != null)
{
@ -874,7 +874,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerStartScript(uint localID, UUID itemID)
@ -895,7 +895,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerStopScript(uint localID, UUID itemID)
@ -916,11 +916,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRemoveScript(uint localID, UUID itemID)
{
{
RemoveScript handlerRemoveScript = OnRemoveScript;
if (handlerRemoveScript != null)
{
@ -937,7 +937,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public bool TriggerGroupMove(UUID groupID, Vector3 delta)
@ -1036,7 +1036,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandObjectAdded(ILandObject newParcel)
@ -1057,7 +1057,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandObjectRemoved(UUID globalID)
@ -1078,7 +1078,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
@ -1104,7 +1104,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerIncomingInstantMessage(GridInstantMessage message)
@ -1125,7 +1125,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerUnhandledInstantMessage(GridInstantMessage message)
@ -1146,7 +1146,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerClientClosed(UUID ClientID, Scene scene)
@ -1167,7 +1167,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnMakeChildAgent(ScenePresence presence)
@ -1188,7 +1188,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnMakeRootAgent(ScenePresence presence)
@ -1209,7 +1209,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
@ -1229,12 +1229,12 @@ namespace OpenSim.Region.Framework.Scenes
"[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
{
{
RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
if (handlerRegisterCaps != null)
{
@ -1251,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
@ -1272,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
@ -1293,7 +1293,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerLandBuy(Object sender, LandBuyArgs args)
@ -1314,7 +1314,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerValidateLandBuy(Object sender, LandBuyArgs args)
@ -1335,11 +1335,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
{
{
ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
if (handlerScriptAtTargetEvent != null)
{
@ -1356,7 +1356,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerNotAtTargetEvent(uint localID)
@ -1377,11 +1377,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
{
{
ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
if (handlerScriptAtRotTargetEvent != null)
{
@ -1398,7 +1398,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerNotAtRotTargetEvent(uint localID)
@ -1419,7 +1419,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRequestChangeWaterHeight(float height)
@ -1440,7 +1440,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
@ -1461,7 +1461,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerSignificantClientMovement(IClientAPI client)
@ -1482,7 +1482,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
@ -1503,7 +1503,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
@ -1524,7 +1524,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
@ -1545,7 +1545,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
@ -1566,7 +1566,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerNoticeNoLandDataFromStorage()
@ -1587,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
@ -1608,7 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerSetAllowForcefulBan(bool allow)
@ -1629,7 +1629,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerRequestParcelPrimCountUpdate()
@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerParcelPrimCountTainted()
@ -1671,7 +1671,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
// this lets us keep track of nasty script events like timer, etc.
@ -1710,7 +1710,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public float GetCurrentTimeAsSunLindenHour()
@ -1737,7 +1737,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public void TriggerOarFileLoaded(Guid requestId, string message)
{
{
OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
if (handlerOarFileLoaded != null)
{
@ -1754,7 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOarFileSaved(Guid requestId, string message)
@ -1775,7 +1775,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
@ -1796,7 +1796,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
@ -1817,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
@ -1838,7 +1838,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
@ -1859,7 +1859,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
@ -1880,7 +1880,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
@ -1901,7 +1901,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
@ -1922,11 +1922,11 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
{
{
OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene;
if (handlerSetRootAgentScene != null)
{
@ -1943,7 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
public void TriggerOnRegionUp(GridRegion otherRegion)
@ -1964,7 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes
e.Message, e.StackTrace);
}
}
}
}
}
}
}

View File

@ -2384,7 +2384,7 @@ namespace OpenSim.Region.Framework.Scenes
AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate();
grp.SendGroupFullUpdate();
}
else
{

View File

@ -262,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Returns a new unallocated local ID
/// </summary>
/// <returns>A brand new local ID</returns>
protected internal uint AllocateLocalId()
public uint AllocateLocalId()
{
uint myID;

View File

@ -642,7 +642,7 @@ namespace OpenSim.Region.Framework.Scenes
// it get cleaned up
//
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
group.HasGroupChanged = false;
group.HasGroupChanged = false;
}
else
{

View File

@ -546,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0)
m_rootPart.ParentID = 0;
if (m_rootPart.LocalId==0)
if (m_rootPart.LocalId == 0)
m_rootPart.LocalId = m_scene.AllocateLocalId();
// No need to lock here since the object isn't yet in a scene
@ -1505,6 +1505,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param>
internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
{
// m_log.DebugFormat(
// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
if (m_rootPart.UUID == part.UUID)
{
if (IsAttachment)
@ -2297,7 +2300,6 @@ namespace OpenSim.Region.Framework.Scenes
AttachToBackup();
// Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
// position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and
// unmoved prims!
@ -2312,9 +2314,10 @@ namespace OpenSim.Region.Framework.Scenes
/// an independent SceneObjectGroup.
/// </summary>
/// <param name="partID"></param>
public void DelinkFromGroup(uint partID)
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
public SceneObjectGroup DelinkFromGroup(uint partID)
{
DelinkFromGroup(partID, true);
return DelinkFromGroup(partID, true);
}
/// <summary>
@ -2323,28 +2326,39 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
public void DelinkFromGroup(uint partID, bool sendEvents)
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
public SceneObjectGroup DelinkFromGroup(uint partID, bool sendEvents)
{
SceneObjectPart linkPart = GetChildPart(partID);
if (linkPart != null)
{
DelinkFromGroup(linkPart, sendEvents);
return DelinkFromGroup(linkPart, sendEvents);
}
else
{
m_log.InfoFormat("[SCENE OBJECT GROUP]: " +
m_log.WarnFormat("[SCENE OBJECT GROUP]: " +
"DelinkFromGroup(): Child prim {0} not found in object {1}, {2}",
partID, LocalId, UUID);
return null;
}
}
public void DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
/// <summary>
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
/// <returns>The object group of the newly delinked prim.</returns>
public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
{
linkPart.ClearUndoState();
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
linkPart.ClearUndoState();
Quaternion worldRot = linkPart.GetWorldRotation();
@ -2397,6 +2411,8 @@ namespace OpenSim.Region.Framework.Scenes
//HasGroupChanged = true;
//ScheduleGroupForFullUpdate();
return objectGroup;
}
/// <summary>
@ -2435,7 +2451,6 @@ namespace OpenSim.Region.Framework.Scenes
part.LinkNum = linkNum;
part.OffsetPosition = part.GroupPosition - AbsolutePosition;
Quaternion rootRotation = m_rootPart.RotationOffset;

View File

@ -4531,7 +4531,7 @@ namespace OpenSim.Region.Framework.Scenes
else
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
ScheduleFullUpdate();
}
}

View File

@ -313,7 +313,7 @@ namespace OpenSim.Region.Framework.Scenes
}
);
}
}
}
private void RestoreSavedScriptState(UUID oldID, UUID newID)
{
@ -578,7 +578,7 @@ namespace OpenSim.Region.Framework.Scenes
m_items.TryGetValue(itemId, out item);
return item;
}
}
/// <summary>
/// Get inventory items by name.
@ -587,7 +587,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
/// </returns>
public IList<TaskInventoryItem> GetInventoryItems(string name)
{
IList<TaskInventoryItem> items = new List<TaskInventoryItem>();

View File

@ -650,7 +650,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Constructor(s)
public ScenePresence()
{
{
m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
CreateSceneViewer();
m_animator = new ScenePresenceAnimator(this);
@ -1241,14 +1241,6 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
if (m_pos.X < 0)
m_pos.X = 128;
if (m_pos.Y < 0)
m_pos.Y = 128;
if (m_pos.X > Scene.WestBorders[0].BorderLine.X)
m_pos.X = 128;
if (m_pos.Y > Scene.NorthBorders[0].BorderLine.Y)
m_pos.Y = 128;
m_LastFinitePos = m_pos;
}
@ -2818,16 +2810,19 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!needsTransit)
{
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.Y;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.Y;
if (AbsolutePosition.Y < 0)
pos.Y += Velocity.Y;
else if (AbsolutePosition.Y > Constants.RegionSize)
pos.Y -= Velocity.Y;
AbsolutePosition = pos;
if (m_requestedSitTargetUUID == UUID.Zero)
{
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.X;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.X;
if (AbsolutePosition.Y < 0)
pos.Y += Velocity.Y;
else if (AbsolutePosition.Y > Constants.RegionSize)
pos.Y -= Velocity.Y;
AbsolutePosition = pos;
}
}
}
else if (neighbor > 0)
@ -3292,7 +3287,7 @@ namespace OpenSim.Region.Framework.Scenes
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
m_physicsActor.SubscribeEvents(500);
m_physicsActor.LocalID = LocalId;
m_physicsActor.LocalID = LocalId;
}
private void OutOfBoundsCall(Vector3 pos)
@ -3384,7 +3379,7 @@ namespace OpenSim.Region.Framework.Scenes
}
if (m_health <= 0)
m_scene.EventManager.TriggerAvatarKill(killerObj, this);
}
}
}
public void setHealthWithUpdate(float health)

View File

@ -50,7 +50,6 @@ using OpenSim.Region.Framework.Scenes;
using Caps = OpenSim.Framework.Capabilities.Caps;
using System.Text.RegularExpressions;
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
@ -76,7 +75,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// SLVoice client will do a GET on this prefix
private static string m_freeSwitchAPIPrefix;
// We need to return some information to SLVoice
// We need to return some information to SLVoice
// figured those out via curl
// http://vd1.vivox.com/api2/viv_get_prelogin.php
//
@ -102,9 +101,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
private Scene m_scene;
private IConfig m_config;
@ -136,9 +135,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_freeSwitchServerUser = m_config.GetString("freeswitch_server_user", String.Empty);
m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty);
m_freeSwitchAPIPrefix = m_config.GetString("freeswitch_api_prefix", String.Empty);
// XXX: get IP address of HTTP server. (This can be this OpenSim server or another, or could be a dedicated grid service or may live on the freeswitch server)
string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty);
int servicePort = m_config.GetInt("freeswitch_service_port", 80);
IPAddress serviceIPAddress = IPAddress.Parse(serviceIP);
@ -156,7 +155,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
m_freeSwitchContext = m_config.GetString("freeswitch_context", "default");
if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
String.IsNullOrEmpty(m_freeSwitchServerPass) ||
String.IsNullOrEmpty(m_freeSwitchRealm) ||
@ -182,9 +181,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceGetPreloginHTTPHandler);
// RestStreamHandler h = new
// RestStreamHandler("GET",
// RestStreamHandler("GET",
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
// MainServer.Instance.AddStreamHandler(h);
@ -202,13 +201,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceBuddyHTTPHandler);
}
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
m_FreeSwitchDirectory = new FreeSwitchDirectory();
m_FreeSwitchDialplan = new FreeSwitchDialplan();
@ -225,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
}
if (m_pluginEnabled)
if (m_pluginEnabled)
{
// we need to capture scene in an anonymous method
// here as we need it later in the callbacks
@ -233,8 +228,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
OnRegisterCaps(scene, agentID, caps);
};
try
{
@ -254,16 +247,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
}
}
}
}
public void PostInitialise()
{
if (m_pluginEnabled)
{
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
// register the voice interface for this module, so the script engine can call us
m_scene.RegisterModuleInterface<IVoiceModule>(this);
}
@ -282,15 +274,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
get { return true; }
}
// <summary>
// implementation of IVoiceModule, called by osSetParcelSIPAddress script function
// </summary>
public void setLandSIPAddress(string SIPAddress,UUID GlobalID)
{
m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
GlobalID, SIPAddress);
lock (m_ParcelAddress)
{
if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
@ -303,18 +295,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
}
}
// <summary>
// OnRegisterCaps is invoked via the scene.EventManager
// everytime OpenSim hands out capabilities to a client
// (login, region crossing). We contribute two capabilities to
// the set of capabilities handed back to the client:
// ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
//
//
// ProvisionVoiceAccountRequest allows the client to obtain
// the voice account credentials for the avatar it is
// controlling (e.g., user name, password, etc).
//
//
// ParcelVoiceInfoRequest is invoked whenever the client
// changes from one region or parcel to another.
//
@ -371,7 +363,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
System.Threading.Thread.Sleep(2000);
avatar = scene.GetScenePresence(agentID);
if (avatar == null)
return "<llsd>undef</llsd>";
}
@ -407,8 +399,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
LLSDVoiceAccountResponse voiceAccountResponse =
new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
@ -442,7 +434,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string avatarName = avatar.Name;
// - check whether we have a region channel in our cache
// - if not:
// - if not:
// create it and cache it
// - send it to the client
// - send channel_uri: as "sip:regionID@m_sipDomain"
@ -451,12 +443,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
LLSDParcelVoiceInfoResponse parcelVoiceInfo;
string channelUri;
if (null == scene.LandChannel)
if (null == scene.LandChannel)
throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
scene.RegionInfo.RegionName, avatarName));
// get channel_uri: check first whether estate
// settings allow voice, then whether parcel allows
// voice, if all do retrieve or obtain the parcel
@ -493,22 +483,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
return r;
}
catch (Exception e)
{
m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
scene.RegionInfo.RegionName, avatarName, e.Message);
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
scene.RegionInfo.RegionName, avatarName, e.ToString());
return "<llsd>undef</llsd>";
}
}
/// <summary>
/// Callback for a client request for ChatSessionRequest
/// </summary>
@ -550,7 +539,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string fwdresponsestr = "";
int fwdresponsecode = 200;
string fwdresponsecontenttype = "text/xml";
HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress);
forwardreq.Method = method;
@ -577,7 +565,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["content_type"] = fwdresponsecontenttype;
response["str_response_string"] = fwdresponsestr;
response["int_response_code"] = fwdresponsecode;
return response;
}
@ -585,11 +573,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
{
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
Hashtable response = new Hashtable();
response["content_type"] = "text/xml";
response["keepalive"] = false;
response["str_response_string"] = String.Format(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
"<VCConfiguration>\r\n"+
@ -607,9 +595,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"</VCConfiguration>",
m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
m_freeSwitchEchoServer, m_freeSwitchEchoPort,
m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
m_freeSwitchUrlResetPassword, "");
response["int_response_code"] = 200;
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
@ -624,7 +612,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["content-type"] = "text/xml";
Hashtable requestBody = parseRequestBody((string)request["body"]);
if (!requestBody.ContainsKey("auth_token"))
return response;
@ -632,7 +620,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
//string[] auth_tokenvals = auth_token.Split(':');
//string username = auth_tokenvals[0];
int strcount = 0;
string[] ids = new string[strcount];
int iter = -1;
@ -648,7 +636,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
StringBuilder resp = new StringBuilder();
resp.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><response xmlns=\"http://www.vivox.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"/xsd/buddy_list.xsd\">");
resp.Append(string.Format(@"<level0>
<status>OK</status>
<cookie_name>lib_session</cookie_name>
@ -678,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
<b2g_group_id></b2g_group_id>
</level3>", ids[i],i,m_freeSwitchRealm,dt));
}
resp.Append("</buddies><groups></groups></body></level0></response>");
response["str_response_string"] = resp.ToString();
@ -694,7 +682,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string requestbody = (string)request["body"];
string uri = (string)request["uri"];
string contenttype = (string)request["content-type"];
Hashtable requestBody = parseRequestBody((string)request["body"]);
//string pwd = (string) requestBody["pwd"];
@ -712,7 +700,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
pos++;
if (s == userid)
break;
}
}
}
@ -735,7 +722,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
</body>
</level0>
</response>", userid, pos, avatarName);
response["int_response_code"] = 200;
return response;
/*
@ -752,13 +739,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
{
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}", (string)request["body"]);
Hashtable response = new Hashtable();
response["str_response_string"] = string.Empty;
// all the params come as NVPs in the request body
Hashtable requestBody = parseRequestBody((string) request["body"]);
// is this a dialplan or directory request
// is this a dialplan or directory request
string section = (string) requestBody["section"];
if (section == "directory")
@ -767,40 +754,39 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response = m_FreeSwitchDialplan.HandleDialplanRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody);
else
m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
// XXX: re-generate dialplan:
// XXX: re-generate dialplan:
// - conf == region UUID
// - conf number = region port
// -> TODO Initialise(): keep track of regions via events
// re-generate accounts for all avatars
// re-generate accounts for all avatars
// -> TODO Initialise(): keep track of avatars via events
Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler return {0}",normalizeEndLines.Replace(((string)response["str_response_string"]), ""));
return response;
}
public Hashtable parseRequestBody(string body)
{
Hashtable bodyParams = new Hashtable();
// split string
string [] nvps = body.Split(new Char [] {'&'});
foreach (string s in nvps) {
foreach (string s in nvps)
{
if (s.Trim() != "")
{
string [] nvp = s.Split(new Char [] {'='});
bodyParams.Add(HttpUtility.UrlDecode(nvp[0]), HttpUtility.UrlDecode(nvp[1]));
}
}
return bodyParams;
}
private string ChannelUri(Scene scene, LandData land)
{
string channelUri = null;
string landUUID;
@ -808,12 +794,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// Create parcel voice channel. If no parcel exists, then the voice channel ID is the same
// as the directory ID. Otherwise, it reflects the parcel's ID.
lock (m_ParcelAddress)
{
if (m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
{
m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]);
return m_ParcelAddress[land.GlobalID.ToString()];
}
@ -823,22 +809,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name);
landUUID = land.GlobalID.ToString();
m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
landName, land.LocalID, landUUID);
}
else
{
landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionName);
landUUID = scene.RegionInfo.RegionID.ToString();
m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
landName, land.LocalID, landUUID);
}
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
// slvoice handles the sip address differently if it begins with confctl, hiding it from the user in the friends list. however it also disables
// the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator.
channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm);
lock (m_ParcelAddress)
{
if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
@ -849,14 +835,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return channelUri;
}
private static bool CustomCertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
return true;
}
}
public class MonoCert : ICertificatePolicy
{
#region ICertificatePolicy Members

View File

@ -34,6 +34,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IAvatar : IEntity
{
bool IsChildAgent { get; }
//// <value>
/// Array of worn attachments, empty but not null, if no attachments are worn
/// </value>

View File

@ -70,6 +70,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
set { GetSP().TeleportWithMomentum(value); }
}
public bool IsChildAgent
{
get { return GetSP().IsChildAgent; }
}
#region IAvatar implementation
public IAvatarAttachment[] Attachments
{

View File

@ -121,19 +121,19 @@ namespace OpenSim.Region.Modules.SvnSerialiser
{
serialiser.LoadPrimsFromXml2(
scene,
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
+ Slash.DirectorySeparatorChar + "objects.xml");
scene.RequestModuleInterface<ITerrainModule>().LoadFromFile(
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
+ Slash.DirectorySeparatorChar + "heightmap.r32");
m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ").");
}
else
{
m_log.ErrorFormat(
"[SVNBACKUP]: Region load of {0} failed - no serialisation module available",
"[SVNBACKUP]: Region load of {0} failed - no serialisation module available",
scene.RegionInfo.RegionName);
}
}

View File

@ -72,23 +72,23 @@ namespace OpenSim.Region.Physics.OdePlugin
// Vehicle properties
private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind
// private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier
private VehicleFlag m_flags = (VehicleFlag) 0; // Boolean settings:
// HOVER_TERRAIN_ONLY
// HOVER_GLOBAL_HEIGHT
// NO_DEFLECTION_UP
// HOVER_WATER_ONLY
// HOVER_UP_ONLY
// LIMIT_MOTOR_UP
// LIMIT_ROLL_ONLY
private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind
// private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier
private VehicleFlag m_flags = (VehicleFlag) 0; // Boolean settings:
// HOVER_TERRAIN_ONLY
// HOVER_GLOBAL_HEIGHT
// NO_DEFLECTION_UP
// HOVER_WATER_ONLY
// HOVER_UP_ONLY
// LIMIT_MOTOR_UP
// LIMIT_ROLL_ONLY
private VehicleFlag m_Hoverflags = (VehicleFlag)0;
private Vector3 m_BlockingEndPoint = Vector3.Zero;
private Quaternion m_RollreferenceFrame = Quaternion.Identity;
// Linear properties
private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time
private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL
private Vector3 m_dir = Vector3.Zero; // velocity applied to body
private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time
private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL
private Vector3 m_dir = Vector3.Zero; // velocity applied to body
private Vector3 m_linearFrictionTimescale = Vector3.Zero;
private float m_linearMotorDecayTimescale = 0;
private float m_linearMotorTimescale = 0;
@ -98,14 +98,14 @@ namespace OpenSim.Region.Physics.OdePlugin
// private Vector3 m_linearMotorOffset = Vector3.Zero;
//Angular properties
private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
private int m_angularMotorApply = 0; // application frame counter
private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity
private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate
private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate
private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
// private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
private int m_angularMotorApply = 0; // application frame counter
private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity
private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate
private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate
private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
// private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
//Deflection properties
// private float m_angularDeflectionEfficiency = 0;
@ -123,14 +123,14 @@ namespace OpenSim.Region.Physics.OdePlugin
// private float m_VhoverEfficiency = 0f;
private float m_VhoverTimescale = 0f;
private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height
private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle.
private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle.
// Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity)
// KF: So far I have found no good method to combine a script-requested .Z velocity and gravity.
// Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity.
//Attractor properties
private float m_verticalAttractionEfficiency = 1.0f; // damped
private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor.
//Attractor properties
private float m_verticalAttractionEfficiency = 1.0f; // damped
private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor.
internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
{

View File

@ -8192,38 +8192,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
{
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
{
lock (m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == item)
{
switch (mask)
{
case 0:
inv.Value.BasePermissions = (uint)value;
break;
case 1:
inv.Value.CurrentPermissions = (uint)value;
break;
case 2:
inv.Value.GroupPermissions = (uint)value;
break;
case 3:
inv.Value.EveryonePermissions = (uint)value;
break;
case 4:
inv.Value.NextPermissions = (uint)value;
break;
}
}
}
}
}
}
{
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
{
lock (m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == item)
{
switch (mask)
{
case 0:
inv.Value.BasePermissions = (uint)value;
break;
case 1:
inv.Value.CurrentPermissions = (uint)value;
break;
case 2:
inv.Value.GroupPermissions = (uint)value;
break;
case 3:
inv.Value.EveryonePermissions = (uint)value;
break;
case 4:
inv.Value.NextPermissions = (uint)value;
break;
}
}
}
}
}
}
}
public LSL_String llGetInventoryCreator(string item)

View File

@ -841,7 +841,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null)
{
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
handlerObjectRemoved(part.UUID);
}

View File

@ -207,7 +207,7 @@ namespace OpenSim.Server.Handlers.Asset
if (!request.ContainsKey("PRINCIPAL"))
return FailureResult();
if(m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString())))
if (m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString())))
result["RESULT"] = "True";
else
result["RESULT"] = "False";

View File

@ -81,12 +81,12 @@ namespace OpenSim.Services.AssetService
}
public AssetBase Get(string id)
{
{
UUID assetID;
if (!UUID.TryParse(id, out assetID))
{
m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested sset id {0}", id);
m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested sset id {0}", id);
return null;
}

View File

@ -106,12 +106,17 @@ namespace OpenSim.Services.AuthenticationService
string passwordSalt = Util.Md5Hash(UUID.Random().ToString());
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + passwordSalt);
AuthenticationData auth = new AuthenticationData();
auth.PrincipalID = principalID;
auth.Data = new System.Collections.Generic.Dictionary<string, object>();
AuthenticationData auth = m_Database.Get(principalID);
if (auth == null)
{
auth = new AuthenticationData();
auth.PrincipalID = principalID;
auth.Data = new System.Collections.Generic.Dictionary<string, object>();
auth.Data["accountType"] = "UserAccount";
auth.Data["webLoginKey"] = UUID.Zero.ToString();
}
auth.Data["passwordHash"] = md5PasswdHash;
auth.Data["passwordSalt"] = passwordSalt;
auth.Data["webLoginKey"] = UUID.Zero.ToString();
if (!m_Database.Store(auth))
{
m_log.DebugFormat("[AUTHENTICATION DB]: Failed to store authentication data");

View File

@ -64,7 +64,7 @@ namespace OpenSim.Services.Base
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
{
if (className != String.Empty &&
pluginType.ToString() !=
pluginType.Namespace + "." + className)
@ -84,8 +84,9 @@ namespace OpenSim.Services.Base
return null;
}
catch (Exception)
catch (Exception e)
{
Console.WriteLine("XXX Exception " + e.StackTrace);
return null;
}
}

View File

@ -93,7 +93,7 @@ namespace OpenSim.Services.Connectors
}
public AssetBase Get(string id)
{
{
string uri = m_ServerURI + "/assets/" + id;
AssetBase asset = null;

View File

@ -82,20 +82,22 @@ namespace OpenSim.Services.GridService
{
m_RootInstance = this;
MainConsole.Instance.Commands.AddCommand("grid", true,
"show region",
"show region <Region name>",
"Show details on a region",
String.Empty,
HandleShowRegion);
MainConsole.Instance.Commands.AddCommand("grid", true,
"set region flags",
"set region flags <Region name> <flags>",
"Set database flags for region",
String.Empty,
HandleSetFlags);
if (MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("grid", true,
"show region",
"show region <Region name>",
"Show details on a region",
String.Empty,
HandleShowRegion);
MainConsole.Instance.Commands.AddCommand("grid", true,
"set region flags",
"set region flags <Region name> <flags>",
"Set database flags for region",
String.Empty,
HandleSetFlags);
}
m_HypergridLinker = new HypergridLinker(m_config, this, m_Database);
}
}

View File

@ -113,18 +113,20 @@ namespace OpenSim.Services.GridService
m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services...");
}
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
"Link a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
"Unlink a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
"Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks <cr>",
"List the HG regions", HandleShow);
if (MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
"Link a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
"Unlink a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
"Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks <cr>",
"List the HG regions", HandleShow);
}
}

View File

@ -77,13 +77,16 @@ namespace OpenSim.Services.UserAccountService
if (invServiceDll != string.Empty)
m_InventoryService = LoadPlugin<IInventoryService>(invServiceDll, new Object[] { config });
MainConsole.Instance.Commands.AddCommand("UserService", false,
"create user",
"create user [<first> [<last> [<pass> [<email>]]]]",
"Create a new user", HandleCreateUser);
MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password",
"reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword);
if (MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("UserService", false,
"create user",
"create user [<first> [<last> [<pass> [<email>]]]]",
"Create a new user", HandleCreateUser);
MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password",
"reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword);
}
}

View File

@ -1,216 +0,0 @@
/*
* 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 OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
namespace OpenSim.Tests.Common.Mock
{
/// <summary>
/// In memory user data provider. Might be quite useful as a proper user data plugin, though getting mono addins
/// to load any plugins when running unit tests has proven impossible so far. Currently no locking since unit
/// tests are single threaded.
/// </summary>
public class TestUserDataPlugin : IUserDataPlugin
{
public string Version { get { return "0"; } }
public string Name { get { return "TestUserDataPlugin"; } }
/// <summary>
/// User profiles keyed by name
/// </summary>
private Dictionary<string, UserProfileData> m_userProfilesByName = new Dictionary<string, UserProfileData>();
/// <summary>
/// User profiles keyed by uuid
/// </summary>
private Dictionary<UUID, UserProfileData> m_userProfilesByUuid = new Dictionary<UUID, UserProfileData>();
/// <summary>
/// User profiles and their agents
/// </summary>
private Dictionary<UUID, UserAgentData> m_agentByProfileUuid = new Dictionary<UUID, UserAgentData>();
/// <summary>
/// Friends list by uuid
/// </summary>
private Dictionary<UUID, List<FriendListItem>> m_friendsListByUuid = new Dictionary<UUID, List<FriendListItem>>();
public void Initialise() {}
public void Dispose() {}
public void AddTemporaryUserProfile(UserProfileData userProfile)
{
// Not interested
}
public void AddNewUserProfile(UserProfileData user)
{
UpdateUserProfile(user);
}
public UserProfileData GetUserByUUID(UUID user)
{
UserProfileData userProfile = null;
m_userProfilesByUuid.TryGetValue(user, out userProfile);
return userProfile;
}
public UserProfileData GetUserByName(string fname, string lname)
{
UserProfileData userProfile = null;
m_userProfilesByName.TryGetValue(fname + " " + lname, out userProfile);
return userProfile;
}
public UserProfileData GetUserByUri(Uri uri) { return null; }
public bool UpdateUserProfile(UserProfileData user)
{
m_userProfilesByUuid[user.ID] = user;
m_userProfilesByName[user.FirstName + " " + user.SurName] = user;
return true;
}
public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; }
public UserAgentData GetAgentByUUID(UUID user)
{
UserAgentData userAgent = null;
m_agentByProfileUuid.TryGetValue(user, out userAgent);
return userAgent;
}
public UserAgentData GetAgentByName(string name)
{
UserProfileData userProfile = null;
m_userProfilesByName.TryGetValue(name, out userProfile);
UserAgentData userAgent = null;
m_agentByProfileUuid.TryGetValue(userProfile.ID, out userAgent);
return userAgent;
}
public UserAgentData GetAgentByName(string fname, string lname)
{
UserProfileData userProfile = GetUserByName(fname,lname);
UserAgentData userAgent = null;
m_agentByProfileUuid.TryGetValue(userProfile.ID, out userAgent);
return userAgent;
}
public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {}
public void AddNewUserAgent(UserAgentData agent)
{
m_agentByProfileUuid[agent.ProfileID] = agent;
}
public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
FriendListItem newfriend = new FriendListItem();
newfriend.FriendPerms = perms;
newfriend.Friend = friend;
newfriend.FriendListOwner = friendlistowner;
if (!m_friendsListByUuid.ContainsKey(friendlistowner))
{
List<FriendListItem> friendslist = new List<FriendListItem>();
m_friendsListByUuid[friendlistowner] = friendslist;
}
m_friendsListByUuid[friendlistowner].Add(newfriend);
}
public void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
if (m_friendsListByUuid.ContainsKey(friendlistowner))
{
List<FriendListItem> friendslist = m_friendsListByUuid[friendlistowner];
foreach (FriendListItem frienditem in friendslist)
{
if (frienditem.Friend == friend)
{
friendslist.Remove(frienditem);
break;
}
}
}
}
public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
if (m_friendsListByUuid.ContainsKey(friendlistowner))
{
List<FriendListItem> friendslist = m_friendsListByUuid[friendlistowner];
foreach (FriendListItem frienditem in friendslist)
{
if (frienditem.Friend == friend)
{
frienditem.FriendPerms = perms;
break;
}
}
}
}
public List<FriendListItem> GetUserFriendList(UUID friendlistowner)
{
if (m_friendsListByUuid.ContainsKey(friendlistowner))
{
return m_friendsListByUuid[friendlistowner];
}
else
return new List<FriendListItem>();
}
public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; }
public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; }
public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; }
public void Initialise(string connect) { return; }
public AvatarAppearance GetUserAppearance(UUID user) { return null; }
public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {}
public void ResetAttachments(UUID userID) {}
public void LogoutUsers(UUID regionID) {}
}
}

View File

@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.Avatar.Gods;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common.Mock;
@ -60,6 +61,7 @@ namespace OpenSim.Tests.Common.Setup
private static ISharedRegionModule m_assetService = null;
private static ISharedRegionModule m_inventoryService = null;
private static ISharedRegionModule m_gridService = null;
private static ISharedRegionModule m_userAccountService = null;
/// <summary>
/// Set up a test scene
@ -183,6 +185,8 @@ namespace OpenSim.Tests.Common.Setup
StartInventoryService(testScene, false);
if (realServices.Contains("grid"))
StartGridService(testScene, true);
if (realServices.Contains("useraccounts"))
StartUserAccountService(testScene, true);
}
// If not, make sure the shared module gets references to this new scene
@ -269,6 +273,28 @@ namespace OpenSim.Tests.Common.Setup
//testScene.AddRegionModule(m_gridService.Name, m_gridService);
}
private static void StartUserAccountService(Scene testScene, bool real)
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.AddConfig("UserAccountService");
config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
if (real)
config.Configs["UserAccountService"].Set("LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
if (m_userAccountService == null)
{
ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
userAccountService.Initialise(config);
m_userAccountService = userAccountService;
}
//else
// config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
m_userAccountService.AddRegion(testScene);
m_userAccountService.RegionLoaded(testScene);
//testScene.AddRegionModule(m_gridService.Name, m_gridService);
}
/// <summary>
/// Setup modules for a scene using their default settings.

View File

@ -122,17 +122,3 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService"
WelcomeMessage = "Welcome, Avatar!"
; * This is the new style grid service.
; * "Realm" is the table that is used for user lookup.
; * It defaults to "regions", which uses the legacy tables
; *
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;"
Realm = "regions"
; If true, duplicate region names are allowed on the grid. If false, no duplicate names are allowed
; Default is false
; AllowDuplicateNames = "True"

View File

@ -4,9 +4,6 @@
;; which you can copy and change.
;;
[Includes]
Include-Common = "config-include/StandaloneCommon.ini"
[Modules]
AssetServices = "LocalAssetServicesConnector"
InventoryServices = "LocalInventoryServicesConnector"
@ -35,14 +32,14 @@
[AvatarService]
LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService"
StorageProvider = "OpenSim.Data.Null.dll"
ConnectionString = "URI=file:avatars.db,version=3"
[AuthorizationService]
LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService"
[AuthenticationService]
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
StorageProvider = "OpenSim.Data.Null.dll"
ConnectionString = "URI=file:auth.db,version=3"
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
@ -55,7 +52,7 @@
[UserAccountService]
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
StorageProvider = "OpenSim.Data.Null.dll"
ConnectionString = "URI=file:userprofiles.db,version=3"
;; These are for creating new accounts
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
@ -72,3 +69,8 @@
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
WelcomeMessage = "Welcome, Avatar!"
;; This should always be the very last thing on this file
[Includes]
Include-Common = "config-include/StandaloneCommon.ini"

View File

@ -3,9 +3,6 @@
;; All optional settings are in StandaloneCommon.ini.example,
;; which you can copy and change.
;;
[Includes]
Include-Common = "config-include/StandaloneCommon.ini"
[Modules]
AssetServices = "HGAssetBroker"
@ -45,7 +42,7 @@
[AvatarService]
LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService"
StorageProvider = "OpenSim.Data.Null.dll"
ConnectionString = "URI=file:avatars.db,version=3"
[LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
@ -57,7 +54,7 @@
[AuthenticationService]
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
StorageProvider = "OpenSim.Data.Null.dll"
ConnectionString = "URI=file:auth.db,version=3"
[GridService]
; LocalGridServicesConnector needs this
@ -73,7 +70,7 @@
[UserAccountService]
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
StorageProvider = "OpenSim.Data.Null.dll"
ConnectionString = "URI=file:userprofiles.db,version=3"
;; These are for creating new accounts by the service
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
@ -112,3 +109,8 @@
[HGInventoryService]
; For the InventoryServiceInConnector
LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService"
;; This should always be the very last thing on this file
[Includes]
Include-Common = "config-include/StandaloneCommon.ini"