/offlineimap/head: changeset 578

Applied patch from Daniel James to adjust the insertion point for a
new header.
This commit is contained in:
jgoerzen 2004-06-04 21:29:24 +01:00
parent e95dae8c3f
commit 69abd0e656
2 changed files with 15 additions and 11 deletions

View File

@ -9,6 +9,8 @@ offlineimap (4.0.3) unstable; urgency=low
Closes: #252645.
* Fixed typos in manual. Closes: #252646.
* Regenerated docs.
* Applied patch from Daniel James to adjust the insertion point
for a new header.
-- John Goerzen <jgoerzen@complete.org> Fri, 4 Jun 2004 10:10:00 -0500

View File

@ -126,20 +126,22 @@ class IMAPFolder(BaseFolder):
ui.debug('imap',
'savemessage_addheader: called to add %s: %s' % (headername,
headervalue))
newline = "%s: %s" % (headername, headervalue)
ui.debug('imap', 'savemessage_addheader: newline = ' + repr(newline))
insertionpoint = content.find("\r\n")
ui.debug('imap', 'savemessage_addheader: insertionpoint = %d' % insertionpoint)
if insertionpoint == -1:
return newline + "\r\n" + content
elif insertionpoint == 0:
return newline + content
else:
leader = content[0:insertionpoint]
ui.debug('imap', 'savemessage_addheader: leader = %s' % repr(leader))
if insertionpoint == 0 or insertionpoint == -1:
newline = ''
insertionpoint = 0
else:
newline = "\r\n"
newline += "%s: %s" % (headername, headervalue)
ui.debug('imap', 'savemessage_addheader: newline = ' + repr(newline))
trailer = content[insertionpoint:]
ui.debug('imap', 'savemessage_addheader: trailer = ' + repr(trailer))
return leader + newline + trailer
return leader + "\r\n" + newline + trailer
def savemessage_searchforheader(self, imapobj, headername, headervalue):
if imapobj.untagged_responses.has_key('APPENDUID'):