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.cs160
1 files changed, 160 insertions, 0 deletions
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
new file mode 100644
index 0000000..959c661
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
@@ -0,0 +1,160 @@
1using System;
2using System.Reflection;
3using System.Text;
4using Nini.Config;
5using log4net;
6using OpenSim.Server.Base;
7using OpenSim.Services.Interfaces;
8using OpenSim.Services.UserAccountService;
9using OpenSim.Data;
10using OpenMetaverse;
11using OpenMetaverse.StructuredData;
12using OpenSim.Framework;
13
14namespace OpenSim.Services.ProfilesService
15{
16 public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService
17 {
18 static readonly ILog m_log =
19 LogManager.GetLogger(
20 MethodBase.GetCurrentMethod().DeclaringType);
21
22 IUserAccountService userAccounts;
23 IAuthenticationService authService;
24
25 public UserProfilesService(IConfigSource config, string configName):
26 base(config, configName)
27 {
28 IConfig Config = config.Configs[configName];
29 if (Config == null)
30 {
31 m_log.Warn("[PROFILES]: No configuration found!");
32 return;
33 }
34 Object[] args = null;
35
36 args = new Object[] { config };
37 string accountService = Config.GetString("UserAccountService", String.Empty);
38 if (accountService != string.Empty)
39 userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
40
41 args = new Object[] { config };
42 string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
43 if (accountService != string.Empty)
44 authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
45 }
46
47 #region Classifieds
48 public OSD AvatarClassifiedsRequest(UUID creatorId)
49 {
50 OSDArray records = ProfilesData.GetClassifiedRecords(creatorId);
51
52 return records;
53 }
54
55 public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result)
56 {
57 if(!ProfilesData.UpdateClassifiedRecord(ad, ref result))
58 {
59 return false;
60 }
61 result = "success";
62 return true;
63 }
64
65 public bool ClassifiedDelete(UUID recordId)
66 {
67 if(ProfilesData.DeleteClassifiedRecord(recordId))
68 return true;
69
70 return false;
71 }
72
73 public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result)
74 {
75 if(ProfilesData.GetClassifiedInfo(ref ad, ref result))
76 return true;
77
78 return false;
79 }
80 #endregion Classifieds
81
82 #region Picks
83 public OSD AvatarPicksRequest(UUID creatorId)
84 {
85 OSDArray records = ProfilesData.GetAvatarPicks(creatorId);
86
87 return records;
88 }
89
90 public bool PickInfoRequest(ref UserProfilePick pick, ref string result)
91 {
92 pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId);
93 result = "OK";
94 return true;
95 }
96
97 public bool PicksUpdate(ref UserProfilePick pick, ref string result)
98 {
99 return ProfilesData.UpdatePicksRecord(pick);
100 }
101
102 public bool PicksDelete(UUID pickId)
103 {
104 return ProfilesData.DeletePicksRecord(pickId);
105 }
106 #endregion Picks
107
108 #region Notes
109 public bool AvatarNotesRequest(ref UserProfileNotes note)
110 {
111 return ProfilesData.GetAvatarNotes(ref note);
112 }
113
114 public bool NotesUpdate(ref UserProfileNotes note, ref string result)
115 {
116 return ProfilesData.UpdateAvatarNotes(ref note, ref result);
117 }
118 #endregion Notes
119
120 #region Profile Properties
121 public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
122 {
123 return ProfilesData.GetAvatarProperties(ref prop, ref result);
124 }
125
126 public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
127 {
128 return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
129 }
130 #endregion Profile Properties
131
132 #region Interests
133 public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
134 {
135 return ProfilesData.UpdateAvatarInterests(prop, ref result);
136 }
137 #endregion Interests
138
139 #region Utility
140 public OSD AvatarImageAssetsRequest(UUID avatarId)
141 {
142 OSDArray records = ProfilesData.GetUserImageAssets(avatarId);
143 return records;
144 }
145 #endregion Utility
146
147 #region UserData
148 public bool RequestUserAppData(ref UserAppData prop, ref string result)
149 {
150 return ProfilesData.GetUserAppData(ref prop, ref result);
151 }
152
153 public bool SetUserAppData(UserAppData prop, ref string result)
154 {
155 return true;
156 }
157 #endregion UserData
158 }
159}
160