diff --git a/impra/core.py b/impra/core.py index 72517c3..d67bdb0 100644 --- a/impra/core.py +++ b/impra/core.py @@ -759,7 +759,7 @@ class ImpraStorage: #~ self.srv.expunge() #~ sleep(2) self.index.fixDuplicateIds() - #~ self.index.fixAccount('gmx') + #~ self.index.fixAccount('gmail5') encData = self.index.encrypt() msgIndex = self.mb.buildIndex(encData) if DEBUG.level <= DEBUG.NOTICE : mprint(msgIndex.as_string()) @@ -841,7 +841,7 @@ class ImpraStorage: md5 = hash_sha256_file(path) mprint() Clz.print(' account : ' , Clz.fgn7, False) - Clz.print(account , Clz.fgB7) + Clz.print(self.ih.conf.user , Clz.fgB7) Clz.print(' file : ' , Clz.fgn7, False) Clz.print(path , Clz.fgN1) Clz.print(' hash : ' , Clz.fgn7, False) @@ -871,7 +871,16 @@ class ImpraStorage: test = True for row in hlst['data'] : msg = self.mb.build(usr,'all',hlst['head'][2],self.fsplit.DIR_OUTBOX+row[1]+'.ipr') - mid = self.ih.send(msg.as_string(), self.rootBox) + mid = None + try : + mid = self.ih.send(msg.as_string(), self.rootBox) + except Exception as e: + Clz.print('Error :', Clz.fgB1, True, False) + mprint(e) + Clz.print('retry', Clz.fgB1) + self.switchFileAccount(account) + mid = self.ih.send(msg.as_string(), self.rootBox) + if mid is not None : #sleep(0.5) # dont remove diff --git a/impra/imap.py b/impra/imap.py index dcca8ba..b47aaf1 100644 --- a/impra/imap.py +++ b/impra/imap.py @@ -169,10 +169,6 @@ class ImapHelper: rt = RuTime(eval(__CALLER__('conf,"'+str(box)+'"'))) self.srv = IMAP4_SSL(conf.host,conf.port) self.conf = conf - print(conf.host) - print(conf.port) - print(conf.user) - print(conf.pwd) status, resp = self.srv.login(conf.user,conf.pwd) if DEBUG.level <= DEBUG.ALL : mprint(status) @@ -180,7 +176,7 @@ class ImapHelper: if status == self.OK: self.rootBox = box if boxBin is None : - if search('google.com',conf.host) is None: + if search('gmail.com',conf.host) is None: self.BOX_BIN = 'Trash' if box != None : status, resp = self.srv.select(self.rootBox) @@ -270,7 +266,7 @@ class ImapHelper: return s def search(self, query, byUid=False): - if byUid : + if byUid : status, resp = self.srv.uid('search', None, query) else : status, resp = self.srv.search(None, query) diff --git a/imprastorage.py b/imprastorage.py index 2e19638..e9eb8c2 100644 --- a/imprastorage.py +++ b/imprastorage.py @@ -27,7 +27,7 @@ # along with ImpraStorage. If not, see . from impra.core import ImpraConf, ImpraStorage, realpath, dirname, abspath, sep -from impra.util import IniFile, RuTime, get_file_path, Clz +from impra.util import IniFile, RuTime, get_file_path, Clz, mprint from impra.cli import Cli import sys, os @@ -37,7 +37,7 @@ import sys, os # - write help in colors if __name__ == '__main__': - + try: if not Clz.isUnix: if len(sys.argv)>1 and sys.argv[1] == '--run' : Cli.print_header(None) @@ -47,5 +47,7 @@ if __name__ == '__main__': else: Cli(realpath('./')+sep) else : Cli(get_file_path(realpath('./')+sep)) + except KeyboardInterrupt as e : + Clz.print('\nKeyboardInterrupt\n', Clz.fgB1) #python -O -m compileall impra/*.py