@@ -1560,6 +1560,9 @@ def login(user, password)
15601560 . tap do state_authenticated! _1 end
15611561 end
15621562
1563+ # :call-seq:
1564+ # select(mailbox, **opts) -> result
1565+ #
15631566 # Sends a {SELECT command [IMAP4rev1 §6.3.1]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.3.1]
15641567 # to select a +mailbox+ so that messages in the +mailbox+ can be accessed.
15651568 #
@@ -1593,17 +1596,13 @@ def login(user, password)
15931596 # the +condstore+ keyword parameter may be used.
15941597 # imap.select("mbox", condstore: true)
15951598 # modseq = imap.responses("HIGHESTMODSEQ", &:last)
1596- def select ( mailbox , condstore : false )
1597- args = [ "SELECT" , mailbox ]
1598- args << [ "CONDSTORE" ] if condstore
1599- synchronize do
1600- state_unselected! # implicitly closes current mailbox
1601- @responses . clear
1602- send_command ( *args )
1603- . tap do state_selected! end
1604- end
1599+ def select ( ...)
1600+ select_internal ( "SELECT" , ...)
16051601 end
16061602
1603+ # :call-seq:
1604+ # examine(mailbox, **opts) -> result
1605+ #
16071606 # Sends a {EXAMINE command [IMAP4rev1 §6.3.2]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.3.2]
16081607 # to select a +mailbox+ so that messages in the +mailbox+ can be accessed.
16091608 # Behaves the same as #select, except that the selected +mailbox+ is
@@ -1613,15 +1612,8 @@ def select(mailbox, condstore: false)
16131612 # exist or is for some reason non-examinable.
16141613 #
16151614 # Related: #select
1616- def examine ( mailbox , condstore : false )
1617- args = [ "EXAMINE" , mailbox ]
1618- args << [ "CONDSTORE" ] if condstore
1619- synchronize do
1620- state_unselected! # implicitly closes current mailbox
1621- @responses . clear
1622- send_command ( *args )
1623- . tap do state_selected! end
1624- end
1615+ def examine ( ...)
1616+ select_internal ( "EXAMINE" , ...)
16251617 end
16261618
16271619 # Sends a {CREATE command [IMAP4rev1 §6.3.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.3.3]
@@ -3588,6 +3580,17 @@ def enforce_logindisabled?
35883580 end
35893581 end
35903582
3583+ def select_internal ( command , mailbox , condstore : false )
3584+ args = [ command , mailbox ]
3585+ args << [ "CONDSTORE" ] if condstore
3586+ synchronize do
3587+ state_unselected! # implicitly closes current mailbox
3588+ @responses . clear
3589+ send_command ( *args )
3590+ . tap do state_selected! end
3591+ end
3592+ end
3593+
35913594 def expunge_internal ( ...)
35923595 synchronize do
35933596 send_command ( ...)
0 commit comments