aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
diff options
context:
space:
mode:
authormingchen2007-06-28 19:09:50 +0000
committermingchen2007-06-28 19:09:50 +0000
commitfe0528b98cfc13d26ac7f1bf6bc23655be1f52e5 (patch)
tree3ec7a1b247e84add390e962a58d26ec43c29e240 /OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
parentenabled physics plugin flying flags. (diff)
downloadopensim-SC_OLD-fe0528b98cfc13d26ac7f1bf6bc23655be1f52e5.zip
opensim-SC_OLD-fe0528b98cfc13d26ac7f1bf6bc23655be1f52e5.tar.gz
opensim-SC_OLD-fe0528b98cfc13d26ac7f1bf6bc23655be1f52e5.tar.bz2
opensim-SC_OLD-fe0528b98cfc13d26ac7f1bf6bc23655be1f52e5.tar.xz
*Added UUIDNameRequest packet support (untested, but should work -- at least in sandbox mode)
*Various small renamings
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1UserServices.cs')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs109
1 files changed, 109 insertions, 0 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
new file mode 100644
index 0000000..856c447
--- /dev/null
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -0,0 +1,109 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using OpenSim.Framework.Types;
6using OpenSim.Framework.Communications;
7using OpenSim.Framework.Data;
8using libsecondlife;
9
10using Nwc.XmlRpc;
11
12namespace OpenSim.Region.Communications.OGS1
13{
14 public class OGS1UserServices :IUserServices
15 {
16 CommunicationsOGS1 m_parent;
17 public OGS1UserServices(CommunicationsOGS1 parent)
18 {
19 m_parent = parent;
20 }
21
22 public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data)
23 {
24 if (data.Contains("error_type"))
25 {
26 Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]);
27 return null;
28 }
29
30 UserProfileData userData = new UserProfileData();
31 userData.username = (string)data["firstname"];
32 userData.surname = (string)data["lastname"];
33 userData.UUID = new LLUUID((string)data["uuid"]);
34 userData.userInventoryURI = (string)data["server_inventory"];
35 userData.userAssetURI = (string)data["server_asset"];
36 userData.profileFirstText = (string)data["profile_firstlife_about"];
37 userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]);
38 userData.profileCanDoMask = (uint)data["profile_can_do"];
39 userData.profileWantDoMask = (uint)data["profile_want_do"];
40 userData.profileImage = new LLUUID((string)data["profile_image"]);
41 userData.lastLogin = (int)data["profile_lastlogin"];
42 userData.homeLocation = new LLVector3();
43 userData.homeLookAt = new LLVector3();
44
45 return userData;
46 }
47 public UserProfileData GetUserProfile(string firstName, string lastName)
48 {
49 return GetUserProfile(firstName + " " + lastName);
50 }
51 public UserProfileData GetUserProfile(string name)
52 {
53
54 try
55 {
56 Hashtable param = new Hashtable();
57 param["avatar_name"] = name;
58 IList parameters = new ArrayList();
59 parameters.Add(param);
60 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
61 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000);
62 Hashtable respData = (Hashtable)resp.Value;
63
64 return ConvertXMLRPCDataToUserProfile(respData);
65 }
66 catch (Exception e)
67 {
68 Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message);
69 }
70 return null;
71 }
72 public UserProfileData GetUserProfile(LLUUID avatarID)
73 {
74 try
75 {
76
77 Hashtable param = new Hashtable();
78 param["avatar_uuid"] = avatarID.ToString();
79 IList parameters = new ArrayList();
80 parameters.Add(param);
81 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
82 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000);
83 Hashtable respData = (Hashtable)resp.Value;
84
85 return ConvertXMLRPCDataToUserProfile(respData);
86 }
87 catch (Exception e)
88 {
89 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message);
90 }
91 return null;
92 }
93
94 public UserProfileData SetupMasterUser(string firstName, string lastName)
95 {
96 return SetupMasterUser(firstName, lastName, "");
97 }
98
99 public UserProfileData SetupMasterUser(string firstName, string lastName, string password)
100 {
101 UserProfileData profile = GetUserProfile(firstName, lastName);
102 if (profile == null)
103 {
104 Console.WriteLine("Unknown Master User. Grid Mode: No clue what I should do. Probably would choose the grid owner UUID when that is implemented");
105 }
106 return null;
107 }
108 }
109}