aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGSUserServices.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGSUserServices.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs
index 48d3018..d41bdaf 100644
--- a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs
@@ -1,24 +1,87 @@
1using System; 1using System;
2using System.Collections;
2using System.Collections.Generic; 3using System.Collections.Generic;
3using System.Text; 4using System.Text;
5using OpenSim.Framework.Types;
4using OpenSim.Framework.Communications; 6using OpenSim.Framework.Communications;
5using OpenSim.Framework.Data; 7using OpenSim.Framework.Data;
6using libsecondlife; 8using libsecondlife;
7 9
10using Nwc.XmlRpc;
11
8namespace OpenSim.Region.Communications.OGS1 12namespace OpenSim.Region.Communications.OGS1
9{ 13{
10 public class OGSUserServices :IUserServices 14 public class OGSUserServices :IUserServices
11 { 15 {
16 GridCommsManager m_parent;
17 public OGSUserServices(GridCommsManager parent)
18 {
19 m_parent = parent;
20 }
21
22 public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data)
23 {
24 UserProfileData userData = new UserProfileData();
25 userData.username = (string)data["firstname"];
26 userData.surname = (string)data["lastname"];
27 userData.UUID = new LLUUID((string)data["uuid"]);
28 userData.userInventoryURI = (string)data["server_inventory"];
29 userData.userAssetURI = (string)data["server_asset"];
30 userData.profileFirstText = (string)data["profile_firstlife_about"];
31 userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]);
32 userData.profileCanDoMask = (uint)data["profile_can_do"];
33 userData.profileWantDoMask = (uint)data["profile_want_do"];
34 userData.profileImage = new LLUUID((string)data["profile_image"]);
35 userData.lastLogin = (int)data["profile_lastlogin"];
36 userData.homeLocation = new LLVector3();
37 userData.homeLookAt = new LLVector3();
38
39 return userData;
40 }
12 public UserProfileData GetUserProfile(string firstName, string lastName) 41 public UserProfileData GetUserProfile(string firstName, string lastName)
13 { 42 {
14 return GetUserProfile(firstName + " " + lastName); 43 return GetUserProfile(firstName + " " + lastName);
15 } 44 }
16 public UserProfileData GetUserProfile(string name) 45 public UserProfileData GetUserProfile(string name)
17 { 46 {
47
48 try
49 {
50 Hashtable param = new Hashtable();
51 param["avatar_name"] = name;
52 IList parameters = new ArrayList();
53 parameters.Add(param);
54 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
55 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000);
56 Hashtable respData = (Hashtable)resp.Value;
57
58 return ConvertXMLRPCDataToUserProfile(respData);
59 }
60 catch (Exception e)
61 {
62 Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message);
63 }
18 return null; 64 return null;
19 } 65 }
20 public UserProfileData GetUserProfile(LLUUID avatarID) 66 public UserProfileData GetUserProfile(LLUUID avatarID)
21 { 67 {
68 try
69 {
70
71 Hashtable param = new Hashtable();
72 param["avatar_uuid"] = avatarID.ToString();
73 IList parameters = new ArrayList();
74 parameters.Add(param);
75 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
76 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000);
77 Hashtable respData = (Hashtable)resp.Value;
78
79 return ConvertXMLRPCDataToUserProfile(respData);
80 }
81 catch (Exception e)
82 {
83 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message);
84 }
22 return null; 85 return null;
23 } 86 }
24 87