From f5d1bfeb47cfccb5aed1659a1cfa438e69825f34 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 19 Aug 2019 10:11:25 +0100 Subject: [PATCH] Debug for mentions extraction --- daemon.py | 4 +++- posts.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index e519bd9ea..e070ac6fc 100644 --- a/daemon.py +++ b/daemon.py @@ -1849,7 +1849,9 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ fields['message'],True,False,False, \ filename,fields['imageDescription'],True, \ - fields['replyTo'],fields['replyTo'],fields['subject']) + fields['replyTo'],fields['replyTo'], \ + fields['subject'], \ + self.server.debug) if messageJson: self.postToNickname=nickname if self.server.debug: diff --git a/posts.py b/posts.py index 6ad8788cf..090cb98e9 100644 --- a/posts.py +++ b/posts.py @@ -761,7 +761,8 @@ def createFollowersOnlyPost(baseDir: str, attachImageFilename,imageDescription,useBlurhash, \ False,inReplyTo, inReplyToAtomUri, subject) -def getMentionedPeople(baseDir: str,httpPrefix: str,content: str,domain: str) -> []: +def getMentionedPeople(baseDir: str,httpPrefix: str, \ + content: str,domain: str,debug: bool) -> []: """Extracts a list of mentioned actors from the given message content """ if '@' not in content: @@ -771,6 +772,8 @@ def getMentionedPeople(baseDir: str,httpPrefix: str,content: str,domain: str) -> for wrd in words: if wrd.startswith('@'): handle=wrd[1:] + if debug: + print('DEBUG: mentioned handle '+handle) if '@' not in handle: handle=handle+'@'+domain if not os.path.isdir(baseDir+'/accounts/'+handle): @@ -791,10 +794,12 @@ def createDirectMessagePost(baseDir: str, content: str, followersOnly: bool, saveToFile: bool, clientToServer: bool,\ attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ - inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}: + inReplyTo=None, inReplyToAtomUri=None, subject=None,debug=False) -> {}: """Direct Message post """ - mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain) + mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain,debug) + if debug: + print('mentionedPeople: '+str(mentionedPeople)) postTo=None postCc=None if not mentionedPeople: