diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-03 18:41:23 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-03 18:41:23 +0100 |
commit | a103309935c4a2c72770343542493d1c285d94dd (patch) | |
tree | 8d030950cf75f4b10f1cc657b56a0079b027b7b5 /strconv.go | |
parent | b386d1c2bb0efacea2484b4aa2088c769e048a9c (diff) | |
download | alps-a103309935c4a2c72770343542493d1c285d94dd.tar.gz alps-a103309935c4a2c72770343542493d1c285d94dd.zip |
Add support for replying to a message
Diffstat (limited to 'strconv.go')
-rw-r--r-- | strconv.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -4,12 +4,13 @@ import ( "fmt" "strconv" "strings" + "net/url" ) func parseUid(s string) (uint32, error) { uid, err := strconv.ParseUint(s, 10, 32) if err != nil { - return 0, err + return 0, fmt.Errorf("invalid UID: %v", err) } if uid == 0 { return 0, fmt.Errorf("UID must be non-zero") @@ -17,6 +18,15 @@ func parseUid(s string) (uint32, error) { 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 |