aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserProfilesService/UserProfilesService.cs
diff options
context:
space:
mode:
authorMelanie Thielker2014-06-21 00:39:55 +0200
committerMelanie Thielker2014-06-21 00:39:55 +0200
commit159fcbf150b7da0e229b29aa7b94793484543d12 (patch)
treeb8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Services/UserProfilesService/UserProfilesService.cs
parentMerge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.zip
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Services/UserProfilesService/UserProfilesService.cs')
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesService.cs262
1 files changed, 262 insertions, 0 deletions
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
new file mode 100644
index 0000000..038e993
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
@@ -0,0 +1,262 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using System.Text;
31using Nini.Config;
32using log4net;
33using OpenSim.Server.Base;
34using OpenSim.Services.Interfaces;
35using OpenSim.Services.UserAccountService;
36using OpenSim.Data;
37using OpenMetaverse;
38using OpenMetaverse.StructuredData;
39using OpenSim.Framework;
40using OpenSim.Services.UserAccountService;
41
42namespace OpenSim.Services.ProfilesService
43{
44 public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService
45 {
46 static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 IUserAccountService userAccounts;
51 IAuthenticationService authService;
52
53 public UserProfilesService(IConfigSource config, string configName):
54 base(config, configName)
55 {
56 IConfig Config = config.Configs[configName];
57 if (Config == null)
58 {
59 m_log.Warn("[PROFILES]: No configuration found!");
60 return;
61 }
62 Object[] args = null;
63
64 args = new Object[] { config };
65 string accountService = Config.GetString("UserAccountService", String.Empty);
66 if (accountService != string.Empty)
67 userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
68
69 args = new Object[] { config };
70 string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
71 if (accountService != string.Empty)
72 authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
73 }
74
75 #region Classifieds
76 public OSD AvatarClassifiedsRequest(UUID creatorId)
77 {
78 OSDArray records = ProfilesData.GetClassifiedRecords(creatorId);
79
80 return records;
81 }
82
83 public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result)
84 {
85 if(!ProfilesData.UpdateClassifiedRecord(ad, ref result))
86 {
87 return false;
88 }
89 result = "success";
90 return true;
91 }
92
93 public bool ClassifiedDelete(UUID recordId)
94 {
95 if(ProfilesData.DeleteClassifiedRecord(recordId))
96 return true;
97
98 return false;
99 }
100
101 public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result)
102 {
103 if(ProfilesData.GetClassifiedInfo(ref ad, ref result))
104 return true;
105
106 return false;
107 }
108 #endregion Classifieds
109
110 #region Picks
111 public OSD AvatarPicksRequest(UUID creatorId)
112 {
113 OSDArray records = ProfilesData.GetAvatarPicks(creatorId);
114
115 return records;
116 }
117
118 public bool PickInfoRequest(ref UserProfilePick pick, ref string result)
119 {
120 pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId);
121 result = "OK";
122 return true;
123 }
124
125 public bool PicksUpdate(ref UserProfilePick pick, ref string result)
126 {
127 return ProfilesData.UpdatePicksRecord(pick);
128 }
129
130 public bool PicksDelete(UUID pickId)
131 {
132 return ProfilesData.DeletePicksRecord(pickId);
133 }
134 #endregion Picks
135
136 #region Notes
137 public bool AvatarNotesRequest(ref UserProfileNotes note)
138 {
139 return ProfilesData.GetAvatarNotes(ref note);
140 }
141
142 public bool NotesUpdate(ref UserProfileNotes note, ref string result)
143 {
144 return ProfilesData.UpdateAvatarNotes(ref note, ref result);
145 }
146 #endregion Notes
147
148 #region Profile Properties
149 public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
150 {
151 return ProfilesData.GetAvatarProperties(ref prop, ref result);
152 }
153
154 public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
155 {
156 return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
157 }
158 #endregion Profile Properties
159
160 #region Interests
161 public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
162 {
163 return ProfilesData.UpdateAvatarInterests(prop, ref result);
164 }
165 #endregion Interests
166
167 /*
168 #region User Preferences
169 public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result)
170 {
171 if(string.IsNullOrEmpty(pref.EMail))
172 {
173 UserAccount account = new UserAccount();
174 if(userAccounts is UserAccountService.UserAccountService)
175 {
176 try
177 {
178 account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
179 if(string.IsNullOrEmpty(account.Email))
180 {
181 result = "No Email address on record!";
182 return false;
183 }
184 else
185 pref.EMail = account.Email;
186 }
187 catch
188 {
189 m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account");
190 result = "Missing Email address!";
191 return false;
192 }
193 }
194 else
195 {
196 m_log.Info ("[PROFILES]: UserAccountService: Could not get user account");
197 result = "Missing Email address!";
198 return false;
199 }
200 }
201 return ProfilesData.UpdateUserPreferences(ref pref, ref result);
202 }
203
204 public bool UserPreferencesRequest(ref UserPreferences pref, ref string result)
205 {
206 if(string.IsNullOrEmpty(pref.EMail))
207 {
208 UserAccount account = new UserAccount();
209 if(userAccounts is UserAccountService.UserAccountService)
210 {
211 try
212 {
213 account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
214 if(string.IsNullOrEmpty(account.Email))
215 {
216 result = "No Email address on record!";
217 return false;
218 }
219 else
220 pref.EMail = account.Email;
221 }
222 catch
223 {
224 m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account");
225 result = "Missing Email address!";
226 return false;
227 }
228 }
229 else
230 {
231 m_log.Info ("[PROFILES]: UserAccountService: Could not get user account");
232 result = "Missing Email address!";
233 return false;
234 }
235 }
236 return ProfilesData.GetUserPreferences(ref pref, ref result);
237 }
238 #endregion User Preferences
239 */
240
241 #region Utility
242 public OSD AvatarImageAssetsRequest(UUID avatarId)
243 {
244 OSDArray records = ProfilesData.GetUserImageAssets(avatarId);
245 return records;
246 }
247 #endregion Utility
248
249 #region UserData
250 public bool RequestUserAppData(ref UserAppData prop, ref string result)
251 {
252 return ProfilesData.GetUserAppData(ref prop, ref result);
253 }
254
255 public bool SetUserAppData(UserAppData prop, ref string result)
256 {
257 return true;
258 }
259 #endregion UserData
260 }
261}
262