Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Enno Rehling 2019-02-02 21:19:56 +01:00
commit 4bb2b5529d
3 changed files with 36 additions and 2 deletions

32
process/getfaction.py Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env python
import sys, re
from epasswd import EPasswd
if len(sys.argv)<3:
sys.exit(-2)
filename=sys.argv[1]
myfaction=sys.argv[2]
quiet=len(sys.argv)<=3
def log(str):
if not quiet:
print(str)
pw_data = EPasswd()
try:
pw_data.load_database(filename)
log("loaded from db " + filename)
except:
pw_data.load_file(filename)
log("loaded from file " + filename)
if pw_data.fac_exists(myfaction):
print(pw_data.get_email(myfaction))
log("faction found: " + myfaction)
sys.exit(0)
else:
log("faction missing: " + myfaction)
sys.exit(-1)

View file

@ -1 +1,2 @@
#!/bin/sh
grep -hiw ERESSEA orders.dir/turn-* | cut -d\ -f2 | sort -u

View file

@ -30,11 +30,12 @@ LOCKFILE="$ERESSEA/.report.lock"
echo "$(date):report:$GAME:$EMAIL:$FACTION:$PASSWD" >> "$ERESSEA/request.log"
cd "$ERESSEA" || exit
BIN="$ERESSEA/server/bin"
PWFILE="game-$GAME/eressea.db"
if [ ! -e "$PWFILE" ]; then
PWFILE="game-$GAME/passwd"
fi
checkpasswd.py "$PWFILE" "$FACTION" "$PASSWD" || reply "Das Passwort fuer die Partei $FACTION ist ungueltig"
"$BIN/checkpasswd.py" "$PWFILE" "$FACTION" "$PASSWD" || reply "Das Passwort fuer die Partei $FACTION ist ungueltig"
cd "$ERESSEA/game-$GAME/reports" || exit
if [ ! -e "${FACTION}.sh" ]; then
@ -45,7 +46,7 @@ fi
bash "${FACTION}.sh" "$EMAIL" || reply "Unbekannte Partei $FACTION"
OWNER=$(getfaction.py "$PWFILE" "$FACTION")
OWNER=$("$BIN/getfaction.py" "$PWFILE" "$FACTION")
if [ ! -z "$OWNER" ]; then
echo "Der Report Deiner Partei wurde an ${EMAIL} gesandt." \
| mutt -s "Reportnachforderung Partei ${FACTION}" "$OWNER"