diff options
author | Justin Clarke Casey | 2009-04-22 19:26:18 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-22 19:26:18 +0000 |
commit | 4c806855636543eba0423bfca0ef2084d7d7a536 (patch) | |
tree | 7b22e9815b56e169d31d6a262da204411b24e315 /OpenSim | |
parent | add if exists to the drop table (diff) | |
download | opensim-SC-4c806855636543eba0423bfca0ef2084d7d7a536.zip opensim-SC-4c806855636543eba0423bfca0ef2084d7d7a536.tar.gz opensim-SC-4c806855636543eba0423bfca0ef2084d7d7a536.tar.bz2 opensim-SC-4c806855636543eba0423bfca0ef2084d7d7a536.tar.xz |
* Allow plugins to play nicely in UserManagerBase
* Some methods were returning the value of the first plugin queried, even if the return was null
* Other methods are probably best off querying more than one plugin and aggregating results
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/IUserData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 48 |
2 files changed, 26 insertions, 24 deletions
diff --git a/OpenSim/Data/IUserData.cs b/OpenSim/Data/IUserData.cs index 9ac923f..573355b 100644 --- a/OpenSim/Data/IUserData.cs +++ b/OpenSim/Data/IUserData.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Data | |||
64 | /// </summary> | 64 | /// </summary> |
65 | /// <param name="queryID">ID associated with the user's query. This must match what the client sent</param> | 65 | /// <param name="queryID">ID associated with the user's query. This must match what the client sent</param> |
66 | /// <param name="query">The filtered contents of the search box when the user hit search.</param> | 66 | /// <param name="query">The filtered contents of the search box when the user hit search.</param> |
67 | /// <returns>The user data profile</returns> | 67 | /// <returns>A list of user details. If there are no results than either an empty list or null can be returned</returns> |
68 | List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query); | 68 | List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query); |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 3b43622..a269b59 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -174,44 +174,46 @@ namespace OpenSim.Framework.Communications | |||
174 | 174 | ||
175 | public virtual List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) | 175 | public virtual List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) |
176 | { | 176 | { |
177 | List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); | 177 | List<AvatarPickerAvatar> allPickerList = new List<AvatarPickerAvatar>(); |
178 | |||
178 | foreach (IUserDataPlugin plugin in m_plugins) | 179 | foreach (IUserDataPlugin plugin in m_plugins) |
179 | { | 180 | { |
180 | try | 181 | try |
181 | { | 182 | { |
182 | pickerlist = plugin.GeneratePickerResults(queryID, query); | 183 | List<AvatarPickerAvatar> pickerList = plugin.GeneratePickerResults(queryID, query); |
184 | if (pickerList != null) | ||
185 | allPickerList.AddRange(pickerList); | ||
183 | } | 186 | } |
184 | catch (Exception) | 187 | catch (Exception) |
185 | { | 188 | { |
186 | m_log.Info("[USERSTORAGE]: Unable to generate AgentPickerData via " + plugin.Name + "(" + query + ")"); | 189 | m_log.Error( |
187 | return new List<AvatarPickerAvatar>(); | 190 | "[USERSTORAGE]: Unable to generate AgentPickerData via " + plugin.Name + "(" + query + ")"); |
188 | } | 191 | } |
189 | } | 192 | } |
190 | 193 | ||
191 | return pickerlist; | 194 | return allPickerList; |
192 | } | 195 | } |
193 | 196 | ||
194 | /// <summary> | ||
195 | /// Updates a user profile from data object | ||
196 | /// </summary> | ||
197 | /// <param name="data"></param> | ||
198 | /// <returns></returns> | ||
199 | public virtual bool UpdateUserProfile(UserProfileData data) | 197 | public virtual bool UpdateUserProfile(UserProfileData data) |
200 | { | 198 | { |
199 | bool result = false; | ||
200 | |||
201 | foreach (IUserDataPlugin plugin in m_plugins) | 201 | foreach (IUserDataPlugin plugin in m_plugins) |
202 | { | 202 | { |
203 | try | 203 | try |
204 | { | 204 | { |
205 | plugin.UpdateUserProfile(data); | 205 | plugin.UpdateUserProfile(data); |
206 | return true; | 206 | result = true; |
207 | } | 207 | } |
208 | catch (Exception e) | 208 | catch (Exception e) |
209 | { | 209 | { |
210 | m_log.InfoFormat("[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", data.FirstName, data.SurName, | 210 | m_log.InfoFormat( |
211 | plugin.Name, e.ToString()); | 211 | "[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", |
212 | data.FirstName, data.SurName, plugin.Name, e.ToString()); | ||
212 | } | 213 | } |
213 | } | 214 | } |
214 | return false; | 215 | |
216 | return result; | ||
215 | } | 217 | } |
216 | 218 | ||
217 | #endregion | 219 | #endregion |
@@ -232,9 +234,7 @@ namespace OpenSim.Framework.Communications | |||
232 | UserAgentData result = plugin.GetAgentByUUID(uuid); | 234 | UserAgentData result = plugin.GetAgentByUUID(uuid); |
233 | 235 | ||
234 | if (result != null) | 236 | if (result != null) |
235 | { | ||
236 | return result; | 237 | return result; |
237 | } | ||
238 | } | 238 | } |
239 | catch (Exception e) | 239 | catch (Exception e) |
240 | { | 240 | { |
@@ -256,7 +256,10 @@ namespace OpenSim.Framework.Communications | |||
256 | { | 256 | { |
257 | try | 257 | try |
258 | { | 258 | { |
259 | return plugin.GetAgentByName(name); | 259 | UserAgentData result = plugin.GetAgentByName(name); |
260 | |||
261 | if (result != null) | ||
262 | return result; | ||
260 | } | 263 | } |
261 | catch (Exception e) | 264 | catch (Exception e) |
262 | { | 265 | { |
@@ -279,7 +282,10 @@ namespace OpenSim.Framework.Communications | |||
279 | { | 282 | { |
280 | try | 283 | try |
281 | { | 284 | { |
282 | return plugin.GetAgentByName(fname, lname); | 285 | UserAgentData result = plugin.GetAgentByName(fname, lname); |
286 | |||
287 | if (result != null) | ||
288 | return result; | ||
283 | } | 289 | } |
284 | catch (Exception e) | 290 | catch (Exception e) |
285 | { | 291 | { |
@@ -304,9 +310,7 @@ namespace OpenSim.Framework.Communications | |||
304 | List<FriendListItem> result = plugin.GetUserFriendList(ownerID); | 310 | List<FriendListItem> result = plugin.GetUserFriendList(ownerID); |
305 | 311 | ||
306 | if (result != null) | 312 | if (result != null) |
307 | { | ||
308 | return result; | 313 | return result; |
309 | } | ||
310 | } | 314 | } |
311 | catch (Exception e) | 315 | catch (Exception e) |
312 | { | 316 | { |
@@ -326,9 +330,7 @@ namespace OpenSim.Framework.Communications | |||
326 | Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids); | 330 | Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids); |
327 | 331 | ||
328 | if (result != null) | 332 | if (result != null) |
329 | { | ||
330 | return result; | 333 | return result; |
331 | } | ||
332 | } | 334 | } |
333 | catch (Exception e) | 335 | catch (Exception e) |
334 | { | 336 | { |