aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2012-03-17 21:27:28 -0700
committerDiva Canto2012-03-17 21:27:28 -0700
commitd1256536b500a0d72eb643635d10c65980ea2588 (patch)
treeb378a299d970fa5f3266a59f32baa607fee3006b
parentAmend to previous commit: normalize strings ToLower. (diff)
downloadopensim-SC_OLD-d1256536b500a0d72eb643635d10c65980ea2588.zip
opensim-SC_OLD-d1256536b500a0d72eb643635d10c65980ea2588.tar.gz
opensim-SC_OLD-d1256536b500a0d72eb643635d10c65980ea2588.tar.bz2
opensim-SC_OLD-d1256536b500a0d72eb643635d10c65980ea2588.tar.xz
Added GetUUID(first, last) on UserAgentsService so that we can finally make direct user connections.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs1
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs32
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs61
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs10
-rw-r--r--OpenSim/Services/Interfaces/IHypergridServices.cs2
6 files changed, 136 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index 8077a7a..66de8e4 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -92,19 +92,47 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
92 foreach (UserData d in m_UserCache.Values) 92 foreach (UserData d in m_UserCache.Values)
93 { 93 {
94 if (d.LastName.StartsWith("@") && 94 if (d.LastName.StartsWith("@") &&
95 (d.FirstName.ToLower().Equals(words[0].ToLower()) || 95 d.FirstName.ToLower().Equals(words[0].ToLower()) &&
96 d.LastName.ToLower().Equals(words[1].ToLower()))) 96 d.LastName.ToLower().Equals(words[1].ToLower()))
97 { 97 {
98 users.Add(d); 98 users.Add(d);
99 found = true; 99 found = true;
100 break; 100 break;
101 } 101 }
102 } 102 }
103 if (!found) // This is it! Let's ask the other world 103
104 if (!found && words[1].StartsWith("@") && words[0].Contains(".")) // This is it! Let's ask the other world
104 { 105 {
105 // TODO 106 string[] names = words[0].Split(new char[] { '.' });
106 //UserAgentServiceConnector uasConn = new UserAgentServiceConnector(words[0]); 107 if (names.Length >= 2)
107 //uasConn.GetUserInfo(...); 108 {
109
110 string uriStr = "http://" + words[1].Substring(1); // remove the @
111 // Let's check that the last name is a valid address
112 try
113 {
114 new Uri(uriStr);
115 }
116 catch (UriFormatException)
117 {
118 return;
119 }
120
121 UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
122 UUID userID = uasConn.GetUUID(names[0], names[1]);
123 if (!userID.Equals(UUID.Zero))
124 {
125 UserData ud = new UserData();
126 ud.Id = userID;
127 ud.FirstName = words[0];
128 ud.LastName = words[1];
129 users.Add(ud);
130 AddUser(userID, ud.FirstName, ud.LastName, uriStr);
131 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0} {1} found", words[0], words[1]);
132 }
133 else
134 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0} {1} not found", words[0], words[1]);
135 }
108 } 136 }
109 } 137 }
110 else 138 else
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 23ef0fc..cb562a2 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -183,7 +183,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
183 List<UserData> users = new List<UserData>(); 183 List<UserData> users = new List<UserData>();
184 if (accs != null) 184 if (accs != null)
185 { 185 {
186 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Found {0} users", accs.Count);
187 foreach (UserAccount acc in accs) 186 foreach (UserAccount acc in accs)
188 { 187 {
189 UserData ud = new UserData(); 188 UserData ud = new UserData();
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 1bd3706..7348368 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -96,6 +96,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
96 96
97 server.AddXmlRPCHandler("locate_user", LocateUser, false); 97 server.AddXmlRPCHandler("locate_user", LocateUser, false);
98 server.AddXmlRPCHandler("get_uui", GetUUI, false); 98 server.AddXmlRPCHandler("get_uui", GetUUI, false);
99 server.AddXmlRPCHandler("get_uuid", GetUUID, false);
99 100
100 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); 101 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
101 } 102 }
@@ -410,8 +411,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
410 } 411 }
411 412
412 /// <summary> 413 /// <summary>
413 /// Locates the user. 414 /// Returns the UUI of a user given a UUID.
414 /// This is a sensitive operation, only authorized IP addresses can perform it.
415 /// </summary> 415 /// </summary>
416 /// <param name="request"></param> 416 /// <param name="request"></param>
417 /// <param name="remoteClient"></param> 417 /// <param name="remoteClient"></param>
@@ -445,5 +445,33 @@ namespace OpenSim.Server.Handlers.Hypergrid
445 445
446 } 446 }
447 447
448 /// <summary>
449 /// Gets the UUID of a user given First name, Last name.
450 /// </summary>
451 /// <param name="request"></param>
452 /// <param name="remoteClient"></param>
453 /// <returns></returns>
454 public XmlRpcResponse GetUUID(XmlRpcRequest request, IPEndPoint remoteClient)
455 {
456 Hashtable hash = new Hashtable();
457
458 Hashtable requestData = (Hashtable)request.Params[0];
459 //string host = (string)requestData["host"];
460 //string portstr = (string)requestData["port"];
461 if (requestData.ContainsKey("first") && requestData.ContainsKey("last"))
462 {
463 UUID userID = UUID.Zero;
464 string first = (string)requestData["first"];
465
466 string last = (string)requestData["last"];
467 UUID uuid = m_HomeUsersService.GetUUID(first, last);
468 hash["UUID"] = uuid.ToString();
469 }
470
471 XmlRpcResponse response = new XmlRpcResponse();
472 response.Value = hash;
473 return response;
474
475 }
448 } 476 }
449} 477}
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 5b27cf6..bf86035 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -789,13 +789,72 @@ namespace OpenSim.Services.Connectors.Hypergrid
789 } 789 }
790 catch 790 catch
791 { 791 {
792 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); 792 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response.");
793// reason = "Exception: " + e.Message; 793// reason = "Exception: " + e.Message;
794 } 794 }
795 795
796 return uui; 796 return uui;
797 } 797 }
798 798
799 public UUID GetUUID(String first, String last)
800 {
801 Hashtable hash = new Hashtable();
802 hash["first"] = first;
803 hash["last"] = last;
804
805 IList paramList = new ArrayList();
806 paramList.Add(hash);
807
808 XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList);
809 // string reason = string.Empty;
810
811 // Send and get reply
812 UUID uuid = UUID.Zero;
813 XmlRpcResponse response = null;
814 try
815 {
816 response = request.Send(m_ServerURL, 10000);
817 }
818 catch
819 {
820 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL);
821 // reason = "Exception: " + e.Message;
822 return uuid;
823 }
824
825 if (response.IsFault)
826 {
827 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString);
828 // reason = "XMLRPC Fault";
829 return uuid;
830 }
831
832 hash = (Hashtable)response.Value;
833 //foreach (Object o in hash)
834 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
835 try
836 {
837 if (hash == null)
838 {
839 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
840 // reason = "Internal error 1";
841 return uuid;
842 }
843
844 // Here's the actual response
845 if (hash.ContainsKey("UUID"))
846 UUID.TryParse(hash["UUID"].ToString(), out uuid);
847
848 }
849 catch
850 {
851 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response.");
852 // reason = "Exception: " + e.Message;
853 }
854
855 return uuid;
856 }
857
799 private bool GetBoolResponse(XmlRpcRequest request, out string reason) 858 private bool GetBoolResponse(XmlRpcRequest request, out string reason)
800 { 859 {
801 //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); 860 //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL);
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index f681df4..5eca801 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -566,6 +566,16 @@ namespace OpenSim.Services.HypergridService
566 566
567 return string.Empty; 567 return string.Empty;
568 } 568 }
569
570 public UUID GetUUID(String first, String last)
571 {
572 // Let's see if it's a local user
573 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, first, last);
574 if (account != null)
575 return account.PrincipalID;
576 else
577 return UUID.Zero;
578 }
569 } 579 }
570 580
571 class TravelingAgentInfo 581 class TravelingAgentInfo
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs
index 5b293ac..0cd44f7 100644
--- a/OpenSim/Services/Interfaces/IHypergridServices.cs
+++ b/OpenSim/Services/Interfaces/IHypergridServices.cs
@@ -62,6 +62,8 @@ namespace OpenSim.Services.Interfaces
62 // on behalf of the userID 62 // on behalf of the userID
63 string GetUUI(UUID userID, UUID targetUserID); 63 string GetUUI(UUID userID, UUID targetUserID);
64 64
65 UUID GetUUID(String first, String last);
66
65 // Returns the local friends online 67 // Returns the local friends online
66 List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); 68 List<UUID> StatusNotification(List<string> friends, UUID userID, bool online);
67 //List<UUID> GetOnlineFriends(UUID userID, List<string> friends); 69 //List<UUID> GetOnlineFriends(UUID userID, List<string> friends);