Write first entry in index

main2
Bob Mottram 2019-10-20 11:45:12 +01:00
parent 6b7120dca7
commit a318f299ca
1 changed files with 12 additions and 5 deletions

View File

@ -1512,11 +1512,18 @@ def inboxUpdateIndex(baseDir: str,handle: str,destinationFilename: str,debug: bo
indexFilename=baseDir+'/accounts/'+handle+'/inbox.index'
if debug:
print('DEBUG: Updating index '+indexFilename)
if os.path.isfile(indexFilename):
with open(indexFilename, 'r+') as indexFile:
content = indexFile.read()
indexFile.seek(0, 0)
indexFile.write(destinationFilename+'\n'+content)
return True
else:
indexFile=open(indexFilename,'w+')
if indexFile:
indexFile.write(destinationFilename+'\n')
indexFile.close()
return False
def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \