mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
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.
This commit is contained in:
@@ -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,16 +804,13 @@ 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] + "/";
|
||||
}
|
||||
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
|
||||
@@ -821,16 +818,29 @@ namespace OpenSim.Services.LLLoginService
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user