[Patches] imaplib.py patch

Piers Lauder piers@cs.su.oz.au
Tue, 29 Feb 2000 09:04:04 +1100


--129.78.10.43.126.26379.951776548.602.5065
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi!

Reason for patch:

        This patch is re: Lucas.Dejonge@awtpl.com.au: [Python-bugs-list] imaplib -
        not complying with RFC (PR#218)
        
        Lucas de Jonge reported that the code in imaplib that detects a read-write
        to read-only change doesn't comply with RFC 2060.
        
        I've modified the code to comply, and tested it, and here is the resulting
        "diff -c" patch against the version in the CVS tree as of 1/2 hour ago.


Standard disclaimer:

        I confirm that, to the best of my knowledge and belief, this contribution
        is free of any claims of third parties under copyright, patent or
        other rights or interests ("claims").  To the extent that I have
        any such claims, I hereby grant to CNRI a nonexclusive, irrevocable,
        royalty-free, worldwide license to reproduce, distribute, perform and/or
        display publicly, prepare derivative versions, and otherwise use this
        contribution as part of the Python software and its related documentation,
        or any derivative versions thereof, at no cost to CNRI or its licensed
        users, and to authorize others to do so.
        
        I acknowledge that CNRI may, at its sole discretion, decide whether
        or not to incorporate this contribution in the Python software and its
        related documentation.  I further grant CNRI permission to use my name
        and other identifying information provided to CNRI by me for use in
        connection with the Python software and its related documentation.

Piers Lauder.



--129.78.10.43.126.26379.951776548.602.5065
Content-Type: application/octet-stream; name=imaplib.diff
Content-Transfer-Encoding: 7bit

*** dist/src/Lib/imaplib.py	Tue Feb 29 09:06:12 2000
--- /usr/staff/piers/lib/html/python/imaplib.py	Tue Feb 29 09:13:43 2000
***************
*** 15,21 ****
  # 
  # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
  
! __version__ = "2.32"
  
  import binascii, re, socket, string, time, random, sys
  
--- 15,21 ----
  # 
  # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
  
! __version__ = "2.33"
  
  import binascii, re, socket, string, time, random, sys
  
***************
*** 128,133 ****
--- 128,134 ----
  		self.tagged_commands = {}	# Tagged commands awaiting response
  		self.untagged_responses = {}	# {typ: [data, ...], ...}
  		self.continuation_response = ''	# Last continuation response
+ 		self.is_readonly = None		# READ-ONLY desired state
  		self.tagnum = 0
  
  		# Open socket to server.
***************
*** 470,475 ****
--- 471,477 ----
  		"""
  		# Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY')
  		self.untagged_responses = {}	# Flush old responses.
+ 		self.is_readonly = readonly
  		if readonly:
  			name = 'EXAMINE'
  		else:
***************
*** 479,485 ****
  			self.state = 'AUTH'	# Might have been 'SELECTED'
  			return typ, dat
  		self.state = 'SELECTED'
! 		if not self.untagged_responses.has_key('READ-WRITE') \
  			and not readonly:
  			if __debug__:
  				if self.debug >= 1:
--- 481,487 ----
  			self.state = 'AUTH'	# Might have been 'SELECTED'
  			return typ, dat
  		self.state = 'SELECTED'
! 		if self.untagged_responses.has_key('READ-ONLY') \
  			and not readonly:
  			if __debug__:
  				if self.debug >= 1:
***************
*** 594,602 ****
  			if self.untagged_responses.has_key(typ):
  				del self.untagged_responses[typ]
  
! 		if self.untagged_responses.has_key('READ-WRITE') \
! 		and self.untagged_responses.has_key('READ-ONLY'):
! 			del self.untagged_responses['READ-WRITE']
  			raise self.readonly('mailbox status changed to READ-ONLY')
  
  		tag = self._new_tag()
--- 596,603 ----
  			if self.untagged_responses.has_key(typ):
  				del self.untagged_responses[typ]
  
! 		if self.untagged_responses.has_key('READ-ONLY') \
! 		and not self.is_readonly:
  			raise self.readonly('mailbox status changed to READ-ONLY')
  
  		tag = self._new_tag()

--129.78.10.43.126.26379.951776548.602.5065--