aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs109
1 files changed, 55 insertions, 54 deletions
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
index 49aa8ba..f23a981 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
@@ -48,17 +48,17 @@ namespace OpenSim.Server.Handlers
48 static readonly ILog m_log = 48 static readonly ILog m_log =
49 LogManager.GetLogger( 49 LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType); 50 MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 public IUserProfilesService Service 52 public IUserProfilesService Service
53 { 53 {
54 get; private set; 54 get; private set;
55 } 55 }
56 56
57 public JsonRpcProfileHandlers(IUserProfilesService service) 57 public JsonRpcProfileHandlers(IUserProfilesService service)
58 { 58 {
59 Service = service; 59 Service = service;
60 } 60 }
61 61
62 #region Classifieds 62 #region Classifieds
63 /// <summary> 63 /// <summary>
64 /// Request avatar's classified ads. 64 /// Request avatar's classified ads.
@@ -80,17 +80,17 @@ namespace OpenSim.Server.Handlers
80 m_log.DebugFormat ("Classified Request"); 80 m_log.DebugFormat ("Classified Request");
81 return false; 81 return false;
82 } 82 }
83 83
84 OSDMap request = (OSDMap)json["params"]; 84 OSDMap request = (OSDMap)json["params"];
85 UUID creatorId = new UUID(request["creatorId"].AsString()); 85 UUID creatorId = new UUID(request["creatorId"].AsString());
86 86
87 87
88 OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId); 88 OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId);
89 response.Result = data; 89 response.Result = data;
90 90
91 return true; 91 return true;
92 } 92 }
93 93
94 public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response) 94 public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response)
95 { 95 {
96 if(!json.ContainsKey("params")) 96 if(!json.ContainsKey("params"))
@@ -100,7 +100,7 @@ namespace OpenSim.Server.Handlers
100 m_log.DebugFormat ("Classified Update Request"); 100 m_log.DebugFormat ("Classified Update Request");
101 return false; 101 return false;
102 } 102 }
103 103
104 string result = string.Empty; 104 string result = string.Empty;
105 UserClassifiedAdd ad = new UserClassifiedAdd(); 105 UserClassifiedAdd ad = new UserClassifiedAdd();
106 object Ad = (object)ad; 106 object Ad = (object)ad;
@@ -110,12 +110,12 @@ namespace OpenSim.Server.Handlers
110 response.Result = OSD.SerializeMembers(ad); 110 response.Result = OSD.SerializeMembers(ad);
111 return true; 111 return true;
112 } 112 }
113 113
114 response.Error.Code = ErrorCode.InternalError; 114 response.Error.Code = ErrorCode.InternalError;
115 response.Error.Message = string.Format("{0}", result); 115 response.Error.Message = string.Format("{0}", result);
116 return false; 116 return false;
117 } 117 }
118 118
119 public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response) 119 public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response)
120 { 120 {
121 if(!json.ContainsKey("params")) 121 if(!json.ContainsKey("params"))
@@ -124,10 +124,10 @@ namespace OpenSim.Server.Handlers
124 m_log.DebugFormat ("Classified Delete Request"); 124 m_log.DebugFormat ("Classified Delete Request");
125 return false; 125 return false;
126 } 126 }
127 127
128 OSDMap request = (OSDMap)json["params"]; 128 OSDMap request = (OSDMap)json["params"];
129 UUID classifiedId = new UUID(request["classifiedId"].AsString()); 129 UUID classifiedId = new UUID(request["classifiedId"].AsString());
130 130
131 if (Service.ClassifiedDelete(classifiedId)) 131 if (Service.ClassifiedDelete(classifiedId))
132 return true; 132 return true;
133 133
@@ -135,7 +135,7 @@ namespace OpenSim.Server.Handlers
135 response.Error.Message = "data error removing record"; 135 response.Error.Message = "data error removing record";
136 return false; 136 return false;
137 } 137 }
138 138
139 public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response) 139 public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response)
140 { 140 {
141 if(!json.ContainsKey("params")) 141 if(!json.ContainsKey("params"))
@@ -145,7 +145,7 @@ namespace OpenSim.Server.Handlers
145 m_log.DebugFormat ("Classified Info Request"); 145 m_log.DebugFormat ("Classified Info Request");
146 return false; 146 return false;
147 } 147 }
148 148
149 string result = string.Empty; 149 string result = string.Empty;
150 UserClassifiedAdd ad = new UserClassifiedAdd(); 150 UserClassifiedAdd ad = new UserClassifiedAdd();
151 object Ad = (object)ad; 151 object Ad = (object)ad;
@@ -155,13 +155,13 @@ namespace OpenSim.Server.Handlers
155 response.Result = OSD.SerializeMembers(ad); 155 response.Result = OSD.SerializeMembers(ad);
156 return true; 156 return true;
157 } 157 }
158 158
159 response.Error.Code = ErrorCode.InternalError; 159 response.Error.Code = ErrorCode.InternalError;
160 response.Error.Message = string.Format("{0}", result); 160 response.Error.Message = string.Format("{0}", result);
161 return false; 161 return false;
162 } 162 }
163 #endregion Classifieds 163 #endregion Classifieds
164 164
165 #region Picks 165 #region Picks
166 public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response) 166 public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response)
167 { 167 {
@@ -171,17 +171,17 @@ namespace OpenSim.Server.Handlers
171 m_log.DebugFormat ("Avatar Picks Request"); 171 m_log.DebugFormat ("Avatar Picks Request");
172 return false; 172 return false;
173 } 173 }
174 174
175 OSDMap request = (OSDMap)json["params"]; 175 OSDMap request = (OSDMap)json["params"];
176 UUID creatorId = new UUID(request["creatorId"].AsString()); 176 UUID creatorId = new UUID(request["creatorId"].AsString());
177 177
178 178
179 OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId); 179 OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId);
180 response.Result = data; 180 response.Result = data;
181 181
182 return true; 182 return true;
183 } 183 }
184 184
185 public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response) 185 public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response)
186 { 186 {
187 if(!json.ContainsKey("params")) 187 if(!json.ContainsKey("params"))
@@ -191,7 +191,7 @@ namespace OpenSim.Server.Handlers
191 m_log.DebugFormat ("Avatar Picks Info Request"); 191 m_log.DebugFormat ("Avatar Picks Info Request");
192 return false; 192 return false;
193 } 193 }
194 194
195 string result = string.Empty; 195 string result = string.Empty;
196 UserProfilePick pick = new UserProfilePick(); 196 UserProfilePick pick = new UserProfilePick();
197 object Pick = (object)pick; 197 object Pick = (object)pick;
@@ -201,12 +201,12 @@ namespace OpenSim.Server.Handlers
201 response.Result = OSD.SerializeMembers(pick); 201 response.Result = OSD.SerializeMembers(pick);
202 return true; 202 return true;
203 } 203 }
204 204
205 response.Error.Code = ErrorCode.InternalError; 205 response.Error.Code = ErrorCode.InternalError;
206 response.Error.Message = string.Format("{0}", result); 206 response.Error.Message = string.Format("{0}", result);
207 return false; 207 return false;
208 } 208 }
209 209
210 public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response) 210 public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response)
211 { 211 {
212 if(!json.ContainsKey("params")) 212 if(!json.ContainsKey("params"))
@@ -216,7 +216,7 @@ namespace OpenSim.Server.Handlers
216 m_log.DebugFormat ("Avatar Picks Update Request"); 216 m_log.DebugFormat ("Avatar Picks Update Request");
217 return false; 217 return false;
218 } 218 }
219 219
220 string result = string.Empty; 220 string result = string.Empty;
221 UserProfilePick pick = new UserProfilePick(); 221 UserProfilePick pick = new UserProfilePick();
222 object Pick = (object)pick; 222 object Pick = (object)pick;
@@ -226,13 +226,13 @@ namespace OpenSim.Server.Handlers
226 response.Result = OSD.SerializeMembers(pick); 226 response.Result = OSD.SerializeMembers(pick);
227 return true; 227 return true;
228 } 228 }
229 229
230 response.Error.Code = ErrorCode.InternalError; 230 response.Error.Code = ErrorCode.InternalError;
231 response.Error.Message = "unable to update pick"; 231 response.Error.Message = "unable to update pick";
232 232
233 return false; 233 return false;
234 } 234 }
235 235
236 public bool PicksDelete(OSDMap json, ref JsonRpcResponse response) 236 public bool PicksDelete(OSDMap json, ref JsonRpcResponse response)
237 { 237 {
238 if(!json.ContainsKey("params")) 238 if(!json.ContainsKey("params"))
@@ -241,18 +241,18 @@ namespace OpenSim.Server.Handlers
241 m_log.DebugFormat ("Avatar Picks Delete Request"); 241 m_log.DebugFormat ("Avatar Picks Delete Request");
242 return false; 242 return false;
243 } 243 }
244 244
245 OSDMap request = (OSDMap)json["params"]; 245 OSDMap request = (OSDMap)json["params"];
246 UUID pickId = new UUID(request["pickId"].AsString()); 246 UUID pickId = new UUID(request["pickId"].AsString());
247 if(Service.PicksDelete(pickId)) 247 if(Service.PicksDelete(pickId))
248 return true; 248 return true;
249 249
250 response.Error.Code = ErrorCode.InternalError; 250 response.Error.Code = ErrorCode.InternalError;
251 response.Error.Message = "data error removing record"; 251 response.Error.Message = "data error removing record";
252 return false; 252 return false;
253 } 253 }
254 #endregion Picks 254 #endregion Picks
255 255
256 #region Notes 256 #region Notes
257 public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response) 257 public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response)
258 { 258 {
@@ -277,7 +277,7 @@ namespace OpenSim.Server.Handlers
277 response.Error.Message = "Error reading notes"; 277 response.Error.Message = "Error reading notes";
278 return false; 278 return false;
279 } 279 }
280 280
281 public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response) 281 public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response)
282 { 282 {
283 if(!json.ContainsKey("params")) 283 if(!json.ContainsKey("params"))
@@ -287,7 +287,7 @@ namespace OpenSim.Server.Handlers
287 m_log.DebugFormat ("Avatar Notes Update Request"); 287 m_log.DebugFormat ("Avatar Notes Update Request");
288 return false; 288 return false;
289 } 289 }
290 290
291 string result = string.Empty; 291 string result = string.Empty;
292 UserProfileNotes note = new UserProfileNotes(); 292 UserProfileNotes note = new UserProfileNotes();
293 object Notes = (object) note; 293 object Notes = (object) note;
@@ -300,7 +300,7 @@ namespace OpenSim.Server.Handlers
300 return true; 300 return true;
301 } 301 }
302 #endregion Notes 302 #endregion Notes
303 303
304 #region Profile Properties 304 #region Profile Properties
305 public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response) 305 public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response)
306 { 306 {
@@ -311,7 +311,7 @@ namespace OpenSim.Server.Handlers
311 m_log.DebugFormat ("Avatar Properties Request"); 311 m_log.DebugFormat ("Avatar Properties Request");
312 return false; 312 return false;
313 } 313 }
314 314
315 string result = string.Empty; 315 string result = string.Empty;
316 UserProfileProperties props = new UserProfileProperties(); 316 UserProfileProperties props = new UserProfileProperties();
317 object Props = (object)props; 317 object Props = (object)props;
@@ -321,12 +321,12 @@ namespace OpenSim.Server.Handlers
321 response.Result = OSD.SerializeMembers(props); 321 response.Result = OSD.SerializeMembers(props);
322 return true; 322 return true;
323 } 323 }
324 324
325 response.Error.Code = ErrorCode.InternalError; 325 response.Error.Code = ErrorCode.InternalError;
326 response.Error.Message = string.Format("{0}", result); 326 response.Error.Message = string.Format("{0}", result);
327 return false; 327 return false;
328 } 328 }
329 329
330 public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response) 330 public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response)
331 { 331 {
332 if(!json.ContainsKey("params")) 332 if(!json.ContainsKey("params"))
@@ -336,7 +336,7 @@ namespace OpenSim.Server.Handlers
336 m_log.DebugFormat ("Avatar Properties Update Request"); 336 m_log.DebugFormat ("Avatar Properties Update Request");
337 return false; 337 return false;
338 } 338 }
339 339
340 string result = string.Empty; 340 string result = string.Empty;
341 UserProfileProperties props = new UserProfileProperties(); 341 UserProfileProperties props = new UserProfileProperties();
342 object Props = (object)props; 342 object Props = (object)props;
@@ -346,13 +346,13 @@ namespace OpenSim.Server.Handlers
346 response.Result = OSD.SerializeMembers(props); 346 response.Result = OSD.SerializeMembers(props);
347 return true; 347 return true;
348 } 348 }
349 349
350 response.Error.Code = ErrorCode.InternalError; 350 response.Error.Code = ErrorCode.InternalError;
351 response.Error.Message = string.Format("{0}", result); 351 response.Error.Message = string.Format("{0}", result);
352 return false; 352 return false;
353 } 353 }
354 #endregion Profile Properties 354 #endregion Profile Properties
355 355
356 #region Interests 356 #region Interests
357 public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response) 357 public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response)
358 { 358 {
@@ -363,7 +363,7 @@ namespace OpenSim.Server.Handlers
363 m_log.DebugFormat ("Avatar Interests Update Request"); 363 m_log.DebugFormat ("Avatar Interests Update Request");
364 return false; 364 return false;
365 } 365 }
366 366
367 string result = string.Empty; 367 string result = string.Empty;
368 UserProfileProperties props = new UserProfileProperties(); 368 UserProfileProperties props = new UserProfileProperties();
369 object Props = (object)props; 369 object Props = (object)props;
@@ -373,7 +373,7 @@ namespace OpenSim.Server.Handlers
373 response.Result = OSD.SerializeMembers(props); 373 response.Result = OSD.SerializeMembers(props);
374 return true; 374 return true;
375 } 375 }
376 376
377 response.Error.Code = ErrorCode.InternalError; 377 response.Error.Code = ErrorCode.InternalError;
378 response.Error.Message = string.Format("{0}", result); 378 response.Error.Message = string.Format("{0}", result);
379 return false; 379 return false;
@@ -399,7 +399,7 @@ namespace OpenSim.Server.Handlers
399 response.Result = OSD.SerializeMembers(prefs); 399 response.Result = OSD.SerializeMembers(prefs);
400 return true; 400 return true;
401 } 401 }
402 402
403 response.Error.Code = ErrorCode.InternalError; 403 response.Error.Code = ErrorCode.InternalError;
404 response.Error.Message = string.Format("{0}", result); 404 response.Error.Message = string.Format("{0}", result);
405// m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); 405// m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message);
@@ -415,7 +415,7 @@ namespace OpenSim.Server.Handlers
415 m_log.DebugFormat ("User Preferences Update Request"); 415 m_log.DebugFormat ("User Preferences Update Request");
416 return false; 416 return false;
417 } 417 }
418 418
419 string result = string.Empty; 419 string result = string.Empty;
420 UserPreferences prefs = new UserPreferences(); 420 UserPreferences prefs = new UserPreferences();
421 object Prefs = (object)prefs; 421 object Prefs = (object)prefs;
@@ -425,7 +425,7 @@ namespace OpenSim.Server.Handlers
425 response.Result = OSD.SerializeMembers(prefs); 425 response.Result = OSD.SerializeMembers(prefs);
426 return true; 426 return true;
427 } 427 }
428 428
429 response.Error.Code = ErrorCode.InternalError; 429 response.Error.Code = ErrorCode.InternalError;
430 response.Error.Message = string.Format("{0}", result); 430 response.Error.Message = string.Format("{0}", result);
431 m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message); 431 m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message);
@@ -433,6 +433,7 @@ namespace OpenSim.Server.Handlers
433 } 433 }
434 #endregion User Preferences 434 #endregion User Preferences
435 435
436
436 #region Utility 437 #region Utility
437 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) 438 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
438 { 439 {
@@ -442,13 +443,13 @@ namespace OpenSim.Server.Handlers
442 m_log.DebugFormat ("Avatar Image Assets Request"); 443 m_log.DebugFormat ("Avatar Image Assets Request");
443 return false; 444 return false;
444 } 445 }
445 446
446 OSDMap request = (OSDMap)json["params"]; 447 OSDMap request = (OSDMap)json["params"];
447 UUID avatarId = new UUID(request["avatarId"].AsString()); 448 UUID avatarId = new UUID(request["avatarId"].AsString());
448 449
449 OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId); 450 OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId);
450 response.Result = data; 451 response.Result = data;
451 452
452 return true; 453 return true;
453 } 454 }
454 #endregion Utiltiy 455 #endregion Utiltiy
@@ -463,7 +464,7 @@ namespace OpenSim.Server.Handlers
463 m_log.DebugFormat ("User Application Service URL Request: No Parameters!"); 464 m_log.DebugFormat ("User Application Service URL Request: No Parameters!");
464 return false; 465 return false;
465 } 466 }
466 467
467 string result = string.Empty; 468 string result = string.Empty;
468 UserAppData props = new UserAppData(); 469 UserAppData props = new UserAppData();
469 object Props = (object)props; 470 object Props = (object)props;
@@ -474,15 +475,15 @@ namespace OpenSim.Server.Handlers
474 res["result"] = OSD.FromString("success"); 475 res["result"] = OSD.FromString("success");
475 res["token"] = OSD.FromString (result); 476 res["token"] = OSD.FromString (result);
476 response.Result = res; 477 response.Result = res;
477 478
478 return true; 479 return true;
479 } 480 }
480 481
481 response.Error.Code = ErrorCode.InternalError; 482 response.Error.Code = ErrorCode.InternalError;
482 response.Error.Message = string.Format("{0}", result); 483 response.Error.Message = string.Format("{0}", result);
483 return false; 484 return false;
484 } 485 }
485 486
486 public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response) 487 public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response)
487 { 488 {
488 if(!json.ContainsKey("params")) 489 if(!json.ContainsKey("params"))
@@ -492,7 +493,7 @@ namespace OpenSim.Server.Handlers
492 m_log.DebugFormat ("User App Data Update Request"); 493 m_log.DebugFormat ("User App Data Update Request");
493 return false; 494 return false;
494 } 495 }
495 496
496 string result = string.Empty; 497 string result = string.Empty;
497 UserAppData props = new UserAppData(); 498 UserAppData props = new UserAppData();
498 object Props = (object)props; 499 object Props = (object)props;
@@ -502,7 +503,7 @@ namespace OpenSim.Server.Handlers
502 response.Result = OSD.SerializeMembers(props); 503 response.Result = OSD.SerializeMembers(props);
503 return true; 504 return true;
504 } 505 }
505 506
506 response.Error.Code = ErrorCode.InternalError; 507 response.Error.Code = ErrorCode.InternalError;
507 response.Error.Message = string.Format("{0}", result); 508 response.Error.Message = string.Format("{0}", result);
508 return false; 509 return false;