Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
01eacd3a31
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public interface IProfileModule
|
||||||
|
{
|
||||||
|
void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,7 +43,7 @@ using OpenSim.Services.Interfaces;
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Profile
|
namespace OpenSim.Region.CoreModules.Avatar.Profile
|
||||||
{
|
{
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||||
public class BasicProfileModule : ISharedRegionModule
|
public class BasicProfileModule : IProfileModule, ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
||||||
|
|
||||||
public void Initialise(IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
|
// This can be reduced later as the loader will determine
|
||||||
|
// whether we are needed
|
||||||
if (config.Configs["Profile"] != null)
|
if (config.Configs["Profile"] != null)
|
||||||
{
|
{
|
||||||
if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule")
|
if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule")
|
||||||
|
@ -65,7 +67,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
||||||
|
|
||||||
m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled");
|
m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled");
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
|
@ -80,6 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
||||||
m_Scenes.Add(scene);
|
m_Scenes.Add(scene);
|
||||||
// Hook up events
|
// Hook up events
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
|
scene.RegisterModuleInterface<IProfileModule>(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return typeof(IProfileModule); }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -50,6 +50,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
public string HomeURL { get; set; }
|
public string HomeURL { get; set; }
|
||||||
public Dictionary<string, object> ServerURLs { get; set; }
|
public Dictionary<string, object> ServerURLs { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public int Flags { get; set; }
|
||||||
|
public int Created { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserManagementModule : ISharedRegionModule, IUserManagement
|
public class UserManagementModule : ISharedRegionModule, IUserManagement
|
||||||
|
@ -281,6 +284,94 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetUserFlags(UUID userID)
|
||||||
|
{
|
||||||
|
UserData userdata;
|
||||||
|
lock (m_UserCache)
|
||||||
|
m_UserCache.TryGetValue(userID, out userdata);
|
||||||
|
|
||||||
|
if (userdata.Flags == -1)
|
||||||
|
GetUserInfo(userID);
|
||||||
|
|
||||||
|
if (userdata.Flags != -1)
|
||||||
|
return userdata.Flags;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetUserCreated(UUID userID)
|
||||||
|
{
|
||||||
|
UserData userdata;
|
||||||
|
lock (m_UserCache)
|
||||||
|
m_UserCache.TryGetValue(userID, out userdata);
|
||||||
|
|
||||||
|
if (userdata.Flags == -1)
|
||||||
|
GetUserInfo(userID);
|
||||||
|
|
||||||
|
if (userdata.Created != -1)
|
||||||
|
return userdata.Created;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetUserTitle(UUID userID)
|
||||||
|
{
|
||||||
|
UserData userdata;
|
||||||
|
lock (m_UserCache)
|
||||||
|
m_UserCache.TryGetValue(userID, out userdata);
|
||||||
|
|
||||||
|
if (userdata.Flags == -1)
|
||||||
|
GetUserInfo(userID);
|
||||||
|
|
||||||
|
if (userdata.Created != -1)
|
||||||
|
return userdata.Title;
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will cache the user data
|
||||||
|
// Change this to return bool
|
||||||
|
private bool GetUserInfo(UUID userID)
|
||||||
|
{
|
||||||
|
UserData userdata;
|
||||||
|
lock (m_UserCache)
|
||||||
|
m_UserCache.TryGetValue(userID, out userdata);
|
||||||
|
|
||||||
|
if (userdata != null)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
|
||||||
|
|
||||||
|
if (userdata.Flags >= 0)
|
||||||
|
{
|
||||||
|
// This is already populated
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}",
|
||||||
|
userdata.HomeURL, userID);
|
||||||
|
|
||||||
|
UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
|
||||||
|
Dictionary<string, object> info = uConn.GetUserInfo(userID);
|
||||||
|
|
||||||
|
// Pull our data now
|
||||||
|
if (info["result"].ToString() == "success")
|
||||||
|
{
|
||||||
|
userdata.Flags = (int)info["user_flags"];
|
||||||
|
userdata.Created = (int)info["user_created"];
|
||||||
|
userdata.Title = (string)info["user_title"];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public string GetUserUUI(UUID userID)
|
public string GetUserUUI(UUID userID)
|
||||||
{
|
{
|
||||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID);
|
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID);
|
||||||
|
@ -352,6 +443,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||||
{
|
{
|
||||||
UserData user = new UserData();
|
UserData user = new UserData();
|
||||||
user.Id = id;
|
user.Id = id;
|
||||||
|
user.Flags = -1;
|
||||||
|
user.Created = -1;
|
||||||
|
|
||||||
if (creatorData != null && creatorData != string.Empty)
|
if (creatorData != null && creatorData != string.Empty)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
string GetUserHomeURL(UUID uuid);
|
string GetUserHomeURL(UUID uuid);
|
||||||
string GetUserUUI(UUID uuid);
|
string GetUserUUI(UUID uuid);
|
||||||
string GetUserServerURL(UUID uuid, string serverType);
|
string GetUserServerURL(UUID uuid, string serverType);
|
||||||
|
int GetUserFlags(UUID userID);
|
||||||
|
int GetUserCreated(UUID userID);
|
||||||
|
string GetUserTitle(UUID userID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a user.
|
/// Add a user.
|
||||||
|
|
|
@ -91,6 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
|
||||||
server.AddXmlRPCHandler("status_notification", StatusNotification, false);
|
server.AddXmlRPCHandler("status_notification", StatusNotification, false);
|
||||||
server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
|
server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
|
||||||
|
server.AddXmlRPCHandler("get_user_info", GetUserInfo, false);
|
||||||
server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
|
server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
|
||||||
|
|
||||||
server.AddXmlRPCHandler("locate_user", LocateUser, false);
|
server.AddXmlRPCHandler("locate_user", LocateUser, false);
|
||||||
|
@ -299,6 +300,38 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XmlRpcResponse GetUserInfo(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
|
{
|
||||||
|
Hashtable hash = new Hashtable();
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
|
||||||
|
// This needs checking!
|
||||||
|
if (requestData.ContainsKey("userID"))
|
||||||
|
{
|
||||||
|
string userID_str = (string)requestData["userID"];
|
||||||
|
UUID userID = UUID.Zero;
|
||||||
|
UUID.TryParse(userID_str, out userID);
|
||||||
|
|
||||||
|
//int userFlags = m_HomeUsersService.GetUserFlags(userID);
|
||||||
|
Dictionary<string,object> userInfo = m_HomeUsersService.GetUserInfo(userID);
|
||||||
|
if (userInfo.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, object> kvp in userInfo)
|
||||||
|
{
|
||||||
|
hash[kvp.Key] = kvp.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hash["result"] = "failure";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
response.Value = hash;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient)
|
public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
Hashtable hash = new Hashtable();
|
Hashtable hash = new Hashtable();
|
||||||
|
|
|
@ -561,6 +561,60 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
return online;
|
return online;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<string,object> GetUserInfo (UUID userID)
|
||||||
|
{
|
||||||
|
Hashtable hash = new Hashtable();
|
||||||
|
hash["userID"] = userID.ToString();
|
||||||
|
|
||||||
|
IList paramList = new ArrayList();
|
||||||
|
paramList.Add(hash);
|
||||||
|
|
||||||
|
XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList);
|
||||||
|
|
||||||
|
Dictionary<string, object> info = new Dictionary<string, object>();
|
||||||
|
XmlRpcResponse response = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = request.Send(m_ServerURL, 10000);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.IsFault)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
hash = (Hashtable)response.Value;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (hash == null)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here is the actual response
|
||||||
|
foreach (object key in hash.Keys)
|
||||||
|
{
|
||||||
|
if (hash[key] != null)
|
||||||
|
{
|
||||||
|
info.Add(key.ToString(), hash[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, object> GetServerURLs(UUID userID)
|
public Dictionary<string, object> GetServerURLs(UUID userID)
|
||||||
{
|
{
|
||||||
Hashtable hash = new Hashtable();
|
Hashtable hash = new Hashtable();
|
||||||
|
|
|
@ -488,6 +488,31 @@ namespace OpenSim.Services.HypergridService
|
||||||
return online;
|
return online;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, object> GetUserInfo(UUID userID)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> info = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
if (m_UserAccountService == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get user flags because user account service is missing");
|
||||||
|
info["result"] = "fail";
|
||||||
|
info["message"] = "UserAccountService is missing!";
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID);
|
||||||
|
|
||||||
|
if (account != null)
|
||||||
|
{
|
||||||
|
info.Add("user_flags", (object)account.UserFlags);
|
||||||
|
info.Add("user_created", (object)account.Created);
|
||||||
|
info.Add("user_title", (object)account.UserTitle);
|
||||||
|
info.Add("result", "success");
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, object> GetServerURLs(UUID userID)
|
public Dictionary<string, object> GetServerURLs(UUID userID)
|
||||||
{
|
{
|
||||||
if (m_UserAccountService == null)
|
if (m_UserAccountService == null)
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
void LogoutAgent(UUID userID, UUID sessionID);
|
void LogoutAgent(UUID userID, UUID sessionID);
|
||||||
GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
|
GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
|
||||||
Dictionary<string, object> GetServerURLs(UUID userID);
|
Dictionary<string, object> GetServerURLs(UUID userID);
|
||||||
|
Dictionary<string,object> GetUserInfo(UUID userID);
|
||||||
|
|
||||||
string LocateUser(UUID userID);
|
string LocateUser(UUID userID);
|
||||||
// Tries to get the universal user identifier for the targetUserId
|
// Tries to get the universal user identifier for the targetUserId
|
||||||
|
|
Loading…
Reference in New Issue