From 021048950f380d8b0de87d5d449708228be0b956 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 19 Aug 2019 11:43:52 +0100 Subject: [PATCH] Tidying --- content.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/content.py b/content.py index d25a0bd15..66f387cc0 100644 --- a/content.py +++ b/content.py @@ -120,7 +120,7 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r return True return False possibleNickname=possibleHandle.split('@')[0] - possibleDomain=possibleHandle.split('@')[1] + possibleDomain=possibleHandle.split('@')[1].strip('\n') for follow in following: if follow.replace('\n','')==possibleHandle: recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname @@ -130,14 +130,12 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r return True # @nick@domain if '@' in possibleHandle: - replaceDomain=possibleHandle.split('@')[1] - if not (replaceDomain=='localhost' or '.' in replaceDomain): - return False - possibleNickname=possibleHandle.split('@')[0] - recipientActor=httpPrefix+"://"+replaceDomain+"/users/"+possibleNickname + if not (possibleDomain=='localhost' or '.' in possibleDomain): + return False + recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname if recipientActor not in recipients: recipients.append(recipientActor) - replaceMentions[wordStr]="@"+possibleNickname+"" + replaceMentions[wordStr]="@"+possibleNickname+"" return True return False