- % TODO : pas très beau, mieux vaut construire un #user\r
- case euphorik_bd:set_profile(\r
- Cookie,\r
- Login,\r
- Password,\r
- Pseudo,\r
- Email,\r
- Css,\r
- list_to_atom(Nick_format_str),\r
- View_times,\r
- View_tooltips,\r
- Conversations,\r
- list_to_atom(Ostentatious_master)) of\r
- ok ->\r
- json_reponse_ok();\r
- login_deja_pris ->\r
- erreur("Login déjà pris");\r
- _ ->\r
- erreur("Impossible de mettre à jour le profile")\r
+ % vérification des données JSON\r
+ Chat_order = list_to_atom(Chat_order_str),\r
+ Chat_order_valide = lists:any(fun(E) -> E =:= Chat_order end, [reverse, chrono]),\r
+ if not Chat_order_valide ->\r
+ {erreur, Chat_order_str ++ " n'est pas une valeur acceptée pour 'chat_order'"};\r
+ true -> \r
+ Nick_format = list_to_atom(Nick_format_str),\r
+ Nick_format_valide = lists:any(fun(E) -> E =:= Nick_format end, [nick, login, nick_login]),\r
+ if not Nick_format_valide ->\r
+ {erreur, Nick_format_str ++ " n'est pas une valeur acceptée pour 'nick_format'"};\r
+ true -> \r
+ Ostentatious_master = list_to_atom(Ostentatious_master_str),\r
+ Ostentatious_master_valide = lists:any(fun(E) -> E =:= Ostentatious_master end, [invisible, light, heavy]),\r
+ if not Ostentatious_master_valide ->\r
+ {erreur, Ostentatious_master_str ++ " n'est pas une valeur acceptée pour 'ostentatious_master'"};\r
+ true ->\r
+ #profile{\r
+ pseudo = Pseudo,\r
+ email = Email,\r
+ css = Css,\r
+ chat_order = Chat_order,\r
+ nick_format = Nick_format,\r
+ view_times = View_times,\r
+ view_tooltips = View_tooltips,\r
+ conversations = Conversations,\r
+ ostentatious_master = Ostentatious_master\r
+ }\r
+ end\r
+ end \r