@@ -73,12 +73,12 @@ named!(flag_perm<&str>, alt!(
7373) ) ;
7474
7575named ! ( resp_text_code_alert<ResponseCode >, do_parse!(
76- tag !( "ALERT" ) >>
76+ tag_no_case !( "ALERT" ) >>
7777 ( ResponseCode :: Alert )
7878) ) ;
7979
8080named ! ( resp_text_code_badcharset<ResponseCode >, do_parse!(
81- tag !( "BADCHARSET" ) >>
81+ tag_no_case !( "BADCHARSET" ) >>
8282 ch: opt!( do_parse!(
8383 tag!( " " ) >>
8484 charsets: parenthesized_nonempty_list!( astring_utf8) >>
@@ -93,45 +93,45 @@ named!(resp_text_code_capability<ResponseCode>, map!(
9393) ) ;
9494
9595named ! ( resp_text_code_parse<ResponseCode >, do_parse!(
96- tag !( "PARSE" ) >>
96+ tag_no_case !( "PARSE" ) >>
9797 ( ResponseCode :: Parse )
9898) ) ;
9999
100100named ! ( resp_text_code_permanent_flags<ResponseCode >, do_parse!(
101- tag !( "PERMANENTFLAGS " ) >>
101+ tag_no_case !( "PERMANENTFLAGS " ) >>
102102 flags: parenthesized_list!( flag_perm) >>
103103 ( ResponseCode :: PermanentFlags ( flags) )
104104) ) ;
105105
106106named ! ( resp_text_code_read_only<ResponseCode >, do_parse!(
107- tag !( "READ-ONLY" ) >>
107+ tag_no_case !( "READ-ONLY" ) >>
108108 ( ResponseCode :: ReadOnly )
109109) ) ;
110110
111111named ! ( resp_text_code_read_write<ResponseCode >, do_parse!(
112- tag !( "READ-WRITE" ) >>
112+ tag_no_case !( "READ-WRITE" ) >>
113113 ( ResponseCode :: ReadWrite )
114114) ) ;
115115
116116named ! ( resp_text_code_try_create<ResponseCode >, do_parse!(
117- tag !( "TRYCREATE" ) >>
117+ tag_no_case !( "TRYCREATE" ) >>
118118 ( ResponseCode :: TryCreate )
119119) ) ;
120120
121121named ! ( resp_text_code_uid_validity<ResponseCode >, do_parse!(
122- tag !( "UIDVALIDITY " ) >>
122+ tag_no_case !( "UIDVALIDITY " ) >>
123123 num: number >>
124124 ( ResponseCode :: UidValidity ( num) )
125125) ) ;
126126
127127named ! ( resp_text_code_uid_next<ResponseCode >, do_parse!(
128- tag !( "UIDNEXT " ) >>
128+ tag_no_case !( "UIDNEXT " ) >>
129129 num: number >>
130130 ( ResponseCode :: UidNext ( num) )
131131) ) ;
132132
133133named ! ( resp_text_code_unseen<ResponseCode >, do_parse!(
134- tag !( "UNSEEN " ) >>
134+ tag_no_case !( "UNSEEN " ) >>
135135 num: number >>
136136 ( ResponseCode :: Unseen ( num) )
137137) ) ;
@@ -159,8 +159,8 @@ named!(resp_text_code<ResponseCode>, do_parse!(
159159) ) ;
160160
161161named ! ( capability<Capability >, alt!(
162- map!( tag !( "IMAP4rev1" ) , |_| Capability :: Imap4rev1 ) |
163- map!( preceded!( tag !( "AUTH=" ) , atom) , |a| Capability :: Auth ( a) ) |
162+ map!( tag_no_case !( "IMAP4rev1" ) , |_| Capability :: Imap4rev1 ) |
163+ map!( preceded!( tag_no_case !( "AUTH=" ) , atom) , |a| Capability :: Auth ( a) ) |
164164 map!( atom, |a| Capability :: Atom ( a) )
165165) ) ;
166166
@@ -174,7 +174,7 @@ fn ensure_capabilities_contains_imap4rev<'a>(capabilities: Vec<Capability<'a>>)
174174
175175named ! ( capability_data<Vec <Capability >>, map_res!(
176176 do_parse!(
177- tag !( "CAPABILITY" ) >>
177+ tag_no_case !( "CAPABILITY" ) >>
178178 capabilities: many0!( preceded!( char !( ' ' ) , capability) ) >>
179179 ( capabilities)
180180 ) ,
@@ -187,7 +187,7 @@ named!(resp_capability<Response>, map!(
187187) ) ;
188188
189189named ! ( mailbox_data_search<Response >, do_parse!(
190- tag !( "SEARCH" ) >>
190+ tag_no_case !( "SEARCH" ) >>
191191 ids: many0!( do_parse!(
192192 tag!( " " ) >>
193193 id: number >>
@@ -197,14 +197,14 @@ named!(mailbox_data_search<Response>, do_parse!(
197197) ) ;
198198
199199named ! ( mailbox_data_flags<Response >, do_parse!(
200- tag !( "FLAGS " ) >>
200+ tag_no_case !( "FLAGS " ) >>
201201 flags: flag_list >>
202202 ( Response :: MailboxData ( MailboxDatum :: Flags ( flags) ) )
203203) ) ;
204204
205205named ! ( mailbox_data_exists<Response >, do_parse!(
206206 num: number >>
207- tag !( " EXISTS" ) >>
207+ tag_no_case !( " EXISTS" ) >>
208208 ( Response :: MailboxData ( MailboxDatum :: Exists ( num) ) )
209209) ) ;
210210
@@ -221,7 +221,7 @@ named!(mailbox_list<(Vec<&str>, Option<&str>, &str)>, do_parse!(
221221) ) ;
222222
223223named ! ( mailbox_data_list<Response >, do_parse!(
224- tag !( "LIST " ) >>
224+ tag_no_case !( "LIST " ) >>
225225 data: mailbox_list >>
226226 ( Response :: MailboxData ( MailboxDatum :: List {
227227 flags: data. 0 ,
@@ -231,7 +231,7 @@ named!(mailbox_data_list<Response>, do_parse!(
231231) ) ;
232232
233233named ! ( mailbox_data_lsub<Response >, do_parse!(
234- tag !( "LSUB " ) >>
234+ tag_no_case !( "LSUB " ) >>
235235 data: mailbox_list >>
236236 ( Response :: MailboxData ( MailboxDatum :: List {
237237 flags: data. 0 ,
@@ -245,29 +245,36 @@ named!(mailbox_data_lsub<Response>, do_parse!(
245245named ! ( status_att<StatusAttribute >, alt!(
246246 rfc4551:: status_att_val_highest_mod_seq |
247247 do_parse!(
248- key: alt!(
249- tag!( "MESSAGES" ) |
250- tag!( "RECENT" ) |
251- tag!( "UIDNEXT" ) |
252- tag!( "UIDVALIDITY" ) |
253- tag!( "UNSEEN" )
254- ) >>
255- tag!( " " ) >>
248+ tag_no_case!( "MESSAGES " ) >>
249+ val: number >>
250+ ( StatusAttribute :: Messages ( val) )
251+ ) |
252+ do_parse!(
253+ tag_no_case!( "RECENT " ) >>
254+ val: number >>
255+ ( StatusAttribute :: Recent ( val) )
256+ ) |
257+ do_parse!(
258+ tag_no_case!( "UIDNEXT " ) >>
256259 val: number >>
257- ( match key {
258- b"MESSAGES" => StatusAttribute :: Messages ( val) ,
259- b"RECENT" => StatusAttribute :: Recent ( val) ,
260- b"UIDNEXT" => StatusAttribute :: UidNext ( val) ,
261- b"UIDVALIDITY" => StatusAttribute :: UidValidity ( val) ,
262- b"UNSEEN" => StatusAttribute :: Unseen ( val) ,
263- _ => panic!( "invalid status key {}" , str :: from_utf8( key) . unwrap( ) ) ,
264- } ) )
260+ ( StatusAttribute :: UidNext ( val) )
261+ ) |
262+ do_parse!(
263+ tag_no_case!( "UIDVALIDITY " ) >>
264+ val: number >>
265+ ( StatusAttribute :: UidValidity ( val) )
266+ ) |
267+ do_parse!(
268+ tag_no_case!( "UNSEEN " ) >>
269+ val: number >>
270+ ( StatusAttribute :: Unseen ( val) )
271+ )
265272) ) ;
266273
267274named ! ( status_att_list<Vec <StatusAttribute >>, parenthesized_nonempty_list!( status_att) ) ;
268275
269276named ! ( mailbox_data_status<Response >, do_parse!(
270- tag !( "STATUS " ) >>
277+ tag_no_case !( "STATUS " ) >>
271278 mailbox: mailbox >>
272279 tag!( " " ) >>
273280 status: status_att_list >>
@@ -279,7 +286,7 @@ named!(mailbox_data_status<Response>, do_parse!(
279286
280287named ! ( mailbox_data_recent<Response >, do_parse!(
281288 num: number >>
282- tag !( " RECENT" ) >>
289+ tag_no_case !( " RECENT" ) >>
283290 ( Response :: MailboxData ( MailboxDatum :: Recent ( num) ) )
284291) ) ;
285292
@@ -361,50 +368,50 @@ named!(pub(crate) envelope<Envelope>, paren_delimited!(
361368) ) ;
362369
363370named ! ( msg_att_envelope<AttributeValue >, do_parse!(
364- tag !( "ENVELOPE " ) >>
371+ tag_no_case !( "ENVELOPE " ) >>
365372 envelope: envelope >>
366373 ( AttributeValue :: Envelope ( Box :: new( envelope) ) )
367374) ) ;
368375
369376named ! ( msg_att_internal_date<AttributeValue >, do_parse!(
370- tag !( "INTERNALDATE " ) >>
377+ tag_no_case !( "INTERNALDATE " ) >>
371378 date: nstring_utf8 >>
372379 ( AttributeValue :: InternalDate ( date. unwrap( ) ) )
373380) ) ;
374381
375382named ! ( msg_att_flags<AttributeValue >, do_parse!(
376- tag !( "FLAGS " ) >>
383+ tag_no_case !( "FLAGS " ) >>
377384 flags: flag_list >>
378385 ( AttributeValue :: Flags ( flags) )
379386) ) ;
380387
381388named ! ( msg_att_rfc822<AttributeValue >, do_parse!(
382- tag !( "RFC822 " ) >>
389+ tag_no_case !( "RFC822 " ) >>
383390 raw: nstring >>
384391 ( AttributeValue :: Rfc822 ( raw) )
385392) ) ;
386393
387394named ! ( msg_att_rfc822_header<AttributeValue >, do_parse!(
388- tag !( "RFC822.HEADER " ) >>
395+ tag_no_case !( "RFC822.HEADER " ) >>
389396 opt!( tag!( " " ) ) >> // extra space workaround for DavMail
390397 raw: nstring >>
391398 ( AttributeValue :: Rfc822Header ( raw) )
392399) ) ;
393400
394401named ! ( msg_att_rfc822_size<AttributeValue >, do_parse!(
395- tag !( "RFC822.SIZE " ) >>
402+ tag_no_case !( "RFC822.SIZE " ) >>
396403 num: number >>
397404 ( AttributeValue :: Rfc822Size ( num) )
398405) ) ;
399406
400407named ! ( msg_att_rfc822_text<AttributeValue >, do_parse!(
401- tag !( "RFC822.TEXT " ) >>
408+ tag_no_case !( "RFC822.TEXT " ) >>
402409 raw: nstring >>
403410 ( AttributeValue :: Rfc822Text ( raw) )
404411) ) ;
405412
406413named ! ( msg_att_uid<AttributeValue >, do_parse!(
407- tag !( "UID " ) >>
414+ tag_no_case !( "UID " ) >>
408415 num: number >>
409416 ( AttributeValue :: Uid ( num) )
410417) ) ;
@@ -427,14 +434,14 @@ named!(msg_att_list<Vec<AttributeValue>>, parenthesized_nonempty_list!(msg_att))
427434
428435named ! ( message_data_fetch<Response >, do_parse!(
429436 num: number >>
430- tag !( " FETCH " ) >>
437+ tag_no_case !( " FETCH " ) >>
431438 attrs: msg_att_list >>
432439 ( Response :: Fetch ( num, attrs) )
433440) ) ;
434441
435442named ! ( message_data_expunge<Response >, do_parse!(
436443 num: number >>
437- tag !( " EXPUNGE" ) >>
444+ tag_no_case !( " EXPUNGE" ) >>
438445 ( Response :: Expunge ( num) )
439446) ) ;
440447
0 commit comments