bans: minor changes

This commit is contained in:
Master Jumblespeed 2015-08-15 02:40:35 -04:00
parent 6a05d84b04
commit 3c85a9e886

View file

@ -1,6 +1,6 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.uberdog.ClientServicesManagerUD import executeHttpRequest from toontown.uberdog.ClientServicesManagerUD import executeHttpRequest
import datetime import time
from direct.fsm.FSM import FSM from direct.fsm.FSM import FSM
from direct.distributed.PyDatagram import PyDatagram from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.MsgTypes import * from direct.distributed.MsgTypes import *
@ -22,9 +22,9 @@ class BanFSM(FSM):
self.accountId = None self.accountId = None
self.avName = None self.avName = None
def performBan(self, bannedUntil): def performBan(self, duration):
executeHttpRequest('accounts/ban/', Id=self.accountId, Release=bannedUntil, executeHttpRequest('ban', username=self.accountId, start=int(time.time()),
Reason=self.comment) duration=duration, reason=self.comment, bannedby='todo')
def ejectPlayer(self): def ejectPlayer(self):
av = self.air.doId2do.get(self.avId) av = self.air.doId2do.get(self.avId)
@ -49,15 +49,9 @@ class BanFSM(FSM):
if not self.accountId: if not self.accountId:
return return
date = datetime.date.today()
if simbase.config.GetBool('want-bans', True): if simbase.config.GetBool('want-bans', True):
if self.duration == 0: self.performBan(self.duration)
bannedUntil = "0000-00-00" # Terminated.
else:
bannedUntil = date + datetime.timedelta(days=self.duration)
self.duration = None self.duration = None
self.performBan(bannedUntil)
def getAvatarDetails(self): def getAvatarDetails(self):
av = self.air.doId2do.get(self.avId) av = self.air.doId2do.get(self.avId)