Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
69155682
Kaydet (Commit)
69155682
authored
Haz 10, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
small fix by Sjoerd
üst
eaa1959c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
mimify.py
Lib/mimify.py
+12
-3
No files found.
Lib/mimify.py
Dosyayı görüntüle @
69155682
...
@@ -29,8 +29,10 @@ QUOTE = '> ' # string replies are quoted with
...
@@ -29,8 +29,10 @@ QUOTE = '> ' # string replies are quoted with
import
regex
,
regsub
,
string
import
regex
,
regsub
,
string
qp
=
regex
.
compile
(
'^content-transfer-encoding:[
\000
-
\377
]*quoted-printable'
,
qp
=
regex
.
compile
(
'^content-transfer-encoding:[
\t
]*quoted-printable'
,
regex
.
casefold
)
regex
.
casefold
)
base64
=
regex
.
compile
(
'^content-transfer-encoding:[
\t
]*base64'
,
regex
.
casefold
)
mp
=
regex
.
compile
(
'^content-type:[
\000
-
\377
]*multipart/[
\000
-
\377
]*boundary="?
\\
([^;"
\n
]*
\\
)'
,
mp
=
regex
.
compile
(
'^content-type:[
\000
-
\377
]*multipart/[
\000
-
\377
]*boundary="?
\\
([^;"
\n
]*
\\
)'
,
regex
.
casefold
)
regex
.
casefold
)
chrset
=
regex
.
compile
(
'^
\\
(content-type:.*charset="
\\
)
\\
(us-ascii
\\
|iso-8859-[0-9]+
\\
)
\\
("[
\000
-
\377
]*
\\
)'
,
chrset
=
regex
.
compile
(
'^
\\
(content-type:.*charset="
\\
)
\\
(us-ascii
\\
|iso-8859-[0-9]+
\\
)
\\
("[
\000
-
\377
]*
\\
)'
,
...
@@ -261,7 +263,7 @@ iso_char = regex.compile('[\240-\377]')
...
@@ -261,7 +263,7 @@ iso_char = regex.compile('[\240-\377]')
def
mimify_part
(
ifile
,
ofile
,
is_mime
):
def
mimify_part
(
ifile
,
ofile
,
is_mime
):
'''Convert an 8bit part of a MIME mail message to quoted-printable.'''
'''Convert an 8bit part of a MIME mail message to quoted-printable.'''
has_cte
=
is_qp
=
0
has_cte
=
is_qp
=
is_base64
=
0
multipart
=
None
multipart
=
None
must_quote_body
=
must_quote_header
=
has_iso_chars
=
0
must_quote_body
=
must_quote_header
=
has_iso_chars
=
0
...
@@ -283,6 +285,8 @@ def mimify_part(ifile, ofile, is_mime):
...
@@ -283,6 +285,8 @@ def mimify_part(ifile, ofile, is_mime):
has_cte
=
1
has_cte
=
1
if
qp
.
match
(
line
)
>=
0
:
if
qp
.
match
(
line
)
>=
0
:
is_qp
=
1
is_qp
=
1
elif
base64
.
match
(
line
)
>=
0
:
is_base64
=
1
if
mp
.
match
(
line
)
>=
0
:
if
mp
.
match
(
line
)
>=
0
:
multipart
=
'--'
+
mp
.
group
(
1
)
multipart
=
'--'
+
mp
.
group
(
1
)
if
he
.
match
(
line
)
>=
0
:
if
he
.
match
(
line
)
>=
0
:
...
@@ -302,6 +306,9 @@ def mimify_part(ifile, ofile, is_mime):
...
@@ -302,6 +306,9 @@ def mimify_part(ifile, ofile, is_mime):
if
line
==
multipart
+
'
\n
'
:
if
line
==
multipart
+
'
\n
'
:
message_end
=
line
message_end
=
line
break
break
if
is_base64
:
message
.
append
(
line
)
continue
if
is_qp
:
if
is_qp
:
while
line
[
-
2
:]
==
'=
\n
'
:
while
line
[
-
2
:]
==
'=
\n
'
:
line
=
line
[:
-
2
]
line
=
line
[:
-
2
]
...
@@ -333,7 +340,9 @@ def mimify_part(ifile, ofile, is_mime):
...
@@ -333,7 +340,9 @@ def mimify_part(ifile, ofile, is_mime):
line
=
chrset
.
group
(
1
)
+
'us-ascii'
+
chrset
.
group
(
3
)
line
=
chrset
.
group
(
1
)
+
'us-ascii'
+
chrset
.
group
(
3
)
if
has_cte
and
cte
.
match
(
line
)
>=
0
:
if
has_cte
and
cte
.
match
(
line
)
>=
0
:
line
=
'Content-Transfer-Encoding: '
line
=
'Content-Transfer-Encoding: '
if
must_quote_body
:
if
is_base64
:
line
=
line
+
'base64
\n
'
elif
must_quote_body
:
line
=
line
+
'quoted-printable
\n
'
line
=
line
+
'quoted-printable
\n
'
else
:
else
:
line
=
line
+
'7bit
\n
'
line
=
line
+
'7bit
\n
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment