Added necessary code to drop inventory on hg friends using the profile window, but can't test because this mechanism doesn't seem to work without a profile service.
parent
24f28d3534
commit
e19031849e
|
@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel)
|
||||
{
|
||||
string userAssetServer = string.Empty;
|
||||
if (IsForeignUser(avatarID, out userAssetServer) && m_OutboundPermission)
|
||||
if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
|
||||
{
|
||||
Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); });
|
||||
}
|
||||
|
@ -180,10 +180,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
|
||||
{
|
||||
string userAssetServer = string.Empty;
|
||||
if (IsForeignUser(sender, out userAssetServer))
|
||||
if (IsForeignUser(sender, out userAssetServer) && userAssetServer != string.Empty)
|
||||
m_assMapper.Get(item.AssetID, sender, userAssetServer);
|
||||
|
||||
if (IsForeignUser(receiver, out userAssetServer) && m_OutboundPermission)
|
||||
if (IsForeignUser(receiver, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
|
||||
m_assMapper.Post(item.AssetID, receiver, userAssetServer);
|
||||
}
|
||||
|
||||
|
@ -203,9 +203,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
|
||||
{
|
||||
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
|
||||
assetServerURL = assetServerURL.Trim(new char[] { '/' }); return true;
|
||||
assetServerURL = assetServerURL.Trim(new char[] { '/' });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI");
|
||||
assetServerURL = assetServerURL.Trim(new char[] { '/' });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -35,6 +35,7 @@ using OpenSim.Region.Framework;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.Connectors.Hypergrid;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
|
@ -47,7 +48,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
public UUID Id;
|
||||
public string FirstName;
|
||||
public string LastName;
|
||||
public string ProfileURL;
|
||||
public string HomeURL;
|
||||
public Dictionary<string, object> ServerURLs;
|
||||
}
|
||||
|
||||
public class UserManagementModule : ISharedRegionModule, IUserManagement
|
||||
|
@ -224,6 +226,34 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
return "(hippos)";
|
||||
}
|
||||
|
||||
public string GetUserHomeURL(UUID userID)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(userID))
|
||||
return m_UserCache[userID].HomeURL;
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetUserServerURL(UUID userID, string serverType)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(userID))
|
||||
{
|
||||
UserData userdata = m_UserCache[userID];
|
||||
if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
|
||||
return userdata.ServerURLs[serverType].ToString();
|
||||
|
||||
if (userdata.HomeURL != string.Empty)
|
||||
{
|
||||
UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
|
||||
userdata.ServerURLs = uConn.GetServerURLs(userID);
|
||||
if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
|
||||
return userdata.ServerURLs[serverType].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void AddUser(UUID id, string creatorData)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(id))
|
||||
|
@ -249,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
string[] parts = creatorData.Split(';');
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
user.ProfileURL = parts[0];
|
||||
user.HomeURL = parts[0];
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri(parts[0]);
|
||||
|
@ -274,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
lock (m_UserCache)
|
||||
m_UserCache[id] = user;
|
||||
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL);
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.HomeURL);
|
||||
}
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last, string profileURL)
|
||||
|
|
|
@ -58,6 +58,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
|
||||
protected IUserManagement m_UserManagement;
|
||||
protected IUserManagement UserManagementModule
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_UserManagement == null)
|
||||
m_UserManagement = m_Scenes[0].RequestModuleInterface<IUserManagement>();
|
||||
return m_UserManagement;
|
||||
}
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
|
@ -206,6 +217,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
inventoryURL = UserManagementModule.GetUserServerURL(userID, "InventoryServerURI");
|
||||
inventoryURL = inventoryURL.Trim(new char[] { '/' });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
public interface IUserManagement
|
||||
{
|
||||
string GetUserName(UUID uuid);
|
||||
string GetUserHomeURL(UUID uuid);
|
||||
string GetUserServerURL(UUID uuid, string serverType);
|
||||
void AddUser(UUID uuid, string userData);
|
||||
void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
|
||||
server.AddXmlRPCHandler("status_notification", StatusNotification, false);
|
||||
server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
|
||||
server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
|
||||
|
||||
server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
|
||||
}
|
||||
|
@ -256,7 +257,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
ids.Add(requestData[key].ToString());
|
||||
}
|
||||
|
||||
// let's spawn a thread for this, because it may take a long time...
|
||||
List<UUID> online = m_HomeUsersService.GetOnlineFriends(userID, ids);
|
||||
if (online.Count > 0)
|
||||
{
|
||||
|
@ -266,8 +266,38 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
hash["friend_" + i.ToString()] = id.ToString();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
hash["result"] = "No Friends Online";
|
||||
}
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable hash = new Hashtable();
|
||||
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
if (requestData.ContainsKey("userID"))
|
||||
{
|
||||
string userID_str = (string)requestData["userID"];
|
||||
UUID userID = UUID.Zero;
|
||||
UUID.TryParse(userID_str, out userID);
|
||||
|
||||
Dictionary<string, object> serverURLs = m_HomeUsersService.GetServerURLs(userID);
|
||||
if (serverURLs.Count > 0)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> kvp in serverURLs)
|
||||
hash["SRV_" + kvp.Key] = kvp.Value.ToString();
|
||||
}
|
||||
else
|
||||
hash["result"] = "No Service URLs";
|
||||
}
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
|
|
@ -470,7 +470,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
{
|
||||
if (hash == null)
|
||||
{
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
|
||||
reason = "Internal error 1";
|
||||
return online;
|
||||
}
|
||||
|
@ -496,6 +496,70 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
return online;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetServerURLs(UUID userID)
|
||||
{
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["userID"] = userID.ToString();
|
||||
|
||||
IList paramList = new ArrayList();
|
||||
paramList.Add(hash);
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList);
|
||||
string reason = string.Empty;
|
||||
|
||||
// Send and get reply
|
||||
Dictionary<string, object> serverURLs = new Dictionary<string,object>();
|
||||
XmlRpcResponse response = null;
|
||||
try
|
||||
{
|
||||
response = request.Send(m_ServerURL, 10000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
|
||||
reason = "Exception: " + e.Message;
|
||||
return serverURLs;
|
||||
}
|
||||
|
||||
if (response.IsFault)
|
||||
{
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
|
||||
reason = "XMLRPC Fault";
|
||||
return serverURLs;
|
||||
}
|
||||
|
||||
hash = (Hashtable)response.Value;
|
||||
//foreach (Object o in hash)
|
||||
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||
try
|
||||
{
|
||||
if (hash == null)
|
||||
{
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
|
||||
reason = "Internal error 1";
|
||||
return serverURLs;
|
||||
}
|
||||
|
||||
// Here is the actual response
|
||||
foreach (object key in hash.Keys)
|
||||
{
|
||||
if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null)
|
||||
{
|
||||
string serverType = key.ToString().Substring(4); // remove "SRV_"
|
||||
serverURLs.Add(serverType, hash[key].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
|
||||
reason = "Exception: " + e.Message;
|
||||
}
|
||||
|
||||
return serverURLs;
|
||||
}
|
||||
|
||||
private bool GetBoolResponse(XmlRpcRequest request, out string reason)
|
||||
{
|
||||
//m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL);
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace OpenSim.Services.HypergridService
|
|||
protected static IGatekeeperService m_GatekeeperService;
|
||||
protected static IFriendsService m_FriendsService;
|
||||
protected static IPresenceService m_PresenceService;
|
||||
protected static IUserAccountService m_UserAccountService;
|
||||
protected static IFriendsSimConnector m_FriendsLocalSimConnector; // standalone, points to HGFriendsModule
|
||||
protected static FriendsSimConnector m_FriendsSimConnector; // grid
|
||||
|
||||
|
@ -102,6 +103,7 @@ namespace OpenSim.Services.HypergridService
|
|||
string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty);
|
||||
string friendsService = serverConfig.GetString("FriendsService", String.Empty);
|
||||
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
|
||||
string userAccountService = serverConfig.GetString("UserAccountService", String.Empty);
|
||||
|
||||
m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);
|
||||
|
||||
|
@ -115,6 +117,7 @@ namespace OpenSim.Services.HypergridService
|
|||
m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args);
|
||||
m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
|
||||
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args);
|
||||
|
||||
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
if (m_GridName == string.Empty)
|
||||
|
@ -457,6 +460,20 @@ namespace OpenSim.Services.HypergridService
|
|||
|
||||
return online;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetServerURLs(UUID userID)
|
||||
{
|
||||
if (m_UserAccountService == null)
|
||||
{
|
||||
m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get server URLs because user account service is missing");
|
||||
return new Dictionary<string, object>();
|
||||
}
|
||||
UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID);
|
||||
if (account != null)
|
||||
return account.ServiceURLs;
|
||||
|
||||
return new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
||||
class TravelingAgentInfo
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim.Services.Interfaces
|
|||
bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason);
|
||||
void LogoutAgent(UUID userID, UUID sessionID);
|
||||
GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
|
||||
Dictionary<string, object> GetServerURLs(UUID userID);
|
||||
|
||||
void StatusNotification(List<string> friends, UUID userID, bool online);
|
||||
List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
|
||||
|
|
|
@ -804,33 +804,43 @@ namespace OpenSim.Services.LLLoginService
|
|||
// Old style: get the service keys from the DB
|
||||
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
|
||||
{
|
||||
if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty))
|
||||
{
|
||||
aCircuit.ServiceURLs[kvp.Key] = m_LoginServerConfig.GetString(kvp.Key, string.Empty);
|
||||
}
|
||||
else
|
||||
if (kvp.Value != null)
|
||||
{
|
||||
aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
|
||||
}
|
||||
|
||||
if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/"))
|
||||
aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/";
|
||||
}
|
||||
}
|
||||
|
||||
// New style: service keys start with SRV_; override the previous
|
||||
string[] keys = m_LoginServerConfig.GetKeys();
|
||||
|
||||
if (keys.Length > 0)
|
||||
{
|
||||
bool newUrls = false;
|
||||
IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_"));
|
||||
foreach (string serviceKey in serviceKeys)
|
||||
{
|
||||
string keyName = serviceKey.Replace("SRV_", "");
|
||||
aCircuit.ServiceURLs[keyName] = m_LoginServerConfig.GetString(serviceKey, string.Empty);
|
||||
if (!aCircuit.ServiceURLs[keyName].ToString().EndsWith("/"))
|
||||
aCircuit.ServiceURLs[keyName] = aCircuit.ServiceURLs[keyName] + "/";
|
||||
string keyValue = m_LoginServerConfig.GetString(serviceKey, string.Empty);
|
||||
if (!keyValue.EndsWith("/"))
|
||||
keyValue = keyValue + "/";
|
||||
|
||||
if (!account.ServiceURLs.ContainsKey(keyName) || (account.ServiceURLs.ContainsKey(keyName) && account.ServiceURLs[keyName] != keyValue))
|
||||
{
|
||||
account.ServiceURLs[keyName] = keyValue;
|
||||
newUrls = true;
|
||||
}
|
||||
aCircuit.ServiceURLs[keyName] = keyValue;
|
||||
|
||||
m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
|
||||
}
|
||||
|
||||
// The grid operator decided to override the defaults in the
|
||||
// [LoginService] configuration. Let's store the correct ones.
|
||||
if (newUrls)
|
||||
m_UserAccountService.StoreUserAccount(account);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService"
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService"
|
||||
|
||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||
|
||||
|
||||
;; The interface that local users get when they are in other grids
|
||||
|
|
Loading…
Reference in New Issue