forked from indymedia/epicyon
Get actor from status
parent
a94665d9a0
commit
e986d30367
68
inbox.py
68
inbox.py
|
@ -984,6 +984,8 @@ def receiveAnnounce(session,handle: str,baseDir: str, \
|
||||||
print('DEBUG: Downloading announce post '+messageJson['object'])
|
print('DEBUG: Downloading announce post '+messageJson['object'])
|
||||||
postJsonObject=downloadAnnounce(session,baseDir,httpPrefix,nickname,domain,messageJson,__version__)
|
postJsonObject=downloadAnnounce(session,baseDir,httpPrefix,nickname,domain,messageJson,__version__)
|
||||||
if postJsonObject:
|
if postJsonObject:
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Announce post downloaded for '+messageJson['object'])
|
||||||
# Try to obtain the actor for this person
|
# Try to obtain the actor for this person
|
||||||
# so that their avatar can be shown
|
# so that their avatar can be shown
|
||||||
lookupActor=None
|
lookupActor=None
|
||||||
|
@ -992,21 +994,27 @@ def receiveAnnounce(session,handle: str,baseDir: str, \
|
||||||
if postJsonObject['object'].get('attributedTo'):
|
if postJsonObject['object'].get('attributedTo'):
|
||||||
lookupActor=postJsonObject['object']['attributedTo']
|
lookupActor=postJsonObject['object']['attributedTo']
|
||||||
if lookupActor:
|
if lookupActor:
|
||||||
if debug:
|
if '/users/' in lookupActor:
|
||||||
print('DEBUG: Obtaining actor for announce post '+lookupActor)
|
if '/statuses/' in lookupActor:
|
||||||
for tries in range(6):
|
lookupActor=lookupActor.split('/statuses/')[0]
|
||||||
pubKey= \
|
elif '/profile/' in lookupActor:
|
||||||
getPersonPubKey(baseDir,session,lookupActor, \
|
lookupActor=lookupActor.split('/profile/')[0]
|
||||||
personCache,debug, \
|
|
||||||
__version__,httpPrefix,domain)
|
|
||||||
if pubKey:
|
|
||||||
print('DEBUG: public key obtained for announce: '+lookupActor)
|
|
||||||
break
|
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: Retry '+str(tries+1)+ \
|
print('DEBUG: Obtaining actor for announce post '+lookupActor)
|
||||||
' obtaining actor for '+lookupActor)
|
for tries in range(6):
|
||||||
time.sleep(5)
|
pubKey= \
|
||||||
|
getPersonPubKey(baseDir,session,lookupActor, \
|
||||||
|
personCache,debug, \
|
||||||
|
__version__,httpPrefix,domain)
|
||||||
|
if pubKey:
|
||||||
|
print('DEBUG: public key obtained for announce: '+lookupActor)
|
||||||
|
break
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Retry '+str(tries+1)+ \
|
||||||
|
' obtaining actor for '+lookupActor)
|
||||||
|
time.sleep(5)
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: announced/repeated post arrived in inbox')
|
print('DEBUG: announced/repeated post arrived in inbox')
|
||||||
return True
|
return True
|
||||||
|
@ -1189,21 +1197,27 @@ def obtainAvatarForReplyPost(session,baseDir: str,httpPrefix: str,domain: str,pe
|
||||||
|
|
||||||
lookupActor=postJsonObject['object']['inReplyTo']
|
lookupActor=postJsonObject['object']['inReplyTo']
|
||||||
if lookupActor:
|
if lookupActor:
|
||||||
if debug:
|
if '/users/' in lookupActor:
|
||||||
print('DEBUG: Obtaining actor for reply post '+lookupActor)
|
if '/statuses/' in lookupActor:
|
||||||
for tries in range(6):
|
lookupActor=lookupActor.split('/statuses/')[0]
|
||||||
pubKey= \
|
elif '/profile/' in lookupActor:
|
||||||
getPersonPubKey(baseDir,session,lookupActor, \
|
lookupActor=lookupActor.split('/profile/')[0]
|
||||||
personCache,debug, \
|
|
||||||
__version__,httpPrefix,domain)
|
|
||||||
if pubKey:
|
|
||||||
print('DEBUG: public key obtained for reply: '+lookupActor)
|
|
||||||
break
|
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: Retry '+str(tries+1)+ \
|
print('DEBUG: Obtaining actor for reply post '+lookupActor)
|
||||||
' obtaining actor for '+lookupActor)
|
for tries in range(6):
|
||||||
time.sleep(5)
|
pubKey= \
|
||||||
|
getPersonPubKey(baseDir,session,lookupActor, \
|
||||||
|
personCache,debug, \
|
||||||
|
__version__,httpPrefix,domain)
|
||||||
|
if pubKey:
|
||||||
|
print('DEBUG: public key obtained for reply: '+lookupActor)
|
||||||
|
break
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Retry '+str(tries+1)+ \
|
||||||
|
' obtaining actor for '+lookupActor)
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
|
def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
|
||||||
baseDir: str,httpPrefix: str,sendThreads: [], \
|
baseDir: str,httpPrefix: str,sendThreads: [], \
|
||||||
|
|
Loading…
Reference in New Issue