mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
HG: Instant Message working. Tested on HG standalones only. Needs a lot more testing.
This commit is contained in:
@@ -52,6 +52,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IUserAgentService m_HomeUsersService;
|
||||
private string[] m_AuthorizedCallers;
|
||||
|
||||
public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
|
||||
this(config, server, null)
|
||||
@@ -75,6 +76,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1");
|
||||
bool proxy = gridConfig.GetBoolean("HasProxy", false);
|
||||
|
||||
string csv = gridConfig.GetString("AuthorizedCallers", "127.0.0.1");
|
||||
csv = csv.Replace(" ", "");
|
||||
m_AuthorizedCallers = csv.Split(',');
|
||||
|
||||
server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
|
||||
server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
|
||||
server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
|
||||
@@ -85,6 +90,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
|
||||
server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
|
||||
|
||||
server.AddXmlRPCHandler("locate_user", LocateUser, false);
|
||||
|
||||
server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
|
||||
}
|
||||
|
||||
@@ -306,5 +313,46 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locates the user.
|
||||
/// This is a sensitive operation, only authorized IP addresses can perform it.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <returns></returns>
|
||||
public XmlRpcResponse LocateUser(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable hash = new Hashtable();
|
||||
|
||||
bool authorized = false;
|
||||
foreach (string s in m_AuthorizedCallers)
|
||||
if (s == remoteClient.Address.ToString())
|
||||
{
|
||||
authorized = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
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);
|
||||
|
||||
string url = m_HomeUsersService.LocateUser(userID);
|
||||
if (url != string.Empty)
|
||||
hash["URL"] = url;
|
||||
}
|
||||
}
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user