mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-40375: Implement imaplib.IMAP4.unselect (GH-19712)
This commit is contained in:
parent
91a5ae1835
commit
c5c42815ec
5 changed files with 59 additions and 0 deletions
|
@ -98,6 +98,7 @@ Commands = {
|
|||
'THREAD': ('SELECTED',),
|
||||
'UID': ('SELECTED',),
|
||||
'UNSUBSCRIBE': ('AUTH', 'SELECTED'),
|
||||
'UNSELECT': ('SELECTED',),
|
||||
}
|
||||
|
||||
# Patterns to match server responses
|
||||
|
@ -902,6 +903,22 @@ class IMAP4:
|
|||
return self._simple_command('UNSUBSCRIBE', mailbox)
|
||||
|
||||
|
||||
def unselect(self):
|
||||
"""Free server's resources associated with the selected mailbox
|
||||
and returns the server to the authenticated state.
|
||||
This command performs the same actions as CLOSE, except
|
||||
that no messages are permanently removed from the currently
|
||||
selected mailbox.
|
||||
|
||||
(typ, [data]) = <instance>.unselect()
|
||||
"""
|
||||
try:
|
||||
typ, data = self._simple_command('UNSELECT')
|
||||
finally:
|
||||
self.state = 'AUTH'
|
||||
return typ, data
|
||||
|
||||
|
||||
def xatom(self, name, *args):
|
||||
"""Allow simple extension commands
|
||||
notified by server in CAPABILITY response.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue