My agentic slop goes here. Not intended for anyone else!
at main 1.7 kB view raw
1(* 2 * Copyright (c) 2014, OCaml.org project 3 * Copyright (c) 2015 KC Sivaramakrishnan <sk826@cl.cam.ac.uk> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 *) 17 18(** River user composed from Sortal contact data + sync state. *) 19 20type t = { 21 contact : Sortal.Contact.t; 22 last_synced : string option; 23} 24 25let of_contact contact ?last_synced () = 26 { contact; last_synced } 27 28let username t = Sortal.Contact.handle t.contact 29let fullname t = Sortal.Contact.primary_name t.contact 30let email t = Sortal.Contact.email t.contact 31let contact t = t.contact 32let last_synced t = t.last_synced 33 34let feeds t = 35 match Sortal.Contact.feeds t.contact with 36 | None -> [] 37 | Some sortal_feeds -> 38 List.map (fun feed -> 39 let name = match Sortal.Feed.name feed with 40 | Some n -> n 41 | None -> Sortal.Contact.primary_name t.contact ^ " feed" 42 in 43 Source.make ~name ~url:(Sortal.Feed.url feed) 44 ) sortal_feeds 45 46let set_last_synced t timestamp = 47 { t with last_synced = Some timestamp }