organizational and whitespace changes
authorAndrew Engelbrecht <sudoman@ninthfloor.org>
Sun, 27 Jul 2014 05:57:36 +0000 (01:57 -0400)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Mon, 7 Dec 2015 17:46:48 +0000 (12:46 -0500)
easier to read

edward-bot

index 67adf2e671a00ffd80edbdb5d3e71fcb092678d6..aec4b6cb2ed11d78b95683f1f48d87196aad5ec4 100755 (executable)
@@ -55,25 +55,27 @@ def msg_walk (msg):
         if part.get_content_type() == 'multipart':
             continue
 
+        charset   = part.get_content_charset()
+        payload_b = part.get_payload(decode=True)
+
         filename  = part.get_filename()
         conttype  = part.get_content_type()
         descrip_p = part.get_params(header='content-description')
 
-        charset   = part.get_content_charset()
-        payload_b = part.get_payload(decode=True)
+        if charset == None:
+            charset = 'utf-8'
 
         if payload_b == None:
             continue
+        else:
+            payload = payload_b.decode(charset)
+
 
         if descrip_p == None:
             decript = ""
         else:
             descript = descrip_p[0][0]
 
-        if charset == None:
-            charset = 'utf-8'
-
-        payload = payload_b.decode(charset)
 
         if conttype == "application/pgp-encrypted":
             if descript == 'PGP/MIME version identification':
@@ -82,7 +84,7 @@ def msg_walk (msg):
                             + payload.strip())
             continue
 
-        if (filename == "encrypted.asc") or (conttype == "pgp/mime"):
+        elif (filename == "encrypted.asc") or (conttype == "pgp/mime"):
             dec_msg = decrypt_payload(payload)
             print_decrypted(dec_msg)