diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-16 12:51:42 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-16 12:52:44 +0100 |
commit | d897eeee5c4d163891d0b6a8f85d328ccada7575 (patch) | |
tree | 39d2428b8f9cb677d79e66cb3763cdaed6147616 /strconv.go | |
parent | e83844fbad63a0d6fc2d29a8a412c95f2a419b56 (diff) | |
download | alps-d897eeee5c4d163891d0b6a8f85d328ccada7575.tar.gz alps-d897eeee5c4d163891d0b6a8f85d328ccada7575.zip |
Introduce base plugin
This plugin offers base IMAP/SMTP functionality.
References: https://todo.sr.ht/~sircmpwn/koushin/39
Diffstat (limited to 'strconv.go')
-rw-r--r-- | strconv.go | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/strconv.go b/strconv.go deleted file mode 100644 index 63cbffc..0000000 --- a/strconv.go +++ /dev/null @@ -1,57 +0,0 @@ -package koushin - -import ( - "fmt" - "net/url" - "strconv" - "strings" -) - -func parseUid(s string) (uint32, error) { - uid, err := strconv.ParseUint(s, 10, 32) - if err != nil { - return 0, fmt.Errorf("invalid UID: %v", err) - } - if uid == 0 { - return 0, fmt.Errorf("UID must be non-zero") - } - return uint32(uid), nil -} - -func parseMboxAndUid(mboxString, uidString string) (string, uint32, error) { - mboxName, err := url.PathUnescape(mboxString) - if err != nil { - return "", 0, fmt.Errorf("invalid mailbox name: %v", err) - } - uid, err := parseUid(uidString) - return mboxName, uid, err -} - -func parsePartPath(s string) ([]int, error) { - if s == "" { - return nil, nil - } - - l := strings.Split(s, ".") - path := make([]int, len(l)) - for i, s := range l { - var err error - path[i], err = strconv.Atoi(s) - if err != nil { - return nil, err - } - - if path[i] <= 0 { - return nil, fmt.Errorf("part num must be strictly positive") - } - } - return path, nil -} - -func parseAddressList(s string) []string { - l := strings.Split(s, ",") - for i, addr := range l { - l[i] = strings.TrimSpace(addr) - } - return l -} |