From 470f32382a24211a8a69b5a65147d4310086b3f7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 19 Aug 2019 11:05:50 +0100 Subject: [PATCH] Detecting mentions for @nick@domain --- content.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/content.py b/content.py index b8e0a67d8..7e1a46d1e 100644 --- a/content.py +++ b/content.py @@ -105,6 +105,7 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r if len(wordStr)<2: return False possibleHandle=wordStr[1:] + # @nick if '@' not in possibleHandle: # fall back to a best effort match against the following list # if no domain was specified. eg. @nick @@ -116,7 +117,6 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r if recipientActor not in recipients: recipients.append(recipientActor) replaceMentions[wordStr]="@"+possibleNickname+"" - replaceFound=True return True return False possibleNickname=possibleHandle.split('@')[0] @@ -128,6 +128,15 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r recipients.append(recipientActor) replaceMentions[wordStr]="@"+possibleNickname+"" return True + # @nick@domain + if '@' in possibleHandle: + possibleNickname=possibleHandle.split('@')[0] + replaceDomain=possibleHandle.split('@')[1] + recipientActor=httpPrefix+"://"+replaceDomain+"/users/"+possibleNickname + if recipientActor not in recipients: + recipients.append(recipientActor) + replaceMentions[wordStr]="@"+possibleNickname+"" + return True return False def addHtmlTags(baseDir: str,httpPrefix: str, \