diff --git a/extra/imap/imap.factor b/extra/imap/imap.factor index 048fce0464..9e18862f39 100644 --- a/extra/imap/imap.factor +++ b/extra/imap/imap.factor @@ -48,9 +48,9 @@ CONSTANT: IMAP4_SSL_PORT 993 : read-response-chunk ( stop-expr -- item ? ) read-?crlf ascii decode swap dupd pcre:findall [ - dup [[ ^.*{(\d+)}$]] pcre:findall + dup [[^.*{(\d+)}$]] pcre:findall [ - dup [[ ^\* (\d+) [A-Z-]+ (.*)$]] pcre:findall + dup [[^\* (\d+) [A-Z-]+ (.*)$]] pcre:findall [ ] [ nip first third second ] if-empty ] [ @@ -82,24 +82,24 @@ CONSTANT: IMAP4_SSL_PORT 993 first " " split 2 tail ; : parse-list-folders ( str -- folder ) - [[ \* LIST \(([^\)]+)\) "([^"]+)" "?([^"]+)"?]] pcre:findall + [[\* LIST \(([^\)]+)\) "([^"]+)" "?([^"]+)"?]] pcre:findall first rest values [ utf7imap4 decode ] map ; : parse-select-folder ( seq -- count ) - [ [[ \* (\d+) EXISTS]] pcre:findall ] map harvest + [ [[\* (\d+) EXISTS]] pcre:findall ] map harvest [ f ] [ first first last last string>number ] if-empty ; ! Returns uid if the server supports the UIDPLUS extension. : parse-append-mail ( seq -- uid/f ) - [ [=[ \[APPENDUID (\d+) \d+\]]=] pcre:findall ] map harvest + [ [=[\[APPENDUID (\d+) \d+\]]=] pcre:findall ] map harvest [ f ] [ first first last last string>number ] if-empty ; : parse-status ( seq -- assoc ) - first [[ \* STATUS "[^"]+" \(([^\)]+)\)]] pcre:findall first last last + first [[\* STATUS "[^"]+" \(([^\)]+)\)]] pcre:findall first last last " " split 2 group [ string>number ] assoc-map ; : parse-store-mail-line ( str -- pair/f ) - [[ \(FLAGS \(([^\)]+)\) UID (\d+)\)]] pcre:findall [ f ] [ + [[\(FLAGS \(([^\)]+)\) UID (\d+)\)]] pcre:findall [ f ] [ first rest values first2 [ " " split ] dip string>number swap 2array ] if-empty ;