OpenSim.Region.Communications.* is no more. Thanks to everyone who contributed to these!

slimupdates
Diva Canto 2010-01-10 19:50:09 -08:00
parent 0c2946031b
commit 2415d36bed
12 changed files with 0 additions and 1919 deletions

View File

@ -1,57 +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.Reflection;
using log4net;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Communications.Hypergrid
{
public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1
{
public HGCommunicationsGridMode(
NetworkServersInfo serversInfo,
SceneManager sman, LibraryRootFolder libraryRootFolder)
: base(serversInfo, libraryRootFolder)
{
HGUserServices userServices = new HGUserServices(this);
// This plugin arrangement could eventually be configurable rather than hardcoded here.
userServices.AddPlugin(new TemporaryUserProfilePlugin());
userServices.AddPlugin(new HGUserDataPlugin(this, userServices));
}
}
}

View File

@ -1,63 +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 OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1;
namespace OpenSim.Region.Communications.Hypergrid
{
public class HGCommunicationsStandalone : CommunicationsManager
{
public HGCommunicationsStandalone(
ConfigSettings configSettings,
NetworkServersInfo serversInfo,
BaseHttpServer httpServer,
LibraryRootFolder libraryRootFolder,
bool dumpAssetsToFile)
: base(serversInfo, libraryRootFolder)
{
LocalUserServices localUserService =
new LocalUserServices(
serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
localUserService.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
HGUserServices hgUserService = new HGUserServices(this, localUserService);
// This plugin arrangement could eventually be configurable rather than hardcoded here.
hgUserService.AddPlugin(new TemporaryUserProfilePlugin());
hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService));
}
}
}

View File

@ -1,72 +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.Net;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using log4net;
using Nwc.XmlRpc;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Clients;
using OpenSim.Region.Communications.OGS1;
namespace OpenSim.Region.Communications.Hypergrid
{
public class HGUserDataPlugin : OGS1UserDataPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
HGUserServices m_UserServices;
public HGUserDataPlugin()
{
}
public HGUserDataPlugin(CommunicationsManager commsManager, HGUserServices userServices)
{
m_log.DebugFormat("[HG USER SERVICES]: {0} initialized", Name);
m_commsManager = commsManager;
m_UserServices = userServices;
}
protected override string GetUserServerURL(UUID userID)
{
string url = string.Empty;
if (m_UserServices.IsForeignUser(userID, out url))
return url;
return m_commsManager.NetworkServersInfo.UserURL;
}
}
}

View File

@ -1,338 +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 OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Clients;
using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Communications.Local;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.Communications.Hypergrid
{
/// <summary>
/// For the time being, this class is just an identity wrapper around OGS1UserServices,
/// so it always fails for foreign users.
/// Later it needs to talk with the foreign users' user servers.
/// </summary>
public class HGUserServices : OGS1UserServices
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private OGS1UserServices m_remoteUserServices;
private LocalUserServices m_localUserServices;
// Constructor called when running in grid mode
public HGUserServices(CommunicationsManager commsManager)
: base(commsManager)
{
}
// Constructor called when running in standalone
public HGUserServices(CommunicationsManager commsManager, LocalUserServices local)
: base(commsManager)
{
m_localUserServices = local;
}
public override void SetInventoryService(IInventoryService invService)
{
base.SetInventoryService(invService);
if (m_localUserServices != null)
m_localUserServices.SetInventoryService(invService);
}
public override UUID AddUser(
string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid)
{
// Only valid to create users locally
if (m_localUserServices != null)
return m_localUserServices.AddUser(firstName, lastName, password, email, regX, regY, uuid);
return UUID.Zero;
}
public override bool AddUserAgent(UserAgentData agentdata)
{
if (m_localUserServices != null)
return m_localUserServices.AddUserAgent(agentdata);
return base.AddUserAgent(agentdata);
}
public override UserAgentData GetAgentByUUID(UUID userId)
{
string url = string.Empty;
if ((m_localUserServices != null) && !IsForeignUser(userId, out url))
return m_localUserServices.GetAgentByUUID(userId);
return base.GetAgentByUUID(userId);
}
public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
{
string url = string.Empty;
if ((m_localUserServices != null) && !IsForeignUser(userid, out url))
m_localUserServices.LogOffUser(userid, regionid, regionhandle, position, lookat);
else
base.LogOffUser(userid, regionid, regionhandle, position, lookat);
}
public override UserProfileData GetUserProfile(string firstName, string lastName)
{
if (m_localUserServices != null)
return m_localUserServices.GetUserProfile(firstName, lastName);
return base.GetUserProfile(firstName, lastName);
}
public override List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
{
if (m_localUserServices != null)
return m_localUserServices.GenerateAgentPickerRequestResponse(queryID, query);
return base.GenerateAgentPickerRequestResponse(queryID, query);
}
/// <summary>
/// Get a user profile from the user server
/// </summary>
/// <param name="avatarID"></param>
/// <returns>null if the request fails</returns>
public override UserProfileData GetUserProfile(UUID avatarID)
{
//string url = string.Empty;
// Unfortunately we can't query for foreigners here,
// because we'll end up in an infinite loop...
//if ((m_localUserServices != null) && (!IsForeignUser(avatarID, out url)))
if (m_localUserServices != null)
return m_localUserServices.GetUserProfile(avatarID);
return base.GetUserProfile(avatarID);
}
public override void ClearUserAgent(UUID avatarID)
{
if (m_localUserServices != null)
m_localUserServices.ClearUserAgent(avatarID);
else
base.ClearUserAgent(avatarID);
}
/// <summary>
/// Retrieve the user information for the given master uuid.
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
if (m_localUserServices != null)
return m_localUserServices.SetupMasterUser(firstName, lastName);
return base.SetupMasterUser(firstName, lastName);
}
/// <summary>
/// Retrieve the user information for the given master uuid.
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
if (m_localUserServices != null)
return m_localUserServices.SetupMasterUser(firstName, lastName, password);
return base.SetupMasterUser(firstName, lastName, password);
}
/// <summary>
/// Retrieve the user information for the given master uuid.
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
public override UserProfileData SetupMasterUser(UUID uuid)
{
if (m_localUserServices != null)
return m_localUserServices.SetupMasterUser(uuid);
return base.SetupMasterUser(uuid);
}
public override bool ResetUserPassword(string firstName, string lastName, string newPassword)
{
if (m_localUserServices != null)
return m_localUserServices.ResetUserPassword(firstName, lastName, newPassword);
else
return base.ResetUserPassword(firstName, lastName, newPassword);
}
public override bool UpdateUserProfile(UserProfileData userProfile)
{
string url = string.Empty;
if ((m_localUserServices != null) && (!IsForeignUser(userProfile.ID, out url)))
return m_localUserServices.UpdateUserProfile(userProfile);
return base.UpdateUserProfile(userProfile);
}
public override bool AuthenticateUserByPassword(UUID userID, string password)
{
if (m_localUserServices != null)
return m_localUserServices.AuthenticateUserByPassword(userID, password);
else
return base.AuthenticateUserByPassword(userID, password);
}
#region IUserServices Friend Methods
// NOTE: We're still not dealing with foreign user friends
/// <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>
public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
if (m_localUserServices != null)
m_localUserServices.AddNewUserFriend(friendlistowner, friend, perms);
else
base.AddNewUserFriend(friendlistowner, friend, 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>
public override void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
if (m_localUserServices != null)
m_localUserServices.RemoveUserFriend(friendlistowner, friend);
else
base.RemoveUserFriend(friend, 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>
public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
if (m_localUserServices != null)
m_localUserServices.UpdateUserFriendPerms(friendlistowner, friend, perms);
else
base.UpdateUserFriendPerms(friendlistowner, friend, 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>
public override List<FriendListItem> GetUserFriendList(UUID friendlistowner)
{
if (m_localUserServices != null)
return m_localUserServices.GetUserFriendList(friendlistowner);
return base.GetUserFriendList(friendlistowner);
}
#endregion
/// Appearance
public override AvatarAppearance GetUserAppearance(UUID user)
{
string url = string.Empty;
if ((m_localUserServices != null) && (!IsForeignUser(user, out url)))
return m_localUserServices.GetUserAppearance(user);
else
return base.GetUserAppearance(user);
}
public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
{
string url = string.Empty;
if ((m_localUserServices != null) && (!IsForeignUser(user, out url)))
m_localUserServices.UpdateUserAppearance(user, appearance);
else
base.UpdateUserAppearance(user, appearance);
}
#region IMessagingService
public override Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
{
if (m_localUserServices != null)
return m_localUserServices.GetFriendRegionInfos(uuids);
return base.GetFriendRegionInfos(uuids);
}
#endregion
public override bool VerifySession(UUID userID, UUID sessionID)
{
string url = string.Empty;
if ((m_localUserServices != null) && (!IsForeignUser(userID, out url)))
return m_localUserServices.VerifySession(userID, sessionID);
else
return base.VerifySession(userID, sessionID);
}
protected override string GetUserServerURL(UUID userID)
{
string serverURL = string.Empty;
if (IsForeignUser(userID, out serverURL))
return serverURL;
return m_commsManager.NetworkServersInfo.UserURL;
}
[Obsolete]
public bool IsForeignUser(UUID userID, out string userServerURL)
{
userServerURL = m_commsManager.NetworkServersInfo.UserURL;
//CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID);
//if (uinfo != null)
//{
// if (!HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile))
// {
// userServerURL = ((ForeignUserProfileData)(uinfo.UserProfile)).UserServerURI;
// return true;
// }
//}
return false;
}
}
}

View File

@ -1,55 +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 OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Osp;
namespace OpenSim.Region.Communications.Local
{
public class CommunicationsLocal : CommunicationsManager
{
public CommunicationsLocal(
ConfigSettings configSettings,
NetworkServersInfo serversInfo,
LibraryRootFolder libraryRootFolder)
: base(serversInfo, libraryRootFolder)
{
LocalUserServices lus
= new LocalUserServices(
serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
lus.AddPlugin(new TemporaryUserProfilePlugin());
lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
//LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
}
}
}

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 OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using log4net;
using System.Reflection;
namespace OpenSim.Region.Communications.Local
{
public class LocalUserServices : UserManagerBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly uint m_defaultHomeX;
private readonly uint m_defaultHomeY;
/// <summary>
/// User services used when OpenSim is running in standalone mode.
/// </summary>
/// <param name="defaultHomeLocX"></param>
/// <param name="defaultHomeLocY"></param>
/// <param name="commsManager"></param>
public LocalUserServices(
uint defaultHomeLocX, uint defaultHomeLocY, CommunicationsManager commsManager)
: base(commsManager)
{
m_defaultHomeX = defaultHomeLocX;
m_defaultHomeY = defaultHomeLocY;
}
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
return SetupMasterUser(firstName, lastName, String.Empty);
}
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
UserProfileData profile = GetUserProfile(firstName, lastName);
if (profile != null)
{
return profile;
}
m_log.Debug("Unknown Master User. Sandbox Mode: Creating Account");
AddUser(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY);
return GetUserProfile(firstName, lastName);
}
public override UserProfileData SetupMasterUser(UUID uuid)
{
UserProfileData data = GetUserProfile(uuid);
if (data == null)
{
throw new Exception("[LOCAL USER SERVICES]: Unknown master user UUID. Possible reason: UserServer is not running.");
}
return data;
}
public override bool AuthenticateUserByPassword(UUID userID, string password)
{
UserProfileData userProfile = GetUserProfile(userID);
if (null == userProfile)
return false;
string md5PasswordHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + userProfile.PasswordSalt);
if (md5PasswordHash == userProfile.PasswordHash)
return true;
else
return false;
}
}
}

View File

@ -1,65 +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.Reflection;
using System.Runtime.InteropServices;
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenSim.Region.Communications.Local")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("OpenSim.Region.Communications.Local")]
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("0.6.5.*")]
[assembly : AssemblyFileVersion("0.6.5.0")]

View File

@ -1,51 +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;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Region.Communications.OGS1
{
public class CommunicationsOGS1 : CommunicationsManager
{
public CommunicationsOGS1(
NetworkServersInfo serversInfo,
LibraryRootFolder libraryRootFolder)
: base(serversInfo, libraryRootFolder)
{
// This plugin arrangement could eventually be configurable rather than hardcoded here.
OGS1UserServices userServices = new OGS1UserServices(this);
userServices.AddPlugin(new TemporaryUserProfilePlugin());
userServices.AddPlugin(new OGS1UserDataPlugin(this));
}
}
}

View File

@ -1,774 +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.Net;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using log4net;
using Nwc.XmlRpc;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Clients;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1UserDataPlugin : IUserDataPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected CommunicationsManager m_commsManager;
public OGS1UserDataPlugin()
{
}
public OGS1UserDataPlugin(CommunicationsManager commsManager)
{
m_log.DebugFormat("[OGS1 USER SERVICES]: {0} initialized", Name);
m_commsManager = commsManager;
}
public string Version { get { return "0.1"; } }
public string Name { get { return "Open Grid Services 1 (OGS1) User Data Plugin"; } }
public void Initialise() {}
public void Initialise(string connect) {}
public void Dispose() {}
// Arguably the presence of these means that IUserDataPlugin could be fissioned
public UserAgentData GetUserAgent(string name) { 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 void AddNewUserAgent(UserAgentData agent) {}
public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; }
public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; }
public void ResetAttachments(UUID userID) {}
public void LogoutUsers(UUID regionID) {}
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
// Not interested
}
public UserProfileData GetUserByUri(Uri uri)
{
WebRequest request = WebRequest.Create(uri);
WebResponse webResponse = request.GetResponse();
XmlSerializer deserializer = new XmlSerializer(typeof(XmlRpcResponse));
XmlRpcResponse xmlRpcResponse = (XmlRpcResponse)deserializer.Deserialize(webResponse.GetResponseStream());
Hashtable respData = (Hashtable)xmlRpcResponse.Value;
return ConvertXMLRPCDataToUserProfile(respData);
}
// public Uri GetUserUri(UserProfileData userProfile)
// {
// throw new NotImplementedException();
// }
public virtual UserAgentData GetAgentByUUID(UUID userId)
{
try
{
Hashtable param = new Hashtable();
param["avatar_uuid"] = userId.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 6000);
Hashtable respData = (Hashtable)resp.Value;
if (respData.Contains("error_type"))
{
//m_log.Warn("[GRID]: " +
// "Error sent by user server when trying to get agent: (" +
// (string) respData["error_type"] +
// "): " + (string)respData["error_desc"]);
return null;
}
UUID sessionid = UUID.Zero;
UserAgentData userAgent = new UserAgentData();
userAgent.Handle = Convert.ToUInt64((string)respData["handle"]);
UUID.TryParse((string)respData["sessionid"], out sessionid);
userAgent.SessionID = sessionid;
if ((string)respData["agent_online"] == "TRUE")
{
userAgent.AgentOnline = true;
}
else
{
userAgent.AgentOnline = false;
}
return userAgent;
}
catch (Exception e)
{
m_log.ErrorFormat(
"[OGS1 USER SERVICES]: Error when trying to fetch agent data by uuid from remote user server: {0}",
e);
}
return null;
}
public virtual UserProfileData GetUserByName(string firstName, string lastName)
{
return GetUserProfile(firstName + " " + lastName);
}
public virtual List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query)
{
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]");
try
{
Hashtable param = new Hashtable();
param["queryid"] = (string)queryID.ToString();
param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty);
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000);
Hashtable respData = (Hashtable)resp.Value;
pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData);
}
catch (WebException e)
{
m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar Picker Response: " +
e.Message);
// Return Empty picker list (no results)
}
return pickerlist;
}
/// <summary>
/// Get a user profile from the user server
/// </summary>
/// <param name="avatarID"></param>
/// <returns>null if the request fails</returns>
protected virtual UserProfileData GetUserProfile(string name)
{
try
{
Hashtable param = new Hashtable();
param["avatar_name"] = name;
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
Hashtable respData = (Hashtable)resp.Value;
return ConvertXMLRPCDataToUserProfile(respData);
}
catch (WebException e)
{
m_log.ErrorFormat(
"[OGS1 USER SERVICES]: Error when trying to fetch profile data by name from remote user server: {0}",
e);
}
return null;
}
/// <summary>
/// Get a user profile from the user server
/// </summary>
/// <param name="avatarID"></param>
/// <returns>null if the request fails</returns>
public virtual UserProfileData GetUserByUUID(UUID avatarID)
{
try
{
Hashtable param = new Hashtable();
param["avatar_uuid"] = avatarID.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
Hashtable respData = (Hashtable)resp.Value;
return ConvertXMLRPCDataToUserProfile(respData);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[OGS1 USER SERVICES]: Error when trying to fetch profile data by uuid from remote user server: {0}",
e);
}
return null;
}
public virtual bool UpdateUserProfile(UserProfileData userProfile)
{
m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile.");
Hashtable param = new Hashtable();
param["avatar_uuid"] = userProfile.ID.ToString();
//param["AllowPublish"] = userProfile.ToString();
param["FLImageID"] = userProfile.FirstLifeImage.ToString();
param["ImageID"] = userProfile.Image.ToString();
//param["MaturePublish"] = MaturePublish.ToString();
param["AboutText"] = userProfile.AboutText;
param["FLAboutText"] = userProfile.FirstLifeAboutText;
//param["ProfileURL"] = userProfile.ProfileURL.ToString();
param["home_region"] = userProfile.HomeRegion.ToString();
param["home_region_id"] = userProfile.HomeRegionID.ToString();
param["home_pos_x"] = userProfile.HomeLocationX.ToString();
param["home_pos_y"] = userProfile.HomeLocationY.ToString();
param["home_pos_z"] = userProfile.HomeLocationZ.ToString();
param["home_look_x"] = userProfile.HomeLookAtX.ToString();
param["home_look_y"] = userProfile.HomeLookAtY.ToString();
param["home_look_z"] = userProfile.HomeLookAtZ.ToString();
param["user_flags"] = userProfile.UserFlags.ToString();
param["god_level"] = userProfile.GodLevel.ToString();
param["custom_type"] = userProfile.CustomType.ToString();
param["partner"] = userProfile.Partner.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("update_user_profile", parameters);
XmlRpcResponse resp = req.Send(GetUserServerURL(userProfile.ID), 3000);
Hashtable respData = (Hashtable)resp.Value;
if (respData != null)
{
if (respData.Contains("returnString"))
{
if (((string)respData["returnString"]).ToUpper() != "TRUE")
{
m_log.Warn("[GRID]: Unable to update user profile, User Server Reported an issue");
return false;
}
}
else
{
m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
return false;
}
}
else
{
m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
return false;
}
return true;
}
/// <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>
public virtual void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
try
{
Hashtable param = new Hashtable();
param["ownerID"] = friendlistowner.Guid.ToString();
param["friendID"] = friend.Guid.ToString();
param["friendPerms"] = perms.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000);
Hashtable respData = (Hashtable)resp.Value;
if (respData != null)
{
if (respData.Contains("returnString"))
{
if ((string)respData["returnString"] == "TRUE")
{
}
else
{
m_log.Warn("[GRID]: Unable to add new friend, User Server Reported an issue");
}
}
else
{
m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!");
}
}
else
{
m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!");
}
}
catch (WebException e)
{
m_log.Warn("[GRID]: Error when trying to AddNewUserFriend: " +
e.Message);
}
}
/// <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>
public virtual void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
try
{
Hashtable param = new Hashtable();
param["ownerID"] = friendlistowner.Guid.ToString();
param["friendID"] = friend.Guid.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000);
Hashtable respData = (Hashtable)resp.Value;
if (respData != null)
{
if (respData.Contains("returnString"))
{
if ((string)respData["returnString"] == "TRUE")
{
}
else
{
m_log.Warn("[GRID]: Unable to remove friend, User Server Reported an issue");
}
}
else
{
m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!");
}
}
else
{
m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!");
}
}
catch (WebException e)
{
m_log.Warn("[GRID]: Error when trying to RemoveUserFriend: " +
e.Message);
}
}
/// <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>
public virtual void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
try
{
Hashtable param = new Hashtable();
param["ownerID"] = friendlistowner.Guid.ToString();
param["friendID"] = friend.Guid.ToString();
param["friendPerms"] = perms.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000);
Hashtable respData = (Hashtable)resp.Value;
if (respData != null)
{
if (respData.Contains("returnString"))
{
if ((string)respData["returnString"] == "TRUE")
{
}
else
{
m_log.Warn("[GRID]: Unable to update_user_friend_perms, User Server Reported an issue");
}
}
else
{
m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!");
}
}
else
{
m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!");
}
}
catch (WebException e)
{
m_log.Warn("[GRID]: Error when trying to update_user_friend_perms: " +
e.Message);
}
}
/// <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>
public virtual List<FriendListItem> GetUserFriendList(UUID friendlistowner)
{
List<FriendListItem> buddylist = new List<FriendListItem>();
try
{
Hashtable param = new Hashtable();
param["ownerID"] = friendlistowner.Guid.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000);
Hashtable respData = (Hashtable)resp.Value;
if (respData != null && respData.Contains("avcount"))
{
buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
}
}
catch (WebException e)
{
m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar's friends list: " +
e.Message);
// Return Empty list (no friends)
}
return buddylist;
}
public virtual Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
{
Dictionary<UUID, FriendRegionInfo> result = new Dictionary<UUID, FriendRegionInfo>();
// ask MessageServer about the current on-/offline status and regions the friends are in
ArrayList parameters = new ArrayList();
Hashtable map = new Hashtable();
ArrayList list = new ArrayList();
foreach (UUID uuid in uuids)
{
list.Add(uuid.ToString());
list.Add(uuid.ToString());
}
map["uuids"] = list;
map["recv_key"] = m_commsManager.NetworkServersInfo.UserRecvKey;
map["send_key"] = m_commsManager.NetworkServersInfo.UserSendKey;
parameters.Add(map);
try
{
XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.MessagingURL, 8000);
Hashtable respData = resp != null ? (Hashtable)resp.Value : null;
if (respData == null || respData.ContainsKey("faultMessage"))
{
m_log.WarnFormat("[OGS1 USER SERVICES]: Contacting MessagingServer about user-regions resulted in error: {0}",
respData == null ? "<unknown error>" : respData["faultMessage"]);
}
else if (!respData.ContainsKey("count"))
{
m_log.WarnFormat("[OGS1 USER SERVICES]: Wrong format in response for MessagingServer request get_presence_info_bulk: missing 'count' field");
}
else
{
int count = (int)respData["count"];
m_log.DebugFormat("[OGS1 USER SERVICES]: Request returned {0} results.", count);
for (int i = 0; i < count; ++i)
{
if (respData.ContainsKey("uuid_" + i) && respData.ContainsKey("isOnline_" + i) && respData.ContainsKey("regionHandle_" + i))
{
UUID uuid;
if (UUID.TryParse((string)respData["uuid_" + i], out uuid))
{
FriendRegionInfo info = new FriendRegionInfo();
info.isOnline = (bool)respData["isOnline_" + i];
if (info.isOnline)
{
// TODO remove this after the next protocol update (say, r7800?)
info.regionHandle = Convert.ToUInt64(respData["regionHandle_" + i]);
// accept missing id
if (respData.ContainsKey("regionID_" + i))
UUID.TryParse((string)respData["regionID_" + i], out info.regionID);
}
result.Add(uuid, info);
}
}
else
{
m_log.WarnFormat("[OGS1 USER SERVICES]: Response to get_presence_info_bulk contained an error in entry {0}", i);
}
}
}
}
catch (WebException e)
{
m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch friend infos: {0}", e.Message);
}
m_log.DebugFormat("[OGS1 USER SERVICES]: Returning {0} entries", result.Count);
return result;
}
public virtual AvatarAppearance GetUserAppearance(UUID user)
{
AvatarAppearance appearance = null;
try
{
Hashtable param = new Hashtable();
param["owner"] = user.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters);
XmlRpcResponse resp = req.Send(GetUserServerURL(user), 8000);
Hashtable respData = (Hashtable)resp.Value;
return ConvertXMLRPCDataToAvatarAppearance(respData);
}
catch (WebException e)
{
m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch appearance for avatar {0}, {1}", user, e.Message);
}
return appearance;
}
public virtual void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
{
try
{
Hashtable param = appearance.ToHashTable();
param["owner"] = user.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters);
XmlRpcResponse resp = req.Send(GetUserServerURL(user), 8000);
Hashtable respData = (Hashtable)resp.Value;
if (respData != null)
{
if (respData.Contains("returnString"))
{
if ((string)respData["returnString"] == "TRUE")
{
m_log.DebugFormat("[OGS1 USER SERVICES]: Updated user appearance in {0}", GetUserServerURL(user));
}
else
{
m_log.Warn("[GRID]: Unable to update_user_appearance, User Server Reported an issue");
}
}
else
{
m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!");
}
}
else
{
m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!");
}
}
catch (WebException e)
{
m_log.WarnFormat("[OGS1 USER SERVICES]: Error when trying to update Avatar's appearance in {0}: {1}",
GetUserServerURL(user), e.Message);
// Return Empty list (no friends)
}
}
protected virtual string GetUserServerURL(UUID userID)
{
return m_commsManager.NetworkServersInfo.UserURL;
}
protected UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data)
{
if (data.Contains("error_type"))
{
//m_log.Warn("[GRID]: " +
// "Error sent by user server when trying to get user profile: (" +
// data["error_type"] +
// "): " + data["error_desc"]);
return null;
}
UserProfileData userData = new UserProfileData();
userData.FirstName = (string)data["firstname"];
userData.SurName = (string)data["lastname"];
if (data["email"] != null)
userData.Email = (string)data["email"];
userData.ID = new UUID((string)data["uuid"]);
userData.Created = Convert.ToInt32(data["profile_created"]);
if (data.Contains("server_inventory") && data["server_inventory"] != null)
userData.UserInventoryURI = (string)data["server_inventory"];
if (data.Contains("server_asset") && data["server_asset"] != null)
userData.UserAssetURI = (string)data["server_asset"];
if (data.Contains("profile_firstlife_about") && data["profile_firstlife_about"] != null)
userData.FirstLifeAboutText = (string)data["profile_firstlife_about"];
userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]);
userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]);
userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]);
userData.AboutText = (string)data["profile_about"];
userData.Image = new UUID((string)data["profile_image"]);
userData.LastLogin = Convert.ToInt32((string)data["profile_lastlogin"]);
userData.HomeRegion = Convert.ToUInt64((string)data["home_region"]);
if (data.Contains("home_region_id"))
userData.HomeRegionID = new UUID((string)data["home_region_id"]);
else
userData.HomeRegionID = UUID.Zero;
userData.HomeLocation =
new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]),
(float)Convert.ToDecimal((string)data["home_coordinates_y"]),
(float)Convert.ToDecimal((string)data["home_coordinates_z"]));
userData.HomeLookAt =
new Vector3((float)Convert.ToDecimal((string)data["home_look_x"]),
(float)Convert.ToDecimal((string)data["home_look_y"]),
(float)Convert.ToDecimal((string)data["home_look_z"]));
if (data.Contains("user_flags"))
userData.UserFlags = Convert.ToInt32((string)data["user_flags"]);
if (data.Contains("god_level"))
userData.GodLevel = Convert.ToInt32((string)data["god_level"]);
if (data.Contains("custom_type"))
userData.CustomType = (string)data["custom_type"];
else
userData.CustomType = "";
if (userData.CustomType == null)
userData.CustomType = "";
if (data.Contains("partner"))
userData.Partner = new UUID((string)data["partner"]);
else
userData.Partner = UUID.Zero;
return userData;
}
protected AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data)
{
if (data != null)
{
if (data.Contains("error_type"))
{
m_log.Warn("[GRID]: " +
"Error sent by user server when trying to get user appearance: (" +
data["error_type"] +
"): " + data["error_desc"]);
return null;
}
else
{
return new AvatarAppearance(data);
}
}
else
{
m_log.Error("[GRID]: The avatar appearance is null, something bad happenend");
return null;
}
}
protected List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data)
{
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
int pickercount = Convert.ToInt32((string)data["avcount"]);
UUID respqueryID = new UUID((string)data["queryid"]);
if (queryID == respqueryID)
{
for (int i = 0; i < pickercount; i++)
{
AvatarPickerAvatar apicker = new AvatarPickerAvatar();
UUID avatarID = new UUID((string)data["avatarid" + i.ToString()]);
string firstname = (string)data["firstname" + i.ToString()];
string lastname = (string)data["lastname" + i.ToString()];
apicker.AvatarID = avatarID;
apicker.firstName = firstname;
apicker.lastName = lastname;
pickerlist.Add(apicker);
}
}
else
{
m_log.Warn("[OGS1 USER SERVICES]: Got invalid queryID from userServer");
}
return pickerlist;
}
protected List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
{
List<FriendListItem> buddylist = new List<FriendListItem>();
int buddycount = Convert.ToInt32((string)data["avcount"]);
for (int i = 0; i < buddycount; i++)
{
FriendListItem buddylistitem = new FriendListItem();
buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]);
buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]);
buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
buddylist.Add(buddylistitem);
}
return buddylist;
}
}
}

View File

@ -1,176 +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.Net;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using log4net;
using Nwc.XmlRpc;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Clients;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1UserServices : UserManagerBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public OGS1UserServices(CommunicationsManager commsManager)
: base(commsManager)
{
}
public override void ClearUserAgent(UUID avatarID)
{
// TODO: implement
// It may be possible to use the UserManagerBase implementation.
}
protected virtual string GetUserServerURL(UUID userID)
{
return m_commsManager.NetworkServersInfo.UserURL;
}
/// <summary>
/// Logs off a user on the user server
/// </summary>
/// <param name="UserID">UUID of the user</param>
/// <param name="regionID">UUID of the Region</param>
/// <param name="regionhandle">regionhandle</param>
/// <param name="position">final position</param>
/// <param name="lookat">final lookat</param>
public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
{
Hashtable param = new Hashtable();
param["avatar_uuid"] = userid.Guid.ToString();
param["region_uuid"] = regionid.Guid.ToString();
param["region_handle"] = regionhandle.ToString();
param["region_pos_x"] = position.X.ToString();
param["region_pos_y"] = position.Y.ToString();
param["region_pos_z"] = position.Z.ToString();
param["lookat_x"] = lookat.X.ToString();
param["lookat_y"] = lookat.Y.ToString();
param["lookat_z"] = lookat.Z.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("logout_of_simulator", parameters);
try
{
req.Send(GetUserServerURL(userid), 3000);
}
catch (WebException)
{
m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff");
}
}
/// <summary>
/// Retrieve the user information for the given master uuid.
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
return SetupMasterUser(firstName, lastName, String.Empty);
}
/// <summary>
/// Retrieve the user information for the given master uuid.
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
UserProfileData profile = GetUserProfile(firstName, lastName);
return profile;
}
/// <summary>
/// Retrieve the user information for the given master uuid.
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
public override UserProfileData SetupMasterUser(UUID uuid)
{
UserProfileData data = GetUserProfile(uuid);
if (data == null)
{
throw new Exception(
"Could not retrieve profile for master user " + uuid + ". User server did not respond to the request.");
}
return data;
}
public override bool VerifySession(UUID userID, UUID sessionID)
{
m_log.DebugFormat("[OGS1 USER SERVICES]: Verifying user session for " + userID);
return AuthClient.VerifySession(GetUserServerURL(userID), userID, sessionID);
}
public override bool AuthenticateUserByPassword(UUID userID, string password)
{
Hashtable param = new Hashtable();
param["user_uuid"] = userID.ToString();
param["password"] = password;
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters);
XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
// Temporary measure to deal with older services
if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD)
{
throw new Exception(
String.Format(
"XMLRPC method 'authenticate_user_by_password' not yet implemented by user service at {0}",
m_commsManager.NetworkServersInfo.UserURL));
}
Hashtable respData = (Hashtable)resp.Value;
if ((string)respData["auth_user"] == "TRUE")
{
return true;
}
else
{
return false;
}
}
}
}

View File

@ -1,65 +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.Reflection;
using System.Runtime.InteropServices;
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")]
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("0.6.5.*")]
[assembly : AssemblyFileVersion("0.6.5.0")]

View File

@ -785,71 +785,6 @@
<!-- OpenSim.Framework.Communications -->
<Project frameworkVersion="v3_5" name="OpenSim.Region.Communications.Local" path="OpenSim/Region/Communications/Local" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Data" />
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.Communications.OGS1" path="OpenSim/Region/Communications/OGS1" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data" />
<Reference name="OpenSim.Framework.Communications" />
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Communications.Local" />
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="Nini.dll" />
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<!-- OGS projects -->
<Project frameworkVersion="v3_5" name="OpenSim.Grid.Communications.OGS1" path="OpenSim/Grid/Communications/OGS1" type="Library">
@ -1828,44 +1763,6 @@
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.Communications.Hypergrid" path="OpenSim/Region/Communications/Hypergrid" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications" />
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Communications.Local"/>
<Reference name="OpenSim.Region.Communications.OGS1"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack" path="OpenSim/Region/ClientStack" type="Library">
<Configuration name="Debug">
<Options>