diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1UserServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 46d71c4..0847148 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |||
@@ -1,101 +1,101 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using Nwc.XmlRpc; | 4 | using Nwc.XmlRpc; |
5 | using OpenSim.Framework.Communications; | 5 | using OpenSim.Framework.Communications; |
6 | using OpenSim.Framework.Data; | 6 | using OpenSim.Framework.Data; |
7 | 7 | ||
8 | namespace OpenSim.Region.Communications.OGS1 | 8 | namespace OpenSim.Region.Communications.OGS1 |
9 | { | 9 | { |
10 | public class OGS1UserServices :IUserServices | 10 | public class OGS1UserServices :IUserServices |
11 | { | 11 | { |
12 | CommunicationsOGS1 m_parent; | 12 | CommunicationsOGS1 m_parent; |
13 | public OGS1UserServices(CommunicationsOGS1 parent) | 13 | public OGS1UserServices(CommunicationsOGS1 parent) |
14 | { | 14 | { |
15 | m_parent = parent; | 15 | m_parent = parent; |
16 | } | 16 | } |
17 | 17 | ||
18 | public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) | 18 | public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) |
19 | { | 19 | { |
20 | if (data.Contains("error_type")) | 20 | if (data.Contains("error_type")) |
21 | { | 21 | { |
22 | Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); | 22 | Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); |
23 | return null; | 23 | return null; |
24 | } | 24 | } |
25 | 25 | ||
26 | UserProfileData userData = new UserProfileData(); | 26 | UserProfileData userData = new UserProfileData(); |
27 | userData.username = (string)data["firstname"]; | 27 | userData.username = (string)data["firstname"]; |
28 | userData.surname = (string)data["lastname"]; | 28 | userData.surname = (string)data["lastname"]; |
29 | userData.UUID = new LLUUID((string)data["uuid"]); | 29 | userData.UUID = new LLUUID((string)data["uuid"]); |
30 | userData.userInventoryURI = (string)data["server_inventory"]; | 30 | userData.userInventoryURI = (string)data["server_inventory"]; |
31 | userData.userAssetURI = (string)data["server_asset"]; | 31 | userData.userAssetURI = (string)data["server_asset"]; |
32 | userData.profileFirstText = (string)data["profile_firstlife_about"]; | 32 | userData.profileFirstText = (string)data["profile_firstlife_about"]; |
33 | userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); | 33 | userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); |
34 | userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); | 34 | userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); |
35 | userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); | 35 | userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); |
36 | userData.profileImage = new LLUUID((string)data["profile_image"]); | 36 | userData.profileImage = new LLUUID((string)data["profile_image"]); |
37 | userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); | 37 | userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); |
38 | userData.homeRegion = Convert.ToUInt64((string)data["home_region"]); | 38 | userData.homeRegion = Convert.ToUInt64((string)data["home_region"]); |
39 | userData.homeLocation = new LLVector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), (float)Convert.ToDecimal((string)data["home_coordinates_y"]), (float)Convert.ToDecimal((string)data["home_coordinates_z"])); | 39 | userData.homeLocation = new LLVector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), (float)Convert.ToDecimal((string)data["home_coordinates_y"]), (float)Convert.ToDecimal((string)data["home_coordinates_z"])); |
40 | userData.homeLookAt = new LLVector3((float)Convert.ToDecimal((string)data["home_look_x"]), (float)Convert.ToDecimal((string)data["home_look_y"]), (float)Convert.ToDecimal((string)data["home_look_z"])); | 40 | userData.homeLookAt = new LLVector3((float)Convert.ToDecimal((string)data["home_look_x"]), (float)Convert.ToDecimal((string)data["home_look_y"]), (float)Convert.ToDecimal((string)data["home_look_z"])); |
41 | 41 | ||
42 | return userData; | 42 | return userData; |
43 | } | 43 | } |
44 | public UserProfileData GetUserProfile(string firstName, string lastName) | 44 | public UserProfileData GetUserProfile(string firstName, string lastName) |
45 | { | 45 | { |
46 | return GetUserProfile(firstName + " " + lastName); | 46 | return GetUserProfile(firstName + " " + lastName); |
47 | } | 47 | } |
48 | public UserProfileData GetUserProfile(string name) | 48 | public UserProfileData GetUserProfile(string name) |
49 | { | 49 | { |
50 | //try | 50 | //try |
51 | //{ | 51 | //{ |
52 | Hashtable param = new Hashtable(); | 52 | Hashtable param = new Hashtable(); |
53 | param["avatar_name"] = name; | 53 | param["avatar_name"] = name; |
54 | IList parameters = new ArrayList(); | 54 | IList parameters = new ArrayList(); |
55 | parameters.Add(param); | 55 | parameters.Add(param); |
56 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); | 56 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); |
57 | XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); | 57 | XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); |
58 | Hashtable respData = (Hashtable)resp.Value; | 58 | Hashtable respData = (Hashtable)resp.Value; |
59 | 59 | ||
60 | return ConvertXMLRPCDataToUserProfile(respData); | 60 | return ConvertXMLRPCDataToUserProfile(respData); |
61 | //} | 61 | //} |
62 | //catch (Exception e) | 62 | //catch (Exception e) |
63 | //{ | 63 | //{ |
64 | // Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); | 64 | // Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); |
65 | //} | 65 | //} |
66 | //return null; | 66 | //return null; |
67 | } | 67 | } |
68 | public UserProfileData GetUserProfile(LLUUID avatarID) | 68 | public UserProfileData GetUserProfile(LLUUID avatarID) |
69 | { | 69 | { |
70 | try | 70 | try |
71 | { | 71 | { |
72 | 72 | ||
73 | Hashtable param = new Hashtable(); | 73 | Hashtable param = new Hashtable(); |
74 | param["avatar_uuid"] = avatarID.ToString(); | 74 | param["avatar_uuid"] = avatarID.ToString(); |
75 | IList parameters = new ArrayList(); | 75 | IList parameters = new ArrayList(); |
76 | parameters.Add(param); | 76 | parameters.Add(param); |
77 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); | 77 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); |
78 | XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); | 78 | XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); |
79 | Hashtable respData = (Hashtable)resp.Value; | 79 | Hashtable respData = (Hashtable)resp.Value; |
80 | 80 | ||
81 | return ConvertXMLRPCDataToUserProfile(respData); | 81 | return ConvertXMLRPCDataToUserProfile(respData); |
82 | } | 82 | } |
83 | catch (Exception e) | 83 | catch (Exception e) |
84 | { | 84 | { |
85 | Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); | 85 | Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); |
86 | } | 86 | } |
87 | return null; | 87 | return null; |
88 | } | 88 | } |
89 | 89 | ||
90 | public UserProfileData SetupMasterUser(string firstName, string lastName) | 90 | public UserProfileData SetupMasterUser(string firstName, string lastName) |
91 | { | 91 | { |
92 | return SetupMasterUser(firstName, lastName, ""); | 92 | return SetupMasterUser(firstName, lastName, ""); |
93 | } | 93 | } |
94 | 94 | ||
95 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | 95 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) |
96 | { | 96 | { |
97 | UserProfileData profile = GetUserProfile(firstName, lastName); | 97 | UserProfileData profile = GetUserProfile(firstName, lastName); |
98 | return profile; | 98 | return profile; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | } | 101 | } |