aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
diff options
context:
space:
mode:
authorDiva Canto2011-05-25 12:32:21 -0700
committerDiva Canto2011-05-25 12:32:21 -0700
commit5c2168cae758ae19367f4c2f5a02713e74fc0912 (patch)
tree7d189c03a177ca716c91cf903cc7fd2e91fed1dc /OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
parentAdded necessary code to drop inventory on hg friends using the profile window... (diff)
downloadopensim-SC_OLD-5c2168cae758ae19367f4c2f5a02713e74fc0912.zip
opensim-SC_OLD-5c2168cae758ae19367f4c2f5a02713e74fc0912.tar.gz
opensim-SC_OLD-5c2168cae758ae19367f4c2f5a02713e74fc0912.tar.bz2
opensim-SC_OLD-5c2168cae758ae19367f4c2f5a02713e74fc0912.tar.xz
HG: Instant Message working. Tested on HG standalones only. Needs a lot more testing.
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index e51fe0b..942d960 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
52// MethodBase.GetCurrentMethod().DeclaringType); 52// MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private IUserAgentService m_HomeUsersService; 54 private IUserAgentService m_HomeUsersService;
55 private string[] m_AuthorizedCallers;
55 56
56 public UserAgentServerConnector(IConfigSource config, IHttpServer server) : 57 public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
57 this(config, server, null) 58 this(config, server, null)
@@ -75,6 +76,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
75 string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); 76 string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1");
76 bool proxy = gridConfig.GetBoolean("HasProxy", false); 77 bool proxy = gridConfig.GetBoolean("HasProxy", false);
77 78
79 string csv = gridConfig.GetString("AuthorizedCallers", "127.0.0.1");
80 csv = csv.Replace(" ", "");
81 m_AuthorizedCallers = csv.Split(',');
82
78 server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); 83 server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
79 server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); 84 server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
80 server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); 85 server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
@@ -85,6 +90,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
85 server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false); 90 server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
86 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false); 91 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
87 92
93 server.AddXmlRPCHandler("locate_user", LocateUser, false);
94
88 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); 95 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
89 } 96 }
90 97
@@ -306,5 +313,46 @@ namespace OpenSim.Server.Handlers.Hypergrid
306 313
307 } 314 }
308 315
316 /// <summary>
317 /// Locates the user.
318 /// This is a sensitive operation, only authorized IP addresses can perform it.
319 /// </summary>
320 /// <param name="request"></param>
321 /// <param name="remoteClient"></param>
322 /// <returns></returns>
323 public XmlRpcResponse LocateUser(XmlRpcRequest request, IPEndPoint remoteClient)
324 {
325 Hashtable hash = new Hashtable();
326
327 bool authorized = false;
328 foreach (string s in m_AuthorizedCallers)
329 if (s == remoteClient.Address.ToString())
330 {
331 authorized = true;
332 break;
333 }
334
335 if (authorized)
336 {
337 Hashtable requestData = (Hashtable)request.Params[0];
338 //string host = (string)requestData["host"];
339 //string portstr = (string)requestData["port"];
340 if (requestData.ContainsKey("userID"))
341 {
342 string userID_str = (string)requestData["userID"];
343 UUID userID = UUID.Zero;
344 UUID.TryParse(userID_str, out userID);
345
346 string url = m_HomeUsersService.LocateUser(userID);
347 if (url != string.Empty)
348 hash["URL"] = url;
349 }
350 }
351
352 XmlRpcResponse response = new XmlRpcResponse();
353 response.Value = hash;
354 return response;
355
356 }
309 } 357 }
310} 358}