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