bugfix trash box gmail, catch keyboardInterrupt, cnx reset by peer
This commit is contained in:
parent
97027e7376
commit
3bfa97ca94
|
@ -759,7 +759,7 @@ class ImpraStorage:
|
||||||
#~ self.srv.expunge()
|
#~ self.srv.expunge()
|
||||||
#~ sleep(2)
|
#~ sleep(2)
|
||||||
self.index.fixDuplicateIds()
|
self.index.fixDuplicateIds()
|
||||||
#~ self.index.fixAccount('gmx')
|
#~ self.index.fixAccount('gmail5')
|
||||||
encData = self.index.encrypt()
|
encData = self.index.encrypt()
|
||||||
msgIndex = self.mb.buildIndex(encData)
|
msgIndex = self.mb.buildIndex(encData)
|
||||||
if DEBUG.level <= DEBUG.NOTICE : mprint(msgIndex.as_string())
|
if DEBUG.level <= DEBUG.NOTICE : mprint(msgIndex.as_string())
|
||||||
|
@ -841,7 +841,7 @@ class ImpraStorage:
|
||||||
md5 = hash_sha256_file(path)
|
md5 = hash_sha256_file(path)
|
||||||
mprint()
|
mprint()
|
||||||
Clz.print(' account : ' , Clz.fgn7, False)
|
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(' file : ' , Clz.fgn7, False)
|
||||||
Clz.print(path , Clz.fgN1)
|
Clz.print(path , Clz.fgN1)
|
||||||
Clz.print(' hash : ' , Clz.fgn7, False)
|
Clz.print(' hash : ' , Clz.fgn7, False)
|
||||||
|
@ -871,7 +871,16 @@ class ImpraStorage:
|
||||||
test = True
|
test = True
|
||||||
for row in hlst['data'] :
|
for row in hlst['data'] :
|
||||||
msg = self.mb.build(usr,'all',hlst['head'][2],self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
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 :
|
if mid is not None :
|
||||||
#sleep(0.5)
|
#sleep(0.5)
|
||||||
# dont remove
|
# dont remove
|
||||||
|
|
|
@ -169,10 +169,6 @@ class ImapHelper:
|
||||||
rt = RuTime(eval(__CALLER__('conf,"'+str(box)+'"')))
|
rt = RuTime(eval(__CALLER__('conf,"'+str(box)+'"')))
|
||||||
self.srv = IMAP4_SSL(conf.host,conf.port)
|
self.srv = IMAP4_SSL(conf.host,conf.port)
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
print(conf.host)
|
|
||||||
print(conf.port)
|
|
||||||
print(conf.user)
|
|
||||||
print(conf.pwd)
|
|
||||||
status, resp = self.srv.login(conf.user,conf.pwd)
|
status, resp = self.srv.login(conf.user,conf.pwd)
|
||||||
if DEBUG.level <= DEBUG.ALL :
|
if DEBUG.level <= DEBUG.ALL :
|
||||||
mprint(status)
|
mprint(status)
|
||||||
|
@ -180,7 +176,7 @@ class ImapHelper:
|
||||||
if status == self.OK:
|
if status == self.OK:
|
||||||
self.rootBox = box
|
self.rootBox = box
|
||||||
if boxBin is None :
|
if boxBin is None :
|
||||||
if search('google.com',conf.host) is None:
|
if search('gmail.com',conf.host) is None:
|
||||||
self.BOX_BIN = 'Trash'
|
self.BOX_BIN = 'Trash'
|
||||||
if box != None :
|
if box != None :
|
||||||
status, resp = self.srv.select(self.rootBox)
|
status, resp = self.srv.select(self.rootBox)
|
||||||
|
@ -270,7 +266,7 @@ class ImapHelper:
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def search(self, query, byUid=False):
|
def search(self, query, byUid=False):
|
||||||
if byUid :
|
if byUid :
|
||||||
status, resp = self.srv.uid('search', None, query)
|
status, resp = self.srv.uid('search', None, query)
|
||||||
else :
|
else :
|
||||||
status, resp = self.srv.search(None, query)
|
status, resp = self.srv.search(None, query)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
# along with ImpraStorage. If not, see <http://www.gnu.org/licenses/>.
|
# along with ImpraStorage. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from impra.core import ImpraConf, ImpraStorage, realpath, dirname, abspath, sep
|
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
|
from impra.cli import Cli
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import sys, os
|
||||||
# - write help in colors
|
# - write help in colors
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
if not Clz.isUnix:
|
if not Clz.isUnix:
|
||||||
if len(sys.argv)>1 and sys.argv[1] == '--run' :
|
if len(sys.argv)>1 and sys.argv[1] == '--run' :
|
||||||
Cli.print_header(None)
|
Cli.print_header(None)
|
||||||
|
@ -47,5 +47,7 @@ if __name__ == '__main__':
|
||||||
else: Cli(realpath('./')+sep)
|
else: Cli(realpath('./')+sep)
|
||||||
else :
|
else :
|
||||||
Cli(get_file_path(realpath('./')+sep))
|
Cli(get_file_path(realpath('./')+sep))
|
||||||
|
except KeyboardInterrupt as e :
|
||||||
|
Clz.print('\nKeyboardInterrupt\n', Clz.fgB1)
|
||||||
|
|
||||||
#python -O -m compileall impra/*.py
|
#python -O -m compileall impra/*.py
|
||||||
|
|
Loading…
Reference in New Issue
Block a user