The Battle for Wesnoth
1.19.3+dev
server
common
resultsets
ban_check.cpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2020 - 2024
3
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
15
#ifdef HAVE_MYSQLPP
16
17
#include <ctime>
18
19
#include "
server/common/resultsets/ban_check.hpp
"
20
#include "
server/common/user_handler.hpp
"
21
22
ban_check::ban_check
()
23
{
24
ban_type
= user_handler::BAN_TYPE::BAN_NONE;
25
ban_duration
= 0;
26
user_id
= 0;
27
email
=
""
;
28
}
29
30
void
ban_check::read
(mariadb::result_set_ref rslt)
31
{
32
if
(rslt->next())
33
{
34
ban_type
= rslt->get_signed32(
"ban_type"
);
35
ban_duration
= rslt->get_signed32(
"ban_end"
) != 0 ? rslt->get_signed32(
"ban_end"
) - std::time(
nullptr
) : 0;
36
user_id
= rslt->get_signed32(
"ban_userid"
);
37
email
= rslt->get_string(
"ban_email"
);
38
}
39
}
40
41
long
ban_check::get_ban_type
()
42
{
43
return
ban_type
;
44
}
45
46
int
ban_check::get_ban_duration
()
47
{
48
return
ban_duration
;
49
}
50
51
int
ban_check::get_user_id
()
52
{
53
return
user_id
;
54
}
55
56
std::string
ban_check::get_email
()
57
{
58
return
email
;
59
}
60
61
#endif
//HAVE_MYSQLPP
ban_check.hpp
ban_check::get_ban_duration
int get_ban_duration()
ban_check::get_email
std::string get_email()
ban_check::get_ban_type
long get_ban_type()
ban_check::email
std::string email
Definition:
ban_check.hpp:35
ban_check::ban_duration
int ban_duration
Definition:
ban_check.hpp:33
ban_check::read
void read(mariadb::result_set_ref rslt)
ban_check::ban_check
ban_check()
ban_check::get_user_id
int get_user_id()
ban_check::user_id
int user_id
Definition:
ban_check.hpp:34
ban_check::ban_type
long ban_type
Definition:
ban_check.hpp:32
user_handler.hpp
Generated by
1.9.1