FIX gros bug moisi (ajout de l'information du dernier message au niveau des conversat...
[euphorik.git] / modules / erl / euphorik_protocole.erl
index c2cb984..7519ba8 100755 (executable)
@@ -109,7 +109,13 @@ wait_event(Data) ->
    {value, {_, Message_count}} = lists:keysearch(message_count, 1, Data),
    Main_page = case lists:keysearch(main_page, 1, Data) of {value, {_, P}} -> P; _ -> 1 end,
    {value, {_, {array, Conversations_json}}} = lists:keysearch(conversations, 1, Data),
-   Conversations = lists:map(fun({struct, [{root, Racine}, {page, Page}]}) -> {Racine, Page} end, Conversations_json),
+   Conversations = lists:map(
+      fun({struct, [{root, Racine}, {page, Page} | Reste]}) ->
+         Last_mess_conv  = case Reste of [{last_message_id, L}] -> L; _ -> 0 end,
+         {Racine, Page, Last_mess_conv}
+      end,
+      Conversations_json
+   ),
    User = case euphorik_minichat:user_by_cookie(Cookie) of\r
       {ok, U} -> U;\r
       _ -> inconnu\r