this repo has no description

manual fixes

Changed files
+3 -45
lib
-1
AGENT.md
··· 50 50 12. DONE Extend the fastmail-list to filter messages displays by email address of the 51 51 sender. This may involve adding logic to parse email addresses; if so, add 52 52 this logic into the Jmap_mail library. 53 - 13. Add a new feature to save messages matching specific criteria to a file for offline reading.
+3 -44
lib/jmap_mail.ml
··· 1199 1199 let mailbox_of_json json = 1200 1200 try 1201 1201 let open Ezjsonm in 1202 - Printf.printf "Parsing mailbox JSON\n"; 1203 - 1204 1202 let id = get_string (find json ["id"]) in 1205 - Printf.printf "Got id: %s\n" id; 1206 - 1207 1203 let name = get_string (find json ["name"]) in 1208 - Printf.printf "Got name: %s\n" name; 1209 - 1210 1204 (* Handle parentId which can be null *) 1211 1205 let parent_id = 1212 1206 match find_opt json ["parentId"] with ··· 1215 1209 | None -> None 1216 1210 | _ -> None 1217 1211 in 1218 - Printf.printf "Got parent_id: %s\n" (match parent_id with Some p -> p | None -> "None"); 1219 - 1220 1212 (* Handle role which might be null *) 1221 1213 let role = 1222 1214 match find_opt json ["role"] with ··· 1225 1217 | None -> None 1226 1218 | _ -> None 1227 1219 in 1228 - Printf.printf "Got role\n"; 1229 - 1230 1220 let sort_order = get_int (find json ["sortOrder"]) in 1231 - Printf.printf "Got sort_order: %d\n" sort_order; 1232 - 1233 1221 let total_emails = get_int (find json ["totalEmails"]) in 1234 - Printf.printf "Got total_emails: %d\n" total_emails; 1235 - 1236 1222 let unread_emails = get_int (find json ["unreadEmails"]) in 1237 - Printf.printf "Got unread_emails: %d\n" unread_emails; 1238 - 1239 1223 let total_threads = get_int (find json ["totalThreads"]) in 1240 - Printf.printf "Got total_threads: %d\n" total_threads; 1241 - 1242 1224 let unread_threads = get_int (find json ["unreadThreads"]) in 1243 - Printf.printf "Got unread_threads: %d\n" unread_threads; 1244 - 1245 1225 let is_subscribed = get_bool (find json ["isSubscribed"]) in 1246 - Printf.printf "Got is_subscribed: %b\n" is_subscribed; 1247 - 1248 1226 let rights_json = find json ["myRights"] in 1249 - Printf.printf "Got rights_json\n"; 1250 - 1251 1227 let my_rights = { 1252 1228 Types.may_read_items = get_bool (find rights_json ["mayReadItems"]); 1253 1229 may_add_items = get_bool (find rights_json ["mayAddItems"]); ··· 1259 1235 may_delete = get_bool (find rights_json ["mayDelete"]); 1260 1236 may_submit = get_bool (find rights_json ["maySubmit"]); 1261 1237 } in 1262 - Printf.printf "Constructed my_rights\n"; 1263 - 1264 1238 let result = { 1265 1239 Types.id; 1266 1240 name; ··· 1274 1248 is_subscribed; 1275 1249 my_rights; 1276 1250 } in 1277 - Printf.printf "Constructed mailbox result\n"; 1278 - 1279 1251 Ok (result) 1280 1252 with 1281 - | Not_found as e -> 1282 - Printf.printf "Not_found error: %s\n" (Printexc.to_string e); 1283 - Printexc.print_backtrace stdout; 1253 + | Not_found -> 1284 1254 Error (Parse_error "Required field not found in mailbox object") 1285 1255 | Invalid_argument msg -> 1286 - Printf.printf "Invalid_argument error: %s\n" msg; 1287 1256 Error (Parse_error msg) 1288 1257 | e -> 1289 - Printf.printf "Unknown error: %s\n" (Printexc.to_string e); 1290 1258 Error (Parse_error (Printexc.to_string e)) 1291 1259 1292 1260 (** Convert JSON email object to OCaml type *) 1293 1261 let email_of_json json = 1294 1262 try 1295 1263 let open Ezjsonm in 1296 - Printf.printf "Parsing email JSON\n"; 1297 1264 1298 1265 let id = get_string (find json ["id"]) in 1299 - Printf.printf "Got email id: %s\n" id; 1300 - 1301 1266 let blob_id = get_string (find json ["blobId"]) in 1302 1267 let thread_id = get_string (find json ["threadId"]) in 1303 1268 ··· 1406 1371 let has_attachment = parse_bool_opt "hasAttachment" in 1407 1372 let preview = parse_string_opt "preview" in 1408 1373 1409 - (* Body parts parsing would go here - omitting for brevity *) 1410 - Printf.printf "Email parsed successfully\n"; 1411 - 1374 + (* TODO Body parts parsing would go here - omitting for brevity *) 1412 1375 Ok ({ 1413 1376 Types.id; 1414 1377 blob_id; ··· 1437 1400 headers = None; 1438 1401 }) 1439 1402 with 1440 - | Not_found as e -> 1441 - Printf.printf "Email parse error - Not_found: %s\n" (Printexc.to_string e); 1442 - Printexc.print_backtrace stdout; 1403 + | Not_found -> 1443 1404 Error (Parse_error "Required field not found in email object") 1444 1405 | Invalid_argument msg -> 1445 - Printf.printf "Email parse error - Invalid_argument: %s\n" msg; 1446 1406 Error (Parse_error msg) 1447 1407 | e -> 1448 - Printf.printf "Email parse error - Unknown: %s\n" (Printexc.to_string e); 1449 1408 Error (Parse_error (Printexc.to_string e)) 1450 1409 1451 1410 (** Login to a JMAP server and establish a connection