mirror of https://gitlab.com/bashrc2/epicyon
Remove XMPP address if invalid
parent
dd8650b717
commit
d203262084
15
xmpp.py
15
xmpp.py
|
@ -36,6 +36,14 @@ def getXmppAddress(actorJson: {}) -> str:
|
||||||
def setXmppAddress(actorJson: {}, xmppAddress: str) -> None:
|
def setXmppAddress(actorJson: {}, xmppAddress: str) -> None:
|
||||||
"""Sets an xmpp address for the given actor
|
"""Sets an xmpp address for the given actor
|
||||||
"""
|
"""
|
||||||
|
notXmppAddress = False
|
||||||
|
if '@' not in xmppAddress:
|
||||||
|
notXmppAddress = True
|
||||||
|
if '.' not in xmppAddress:
|
||||||
|
notXmppAddress = True
|
||||||
|
if '"' in xmppAddress:
|
||||||
|
notXmppAddress = True
|
||||||
|
|
||||||
if not actorJson.get('attachment'):
|
if not actorJson.get('attachment'):
|
||||||
actorJson['attachment'] = []
|
actorJson['attachment'] = []
|
||||||
|
|
||||||
|
@ -53,12 +61,7 @@ def setXmppAddress(actorJson: {}, xmppAddress: str) -> None:
|
||||||
break
|
break
|
||||||
if propertyFound:
|
if propertyFound:
|
||||||
actorJson['attachment'].remove(propertyFound)
|
actorJson['attachment'].remove(propertyFound)
|
||||||
|
if notXmppAddress:
|
||||||
if '@' not in xmppAddress:
|
|
||||||
return
|
|
||||||
if '.' not in xmppAddress:
|
|
||||||
return
|
|
||||||
if '"' in xmppAddress:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for propertyValue in actorJson['attachment']:
|
for propertyValue in actorJson['attachment']:
|
||||||
|
|
Loading…
Reference in New Issue