mirror of https://gitlab.com/bashrc2/epicyon
Case insensitive
parent
5e28e33dc0
commit
c3c553e70d
|
@ -31,7 +31,7 @@ def _notify_on_post_arrival(base_dir: str, nickname: str, domain: str,
|
||||||
handle = following_nickname + '@' + following_domain
|
handle = following_nickname + '@' + following_domain
|
||||||
|
|
||||||
# check that you are following this handle
|
# check that you are following this handle
|
||||||
if not text_in_file(handle + '\n', following_filename):
|
if not text_in_file(handle + '\n', following_filename, False):
|
||||||
print('WARN: ' + handle + ' is not in ' + following_filename)
|
print('WARN: ' + handle + ' is not in ' + following_filename)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -59,24 +59,21 @@ def _notify_on_post_arrival(base_dir: str, nickname: str, domain: str,
|
||||||
fp_notify.write(following_handles + handle + '\n')
|
fp_notify.write(following_handles + handle + '\n')
|
||||||
|
|
||||||
# already in the notifyOnPost file?
|
# already in the notifyOnPost file?
|
||||||
if handle + '\n' in following_handles:
|
if handle + '\n' in following_handles or \
|
||||||
|
handle + '\n' in following_handles.lower():
|
||||||
print(handle + ' exists in notifyOnPost.txt')
|
print(handle + ' exists in notifyOnPost.txt')
|
||||||
if add:
|
if add:
|
||||||
# already added
|
# already added
|
||||||
return
|
return
|
||||||
# remove from calendar file
|
# remove from calendar file
|
||||||
following_handles = following_handles.replace(handle + '\n', '')
|
new_following_handles = ''
|
||||||
with open(notify_on_post_filename, 'w+',
|
following_handles_list = following_handles.split('\n')
|
||||||
encoding='utf-8') as fp_notify:
|
handle_lower = handle.lower()
|
||||||
fp_notify.write(following_handles)
|
for followed in following_handles_list:
|
||||||
elif handle + '\n' in following_handles.lower():
|
if followed.lower() != handle_lower:
|
||||||
print(handle + ' exists in notifyOnPost.txt')
|
new_following_handles += followed + '\n'
|
||||||
if add:
|
following_handles = new_following_handles
|
||||||
# already added
|
|
||||||
return
|
|
||||||
# remove from calendar file
|
|
||||||
following_handles = \
|
|
||||||
following_handles.replace(handle.lower() + '\n', '')
|
|
||||||
with open(notify_on_post_filename, 'w+',
|
with open(notify_on_post_filename, 'w+',
|
||||||
encoding='utf-8') as fp_notify:
|
encoding='utf-8') as fp_notify:
|
||||||
fp_notify.write(following_handles)
|
fp_notify.write(following_handles)
|
||||||
|
|
Loading…
Reference in New Issue