In progress: improvement of message presentation

This commit is contained in:
orbifx 2021-09-23 19:31:50 +01:00
parent c8a0ce481b
commit 40e57b68eb

View File

@ -105,8 +105,13 @@ let pull_msgs url _authors _topics = match http_apply response url with
in
let s = Scanf.Scanning.from_string body in
let msgs = MsgSet.empty in
let msgs = fold_msgs s msgs (fun msgs t m -> match Ptime.of_rfc3339 t with Ok (v,_,_) -> MsgSet.add (v,m) msgs | _ -> msgs) in
MsgSet.iter (fun (t,m) -> print_endline (Ptime.to_rfc3339 t ^ " @ " ^ m)) msgs
let msgs = fold_msgs s msgs
(fun msgs t m -> match Ptime.of_rfc3339 t with
| Ok (v,_,_) -> let open MsgSet in
let msgs = if cardinal msgs > 3 then remove (max_elt msgs) msgs else msgs in
add (v,m) msgs
| _ -> msgs) in
MsgSet.iter (fun (t,m) -> print_endline (m ^ "\n\t\t -- " ^ Ptime.to_rfc3339 t)) msgs
let pull_fn url = match Uri.of_string url with
| x when x = Uri.empty -> (fun _ _ -> ())