forked from github/server
fix use of new database for sendreport et al
This commit is contained in:
parent
3327e996e5
commit
ef3ccc8d10
|
@ -25,6 +25,7 @@ ipch/
|
|||
*.user
|
||||
|
||||
*~
|
||||
*.pyc
|
||||
*.bak
|
||||
bin/
|
||||
build*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
install(PROGRAMS create-orders backup-eressea run-turn send-zip-report
|
||||
send-bz2-report compress.py compress.sh epasswd.py orders-process
|
||||
process-orders.py accept-orders.py
|
||||
checkpasswd.py sendreport.sh sendreports.sh orders-accept DESTINATION bin)
|
||||
process-orders.py accept-orders.py getemail.py checkpasswd.py
|
||||
sendreport.sh sendreports.sh orders-accept DESTINATION bin)
|
||||
|
||||
install(DIRECTORY cron/ DESTINATION bin USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING PATTERN "*.cron")
|
||||
|
|
|
@ -35,7 +35,7 @@ class EPasswd:
|
|||
def __init__(self):
|
||||
self.data = {}
|
||||
|
||||
def set_data(no, email, passwd):
|
||||
def set_data(self, no, email, passwd):
|
||||
lc_id = lower(no)
|
||||
self.data[lc_id] = {}
|
||||
self.data[lc_id]["id"] = no
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/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]
|
||||
|
||||
pw_data = EPasswd()
|
||||
try:
|
||||
pw_data.load_database(filename)
|
||||
except:
|
||||
pw_data.load_file(filename)
|
||||
|
||||
if pw_data.fac_exists(myfaction):
|
||||
email = pw_data.get_email(myfaction)
|
||||
print(email)
|
||||
sys.exit(0)
|
||||
sys.exit(-1)
|
|
@ -45,12 +45,8 @@ fi
|
|||
|
||||
bash "${FACTION}.sh" "$EMAIL" || reply "Unbekannte Partei $FACTION"
|
||||
|
||||
if [ -e "$ERESSEA/game-$GAME/eressea.db" ]; then
|
||||
SQL="select email from faction f left join faction_data fd on fd.faction_id=f.id where f.game_id=$GAME AND fd.code='$FACTION' and fd.turn=(select max(turn) from faction_data fx where fx.faction_id=f.id)"
|
||||
OWNER=$(sqlite3 "$ERESSEA/game-$GAME/eressea.db" "$SQL")
|
||||
if [ ! -z "$OWNER" ]; then
|
||||
echo "Der Report Deiner Partei wurde an ${EMAIL} gesandt." \
|
||||
| mutt -s "Reportnachforderung Partei ${FACTION}" "$OWNER"
|
||||
fi
|
||||
OWNER=$(getfaction.py "$PWFILE" "$FACTION")
|
||||
if [ ! -z "$OWNER" ]; then
|
||||
echo "Der Report Deiner Partei wurde an ${EMAIL} gesandt." \
|
||||
| mutt -s "Reportnachforderung Partei ${FACTION}" "$OWNER"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue