<pre style='margin:0'>
Herby Gillot (herbygillot) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/b20c0bda582ff1c679c3308200f09ec1d27a09e1">https://github.com/macports/macports-ports/commit/b20c0bda582ff1c679c3308200f09ec1d27a09e1</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new b20c0bda582 offlineimap: update to 8.0.0-20230330
</span>b20c0bda582 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit b20c0bda582ff1c679c3308200f09ec1d27a09e1
</span>Author: Kirill A. Korinsky <kirill@korins.ky>
AuthorDate: Tue May 2 01:26:33 2023 +0200
<span style='display:block; white-space:pre;color:#404040;'> offlineimap: update to 8.0.0-20230330
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> I also fixed usage when it installed to non standard prefix, and
</span><span style='display:block; white-space:pre;color:#404040;'> included a few useful patches.
</span>---
mail/offlineimap/Portfile | 37 +++++++--
mail/offlineimap/files/patch-keyring.diff | 133 ++++++++++++++++++++++++++++++
mail/offlineimap/files/patch-utf8.diff | 59 +++++++++++++
3 files changed, 222 insertions(+), 7 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/offlineimap/Portfile b/mail/offlineimap/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 0d297370bb2..680ea5d16f7 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/mail/offlineimap/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/offlineimap/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4,8 +4,10 @@ PortSystem 1.0
</span> PortGroup github 1.0
PortGroup python 1.0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-github.setup OfflineIMAP offlineimap3 8.0.0 v
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+github.setup OfflineIMAP offlineimap3 c8c023e706ec2833a6b8ee6495ce518b650252d6
</span> name offlineimap
<span style='display:block; white-space:pre;background:#e0ffe0;'>+version 8.0.0-20230330
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 0
</span> categories mail python
platforms {darwin any}
license {GPL-2+ OpenSSLException}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -37,22 +39,39 @@ long_description OfflineIMAP is a tool to simplify your e-mail reading. \
</span>
homepage http://offlineimap.org/
<span style='display:block; white-space:pre;background:#ffe0e0;'>-checksums rmd160 891aff60037250e3bcb36c298b20e3b86e1f08b4 \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sha256 8b34481dda8c5e79e88dea9e79975e9572661c5d46c218fbb3dc4146d3421cb8 \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- size 702669
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+checksums rmd160 5a12cd26f008fe27f482b8c224c431c928aabdbf \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sha256 17f13b2a5492fd0b1531af5e5079b7a786de8b1489a277ae256407969bdccd75 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size 703780
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-python.default_version 310
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# enable native integration with system keyring
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# See: https://github.com/OfflineIMAP/offlineimap3/pull/102
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles-append patch-keyring.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# A workarround for https://bugs.python.org/issue32330
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# See: https://github.com/OfflineIMAP/offlineimap3/pull/150
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles-append patch-utf8.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+python.default_version 311
</span>
depends_build port:py${python.version}-docutils \
port:py${python.version}-sphinx \
port:asciidoc \
port:docbook-xsl-nons
<span style='display:block; white-space:pre;background:#ffe0e0;'>-depends_lib port:py${python.version}-distro \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+depends_lib port:curl-ca-bundle \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:py${python.version}-distro \
</span> port:py${python.version}-gssapi \
port:py${python.version}-imaplib2 \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:py${python.version}-keyring \
</span> port:py${python.version}-rfc6555
<span style='display:block; white-space:pre;background:#e0ffe0;'>+post-patch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${prefix} ne "/opt/local"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -W ${worksrcpath} "s|/opt/local/share/curl/curl-ca-bundle.crt|${prefix}/share/curl/curl-ca-bundle.crt|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ offlineimap/utils/distro_utils.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> post-build {
system -W ${worksrcpath} "PATH='${python.prefix}/bin:$env(PATH)' make docs"
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -67,4 +86,8 @@ post-destroot {
</span> ${destroot}${prefix}/etc/offlineimap.conf.minimal.sample
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-github.livecheck.regex {([^"-]+)}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+notes "
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+This version of offlineimap includes support system keyring,\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+you may migrate your passwords from .offlineimaprc by adding\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+option --update-keyring for the next run.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/offlineimap/files/patch-keyring.diff b/mail/offlineimap/files/patch-keyring.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..1e9a17667cb
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/offlineimap/files/patch-keyring.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,133 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git README.md README.md
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index bece058..31035f0 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- README.md
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ README.md
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -101,6 +101,7 @@ Bugs, issues and contributions can be requested to both the mailing list or the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Python v3+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * rfc6555 (required)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * imaplib2 >= 3.5
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++* keyring
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * gssapi (optional), for Kerberos authentication
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * portalocker (optional), if you need to run offlineimap in Cygwin for Windows
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git offlineimap/imapserver.py offlineimap/imapserver.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 79015a6..e733899 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- offlineimap/imapserver.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ offlineimap/imapserver.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -56,6 +56,8 @@ class IMAPServer:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.ui = getglobalui()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.repos = repos
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.config = repos.getconfig()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ self.ignore_keyring = self.config.getboolean('general', 'ignore-keyring')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ self.update_keyring = self.config.getboolean('general', 'update-keyring')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.preauth_tunnel = repos.getpreauthtunnel()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.transport_tunnel = repos.gettransporttunnel()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -176,8 +178,10 @@ class IMAPServer:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return self.password # non-failed preconfigured one
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # get 1) configured password first 2) fall back to asking via UI
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- self.password = self.repos.getpassword() or \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ self.password = self.repos.getpassword(self.ignore_keyring) or \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.ui.getpass(self.username, self.config, self.passworderror)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if self.update_keyring:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ self.repos.updatepassword(self.password)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.passworderror = None
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return self.password
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git offlineimap/init.py offlineimap/init.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index fe7aaae..713ae6d 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- offlineimap/init.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ offlineimap/init.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -196,6 +196,14 @@ class OfflineImap:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ action="store_true", dest="mbnames_prune", default=False,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ help="remove mbnames entries for accounts not in accounts")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ parser.add_option("--ignore-keyring",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ action="store_true", dest="ignore_keyring", default=False,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ help="Ignore password which is stored in system keyring")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ parser.add_option("--update-keyring",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ action="store_true", dest="update_keyring", default=False,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ help="Update system keyring with used password")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ (options, args) = parser.parse_args()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ glob.set_options(options)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -273,6 +281,16 @@ class OfflineImap:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ config.set('general', 'dry-run', 'True')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ config.set_if_not_exists('general', 'dry-run', 'False')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ # ignore_keyring? Set [general]ignore_keyring=True.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if options.ignore_keyring:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ config.set('general', 'ignore-keyring', 'True')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ config.set_if_not_exists('general', 'ignore-keyring', 'False')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ # update_keyring? Set [general]update_keyring=True.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if options.update_keyring:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ config.set('general', 'update-keyring', 'True')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ config.set_if_not_exists('general', 'update-keyring', 'False')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ try:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create the ui class.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.ui = UI_LIST[ui_type.lower()](config)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git offlineimap/repository/IMAP.py offlineimap/repository/IMAP.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 5b29b21..0b6bce6 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- offlineimap/repository/IMAP.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ offlineimap/repository/IMAP.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -22,6 +22,9 @@ import netrc
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ import errno
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from sys import exc_info
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from threading import Event
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++import keyring
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from offlineimap import folder, imaputil, imapserver, OfflineImapError
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from offlineimap.repository.Base import BaseRepository
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from offlineimap.threadutil import ExitNotifyThread
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -565,7 +568,7 @@ class IMAPRepository(BaseRepository):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return self.getconfboolean('expunge', True)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- def getpassword(self):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ def getpassword(self, ignore_keyring):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """Return the IMAP password for this repository.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ It tries to get passwords in the following order:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -647,9 +650,22 @@ class IMAPRepository(BaseRepository):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ user = self.getuser()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if user is None or user == netrcentry[0]:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return netrcentry[2]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- # No strategy yielded a password!
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ # 5. Read from keyring as the last option
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if not ignore_keyring:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return keyring.get_password(self.gethost(), self.getuser())
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return None
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ def updatepassword(self, password):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ """
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ This function update provided password into system keyring.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ None means to remove it.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ """
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if password is None:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ keyring.delete_password(self.gethost(), self.getuser())
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ keyring.set_password(self.gethost(), self.getuser(), password)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def getfolder(self, foldername, decode=True):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """Return instance of OfflineIMAP representative folder."""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git requirements.txt requirements.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index e580f5f..fa885db 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- requirements.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ requirements.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -3,7 +3,7 @@ gssapi[kerberos]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ portalocker[cygwin]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rfc6555
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ distro
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++keyring
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ imaplib2>=3.5
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ urllib3~=1.25.9
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ certifi~=2020.6.20
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/offlineimap/files/patch-utf8.diff b/mail/offlineimap/files/patch-utf8.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..518a3b945be
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/offlineimap/files/patch-utf8.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,59 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git offlineimap/folder/Base.py offlineimap/folder/Base.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index f871d6f..c433d7a 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- offlineimap/folder/Base.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ offlineimap/folder/Base.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -17,6 +17,7 @@ Copyright (C) 2002-2016 John Goerzen & contributors
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++import email
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ import os.path
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ import re
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ import time
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -26,12 +27,25 @@ from email import policy
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from email.parser import BytesParser
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from email.generator import BytesGenerator
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from email.utils import parsedate_tz, mktime_tz
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++from email.charset import Charset
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from offlineimap import threadutil
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from offlineimap.ui import getglobalui
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ from offlineimap.error import OfflineImapError
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ import offlineimap.accounts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# This is wrapper to workaround for:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# - https://bugs.python.org/issue32330
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++class EmailMessage(email.message.EmailMessage):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ def set_payload(self, payload, charset=None):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if hasattr(payload, 'encode') and (charset is not None or self.policy.utf8):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if charset is None:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ charset = Charset('utf-8')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ elif not isinstance(charset, Charset):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ charset = Charset(charset)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ payload = payload.encode(charset.output_charset, 'replace')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ charset = None
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ super().set_payload(payload, charset)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ class BaseFolder:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -49,15 +63,16 @@ class BaseFolder:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.messagelist = {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Use the built-in email libraries
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Establish some policies
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ default_policy = policy.default.clone(message_factory=EmailMessage)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.policy = {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ '7bit':
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- policy.default.clone(cte_type='7bit', utf8=False, refold_source='none'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ default_policy.clone(cte_type='7bit', utf8=False, refold_source='none'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ '7bit-RFC':
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- policy.default.clone(cte_type='7bit', utf8=False, refold_source='none', linesep='\r\n'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ default_policy.clone(cte_type='7bit', utf8=False, refold_source='none', linesep='\r\n'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ '8bit':
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- policy.default.clone(cte_type='8bit', utf8=True, refold_source='none'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ default_policy.clone(cte_type='8bit', utf8=True, refold_source='none'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ '8bit-RFC':
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- policy.default.clone(cte_type='8bit', utf8=True, refold_source='none', linesep='\r\n'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ default_policy.clone(cte_type='8bit', utf8=True, refold_source='none', linesep='\r\n'),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Parsers
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.parser = {}
</span></pre><pre style='margin:0'>
</pre>