diff --git a/acceptreject.py b/acceptreject.py index 93a373f0b..04a5f4779 100644 --- a/acceptreject.py +++ b/acceptreject.py @@ -74,6 +74,8 @@ def createReject(baseDir: str,federationList: [], \ def acceptFollow(baseDir: str,domain : str,messageJson: {}, \ federationList: [],debug : bool) -> None: + """Receiving a follow Accept activity + """ if not messageJson.get('object'): return if not messageJson['object'].get('type'): @@ -186,6 +188,7 @@ def receiveAcceptReject(session,baseDir: str, \ print('DEBUG: '+messageJson['type']+' does not contain a nickname') return False handle=nickname.lower()+'@'+domain.lower() + # receive follow accept acceptFollow(baseDir,domain,messageJson,federationList,debug) if debug: print('DEBUG: Uh, '+messageJson['type']+', I guess') diff --git a/follow.py b/follow.py index 06bec9a4a..681abb76f 100644 --- a/follow.py +++ b/follow.py @@ -353,15 +353,33 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \ fp.write(approveHandle+'\n') return True return False + followedAccountAccepts(session,baseDir,httpPrefix, \ + nicknameToFollow,domainToFollow,port, \ + nickname,domain,fromPort, \ + messageJson['actor'],federationList, + messageJson,acceptedCaps, \ + sendThreads,postLog, \ + cachedWebfingers,personCache, \ + debug) +def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \ + nicknameToFollow: str,domainToFollow: str,port: int, \ + nickname: str,domain: str,fromPort: int, \ + personUrl: str,federationList: [], \ + followJson: {},acceptedCaps: [], \ + sendThreads: [],postLog: [], \ + cachedWebfingers: {},personCache: {}, \ + debug: bool): + """The person receiving a follow request accepts the new follower + and sends back an Accept activity + """ # send accept back if debug: - print('DEBUG: sending Accept for follow request which arrived at '+ \ + print('DEBUG: sending Accept activity for follow request which arrived at '+ \ nicknameToFollow+'@'+domainToFollow+' back to '+nickname+'@'+domain) - personUrl=messageJson['actor'] acceptJson=createAccept(baseDir,federationList, \ nicknameToFollow,domainToFollow,port, \ - personUrl,'',httpPrefix,messageJson,acceptedCaps) + personUrl,'',httpPrefix,followJson,acceptedCaps) if debug: pprint(acceptJson) print('DEBUG: sending follow Accept from '+ \