main2
Bob Mottram 2019-10-04 10:58:02 +01:00
parent 1043a857aa
commit 00c8d96099
1 changed files with 21 additions and 35 deletions

View File

@ -1330,43 +1330,29 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
if os.path.isfile(destinationFilename): if os.path.isfile(destinationFilename):
return True return True
if messageJson.get('postNickname'): if messageJson.get('postNickname'):
if validPostContent(messageJson['post'],maxMentions): postJson=messageJson['post']
if isDM(messageJson['post']):
dmNotify(baseDir,handle)
domainFull=domain
if port:
if ':' not in domain:
if port!=80 and port!=443:
domainFull=domainFull+':'+str(port)
actor=httpPrefix+'://'+domainFull+'/users/'+handle.split('@')[0]
if isReply(messageJson['post'],actor):
replyNotify(baseDir,handle)
obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,messageJson['post'],debug)
try:
with open(destinationFilename, 'w+') as fp:
commentjson.dump(messageJson['post'], fp, indent=4, sort_keys=False)
except Exception as e:
print(e)
else: else:
if validPostContent(messageJson,maxMentions): postJson=messageJson
if isDM(messageJson):
dmNotify(baseDir,handle) if validPostContent(postJson,maxMentions):
domainFull=domain if isDM(postJson):
if port: dmNotify(baseDir,handle)
if ':' not in domain: domainFull=domain
if port!=80 and port!=443: if port:
domainFull=domainFull+':'+str(port) if ':' not in domain:
actor=httpPrefix+'://'+domainFull+'/users/'+handle.split('@')[0] if port!=80 and port!=443:
if isReply(messageJson,actor): domainFull=domainFull+':'+str(port)
replyNotify(baseDir,handle) actor=httpPrefix+'://'+domainFull+'/users/'+handle.split('@')[0]
obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,messageJson,debug) if isReply(postJson,actor):
try: replyNotify(baseDir,handle)
with open(destinationFilename, 'w+') as fp: obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,postJson,debug)
commentjson.dump(messageJson, fp, indent=4, sort_keys=False) try:
except Exception as e: with open(destinationFilename, 'w+') as fp:
print(e) commentjson.dump(postJson, fp, indent=4, sort_keys=False)
except Exception as e:
print(e)
if not os.path.isfile(destinationFilename): if not os.path.isfile(destinationFilename):
return False return False