Browse Source

renaming to enigmail

master
Volker Birk 2 years ago
parent
commit
f9f5bd04b6
3 changed files with 29 additions and 6 deletions
  1. +5
    -0
      enigmail.py
  2. +5
    -3
      pEp_import.py
  3. +19
    -3
      thunderbird.py

gnupg.py → enigmail.py View File


+ 5
- 3
pEp_import.py View File

@ -5,10 +5,12 @@
import sys
import gnupg
import enigmail
own_pgp_keys = gnupg.own_pgp_keys()
own_pgp_keys = enigmail.own_pgp_keys()
thunderbird_identities = enigmail.thunderbird_identities()
print own_pgp_keys
print
print thunderbird_identities

+ 19
- 3
thunderbird.py View File

@ -2,6 +2,8 @@
import os
import re
from fileinput import input
class ThunderbirdNotFound(LookupError):
@ -22,13 +24,13 @@ def profile_path(thunderbird_base):
def prefs(thunderbird_base, key):
from fileinput import input
import re
c = re.compile(r'user_pref\(["\']' + key + '["\'],\s*["\'](?P<value>[^"\']*)["\']\);', re.UNICODE)
filename = os.path.join(profile_path(thunderbird_base), 'prefs.js')
for line in input(files=(filename,)):
finput = input(files=(filename,))
for line in finput:
m = c.search(line)
if m:
finput.close()
return m.group('value')
return None
@ -39,3 +41,17 @@ def enigmail_agentPath(thunderbird_base):
def enigmail_juniorMode(thunderbird_base):
return prefs(thunderbird_base, r'extensions\.enigmail\.juniorMode')
def identities(thunderbird_base):
result = {}
c = re.compile(r'user_pref\(["\']mail\.identity\.(?P<name>\w+)\.(?P<field>\w+)["\'],\s*["\'](?P<value>[^"\']*)["\']\);', re.UNICODE)
filename = os.path.join(profile_path(thunderbird_base), 'prefs.js')
for line in input(files=(filename,)):
m = c.search(line)
if m:
if not m.group('name') in result:
result[m.group('name')] = {}
result[m.group('name')][m.group('field')] = m.group('value')
return result

Loading…
Cancel
Save