SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
AuthDBSyncEvents.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 
10 #include "Servers/InternalEvents.h"
11 
12 #include <QDateTime>
13 namespace SEGSEvents
14 {
15 
16 enum AuthDBEventTypes : uint32_t
17 {
18  evRetrieveAccountRequest = Internal_EventTypes::ID_LAST_Internal_EventTypes,
24 };
25 
26 
28 {
29  QString username;
30  QString password;
32  template <class Archive>
33  void serialize( Archive & ar )
34  {
35  ar( username,password,access_level );
36  }
37 };
38 // [[ev_def:macro]]
39 ONE_WAY_MESSAGE(AuthDBEventTypes,CreateAccount)
40 
42 {
43  QString message;
44  template <class Archive>
45  void serialize( Archive & ar )
46  {
47  ar( message );
48  }
49 };
50 // [[ev_def:macro]]
52 
54 {
55  static constexpr uint64_t INVALID_ACCOUNT_ID = 0;
56 
57  QString m_login;
58  QDateTime m_creation_date;
60  uint8_t m_access_level;
61 
62  void mark_as_missing() { m_acc_server_acc_id = INVALID_ACCOUNT_ID; }
63  bool valid() const { return m_acc_server_acc_id != INVALID_ACCOUNT_ID; }
64  bool isBlocked() const { return m_access_level == INVALID_ACCOUNT_ID; }
65 
66  template <class Archive>
67  void serialize( Archive & ar )
68  {
69  ar( m_login,m_creation_date,m_acc_server_acc_id,m_access_level );
70  }
71 };
72 
74 {
75  QString m_login;
76  QString m_password;
77  uint32_t m_id; // if this is 0, the lookup will be done by login, otherwise by id
78  template <class Archive>
79  void serialize( Archive & ar )
80  {
81  ar( m_login,m_password,m_id );
82  }
83 };
84 // [[ev_def:macro]]
85 TWO_WAY_MESSAGE(AuthDBEventTypes,RetrieveAccount)
86 
88 {
89  QString username;
90  QString password;
91  template <class Archive>
92  void serialize( Archive & ar )
93  {
94  ar( username,password );
95  }
96 };
97 
99 {
101  template <class Archive>
102  void serialize( Archive & ar )
103  {
104  ar( m_valid_password );
105  }
106 };
107 // [[ev_def:macro]]
108 TWO_WAY_MESSAGE(AuthDBEventTypes,ValidatePassword)
109 
110 } // end of SEGSSEvents namespace
int access_level
Definition: AuthDBSyncEvents.h:31
QString username
Definition: AuthDBSyncEvents.h:29
QString message
Definition: AuthDBSyncEvents.h:43
Definition: AuthDBSyncEvents.h:53
QDateTime m_creation_date
Definition: AuthDBSyncEvents.h:58
QString m_login
Definition: AuthDBSyncEvents.h:57
Definition: AuthDBSyncEvents.h:23
uint8_t m_access_level
Definition: AuthDBSyncEvents.h:60
void serialize(Archive &ar)
Definition: AuthDBSyncEvents.h:45
Definition: LinkLevelEvent.h:13
QString m_login
Definition: AuthDBSyncEvents.h:75
void serialize(Archive &ar)
Definition: AuthDBSyncEvents.h:33
void mark_as_missing()
Definition: AuthDBSyncEvents.h:62
Definition: AuthDBSyncEvents.h:19
Definition: AuthDBSyncEvents.h:18
QString m_password
Definition: AuthDBSyncEvents.h:76
Definition: AuthDBSyncEvents.h:41
QString password
Definition: AuthDBSyncEvents.h:90
void serialize(Archive &ar)
Definition: AuthDBSyncEvents.h:102
Definition: AuthDBSyncEvents.h:21
Definition: AuthDBSyncEvents.h:27
AuthDBEventTypes
Definition: AuthDBSyncEvents.h:16
#define TWO_WAY_MESSAGE(enum_name, name)
A message with Request having additional data.
Definition: InternalEvents.h:66
QString password
Definition: AuthDBSyncEvents.h:30
void serialize(Archive &ar)
Definition: AuthDBSyncEvents.h:67
Definition: AuthDBSyncEvents.h:20
Definition: AuthDBSyncEvents.h:73
Definition: AuthDBSyncEvents.h:22
bool isBlocked() const
Definition: AuthDBSyncEvents.h:64
Definition: AuthDBSyncEvents.h:87
void serialize(Archive &ar)
Definition: AuthDBSyncEvents.h:92
bool m_valid_password
Definition: AuthDBSyncEvents.h:100
#define ONE_WAY_MESSAGE(enum_name, name)
Definition: InternalEvents.h:54
uint32_t m_acc_server_acc_id
Definition: AuthDBSyncEvents.h:59
Definition: AuthDBSyncEvents.h:98
bool valid() const
Definition: AuthDBSyncEvents.h:63
QString username
Definition: AuthDBSyncEvents.h:89
uint32_t m_id
Definition: AuthDBSyncEvents.h:77
void serialize(Archive &ar)
Definition: AuthDBSyncEvents.h:79