diff options
author | Teravus Ovares | 2007-12-31 22:56:43 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-31 22:56:43 +0000 |
commit | 3180432debcd9078e8e838d4bbe3ddaf9cdfe110 (patch) | |
tree | b838c1b5b6f3bb7b2baf5c013b1e74a44caa909f /OpenSim/Framework/Communications | |
parent | Move unused inventory files into the attic (diff) | |
download | opensim-SC-3180432debcd9078e8e838d4bbe3ddaf9cdfe110.zip opensim-SC-3180432debcd9078e8e838d4bbe3ddaf9cdfe110.tar.gz opensim-SC-3180432debcd9078e8e838d4bbe3ddaf9cdfe110.tar.bz2 opensim-SC-3180432debcd9078e8e838d4bbe3ddaf9cdfe110.tar.xz |
* Added database and UserManagerBase glue for FriendsList management
* Don't forget to run prebuild
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 15 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 74 |
2 files changed, 89 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 2ac34b1..afc6c9a 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -168,6 +168,7 @@ namespace OpenSim.Framework.UserManagement | |||
168 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | 168 | //logResponse.SimAddress = "127.0.0.1"; //overwritten |
169 | //logResponse.SimPort = 0; //overwritten | 169 | //logResponse.SimPort = 0; //overwritten |
170 | logResponse.Message = GetMessage(); | 170 | logResponse.Message = GetMessage(); |
171 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); | ||
171 | 172 | ||
172 | try | 173 | try |
173 | { | 174 | { |
@@ -265,6 +266,20 @@ namespace OpenSim.Framework.UserManagement | |||
265 | return m_welcomeMessage; | 266 | return m_welcomeMessage; |
266 | } | 267 | } |
267 | 268 | ||
269 | private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL) | ||
270 | { | ||
271 | LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList(); | ||
272 | foreach (FriendListItem fl in LFL) | ||
273 | { | ||
274 | LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend); | ||
275 | buddyitem.BuddyID = fl.Friend; | ||
276 | buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; | ||
277 | buddyitem.BuddyRightsGiven = (int) fl.FriendPerms; | ||
278 | buddylistreturn.AddNewBuddy(buddyitem); | ||
279 | |||
280 | } | ||
281 | return buddylistreturn; | ||
282 | } | ||
268 | /// <summary> | 283 | /// <summary> |
269 | /// Converts the inventory library skeleton into the form required by the rpc request. | 284 | /// Converts the inventory library skeleton into the form required by the rpc request. |
270 | /// </summary> | 285 | /// </summary> |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index f913d2c..5d62e5e 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -197,6 +197,80 @@ namespace OpenSim.Framework.UserManagement | |||
197 | } | 197 | } |
198 | 198 | ||
199 | /// <summary> | 199 | /// <summary> |
200 | /// Loads a user's friend list | ||
201 | /// </summary> | ||
202 | /// <param name="name">the UUID of the friend list owner</param> | ||
203 | /// <returns>A List of FriendListItems that contains info about the user's friends</returns> | ||
204 | public List<FriendListItem> GetUserFriendList(LLUUID ownerID) | ||
205 | { | ||
206 | |||
207 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
208 | { | ||
209 | try | ||
210 | { | ||
211 | return plugin.Value.GetUserFriendList(ownerID); | ||
212 | } | ||
213 | catch (Exception e) | ||
214 | { | ||
215 | MainLog.Instance.Verbose("USERSTORAGE", | ||
216 | "Unable to GetUserFriendList via " + plugin.Key + "(" + e.ToString() + ")"); | ||
217 | } | ||
218 | } | ||
219 | |||
220 | return null; | ||
221 | |||
222 | } | ||
223 | |||
224 | public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
225 | { | ||
226 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
227 | { | ||
228 | try | ||
229 | { | ||
230 | plugin.Value.AddNewUserFriend(friendlistowner,friend,perms); | ||
231 | } | ||
232 | catch (Exception e) | ||
233 | { | ||
234 | MainLog.Instance.Verbose("USERSTORAGE", | ||
235 | "Unable to AddNewUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); | ||
236 | } | ||
237 | } | ||
238 | |||
239 | } | ||
240 | |||
241 | |||
242 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | ||
243 | { | ||
244 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
245 | { | ||
246 | try | ||
247 | { | ||
248 | plugin.Value.RemoveUserFriend(friendlistowner, friend); | ||
249 | } | ||
250 | catch (Exception e) | ||
251 | { | ||
252 | MainLog.Instance.Verbose("USERSTORAGE", | ||
253 | "Unable to RemoveUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | |||
258 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
259 | { | ||
260 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
261 | { | ||
262 | try | ||
263 | { | ||
264 | plugin.Value.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
265 | } | ||
266 | catch (Exception e) | ||
267 | { | ||
268 | MainLog.Instance.Verbose("USERSTORAGE", | ||
269 | "Unable to UpdateUserFriendPerms via " + plugin.Key + "(" + e.ToString() + ")"); | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | /// <summary> | ||
200 | /// Loads a user agent by name (not called directly) | 274 | /// Loads a user agent by name (not called directly) |
201 | /// </summary> | 275 | /// </summary> |
202 | /// <param name="name">The agent's name</param> | 276 | /// <param name="name">The agent's name</param> |