mirror of https://gitlab.com/bashrc2/epicyon
Separate follow accept function
parent
f132115432
commit
c49eee530d
|
@ -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')
|
||||
|
|
24
follow.py
24
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 '+ \
|
||||
|
|
Loading…
Reference in New Issue