aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserProfilesService/UserProfilesService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/UserProfilesService/UserProfilesService.cs')
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesService.cs187
1 files changed, 187 insertions, 0 deletions
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
new file mode 100644
index 0000000..d00f34d
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
@@ -0,0 +1,187 @@
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;
40
41namespace OpenSim.Services.ProfilesService
42{
43 public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService
44 {
45 static readonly ILog m_log =
46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType);
48
49 IUserAccountService userAccounts;
50 IAuthenticationService authService;
51
52 public UserProfilesService(IConfigSource config, string configName):
53 base(config, configName)
54 {
55 IConfig Config = config.Configs[configName];
56 if (Config == null)
57 {
58 m_log.Warn("[PROFILES]: No configuration found!");
59 return;
60 }
61 Object[] args = null;
62
63 args = new Object[] { config };
64 string accountService = Config.GetString("UserAccountService", String.Empty);
65 if (accountService != string.Empty)
66 userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
67
68 args = new Object[] { config };
69 string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
70 if (accountService != string.Empty)
71 authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
72 }
73
74 #region Classifieds
75 public OSD AvatarClassifiedsRequest(UUID creatorId)
76 {
77 OSDArray records = ProfilesData.GetClassifiedRecords(creatorId);
78
79 return records;
80 }
81
82 public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result)
83 {
84 if(!ProfilesData.UpdateClassifiedRecord(ad, ref result))
85 {
86 return false;
87 }
88 result = "success";
89 return true;
90 }
91
92 public bool ClassifiedDelete(UUID recordId)
93 {
94 if(ProfilesData.DeleteClassifiedRecord(recordId))
95 return true;
96
97 return false;
98 }
99
100 public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result)
101 {
102 if(ProfilesData.GetClassifiedInfo(ref ad, ref result))
103 return true;
104
105 return false;
106 }
107 #endregion Classifieds
108
109 #region Picks
110 public OSD AvatarPicksRequest(UUID creatorId)
111 {
112 OSDArray records = ProfilesData.GetAvatarPicks(creatorId);
113
114 return records;
115 }
116
117 public bool PickInfoRequest(ref UserProfilePick pick, ref string result)
118 {
119 pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId);
120 result = "OK";
121 return true;
122 }
123
124 public bool PicksUpdate(ref UserProfilePick pick, ref string result)
125 {
126 return ProfilesData.UpdatePicksRecord(pick);
127 }
128
129 public bool PicksDelete(UUID pickId)
130 {
131 return ProfilesData.DeletePicksRecord(pickId);
132 }
133 #endregion Picks
134
135 #region Notes
136 public bool AvatarNotesRequest(ref UserProfileNotes note)
137 {
138 return ProfilesData.GetAvatarNotes(ref note);
139 }
140
141 public bool NotesUpdate(ref UserProfileNotes note, ref string result)
142 {
143 return ProfilesData.UpdateAvatarNotes(ref note, ref result);
144 }
145 #endregion Notes
146
147 #region Profile Properties
148 public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
149 {
150 return ProfilesData.GetAvatarProperties(ref prop, ref result);
151 }
152
153 public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
154 {
155 return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
156 }
157 #endregion Profile Properties
158
159 #region Interests
160 public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
161 {
162 return ProfilesData.UpdateAvatarInterests(prop, ref result);
163 }
164 #endregion Interests
165
166 #region Utility
167 public OSD AvatarImageAssetsRequest(UUID avatarId)
168 {
169 OSDArray records = ProfilesData.GetUserImageAssets(avatarId);
170 return records;
171 }
172 #endregion Utility
173
174 #region UserData
175 public bool RequestUserAppData(ref UserAppData prop, ref string result)
176 {
177 return ProfilesData.GetUserAppData(ref prop, ref result);
178 }
179
180 public bool SetUserAppData(UserAppData prop, ref string result)
181 {
182 return true;
183 }
184 #endregion UserData
185 }
186}
187