removed debug/test stuff from imapy
This commit is contained in:
14
imapy.py
14
imapy.py
@@ -19,7 +19,6 @@ def edit(num):
|
|||||||
|
|
||||||
def get_config():
|
def get_config():
|
||||||
if not os.path.isfile(config_file_path):
|
if not os.path.isfile(config_file_path):
|
||||||
#write default config and exit
|
|
||||||
config_instance = ConfigParser()
|
config_instance = ConfigParser()
|
||||||
config_instance["CREDENTIALS"] = {
|
config_instance["CREDENTIALS"] = {
|
||||||
"username": "virus-user",
|
"username": "virus-user",
|
||||||
@@ -56,7 +55,6 @@ def get_header(eml, string):
|
|||||||
return ergebnisse
|
return ergebnisse
|
||||||
|
|
||||||
|
|
||||||
#aaaah das mit dem decoden und dann die liste anlegen und dann das ergebniss zurückgeben.... irgendwas mit a und auch wenn nicht encoded einfach so zurückgeben genau!
|
|
||||||
|
|
||||||
def force_decode(string, codecs=['utf8', 'cp1252']):
|
def force_decode(string, codecs=['utf8', 'cp1252']):
|
||||||
if isinstance(string, str):
|
if isinstance(string, str):
|
||||||
@@ -149,9 +147,6 @@ def edit_mail(num):
|
|||||||
if action == "ok":
|
if action == "ok":
|
||||||
eml.replace_header('Subject',new_subject)
|
eml.replace_header('Subject',new_subject)
|
||||||
c,d = im.append('INBOX','', imaplib.Time2Internaldate(time.time()),str(eml).encode('utf-8'))
|
c,d = im.append('INBOX','', imaplib.Time2Internaldate(time.time()),str(eml).encode('utf-8'))
|
||||||
# c= OK
|
|
||||||
# d= [b'[APPENDUID 1252405521 2655] APPEND Ok.']
|
|
||||||
# if append ok delete original mailbox
|
|
||||||
if "OK" in c:
|
if "OK" in c:
|
||||||
delete_mail(num)
|
delete_mail(num)
|
||||||
|
|
||||||
@@ -171,25 +166,18 @@ def make_choice():
|
|||||||
|
|
||||||
# Create the menu
|
# Create the menu
|
||||||
menu = CursesMenu("Mails - INBOX", "0 - 10")
|
menu = CursesMenu("Mails - INBOX", "0 - 10")
|
||||||
|
|
||||||
typ, nums = im.search(None, 'ALL')
|
typ, nums = im.search(None, 'ALL')
|
||||||
for n in nums[0].split():
|
for n in nums[0].split():
|
||||||
subject_line=get_subject(n)
|
subject_line=get_subject(n)
|
||||||
if not marvin_pattern.match(subject_line):
|
if not marvin_pattern.match(subject_line):
|
||||||
function_item = FunctionItem(subject_line, edit_mail , [n] ,should_exit=True)
|
function_item = FunctionItem(subject_line, edit_mail , [n] ,should_exit=True)
|
||||||
menu.append_item(function_item)
|
menu.append_item(function_item)
|
||||||
|
|
||||||
menu.show()
|
menu.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
im.close()
|
im.close()
|
||||||
im.logout()
|
im.logout()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# f=open('testmail','rb')
|
|
||||||
# eml=email.message_from_binary_file(f)
|
|
||||||
# dialogit("\n".join(scan_for_marvins(eml)))
|
|
||||||
make_choice()
|
make_choice()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user