X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;ds=sidebyside;f=modules%2Ferl%2Feuphorik_protocole.erl;h=dba48e2eafb5d11eccce9a5476656d39f03a8fc6;hb=ffea71492c07cbf81430883c894b34e1c9408699;hp=f56a335af65af640125937a067ddb3266d20cda2;hpb=dbd5dc444ede3a82c3266684470b342f6a21f685;p=euphorik.git diff --git a/modules/erl/euphorik_protocole.erl b/modules/erl/euphorik_protocole.erl index f56a335..dba48e2 100755 --- a/modules/erl/euphorik_protocole.erl +++ b/modules/erl/euphorik_protocole.erl @@ -83,12 +83,20 @@ profile(Action) -> Email = case xmerl_xpath:string("email", Action) of [#xmlElement{content = [#xmlText{value = E}]}] -> E; _ -> undefined end, Css = case xmerl_xpath:string("css", Action) of [#xmlElement{content = [#xmlText{value = C}]}] -> C; _ -> undefined end, Page_principale = case xmerl_xpath:string("pagePrincipale", Action) of [#xmlElement{content = [#xmlText{value = P3}]}] -> list_to_integer(P3); _ -> undefined end, - Conversations = lists:map( - fun(Conv) -> + Conversations = lists:foldl( + fun(Conv, Acc) -> [#xmlElement{content = [#xmlText{value = Id_racine_str}]}] = xmerl_xpath:string("racine", Conv), [#xmlElement{content = [#xmlText{value = Page_conv_str}]}] = xmerl_xpath:string("page", Conv), - {erlang:list_to_integer(Id_racine_str, 36), list_to_integer(Page_conv_str)} + Message_id = erlang:list_to_integer(Id_racine_str, 36), + % vérification de la validité de l'id + Message_existe = euphorik_minichat:message_existe(Message_id), + if Message_existe -> + [{Message_id, list_to_integer(Page_conv_str)} | Acc]; + true -> + Acc + end end, + [], xmerl_xpath:string("conversation", Action) ), case euphorik_minichat:set_profile(Cookie, Login, Password, Pseudo, Email, Css, Page_principale, Conversations) of