feat: Make the same domain policy configurable

This commit is contained in:
PapaTutuWawa 2020-09-17 15:50:21 +02:00
parent c40390dd5c
commit 50983cae44
2 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ BIWAPP = y # Warnmeldungen
Recipients = some.user@xmpp.server,other@xmpp.server # Empfänger
Timeout=630 # Zeit in Sekunden nach welcher nach neuen Warnungen geschaut wird
DataDir = /etc/janine/data # Verzeichnis für persistente Daten
SameDomain = True # Soll der Bot nur auf Nachrichten von der selben Domain antworten
[Bot]
Avatar = /etc/janine/avatar.png # Bot Avatar (Optional)

View File

@ -135,8 +135,7 @@ class WarningBot:
if not msg.body:
return False
# TODO: Make this configurable
if msg.from_.domain != self._jid.domain:
if msg.from_.domain != self._jid.domain and self._same_domain:
return False
return True
@ -317,6 +316,7 @@ class WarningBot:
self._data_dir = config['General'].get('DataDir', '/etc/janine')
self._recipients = config['General']['Recipients'].split(',')
self._refresh_timeout = int(config['General']['Timeout'])
self._same_domain = config['General'].get('SameDomain', 'True') == 'True'
# Persistent data
# Subscribed clients