aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
diff options
context:
space:
mode:
authorlbsa712009-04-13 20:04:18 +0000
committerlbsa712009-04-13 20:04:18 +0000
commit29355de6ee01b1f44f32ea45b9c06f636ae9a241 (patch)
tree677fb0c71117a6feaa5891f5c7ceacdd8d2069a6 /OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
parent* Remove null reference exception in the J2KDecoderModule's J2K repair routin... (diff)
downloadopensim-SC-29355de6ee01b1f44f32ea45b9c06f636ae9a241.zip
opensim-SC-29355de6ee01b1f44f32ea45b9c06f636ae9a241.tar.gz
opensim-SC-29355de6ee01b1f44f32ea45b9c06f636ae9a241.tar.bz2
opensim-SC-29355de6ee01b1f44f32ea45b9c06f636ae9a241.tar.xz
* Some more experimental work on distributed assets. Nothing hotwired yet.
* Introduced preprocess step in FetchAsset (Might revert this later) * Some minor CCC * Added actual implementation of GetUserProfile( uri ) and the corresponding handler to OGS1. * Introduced non-functioning GetUserUri( userProfile) awaiting user server wireup (this might move elsewhere)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs168
1 files changed, 93 insertions, 75 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 09c1d6a..3fe78a3 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using System.Xml.Serialization;
34using log4net; 35using log4net;
35using Nwc.XmlRpc; 36using Nwc.XmlRpc;
36using OpenMetaverse; 37using OpenMetaverse;
@@ -62,46 +63,46 @@ namespace OpenSim.Region.Communications.OGS1
62 } 63 }
63 64
64 UserProfileData userData = new UserProfileData(); 65 UserProfileData userData = new UserProfileData();
65 userData.FirstName = (string) data["firstname"]; 66 userData.FirstName = (string)data["firstname"];
66 userData.SurName = (string) data["lastname"]; 67 userData.SurName = (string)data["lastname"];
67 userData.ID = new UUID((string) data["uuid"]); 68 userData.ID = new UUID((string)data["uuid"]);
68 userData.Created = Convert.ToInt32(data["profile_created"]); 69 userData.Created = Convert.ToInt32(data["profile_created"]);
69 userData.UserInventoryURI = (string) data["server_inventory"]; 70 userData.UserInventoryURI = (string)data["server_inventory"];
70 userData.UserAssetURI = (string) data["server_asset"]; 71 userData.UserAssetURI = (string)data["server_asset"];
71 userData.FirstLifeAboutText = (string) data["profile_firstlife_about"]; 72 userData.FirstLifeAboutText = (string)data["profile_firstlife_about"];
72 userData.FirstLifeImage = new UUID((string) data["profile_firstlife_image"]); 73 userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]);
73 userData.CanDoMask = Convert.ToUInt32((string) data["profile_can_do"]); 74 userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]);
74 userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]); 75 userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]);
75 userData.AboutText = (string)data["profile_about"]; 76 userData.AboutText = (string)data["profile_about"];
76 userData.Image = new UUID((string) data["profile_image"]); 77 userData.Image = new UUID((string)data["profile_image"]);
77 userData.LastLogin = Convert.ToInt32((string) data["profile_lastlogin"]); 78 userData.LastLogin = Convert.ToInt32((string)data["profile_lastlogin"]);
78 userData.HomeRegion = Convert.ToUInt64((string) data["home_region"]); 79 userData.HomeRegion = Convert.ToUInt64((string)data["home_region"]);
79 if (data.Contains("home_region_id")) 80 if (data.Contains("home_region_id"))
80 userData.HomeRegionID = new UUID((string)data["home_region_id"]); 81 userData.HomeRegionID = new UUID((string)data["home_region_id"]);
81 else 82 else
82 userData.HomeRegionID = UUID.Zero; 83 userData.HomeRegionID = UUID.Zero;
83 userData.HomeLocation = 84 userData.HomeLocation =
84 new Vector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]), 85 new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]),
85 (float) Convert.ToDecimal((string) data["home_coordinates_y"]), 86 (float)Convert.ToDecimal((string)data["home_coordinates_y"]),
86 (float) Convert.ToDecimal((string) data["home_coordinates_z"])); 87 (float)Convert.ToDecimal((string)data["home_coordinates_z"]));
87 userData.HomeLookAt = 88 userData.HomeLookAt =
88 new Vector3((float) Convert.ToDecimal((string) data["home_look_x"]), 89 new Vector3((float)Convert.ToDecimal((string)data["home_look_x"]),
89 (float) Convert.ToDecimal((string) data["home_look_y"]), 90 (float)Convert.ToDecimal((string)data["home_look_y"]),
90 (float) Convert.ToDecimal((string) data["home_look_z"])); 91 (float)Convert.ToDecimal((string)data["home_look_z"]));
91 if (data.Contains("user_flags")) 92 if (data.Contains("user_flags"))
92 userData.UserFlags = Convert.ToInt32((string) data["user_flags"]); 93 userData.UserFlags = Convert.ToInt32((string)data["user_flags"]);
93 if (data.Contains("god_level")) 94 if (data.Contains("god_level"))
94 userData.GodLevel = Convert.ToInt32((string) data["god_level"]); 95 userData.GodLevel = Convert.ToInt32((string)data["god_level"]);
95 96
96 if (data.Contains("custom_type")) 97 if (data.Contains("custom_type"))
97 userData.CustomType = (string) data["custom_type"]; 98 userData.CustomType = (string)data["custom_type"];
98 else 99 else
99 userData.CustomType = ""; 100 userData.CustomType = "";
100 if (userData.CustomType == null) 101 if (userData.CustomType == null)
101 userData.CustomType = ""; 102 userData.CustomType = "";
102 103
103 if (data.Contains("partner")) 104 if (data.Contains("partner"))
104 userData.Partner = new UUID((string) data["partner"]); 105 userData.Partner = new UUID((string)data["partner"]);
105 else 106 else
106 userData.Partner = UUID.Zero; 107 userData.Partner = UUID.Zero;
107 108
@@ -110,7 +111,21 @@ namespace OpenSim.Region.Communications.OGS1
110 111
111 public UserProfileData GetUserProfile(Uri uri) 112 public UserProfileData GetUserProfile(Uri uri)
112 { 113 {
113 throw new System.NotImplementedException(); 114 WebRequest request = WebRequest.Create(uri);
115
116 WebResponse webResponse = request.GetResponse();
117
118 XmlSerializer deserializer = new XmlSerializer(typeof(XmlRpcResponse));
119 XmlRpcResponse xmlRpcResponse = (XmlRpcResponse)deserializer.Deserialize(webResponse.GetResponseStream());
120
121 Hashtable respData = (Hashtable)xmlRpcResponse.Value;
122
123 return ConvertXMLRPCDataToUserProfile(respData);
124 }
125
126 public Uri GetUserUri(UserProfileData userProfile)
127 {
128 throw new NotImplementedException();
114 } 129 }
115 130
116 /// <summary> 131 /// <summary>
@@ -120,40 +135,42 @@ namespace OpenSim.Region.Communications.OGS1
120 /// <returns>null if the request fails</returns> 135 /// <returns>null if the request fails</returns>
121 public UserAgentData GetAgentByUUID(UUID userId) 136 public UserAgentData GetAgentByUUID(UUID userId)
122 { 137 {
123 try 138 try
124 { 139 {
125 Hashtable param = new Hashtable(); 140 Hashtable param = new Hashtable();
126 param["avatar_uuid"] = userId.ToString(); 141 param["avatar_uuid"] = userId.ToString();
127 IList parameters = new ArrayList(); 142 IList parameters = new ArrayList();
128 parameters.Add(param); 143 parameters.Add(param);
129 XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters); 144 XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters);
130 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 6000); 145 string url = m_commsManager.NetworkServersInfo.UserURL;
131 Hashtable respData = (Hashtable) resp.Value; 146
132 if (respData.Contains("error_type")) 147 XmlRpcResponse resp = req.Send(url, 6000);
133 { 148 Hashtable respData = (Hashtable)resp.Value;
134 //m_log.Warn("[GRID]: " + 149 if (respData.Contains("error_type"))
135 // "Error sent by user server when trying to get agent: (" + 150 {
136 // (string) respData["error_type"] + 151 //m_log.Warn("[GRID]: " +
137 // "): " + (string)respData["error_desc"]); 152 // "Error sent by user server when trying to get agent: (" +
138 return null; 153 // (string) respData["error_type"] +
139 } 154 // "): " + (string)respData["error_desc"]);
140 UUID sessionid = UUID.Zero; 155 return null;
141 156 }
142 UserAgentData userAgent = new UserAgentData(); 157 UUID sessionid = UUID.Zero;
143 userAgent.Handle = Convert.ToUInt64((string)respData["handle"]); 158
144 UUID.TryParse((string)respData["sessionid"], out sessionid); 159 UserAgentData userAgent = new UserAgentData();
145 userAgent.SessionID = sessionid; 160 userAgent.Handle = Convert.ToUInt64((string)respData["handle"]);
146 161 UUID.TryParse((string)respData["sessionid"], out sessionid);
147 if ((string)respData["agent_online"] == "TRUE") 162 userAgent.SessionID = sessionid;
148 { 163
149 userAgent.AgentOnline = true; 164 if ((string)respData["agent_online"] == "TRUE")
150 } 165 {
151 else 166 userAgent.AgentOnline = true;
152 { 167 }
153 userAgent.AgentOnline = false; 168 else
154 } 169 {
155 170 userAgent.AgentOnline = false;
156 return userAgent; 171 }
172
173 return userAgent;
157 } 174 }
158 catch (Exception e) 175 catch (Exception e)
159 { 176 {
@@ -192,16 +209,16 @@ namespace OpenSim.Region.Communications.OGS1
192 public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data) 209 public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data)
193 { 210 {
194 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); 211 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
195 int pickercount = Convert.ToInt32((string) data["avcount"]); 212 int pickercount = Convert.ToInt32((string)data["avcount"]);
196 UUID respqueryID = new UUID((string) data["queryid"]); 213 UUID respqueryID = new UUID((string)data["queryid"]);
197 if (queryID == respqueryID) 214 if (queryID == respqueryID)
198 { 215 {
199 for (int i = 0; i < pickercount; i++) 216 for (int i = 0; i < pickercount; i++)
200 { 217 {
201 AvatarPickerAvatar apicker = new AvatarPickerAvatar(); 218 AvatarPickerAvatar apicker = new AvatarPickerAvatar();
202 UUID avatarID = new UUID((string) data["avatarid" + i.ToString()]); 219 UUID avatarID = new UUID((string)data["avatarid" + i.ToString()]);
203 string firstname = (string) data["firstname" + i.ToString()]; 220 string firstname = (string)data["firstname" + i.ToString()];
204 string lastname = (string) data["lastname" + i.ToString()]; 221 string lastname = (string)data["lastname" + i.ToString()];
205 apicker.AvatarID = avatarID; 222 apicker.AvatarID = avatarID;
206 apicker.firstName = firstname; 223 apicker.firstName = firstname;
207 apicker.lastName = lastname; 224 apicker.lastName = lastname;
@@ -298,13 +315,13 @@ namespace OpenSim.Region.Communications.OGS1
298 try 315 try
299 { 316 {
300 Hashtable param = new Hashtable(); 317 Hashtable param = new Hashtable();
301 param["queryid"] = (string) queryID.ToString(); 318 param["queryid"] = (string)queryID.ToString();
302 param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty); 319 param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty);
303 IList parameters = new ArrayList(); 320 IList parameters = new ArrayList();
304 parameters.Add(param); 321 parameters.Add(param);
305 XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); 322 XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters);
306 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); 323 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000);
307 Hashtable respData = (Hashtable) resp.Value; 324 Hashtable respData = (Hashtable)resp.Value;
308 pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData); 325 pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData);
309 } 326 }
310 catch (WebException e) 327 catch (WebException e)
@@ -331,7 +348,7 @@ namespace OpenSim.Region.Communications.OGS1
331 parameters.Add(param); 348 parameters.Add(param);
332 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); 349 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
333 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); 350 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
334 Hashtable respData = (Hashtable) resp.Value; 351 Hashtable respData = (Hashtable)resp.Value;
335 352
336 return ConvertXMLRPCDataToUserProfile(respData); 353 return ConvertXMLRPCDataToUserProfile(respData);
337 } 354 }
@@ -360,7 +377,7 @@ namespace OpenSim.Region.Communications.OGS1
360 parameters.Add(param); 377 parameters.Add(param);
361 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); 378 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
362 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); 379 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
363 Hashtable respData = (Hashtable) resp.Value; 380 Hashtable respData = (Hashtable)resp.Value;
364 381
365 return ConvertXMLRPCDataToUserProfile(respData); 382 return ConvertXMLRPCDataToUserProfile(respData);
366 } 383 }
@@ -423,11 +440,11 @@ namespace OpenSim.Region.Communications.OGS1
423 { 440 {
424 throw new Exception("The method or operation is not implemented."); 441 throw new Exception("The method or operation is not implemented.");
425 } 442 }
426 443
427 public bool ResetUserPassword(string firstName, string lastName, string newPassword) 444 public bool ResetUserPassword(string firstName, string lastName, string newPassword)
428 { 445 {
429 throw new Exception("The method or operation is not implemented."); 446 throw new Exception("The method or operation is not implemented.");
430 } 447 }
431 448
432 public bool UpdateUserProfile(UserProfileData userProfile) 449 public bool UpdateUserProfile(UserProfileData userProfile)
433 { 450 {
@@ -483,7 +500,7 @@ namespace OpenSim.Region.Communications.OGS1
483 m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!"); 500 m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
484 return false; 501 return false;
485 } 502 }
486 503
487 return true; 504 return true;
488 } 505 }
489 506
@@ -659,7 +676,7 @@ namespace OpenSim.Region.Communications.OGS1
659 parameters.Add(param); 676 parameters.Add(param);
660 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); 677 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
661 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000); 678 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000);
662 Hashtable respData = (Hashtable) resp.Value; 679 Hashtable respData = (Hashtable)resp.Value;
663 680
664 if (respData != null && respData.Contains("avcount")) 681 if (respData != null && respData.Contains("avcount"))
665 { 682 {
@@ -676,7 +693,7 @@ namespace OpenSim.Region.Communications.OGS1
676 return buddylist; 693 return buddylist;
677 } 694 }
678 695
679 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids) 696 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
680 { 697 {
681 Dictionary<UUID, FriendRegionInfo> result = new Dictionary<UUID, FriendRegionInfo>(); 698 Dictionary<UUID, FriendRegionInfo> result = new Dictionary<UUID, FriendRegionInfo>();
682 699
@@ -697,10 +714,11 @@ namespace OpenSim.Region.Communications.OGS1
697 714
698 parameters.Add(map); 715 parameters.Add(map);
699 716
700 try { 717 try
718 {
701 XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters); 719 XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters);
702 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.MessagingURL, 8000); 720 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.MessagingURL, 8000);
703 Hashtable respData = resp != null ? (Hashtable) resp.Value : null; 721 Hashtable respData = resp != null ? (Hashtable)resp.Value : null;
704 722
705 if (respData == null || respData.ContainsKey("faultMessage")) 723 if (respData == null || respData.ContainsKey("faultMessage"))
706 { 724 {
@@ -748,7 +766,7 @@ namespace OpenSim.Region.Communications.OGS1
748 { 766 {
749 m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch friend infos: {0}", e.Message); 767 m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch friend infos: {0}", e.Message);
750 } 768 }
751 769
752 m_log.DebugFormat("[OGS1 USER SERVICES]: Returning {0} entries", result.Count); 770 m_log.DebugFormat("[OGS1 USER SERVICES]: Returning {0} entries", result.Count);
753 return result; 771 return result;
754 } 772 }
@@ -769,7 +787,7 @@ namespace OpenSim.Region.Communications.OGS1
769 parameters.Add(param); 787 parameters.Add(param);
770 XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters); 788 XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters);
771 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000); 789 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000);
772 Hashtable respData = (Hashtable) resp.Value; 790 Hashtable respData = (Hashtable)resp.Value;
773 791
774 return ConvertXMLRPCDataToAvatarAppearance(respData); 792 return ConvertXMLRPCDataToAvatarAppearance(respData);
775 } 793 }
@@ -792,7 +810,7 @@ namespace OpenSim.Region.Communications.OGS1
792 parameters.Add(param); 810 parameters.Add(param);
793 XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters); 811 XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters);
794 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000); 812 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000);
795 Hashtable respData = (Hashtable) resp.Value; 813 Hashtable respData = (Hashtable)resp.Value;
796 814
797 if (respData != null) 815 if (respData != null)
798 { 816 {