mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/tglx/remail.git
synced 2024-11-22 04:12:38 +01:00
remail: Remove unused functions and debug leftovers
Spring cleaning. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
bab35c35b6
commit
2cee74a08b
1 changed files with 0 additions and 49 deletions
|
@ -186,21 +186,8 @@ def decode_addrs(hdr):
|
|||
addrs.append(addr)
|
||||
return addrs
|
||||
|
||||
def decode_from(msg):
|
||||
'''
|
||||
Decode the From header and return it as the topmost element
|
||||
'''
|
||||
addrs = decode_addrs(str(msg['From']))
|
||||
return addrs.get_first()
|
||||
|
||||
re_noquote = re.compile('[a-zA-Z0-9_\- ]+')
|
||||
|
||||
def encode_hdr(txt):
|
||||
try:
|
||||
return txt.encode('ascii').decode()
|
||||
except:
|
||||
txt = txt.encode('UTF-8').decode()
|
||||
|
||||
def encode_addr(fulladdr):
|
||||
try:
|
||||
name, addr = fulladdr.split('<', 1)
|
||||
|
@ -321,41 +308,6 @@ def msg_set_gpg_payload(msg, encpl, bseed, addpgp=False):
|
|||
'multipart/encrypted; protocol="application/pgp-encrypted";boundary="%s"' % (boundary))
|
||||
msg_set_header(msg, 'Content-Disposition', 'inline')
|
||||
|
||||
def msg_strip_signature(msg):
|
||||
'''
|
||||
Strip signature from msg for now. The formats are horribly different
|
||||
and proper encrypted mails are signed as part of the encryption.
|
||||
'''
|
||||
ct = msg.get_content_type()
|
||||
if ct != 'multipart/signed':
|
||||
return msg
|
||||
|
||||
boundary = msg.get_boundary(None)
|
||||
payload = msg.get_payload()
|
||||
stripped = False
|
||||
|
||||
for m in payload:
|
||||
if m.get_content_type() == 'application/pgp-signature':
|
||||
payload.remove(m)
|
||||
stripped = True
|
||||
|
||||
# If no signature found return unmodified msg
|
||||
if not stripped:
|
||||
return
|
||||
|
||||
if len(payload) == 1:
|
||||
# If the remaining message is only a single item set it as payload
|
||||
msg_set_payload(msg, payload[0])
|
||||
else:
|
||||
# Recreate the multipart message
|
||||
content = 'Content-type: multipart/mixed; boundary="%s"\n\n' % boundary
|
||||
for m in payload:
|
||||
content += '--%s\n' % boundary
|
||||
content += m.as_string()
|
||||
content += '\n'
|
||||
content += '--%s\n' % boundary
|
||||
msg_set_payload(msg, msg_from_string(content))
|
||||
|
||||
def msg_strip_html(msg):
|
||||
'''
|
||||
Strip html from msg
|
||||
|
@ -461,7 +413,6 @@ def msg_handle_multimix(msg):
|
|||
for payload in payloads:
|
||||
try:
|
||||
ct = payload.get_content_type()
|
||||
print(ct)
|
||||
if ct == 'application/pgp-encrypted':
|
||||
gpgpl += 1
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue