imap: fix regexps
parent
d934114fb7
commit
0b6c3f6f8e
|
@ -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 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue