27 from time
import localtime, strftime, strptime, time
30 from CFDataFile
import CFDataFile, CFData
32 TimeFormat =
"%a, %d %b %Y %H:%M:%S %Z"
37 logheader = [
'Born',
'IP',
'Last_Login_Date',
'Login_Count',
'Kick_Count'
38 ,
'Last_Kick_Date',
'Muzzle_Count',
'Last_Muzzle_Date']
42 date = strftime(TimeFormat, localtime(time()))
46 ,
'Last_Login_Date':date
49 ,
'Last_Kick_Date':
'never'
51 ,
'Last_Muzzle_Date':
'never'}
52 self.
log.put_record(record)
55 self.
log.remove_record(name)
58 date = strftime(TimeFormat, localtime(time()))
59 record = self.
log.get_record(name)
61 record[
'Last_Login_Date']=date
62 record[
'Login_Count']=
int(record[
'Login_Count'])+1
63 self.
log.put_record(record)
66 record = self.
info(name)
68 r = record[
'Last_Login_Date']
69 return strptime(r, TimeFormat)
73 BackupTimeFormat =
"%a, %d %b %Y %H:%M:%S"
75 time_no_tz =
" ".join(r.split(
" ")[:-1])
76 return strptime(time_no_tz, BackupTimeFormat)
77 except Exception
as e:
78 Crossfire.Log(Crossfire.LogDebug,
"CFLog: Failed to parse time: " +
str(e))
80 except Exception
as e:
81 Crossfire.Log(Crossfire.LogDebug,
"CFLog: Failed to parse time: " +
str(e))
85 date = strftime(TimeFormat, localtime(time()))
86 record = self.
log.get_record(name)
87 record[
'Kick_Count']=
int(record[
'Kick_Count'])+1
88 record[
'Last_Kick_Date']=date
89 self.
log.put_record(record)
92 date = strftime(TimeFormat, localtime(time()))
93 record = self.
log.get_record(name)
94 record[
'Muzzle_Count']=
int(record[
'Muzzle_Count'])+1
95 record[
'Last_Muzzle_Date']=date
96 self.
log.put_record(record)
101 record = self.
log.get_record(name)