aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1UserServices.cs')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs63
1 files changed, 39 insertions, 24 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 19a3c3b..d00a813 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -28,16 +28,19 @@
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Net;
31using libsecondlife; 32using libsecondlife;
32using Nwc.XmlRpc; 33using Nwc.XmlRpc;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces;
35 37
36namespace OpenSim.Region.Communications.OGS1 38namespace OpenSim.Region.Communications.OGS1
37{ 39{
38 public class OGS1UserServices :IUserService 40 public class OGS1UserServices : IUserService
39 { 41 {
40 CommunicationsOGS1 m_parent; 42 private CommunicationsOGS1 m_parent;
43
41 public OGS1UserServices(CommunicationsOGS1 parent) 44 public OGS1UserServices(CommunicationsOGS1 parent)
42 { 45 {
43 m_parent = parent; 46 m_parent = parent;
@@ -47,32 +50,41 @@ namespace OpenSim.Region.Communications.OGS1
47 { 50 {
48 if (data.Contains("error_type")) 51 if (data.Contains("error_type"))
49 { 52 {
50 Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); 53 Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] +
54 "): " + data["error_desc"]);
51 return null; 55 return null;
52 } 56 }
53 57
54 UserProfileData userData = new UserProfileData(); 58 UserProfileData userData = new UserProfileData();
55 userData.username = (string)data["firstname"]; 59 userData.username = (string) data["firstname"];
56 userData.surname = (string)data["lastname"]; 60 userData.surname = (string) data["lastname"];
57 userData.UUID = new LLUUID((string)data["uuid"]); 61 userData.UUID = new LLUUID((string) data["uuid"]);
58 userData.userInventoryURI = (string)data["server_inventory"]; 62 userData.userInventoryURI = (string) data["server_inventory"];
59 userData.userAssetURI = (string)data["server_asset"]; 63 userData.userAssetURI = (string) data["server_asset"];
60 userData.profileFirstText = (string)data["profile_firstlife_about"]; 64 userData.profileFirstText = (string) data["profile_firstlife_about"];
61 userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); 65 userData.profileFirstImage = new LLUUID((string) data["profile_firstlife_image"]);
62 userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); 66 userData.profileCanDoMask = Convert.ToUInt32((string) data["profile_can_do"]);
63 userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); 67 userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]);
64 userData.profileImage = new LLUUID((string)data["profile_image"]); 68 userData.profileImage = new LLUUID((string) data["profile_image"]);
65 userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); 69 userData.lastLogin = Convert.ToInt32((string) data["profile_lastlogin"]);
66 userData.homeRegion = Convert.ToUInt64((string)data["home_region"]); 70 userData.homeRegion = Convert.ToUInt64((string) data["home_region"]);
67 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"])); 71 userData.homeLocation =
68 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"])); 72 new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]),
73 (float) Convert.ToDecimal((string) data["home_coordinates_y"]),
74 (float) Convert.ToDecimal((string) data["home_coordinates_z"]));
75 userData.homeLookAt =
76 new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
77 (float) Convert.ToDecimal((string) data["home_look_y"]),
78 (float) Convert.ToDecimal((string) data["home_look_z"]));
69 79
70 return userData; 80 return userData;
71 } 81 }
82
72 public UserProfileData GetUserProfile(string firstName, string lastName) 83 public UserProfileData GetUserProfile(string firstName, string lastName)
73 { 84 {
74 return GetUserProfile(firstName + " " + lastName); 85 return GetUserProfile(firstName + " " + lastName);
75 } 86 }
87
76 public UserProfileData GetUserProfile(string name) 88 public UserProfileData GetUserProfile(string name)
77 { 89 {
78 try 90 try
@@ -83,16 +95,18 @@ namespace OpenSim.Region.Communications.OGS1
83 parameters.Add(param); 95 parameters.Add(param);
84 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); 96 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
85 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); 97 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
86 Hashtable respData = (Hashtable)resp.Value; 98 Hashtable respData = (Hashtable) resp.Value;
87 99
88 return ConvertXMLRPCDataToUserProfile(respData); 100 return ConvertXMLRPCDataToUserProfile(respData);
89 } 101 }
90 catch (System.Net.WebException e) 102 catch (WebException e)
91 { 103 {
92 OpenSim.Framework.Console.MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + e.Message); 104 MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " +
105 e.Message);
93 } 106 }
94 return null; 107 return null;
95 } 108 }
109
96 public UserProfileData GetUserProfile(LLUUID avatarID) 110 public UserProfileData GetUserProfile(LLUUID avatarID)
97 { 111 {
98 try 112 try
@@ -103,18 +117,19 @@ namespace OpenSim.Region.Communications.OGS1
103 parameters.Add(param); 117 parameters.Add(param);
104 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); 118 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
105 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); 119 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
106 Hashtable respData = (Hashtable)resp.Value; 120 Hashtable respData = (Hashtable) resp.Value;
107 121
108 return ConvertXMLRPCDataToUserProfile(respData); 122 return ConvertXMLRPCDataToUserProfile(respData);
109 } 123 }
110 catch (Exception e) 124 catch (Exception e)
111 { 125 {
112 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); 126 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " +
127 e.Message);
113 } 128 }
114 return null; 129 return null;
115 } 130 }
116 131
117 public void clearUserAgent(LLUUID avatarID) 132 public void clearUserAgent(LLUUID avatarID)
118 { 133 {
119 // TODO: implement 134 // TODO: implement
120 } 135 }
@@ -135,4 +150,4 @@ namespace OpenSim.Region.Communications.OGS1
135 throw new Exception("The method or operation is not implemented."); 150 throw new Exception("The method or operation is not implemented.");
136 } 151 }
137 } 152 }
138} 153} \ No newline at end of file