29 using System.Reflection;
31 using OpenMetaverse.StructuredData;
33 using OpenSim.Services.Interfaces;
34 using OpenSim.Framework.Servers.HttpServer;
35 using OpenSim.Framework;
37 namespace OpenSim.Server.Handlers
48 static readonly ILog m_log =
50 MethodBase.GetCurrentMethod().DeclaringType);
77 if(!json.ContainsKey(
"params"))
79 response.Error.Code = ErrorCode.ParseError;
80 m_log.DebugFormat (
"Classified Request");
85 UUID creatorId =
new UUID(request[
"creatorId"].AsString());
89 response.Result = data;
96 if(!json.ContainsKey(
"params"))
98 response.Error.Code = ErrorCode.ParseError;
99 response.Error.Message =
"Error parsing classified update request";
100 m_log.DebugFormat (
"Classified Update Request");
104 string result = string.Empty;
106 object Ad = (object)ad;
107 OSD.DeserializeMembers(ref Ad, (
OSDMap)json[
"params"]);
108 if(Service.ClassifiedUpdate(ad, ref result))
110 response.Result = OSD.SerializeMembers(ad);
114 response.Error.Code = ErrorCode.InternalError;
115 response.Error.Message = string.Format(
"{0}", result);
121 if(!json.ContainsKey(
"params"))
123 response.Error.Code = ErrorCode.ParseError;
124 m_log.DebugFormat (
"Classified Delete Request");
129 UUID classifiedId =
new UUID(request[
"classifiedId"].AsString());
131 if (Service.ClassifiedDelete(classifiedId))
134 response.Error.Code = ErrorCode.InternalError;
135 response.Error.Message =
"data error removing record";
141 if(!json.ContainsKey(
"params"))
143 response.Error.Code = ErrorCode.ParseError;
144 response.Error.Message =
"no parameters supplied";
145 m_log.DebugFormat (
"Classified Info Request");
149 string result = string.Empty;
151 object Ad = (object)ad;
152 OSD.DeserializeMembers(ref Ad, (
OSDMap)json[
"params"]);
153 if(Service.ClassifiedInfoRequest(ref ad, ref result))
155 response.Result = OSD.SerializeMembers(ad);
159 response.Error.Code = ErrorCode.InternalError;
160 response.Error.Message = string.Format(
"{0}", result);
163 #endregion Classifieds
168 if(!json.ContainsKey(
"params"))
170 response.Error.Code = ErrorCode.ParseError;
171 m_log.DebugFormat (
"Avatar Picks Request");
176 UUID creatorId =
new UUID(request[
"creatorId"].AsString());
180 response.Result = data;
187 if(!json.ContainsKey(
"params"))
189 response.Error.Code = ErrorCode.ParseError;
190 response.Error.Message =
"no parameters supplied";
191 m_log.DebugFormat (
"Avatar Picks Info Request");
195 string result = string.Empty;
197 object Pick = (object)pick;
198 OSD.DeserializeMembers(ref Pick, (
OSDMap)json[
"params"]);
199 if(Service.PickInfoRequest(ref pick, ref result))
201 response.Result = OSD.SerializeMembers(pick);
205 response.Error.Code = ErrorCode.InternalError;
206 response.Error.Message = string.Format(
"{0}", result);
212 if(!json.ContainsKey(
"params"))
214 response.Error.Code = ErrorCode.ParseError;
215 response.Error.Message =
"no parameters supplied";
216 m_log.DebugFormat (
"Avatar Picks Update Request");
220 string result = string.Empty;
222 object Pick = (object)pick;
223 OSD.DeserializeMembers(ref Pick, (
OSDMap)json[
"params"]);
224 if(Service.PicksUpdate(ref pick, ref result))
226 response.Result = OSD.SerializeMembers(pick);
230 response.Error.Code = ErrorCode.InternalError;
231 response.Error.Message =
"unable to update pick";
238 if(!json.ContainsKey(
"params"))
240 response.Error.Code = ErrorCode.ParseError;
241 m_log.DebugFormat (
"Avatar Picks Delete Request");
246 UUID pickId =
new UUID(request[
"pickId"].AsString());
247 if(Service.PicksDelete(pickId))
250 response.Error.Code = ErrorCode.InternalError;
251 response.Error.Message =
"data error removing record";
259 if(!json.ContainsKey(
"params"))
261 response.Error.Code = ErrorCode.ParseError;
262 response.Error.Message =
"Params missing";
263 m_log.DebugFormat (
"Avatar Notes Request");
268 object Note = (object)note;
269 OSD.DeserializeMembers(ref Note, (
OSDMap)json[
"params"]);
270 if(Service.AvatarNotesRequest(ref note))
272 response.Result = OSD.SerializeMembers(note);
276 response.Error.Code = ErrorCode.InternalError;
277 response.Error.Message =
"Error reading notes";
283 if(!json.ContainsKey(
"params"))
285 response.Error.Code = ErrorCode.ParseError;
286 response.Error.Message =
"No parameters";
287 m_log.DebugFormat (
"Avatar Notes Update Request");
291 string result = string.Empty;
293 object Notes = (object) note;
294 OSD.DeserializeMembers(ref Notes, (
OSDMap)json[
"params"]);
295 if(Service.NotesUpdate(ref note, ref result))
297 response.Result = OSD.SerializeMembers(note);
304 #region Profile Properties
307 if(!json.ContainsKey(
"params"))
309 response.Error.Code = ErrorCode.ParseError;
310 response.Error.Message =
"no parameters supplied";
311 m_log.DebugFormat (
"Avatar Properties Request");
315 string result = string.Empty;
317 object Props = (object)props;
318 OSD.DeserializeMembers(ref Props, (
OSDMap)json[
"params"]);
319 if(Service.AvatarPropertiesRequest(ref props, ref result))
321 response.Result = OSD.SerializeMembers(props);
325 response.Error.Code = ErrorCode.InternalError;
326 response.Error.Message = string.Format(
"{0}", result);
332 if(!json.ContainsKey(
"params"))
334 response.Error.Code = ErrorCode.ParseError;
335 response.Error.Message =
"no parameters supplied";
336 m_log.DebugFormat (
"Avatar Properties Update Request");
340 string result = string.Empty;
342 object Props = (object)props;
343 OSD.DeserializeMembers(ref Props, (
OSDMap)json[
"params"]);
344 if(Service.AvatarPropertiesUpdate(ref props, ref result))
346 response.Result = OSD.SerializeMembers(props);
350 response.Error.Code = ErrorCode.InternalError;
351 response.Error.Message = string.Format(
"{0}", result);
354 #endregion Profile Properties
359 if(!json.ContainsKey(
"params"))
361 response.Error.Code = ErrorCode.ParseError;
362 response.Error.Message =
"no parameters supplied";
363 m_log.DebugFormat (
"Avatar Interests Update Request");
367 string result = string.Empty;
369 object Props = (object)props;
370 OSD.DeserializeMembers(ref Props, (
OSDMap)json[
"params"]);
371 if(Service.AvatarInterestsUpdate(props, ref result))
373 response.Result = OSD.SerializeMembers(props);
377 response.Error.Code = ErrorCode.InternalError;
378 response.Error.Message = string.Format(
"{0}", result);
383 #region User Preferences
386 if(!json.ContainsKey(
"params"))
388 response.Error.Code = ErrorCode.ParseError;
389 m_log.DebugFormat (
"User Preferences Request");
393 string result = string.Empty;
395 object Prefs = (object)prefs;
396 OSD.DeserializeMembers(ref Prefs, (
OSDMap)json[
"params"]);
397 if(Service.UserPreferencesRequest(ref prefs, ref result))
399 response.Result = OSD.SerializeMembers(prefs);
403 response.Error.Code = ErrorCode.InternalError;
404 response.Error.Message = string.Format(
"{0}", result);
411 if(!json.ContainsKey(
"params"))
413 response.Error.Code = ErrorCode.ParseError;
414 response.Error.Message =
"no parameters supplied";
415 m_log.DebugFormat (
"User Preferences Update Request");
419 string result = string.Empty;
421 object Prefs = (object)prefs;
422 OSD.DeserializeMembers(ref Prefs, (
OSDMap)json[
"params"]);
423 if(Service.UserPreferencesUpdate(ref prefs, ref result))
425 response.Result = OSD.SerializeMembers(prefs);
429 response.Error.Code = ErrorCode.InternalError;
430 response.Error.Message = string.Format(
"{0}", result);
431 m_log.InfoFormat(
"[PROFILES]: User preferences update error - {0}", response.Error.Message);
434 #endregion User Preferences
440 if(!json.ContainsKey(
"params"))
442 response.Error.Code = ErrorCode.ParseError;
443 m_log.DebugFormat (
"Avatar Image Assets Request");
448 UUID avatarId =
new UUID(request[
"avatarId"].AsString());
451 response.Result = data;
460 if(!json.ContainsKey(
"params"))
462 response.Error.Code = ErrorCode.ParseError;
463 response.Error.Message =
"no parameters supplied";
464 m_log.DebugFormat (
"User Application Service URL Request: No Parameters!");
468 string result = string.Empty;
470 object Props = (object)props;
471 OSD.DeserializeMembers(ref Props, (
OSDMap)json[
"params"]);
472 if(Service.RequestUserAppData(ref props, ref result))
475 res[
"result"] = OSD.FromString(
"success");
476 res[
"token"] = OSD.FromString (result);
477 response.Result = res;
482 response.Error.Code = ErrorCode.InternalError;
483 response.Error.Message = string.Format(
"{0}", result);
489 if(!json.ContainsKey(
"params"))
491 response.Error.Code = ErrorCode.ParseError;
492 response.Error.Message =
"no parameters supplied";
493 m_log.DebugFormat (
"User App Data Update Request");
497 string result = string.Empty;
499 object Props = (object)props;
500 OSD.DeserializeMembers(ref Props, (
OSDMap)json[
"params"]);
501 if(Service.SetUserAppData(props, ref result))
503 response.Result = OSD.SerializeMembers(props);
507 response.Error.Code = ErrorCode.InternalError;
508 response.Error.Message = string.Format(
"{0}", result);
OpenMetaverse.StructuredData.OSDArray OSDArray
bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response)
bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response)
OpenMetaverse.StructuredData.OSDMap OSDMap
bool NotesUpdate(OSDMap json, ref JsonRpcResponse response)
JsonRpcProfileHandlers(IUserProfilesService service)
bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response)
bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response)
bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response)
bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response)
bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response)
bool RequestUserAppData(OSDMap json, ref JsonRpcResponse response)
bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response)
bool PicksDelete(OSDMap json, ref JsonRpcResponse response)
bool UserPreferenecesUpdate(OSDMap json, ref JsonRpcResponse response)
bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response)
bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response)
bool PicksUpdate(OSDMap json, ref JsonRpcResponse response)
bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response)