Following

master
Bob Mottram 2019-08-31 13:25:42 +01:00
parent ab9b42c211
commit 0ba7f4e8b9
1 changed files with 11 additions and 11 deletions

View File

@ -33,19 +33,19 @@ def isFollowingActor(baseDir: str,nickname: str,domain: str,actor: str) -> bool:
handle=nickname+'@'+domain handle=nickname+'@'+domain
if not os.path.isdir(baseDir+'/accounts/'+handle): if not os.path.isdir(baseDir+'/accounts/'+handle):
return False return False
followersFile=baseDir+'/accounts/'+handle+'/followers.txt' followingFile=baseDir+'/accounts/'+handle+'/following.txt'
if not os.path.isfile(followersFile): if not os.path.isfile(followingFile):
return False return False
if actor in open(followersFile).read(): if actor in open(followingFile).read():
return True return True
followerNickname=getNicknameFromActor(actor) followingNickname=getNicknameFromActor(actor)
followerDomain,followerPort=getDomainFromActor(actor) followingDomain,followingPort=getDomainFromActor(actor)
followerHandle=followerNickname+'@'+followerDomain followingHandle=followingNickname+'@'+followingDomain
if followerPort: if followingPort:
if followerPort!=80 and followerPort!=443: if followingPort!=80 and followingPort!=443:
if ':' not in followerHandle: if ':' not in followingHandle:
followerHandle+=':'+str(followerPort) followingHandle+=':'+str(followingPort)
if followerHandle in open(followersFile).read(): if followingHandle in open(followingFile).read():
return True return True
return False return False