From 13f8888261350c1f3f591ed6ed2d4c1c3efcc090 Mon Sep 17 00:00:00 2001 From: Payas Relekar Date: Sat, 20 Jul 2024 21:00:52 +0530 Subject: [PATCH] remove unused stuff --- src/gleambox.gleam | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/gleambox.gleam b/src/gleambox.gleam index 394cc25..9fc57fc 100644 --- a/src/gleambox.gleam +++ b/src/gleambox.gleam @@ -1,6 +1,5 @@ import birl.{type Time} import gleam/dict.{type Dict} -// import gleam/io import gleam/iterator.{type Iterator} import gleam/list import gleam/pair @@ -9,6 +8,8 @@ import gleam/result import gleam/string import simplifile +// import gleam/io + pub type MBox { MBox(headers: Dict(String, String), body: String) InvalidMBox @@ -39,20 +40,13 @@ pub fn parse_mbox(mboxcontents: String) -> MBox { } } -pub fn get_headers(mbox: MBox) -> Result(Dict(String, String), Nil) { +fn get_headers(mbox: MBox) -> Result(Dict(String, String), Nil) { case mbox { InvalidMBox -> Error(Nil) MBox(headers, _) -> Ok(headers) } } -pub fn get_header(mbox: MBox, key: String) -> Result(String, Nil) { - case mbox { - MBox(headers, _) -> headers |> dict.get(key) - InvalidMBox -> Error(Nil) - } -} - fn parse_body(mboxcontents: String) -> Result(String, Nil) { // split headers from body case string.split_once(mboxcontents, "\n\n") { @@ -102,14 +96,6 @@ fn remove_dead_space(acc: String, matched_content: String) -> String { |> string.replace(acc, matched_content, _) } -pub fn maildir_iterator(mbox_path: String) -> Iterator(String) { - mbox_path - |> simplifile.get_files - |> result.lazy_unwrap(list.new) - |> iterator.from_list - |> iterator.map(read_file) -} - // TODO: better error pub fn maildir_iterate(maildir_path: String) -> Iterator(#(String, String)) { case simplifile.get_files(maildir_path) {