-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.h
49 lines (38 loc) · 1.28 KB
/
Config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "essentials.h"
#include "IniFile.h"
#include "UserAccount.h"
class Config
{
private:
bool m_loaded;
string m_file;
int m_nextaccountid;
public:
map<int, UserAccount> UserAccounts;
public:
Config(const char* filename);
~Config();
bool Load();
bool Save();
private:
bool GetConfigFile(IniFile& ini) const;
bool SaveConfigFile(IniFile& ini);
void LoadAccounts(IniFile& cfg);
void LoadContacts(UserAccount& acc, int idx, IniFile& cfg);
void LoadBlocks(UserAccount& acc, int idx, IniFile& cfg);
void LoadMessages(UserAccount& acc, int idx, IniFile& cfg);
void LoadFavoriteMessages(UserAccount& acc, int idx, IniFile& cfg);
void WriteAccounts(IniFile& cfg);
void WriteContacts(UserAccount& acc, int idx, IniFile& cfg);
void WriteBlocks(UserAccount& acc, int idx, IniFile& cfg);
void WriteMessages(UserAccount& acc, int idx, IniFile& cfg);
void WriteFavoriteMessages(UserAccount& acc, int idx, IniFile& cfg);
public:
void SetSentMsgsSeen(int Received_ID, vector<pair<UserMessage, int>> msgs, bool seen);
UserAccount* AccountExists(string username);
UserAccount* AccountExists(string username, const string& pw);
UserAccount* GetUserAccount(int id);
int PopNextAccountID();
static void AppendMessage(UserAccount& acc, int userid, UserMessage& msg, bool sent);
};