aboutsummaryrefslogtreecommitdiff
path: root/strconv.go
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-12-03 18:41:23 +0100
committerSimon Ser <contact@emersion.fr>2019-12-03 18:41:23 +0100
commita103309935c4a2c72770343542493d1c285d94dd (patch)
tree8d030950cf75f4b10f1cc657b56a0079b027b7b5 /strconv.go
parentb386d1c2bb0efacea2484b4aa2088c769e048a9c (diff)
downloadalps-a103309935c4a2c72770343542493d1c285d94dd.tar.gz
alps-a103309935c4a2c72770343542493d1c285d94dd.zip
Add support for replying to a message
Diffstat (limited to 'strconv.go')
-rw-r--r--strconv.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/strconv.go b/strconv.go
index 0879aac..b34241d 100644
--- a/strconv.go
+++ b/strconv.go
@@ -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