main2
Bob Mottram 2019-10-04 11:00:57 +01:00
parent 00c8d96099
commit cf854d0039
1 changed files with 10 additions and 0 deletions

View File

@ -1337,23 +1337,33 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
postJson=messageJson postJson=messageJson
if validPostContent(postJson,maxMentions): if validPostContent(postJson,maxMentions):
# create a DM notification file if needed
if isDM(postJson): if isDM(postJson):
dmNotify(baseDir,handle) dmNotify(baseDir,handle)
# get the actor being replied to
domainFull=domain domainFull=domain
if port: if port:
if ':' not in domain: if ':' not in domain:
if port!=80 and port!=443: if port!=80 and port!=443:
domainFull=domainFull+':'+str(port) domainFull=domainFull+':'+str(port)
actor=httpPrefix+'://'+domainFull+'/users/'+handle.split('@')[0] actor=httpPrefix+'://'+domainFull+'/users/'+handle.split('@')[0]
# create a reply notification file if needed
if isReply(postJson,actor): if isReply(postJson,actor):
replyNotify(baseDir,handle) replyNotify(baseDir,handle)
# get the avatar for a reply/announce
obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,postJson,debug) obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,postJson,debug)
# save the post to file
try: try:
with open(destinationFilename, 'w+') as fp: with open(destinationFilename, 'w+') as fp:
commentjson.dump(postJson, fp, indent=4, sort_keys=False) commentjson.dump(postJson, fp, indent=4, sort_keys=False)
except Exception as e: except Exception as e:
print(e) print(e)
# if the post wasn't saved
if not os.path.isfile(destinationFilename): if not os.path.isfile(destinationFilename):
return False return False