diff --git a/followingCalendar.py b/followingCalendar.py index 10fe57ad4..0045aeeab 100644 --- a/followingCalendar.py +++ b/followingCalendar.py @@ -100,7 +100,7 @@ def _receive_calendar_events(base_dir: str, nickname: str, domain: str, handle = following_nickname + '@' + following_domain # check that you are following this handle - if not _text_in_file2(handle + '\n', following_filename): + if not _text_in_file2(handle + '\n', following_filename, False): print('WARN: ' + handle + ' is not in ' + following_filename) return @@ -137,25 +137,14 @@ def _receive_calendar_events(base_dir: str, nickname: str, domain: str, print('EX: unable to write ' + calendar_filename) # already in the calendar file? - if handle + '\n' in following_handles: + if handle + '\n' in following_handles or \ + handle + '\n' in following_handles.lower(): print(handle + ' exists in followingCalendar.txt') if add: # already added return # remove from calendar file following_handles = following_handles.replace(handle + '\n', '') - try: - with open(calendar_filename, 'w+', - encoding='utf-8') as fp_cal: - fp_cal.write(following_handles) - except OSError: - print('EX: _receive_calendar_events 3 ' + calendar_filename) - elif handle + '\n' in following_handles.lower(): - print(handle + ' exists in followingCalendar.txt') - if add: - # already added - return - # remove from calendar file following_handles = \ following_handles.replace(handle.lower() + '\n', '') try: