bugfix trash box gmail, catch keyboardInterrupt, cnx reset by peer

This commit is contained in:
a-Sansara 2012-10-11 05:19:05 +02:00
parent 97027e7376
commit 3bfa97ca94
3 changed files with 18 additions and 11 deletions

View File

@ -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

View File

@ -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)

View File

@ -27,7 +27,7 @@
# along with ImpraStorage. If not, see <http://www.gnu.org/licenses/>.
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