From 5dbd2ad07630ca76a19509bfa08802e7b1f32693 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 3 Jul 2020 20:35:32 +0100 Subject: [PATCH] Create calendar file --- followingCalendar.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/followingCalendar.py b/followingCalendar.py index 92a04b9ec..86ee92b67 100644 --- a/followingCalendar.py +++ b/followingCalendar.py @@ -19,7 +19,15 @@ def receivingCalendarEvents(baseDir: str, nickname: str, domain: str, nickname + '@' + domain + '/followingCalendar.txt' handle = followingNickname + '@' + followingDomain if not os.path.isfile(calendarFilename): - return False + followingFilename = baseDir + '/accounts/' + \ + nickname + '@' + domain + '/following.txt' + if not os.path.isfile(followingFilename): + return False + # create a new calendar file from the following file + with open(followingFilename, 'r') as followingFile: + followingHandles = followingFile.read() + with open(calendarFilename, 'w') as fp: + fp.write(followingHandles) return handle + '\n' in open(calendarFilename).read()