Browse Source

clang-format: switch tabs to spaces

I like tabs, but I have to admit that spaces make source code more
consistent, because every editor/viewer tends to render tabs differently :(
master
Alexey Sokolov 7 years ago
parent
commit
d185d6f22d
  1. 1
      .clang-format
  2. 128
      include/znc/Buffer.h
  3. 340
      include/znc/Chan.h
  4. 460
      include/znc/Client.h
  5. 274
      include/znc/Config.h
  6. 42
      include/znc/ExecSock.h
  7. 434
      include/znc/FileUtils.h
  8. 230
      include/znc/HTTPSock.h
  9. 534
      include/znc/IRCNetwork.h
  10. 278
      include/znc/IRCSock.h
  11. 110
      include/znc/Listener.h
  12. 30
      include/znc/MD5.h
  13. 310
      include/znc/Message.h
  14. 1652
      include/znc/Modules.h
  15. 68
      include/znc/Nick.h
  16. 58
      include/znc/Query.h
  17. 8
      include/znc/SHA256.h
  18. 26
      include/znc/Server.h
  19. 372
      include/znc/Socket.h
  20. 318
      include/znc/Template.h
  21. 122
      include/znc/Threads.h
  22. 444
      include/znc/User.h
  23. 332
      include/znc/Utils.h
  24. 214
      include/znc/WebModules.h
  25. 26
      include/znc/ZNCDebug.h
  26. 538
      include/znc/ZNCString.h
  27. 4
      include/znc/defines.h
  28. 180
      include/znc/main.h
  29. 446
      include/znc/znc.h
  30. 380
      modules/adminlog.cpp
  31. 704
      modules/alias.cpp
  32. 492
      modules/autoattach.cpp
  33. 398
      modules/autocycle.cpp
  34. 1180
      modules/autoop.cpp
  35. 136
      modules/autoreply.cpp
  36. 612
      modules/autovoice.cpp
  37. 12
      modules/awaynick.cpp
  38. 910
      modules/awaystore.cpp
  39. 72
      modules/block_motd.cpp
  40. 360
      modules/blockuser.cpp
  41. 858
      modules/bouncedcc.cpp
  42. 166
      modules/buffextras.cpp
  43. 150
      modules/cert.cpp
  44. 506
      modules/certauth.cpp
  45. 108
      modules/chansaver.cpp
  46. 246
      modules/clearbufferonmsg.cpp
  47. 246
      modules/clientnotify.cpp
  48. 3018
      modules/controlpanel.cpp
  49. 564
      modules/crypt.cpp
  50. 242
      modules/ctcpflood.cpp
  51. 388
      modules/cyrusauth.cpp
  52. 938
      modules/dcc.cpp
  53. 396
      modules/fail2ban.cpp
  54. 440
      modules/flooddetach.cpp
  55. 384
      modules/identfile.cpp
  56. 226
      modules/imapauth.cpp
  57. 326
      modules/keepnick.cpp
  58. 180
      modules/kickrejoin.cpp
  59. 230
      modules/lastseen.cpp
  60. 418
      modules/listsockets.cpp
  61. 666
      modules/log.cpp
  62. 12
      modules/missingmotd.cpp
  63. 560
      modules/modperl.cpp
  64. 326
      modules/modperl/module.h
  65. 96
      modules/modperl/pstring.h
  66. 862
      modules/modpython.cpp
  67. 470
      modules/modpython/module.h
  68. 28
      modules/modpython/ret.h
  69. 960
      modules/modtcl.cpp
  70. 172
      modules/modules_online.cpp
  71. 228
      modules/nickserv.cpp
  72. 400
      modules/notes.cpp
  73. 36
      modules/notify_connect.cpp
  74. 1376
      modules/partyline.cpp
  75. 316
      modules/perform.cpp
  76. 1274
      modules/q.cpp
  77. 26
      modules/raw.cpp
  78. 496
      modules/route_replies.cpp
  79. 518
      modules/sample.cpp
  80. 502
      modules/sasl.cpp
  81. 596
      modules/savebuff.cpp
  82. 750
      modules/schat.cpp
  83. 254
      modules/send_raw.cpp
  84. 188
      modules/shell.cpp
  85. 420
      modules/simple_away.cpp
  86. 424
      modules/stickychan.cpp
  87. 58
      modules/stripcontrols.cpp
  88. 1418
      modules/watch.cpp
  89. 3902
      modules/webadmin.cpp
  90. 180
      src/Buffer.cpp
  91. 1042
      src/Chan.cpp
  92. 2174
      src/Client.cpp
  93. 3672
      src/ClientCommand.cpp
  94. 290
      src/Config.cpp
  95. 788
      src/FileUtils.cpp
  96. 1060
      src/HTTPSock.cpp
  97. 2122
      src/IRCNetwork.cpp
  98. 2442
      src/IRCSock.cpp
  99. 216
      src/Listener.cpp
  100. 312
      src/MD5.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

1
.clang-format

@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
BasedOnStyle: Google
Standard: Cpp11
UseTab: ForIndentation
IndentWidth: 4
TabWidth: 4
AccessModifierOffset: -2

128
include/znc/Buffer.h

@ -29,86 +29,86 @@ class CClient; @@ -29,86 +29,86 @@ class CClient;
class CBufLine {
public:
CBufLine() : CBufLine("") {
throw 0;
} // shouldn't be called, but is needed for compilation
CBufLine(const CMessage& Format, const CString& sText = "");
/// @deprecated
CBufLine(const CString& sFormat, const CString& sText = "",
const timeval* ts = nullptr,
const MCString& mssTags = MCString::EmptyMap);
~CBufLine();
CMessage ToMessage(const CClient& Client, const MCString& mssParams) const;
/// @deprecated Use ToMessage() instead
CString GetLine(const CClient& Client, const MCString& mssParams) const;
/// @deprecated
void UpdateTime();
CBufLine() : CBufLine("") {
throw 0;
} // shouldn't be called, but is needed for compilation
CBufLine(const CMessage& Format, const CString& sText = "");
/// @deprecated
CBufLine(const CString& sFormat, const CString& sText = "",
const timeval* ts = nullptr,
const MCString& mssTags = MCString::EmptyMap);
~CBufLine();
CMessage ToMessage(const CClient& Client, const MCString& mssParams) const;
/// @deprecated Use ToMessage() instead
CString GetLine(const CClient& Client, const MCString& mssParams) const;
/// @deprecated
void UpdateTime();
bool Equals(const CMessage& Format) const {
return m_Message.Equals(Format);
}
bool Equals(const CMessage& Format) const {
return m_Message.Equals(Format);
}
// Setters
void SetFormat(const CString& sFormat) { m_Message.Parse(sFormat); }
void SetText(const CString& sText) { m_sText = sText; }
void SetTime(const timeval& ts) { m_Message.SetTime(ts); }
void SetTags(const MCString& mssTags) { m_Message.SetTags(mssTags); }
// !Setters
// Setters
void SetFormat(const CString& sFormat) { m_Message.Parse(sFormat); }
void SetText(const CString& sText) { m_sText = sText; }
void SetTime(const timeval& ts) { m_Message.SetTime(ts); }
void SetTags(const MCString& mssTags) { m_Message.SetTags(mssTags); }
// !Setters
// Getters
const CString& GetCommand() const { return m_Message.GetCommand(); }
CString GetFormat() const {
return m_Message.ToString(CMessage::ExcludeTags);
}
const CString& GetText() const { return m_sText; }
timeval GetTime() const { return m_Message.GetTime(); }
const MCString& GetTags() const { return m_Message.GetTags(); }
// !Getters
// Getters
const CString& GetCommand() const { return m_Message.GetCommand(); }
CString GetFormat() const {
return m_Message.ToString(CMessage::ExcludeTags);
}
const CString& GetText() const { return m_sText; }
timeval GetTime() const { return m_Message.GetTime(); }
const MCString& GetTags() const { return m_Message.GetTags(); }
// !Getters
private:
protected:
CMessage m_Message;
CString m_sText;
CMessage m_Message;
CString m_sText;
};
class CBuffer : private std::deque<CBufLine> {
public:
CBuffer(unsigned int uLineCount = 100);
~CBuffer();
CBuffer(unsigned int uLineCount = 100);
~CBuffer();
size_type AddLine(const CMessage& Format, const CString& sText = "");
size_type UpdateLine(const CString& sCommand, const CMessage& Format,
const CString& sText = "");
size_type UpdateExactLine(const CMessage& Format,
const CString& sText = "");
size_type AddLine(const CMessage& Format, const CString& sText = "");
size_type UpdateLine(const CString& sCommand, const CMessage& Format,
const CString& sText = "");
size_type UpdateExactLine(const CMessage& Format,
const CString& sText = "");
size_type AddLine(const CString& sFormat, const CString& sText = "",
const timeval* ts = nullptr,
const MCString& mssTags = MCString::EmptyMap);
/// Same as AddLine, but replaces a line whose format string starts with sMatch if there is one.
size_type UpdateLine(const CString& sMatch, const CString& sFormat,
const CString& sText = "");
/// Same as UpdateLine, but does nothing if this exact line already exists.
/// We need this because "/version" sends us the 005 raws again
size_type UpdateExactLine(const CString& sFormat,
const CString& sText = "");
const CBufLine& GetBufLine(unsigned int uIdx) const;
CString GetLine(size_type uIdx, const CClient& Client,
const MCString& msParams = MCString::EmptyMap) const;
size_type Size() const { return size(); }
bool IsEmpty() const { return empty(); }
void Clear() { clear(); }
size_type AddLine(const CString& sFormat, const CString& sText = "",
const timeval* ts = nullptr,
const MCString& mssTags = MCString::EmptyMap);
/// Same as AddLine, but replaces a line whose format string starts with sMatch if there is one.
size_type UpdateLine(const CString& sMatch, const CString& sFormat,
const CString& sText = "");
/// Same as UpdateLine, but does nothing if this exact line already exists.
/// We need this because "/version" sends us the 005 raws again
size_type UpdateExactLine(const CString& sFormat,
const CString& sText = "");
const CBufLine& GetBufLine(unsigned int uIdx) const;
CString GetLine(size_type uIdx, const CClient& Client,
const MCString& msParams = MCString::EmptyMap) const;
size_type Size() const { return size(); }
bool IsEmpty() const { return empty(); }
void Clear() { clear(); }
// Setters
bool SetLineCount(unsigned int u, bool bForce = false);
// !Setters
// Setters
bool SetLineCount(unsigned int u, bool bForce = false);
// !Setters
// Getters
unsigned int GetLineCount() const { return m_uLineCount; }
// !Getters
// Getters
unsigned int GetLineCount() const { return m_uLineCount; }
// !Getters
private:
protected:
unsigned int m_uLineCount;
unsigned int m_uLineCount;
};
#endif // !ZNC_BUFFER_H

340
include/znc/Chan.h

@ -33,178 +33,178 @@ class CFile; @@ -33,178 +33,178 @@ class CFile;
class CChan {
public:
typedef enum {
Voice = '+',
HalfOp = '%',
Op = '@',
Admin = '!',
Owner = '*'
} EUserPerms;
typedef enum {
M_Private = 'p',
M_Secret = 's',
M_Moderated = 'm',
M_InviteOnly = 'i',
M_NoMessages = 'n',
M_OpTopic = 't',
M_Limit = 'l',
M_Key = 'k',
M_Op = 'o',
M_Voice = 'v',
M_Ban = 'b',
M_Except = 'e'
} EModes;
CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig,
CConfig* pConfig = nullptr);
~CChan();
CChan(const CChan&) = delete;
CChan& operator=(const CChan&) = delete;
void Reset();
CConfig ToConfig() const;
void Clone(CChan& chan);
void Cycle() const;
void JoinUser(const CString& sKey = "");
void AttachUser(CClient* pClient = nullptr);
void DetachUser();
void OnWho(const CString& sNick, const CString& sIdent,
const CString& sHost);
// Modes
void SetModes(const CString& s);
void ModeChange(const CString& sModes, const CNick* OpNick = nullptr);
bool AddMode(unsigned char uMode, const CString& sArg);
bool RemMode(unsigned char uMode);
CString GetModeString() const;
CString GetModeArg(CString& sArgs) const;
CString GetModeForNames() const;
// !Modes
// Nicks
void ClearNicks();
const CNick* FindNick(const CString& sNick) const;
CNick* FindNick(const CString& sNick);
int AddNicks(const CString& sNicks);
bool AddNick(const CString& sNick);
bool RemNick(const CString& sNick);
bool ChangeNick(const CString& sOldNick, const CString& sNewNick);
// !Nicks
// Buffer
const CBuffer& GetBuffer() const { return m_Buffer; }
unsigned int GetBufferCount() const { return m_Buffer.GetLineCount(); }
bool SetBufferCount(unsigned int u, bool bForce = false) {
m_bHasBufferCountSet = true;
return m_Buffer.SetLineCount(u, bForce);
}
void InheritBufferCount(unsigned int u, bool bForce = false) {
if (!m_bHasBufferCountSet) m_Buffer.SetLineCount(u, bForce);
}
void ResetBufferCount();
size_t AddBuffer(const CMessage& Format, const CString& sText = "") {
return m_Buffer.AddLine(Format, sText);
}
/// @deprecated
size_t AddBuffer(const CString& sFormat, const CString& sText = "",
const timeval* ts = nullptr,
const MCString& mssTags = MCString::EmptyMap) {
return m_Buffer.AddLine(sFormat, sText, ts, mssTags);
}
void ClearBuffer() { m_Buffer.Clear(); }
void SendBuffer(CClient* pClient);
void SendBuffer(CClient* pClient, const CBuffer& Buffer);
// !Buffer
// m_Nick wrappers
CString GetPermStr() const { return m_Nick.GetPermStr(); }
bool HasPerm(unsigned char uPerm) const { return m_Nick.HasPerm(uPerm); }
bool AddPerm(unsigned char uPerm) { return m_Nick.AddPerm(uPerm); }
bool RemPerm(unsigned char uPerm) { return m_Nick.RemPerm(uPerm); }
// !wrappers
// Setters
void SetModeKnown(bool b) { m_bModeKnown = b; }
void SetIsOn(bool b) {
m_bIsOn = b;
if (!b) {
Reset();
}
}
void SetKey(const CString& s);
void SetTopic(const CString& s) { m_sTopic = s; }
void SetTopicOwner(const CString& s) { m_sTopicOwner = s; }
void SetTopicDate(unsigned long u) { m_ulTopicDate = u; }
void SetDefaultModes(const CString& s) { m_sDefaultModes = s; }
void SetAutoClearChanBuffer(bool b);
void InheritAutoClearChanBuffer(bool b);
void ResetAutoClearChanBuffer();
void SetDetached(bool b = true) { m_bDetached = b; }
void SetInConfig(bool b);
void SetCreationDate(unsigned long u) { m_ulCreationDate = u; }
void Disable() { m_bDisabled = true; }
void Enable();
void IncJoinTries() { m_uJoinTries++; }
void ResetJoinTries() { m_uJoinTries = 0; }
// !Setters
// Getters
CIRCNetwork* GetNetwork() const { return m_pNetwork; }
bool IsModeKnown() const { return m_bModeKnown; }
bool HasMode(unsigned char uMode) const;
CString GetOptions() const;
CString GetModeArg(unsigned char uMode) const;
std::map<char, unsigned int> GetPermCounts() const;
bool IsOn() const { return m_bIsOn; }
const CString& GetName() const { return m_sName; }
const std::map<unsigned char, CString>& GetModes() const {
return m_musModes;
}
const CString& GetKey() const { return m_sKey; }
const CString& GetTopic() const { return m_sTopic; }
const CString& GetTopicOwner() const { return m_sTopicOwner; }
unsigned long GetTopicDate() const { return m_ulTopicDate; }
const CString& GetDefaultModes() const { return m_sDefaultModes; }
const std::map<CString, CNick>& GetNicks() const { return m_msNicks; }
size_t GetNickCount() const { return m_msNicks.size(); }
bool AutoClearChanBuffer() const { return m_bAutoClearChanBuffer; }
bool IsDetached() const { return m_bDetached; }
bool InConfig() const { return m_bInConfig; }
unsigned long GetCreationDate() const { return m_ulCreationDate; }
bool IsDisabled() const { return m_bDisabled; }
unsigned int GetJoinTries() const { return m_uJoinTries; }
bool HasBufferCountSet() const { return m_bHasBufferCountSet; }
bool HasAutoClearChanBufferSet() const {
return m_bHasAutoClearChanBufferSet;
}
// !Getters
typedef enum {
Voice = '+',
HalfOp = '%',
Op = '@',
Admin = '!',
Owner = '*'
} EUserPerms;
typedef enum {
M_Private = 'p',
M_Secret = 's',
M_Moderated = 'm',
M_InviteOnly = 'i',
M_NoMessages = 'n',
M_OpTopic = 't',
M_Limit = 'l',
M_Key = 'k',
M_Op = 'o',
M_Voice = 'v',
M_Ban = 'b',
M_Except = 'e'
} EModes;
CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig,
CConfig* pConfig = nullptr);
~CChan();
CChan(const CChan&) = delete;
CChan& operator=(const CChan&) = delete;
void Reset();
CConfig ToConfig() const;
void Clone(CChan& chan);
void Cycle() const;
void JoinUser(const CString& sKey = "");
void AttachUser(CClient* pClient = nullptr);
void DetachUser();
void OnWho(const CString& sNick, const CString& sIdent,
const CString& sHost);
// Modes
void SetModes(const CString& s);
void ModeChange(const CString& sModes, const CNick* OpNick = nullptr);
bool AddMode(unsigned char uMode, const CString& sArg);
bool RemMode(unsigned char uMode);
CString GetModeString() const;
CString GetModeArg(CString& sArgs) const;
CString GetModeForNames() const;
// !Modes
// Nicks
void ClearNicks();
const CNick* FindNick(const CString& sNick) const;
CNick* FindNick(const CString& sNick);
int AddNicks(const CString& sNicks);
bool AddNick(const CString& sNick);
bool RemNick(const CString& sNick);
bool ChangeNick(const CString& sOldNick, const CString& sNewNick);
// !Nicks
// Buffer
const CBuffer& GetBuffer() const { return m_Buffer; }
unsigned int GetBufferCount() const { return m_Buffer.GetLineCount(); }
bool SetBufferCount(unsigned int u, bool bForce = false) {
m_bHasBufferCountSet = true;
return m_Buffer.SetLineCount(u, bForce);
}
void InheritBufferCount(unsigned int u, bool bForce = false) {
if (!m_bHasBufferCountSet) m_Buffer.SetLineCount(u, bForce);
}
void ResetBufferCount();
size_t AddBuffer(const CMessage& Format, const CString& sText = "") {
return m_Buffer.AddLine(Format, sText);
}
/// @deprecated
size_t AddBuffer(const CString& sFormat, const CString& sText = "",
const timeval* ts = nullptr,
const MCString& mssTags = MCString::EmptyMap) {
return m_Buffer.AddLine(sFormat, sText, ts, mssTags);
}
void ClearBuffer() { m_Buffer.Clear(); }
void SendBuffer(CClient* pClient);
void SendBuffer(CClient* pClient, const CBuffer& Buffer);
// !Buffer
// m_Nick wrappers
CString GetPermStr() const { return m_Nick.GetPermStr(); }
bool HasPerm(unsigned char uPerm) const { return m_Nick.HasPerm(uPerm); }
bool AddPerm(unsigned char uPerm) { return m_Nick.AddPerm(uPerm); }
bool RemPerm(unsigned char uPerm) { return m_Nick.RemPerm(uPerm); }
// !wrappers
// Setters
void SetModeKnown(bool b) { m_bModeKnown = b; }
void SetIsOn(bool b) {
m_bIsOn = b;
if (!b) {
Reset();
}
}
void SetKey(const CString& s);
void SetTopic(const CString& s) { m_sTopic = s; }
void SetTopicOwner(const CString& s) { m_sTopicOwner = s; }
void SetTopicDate(unsigned long u) { m_ulTopicDate = u; }
void SetDefaultModes(const CString& s) { m_sDefaultModes = s; }
void SetAutoClearChanBuffer(bool b);
void InheritAutoClearChanBuffer(bool b);
void ResetAutoClearChanBuffer();
void SetDetached(bool b = true) { m_bDetached = b; }
void SetInConfig(bool b);
void SetCreationDate(unsigned long u) { m_ulCreationDate = u; }
void Disable() { m_bDisabled = true; }
void Enable();
void IncJoinTries() { m_uJoinTries++; }
void ResetJoinTries() { m_uJoinTries = 0; }
// !Setters
// Getters
CIRCNetwork* GetNetwork() const { return m_pNetwork; }
bool IsModeKnown() const { return m_bModeKnown; }
bool HasMode(unsigned char uMode) const;
CString GetOptions() const;
CString GetModeArg(unsigned char uMode) const;
std::map<char, unsigned int> GetPermCounts() const;
bool IsOn() const { return m_bIsOn; }
const CString& GetName() const { return m_sName; }
const std::map<unsigned char, CString>& GetModes() const {
return m_musModes;
}
const CString& GetKey() const { return m_sKey; }
const CString& GetTopic() const { return m_sTopic; }
const CString& GetTopicOwner() const { return m_sTopicOwner; }
unsigned long GetTopicDate() const { return m_ulTopicDate; }
const CString& GetDefaultModes() const { return m_sDefaultModes; }
const std::map<CString, CNick>& GetNicks() const { return m_msNicks; }
size_t GetNickCount() const { return m_msNicks.size(); }
bool AutoClearChanBuffer() const { return m_bAutoClearChanBuffer; }
bool IsDetached() const { return m_bDetached; }
bool InConfig() const { return m_bInConfig; }
unsigned long GetCreationDate() const { return m_ulCreationDate; }
bool IsDisabled() const { return m_bDisabled; }
unsigned int GetJoinTries() const { return m_uJoinTries; }
bool HasBufferCountSet() const { return m_bHasBufferCountSet; }
bool HasAutoClearChanBufferSet() const {
return m_bHasAutoClearChanBufferSet;
}
// !Getters
private:
protected:
bool m_bDetached;
bool m_bIsOn;
bool m_bAutoClearChanBuffer;
bool m_bInConfig;
bool m_bDisabled;
bool m_bHasBufferCountSet;
bool m_bHasAutoClearChanBufferSet;
CString m_sName;
CString m_sKey;
CString m_sTopic;
CString m_sTopicOwner;
unsigned long m_ulTopicDate;
unsigned long m_ulCreationDate;
CIRCNetwork* m_pNetwork;
CNick m_Nick;
unsigned int m_uJoinTries;
CString m_sDefaultModes;
std::map<CString, CNick> m_msNicks; // Todo: make this caseless (irc style)
CBuffer m_Buffer;
bool m_bModeKnown;
std::map<unsigned char, CString> m_musModes;
bool m_bDetached;
bool m_bIsOn;
bool m_bAutoClearChanBuffer;
bool m_bInConfig;
bool m_bDisabled;
bool m_bHasBufferCountSet;
bool m_bHasAutoClearChanBufferSet;
CString m_sName;
CString m_sKey;
CString m_sTopic;
CString m_sTopicOwner;
unsigned long m_ulTopicDate;
unsigned long m_ulCreationDate;
CIRCNetwork* m_pNetwork;
CNick m_Nick;
unsigned int m_uJoinTries;
CString m_sDefaultModes;
std::map<CString, CNick> m_msNicks; // Todo: make this caseless (irc style)
CBuffer m_Buffer;
bool m_bModeKnown;
std::map<unsigned char, CString> m_musModes;
};
#endif // !ZNC_CHAN_H

460
include/znc/Client.h

@ -36,162 +36,162 @@ class CChan; @@ -36,162 +36,162 @@ class CChan;
class CAuthBase {
public:
CAuthBase(const CString& sUsername, const CString& sPassword,
CZNCSock* pSock)
: m_sUsername(sUsername), m_sPassword(sPassword), m_pSock(pSock) {}
CAuthBase(const CString& sUsername, const CString& sPassword,
CZNCSock* pSock)
: m_sUsername(sUsername), m_sPassword(sPassword), m_pSock(pSock) {}
virtual ~CAuthBase() {}
virtual ~CAuthBase() {}
CAuthBase(const CAuthBase&) = delete;
CAuthBase& operator=(const CAuthBase&) = delete;
CAuthBase(const CAuthBase&) = delete;
CAuthBase& operator=(const CAuthBase&) = delete;
virtual void SetLoginInfo(const CString& sUsername,
const CString& sPassword, CZNCSock* pSock) {
m_sUsername = sUsername;
m_sPassword = sPassword;
m_pSock = pSock;
}
virtual void SetLoginInfo(const CString& sUsername,
const CString& sPassword, CZNCSock* pSock) {
m_sUsername = sUsername;
m_sPassword = sPassword;
m_pSock = pSock;
}
void AcceptLogin(CUser& User);
void RefuseLogin(const CString& sReason);
void AcceptLogin(CUser& User);
void RefuseLogin(const CString& sReason);
const CString& GetUsername() const { return m_sUsername; }
const CString& GetPassword() const { return m_sPassword; }
Csock* GetSocket() const { return m_pSock; }
CString GetRemoteIP() const;
const CString& GetUsername() const { return m_sUsername; }
const CString& GetPassword() const { return m_sPassword; }
Csock* GetSocket() const { return m_pSock; }
CString GetRemoteIP() const;
// Invalidate this CAuthBase instance which means it will no longer use
// m_pSock and AcceptLogin() or RefusedLogin() will have no effect.
virtual void Invalidate();
// Invalidate this CAuthBase instance which means it will no longer use
// m_pSock and AcceptLogin() or RefusedLogin() will have no effect.
virtual void Invalidate();
protected:
virtual void AcceptedLogin(CUser& User) = 0;
virtual void RefusedLogin(const CString& sReason) = 0;
virtual void AcceptedLogin(CUser& User) = 0;
virtual void RefusedLogin(const CString& sReason) = 0;
private:
CString m_sUsername;
CString m_sPassword;
CZNCSock* m_pSock;
CString m_sUsername;
CString m_sPassword;
CZNCSock* m_pSock;
};
class CClientAuth : public CAuthBase {
public:
CClientAuth(CClient* pClient, const CString& sUsername,
const CString& sPassword);
virtual ~CClientAuth() {}
CClientAuth(CClient* pClient, const CString& sUsername,
const CString& sPassword);
virtual ~CClientAuth() {}
CClientAuth(const CClientAuth&) = delete;
CClientAuth& operator=(const CClientAuth&) = delete;
CClientAuth(const CClientAuth&) = delete;
CClientAuth& operator=(const CClientAuth&) = delete;
void Invalidate() override {
m_pClient = nullptr;
CAuthBase::Invalidate();
}
void AcceptedLogin(CUser& User) override;
void RefusedLogin(const CString& sReason) override;
void Invalidate() override {
m_pClient = nullptr;
CAuthBase::Invalidate();
}
void AcceptedLogin(CUser& User) override;
void RefusedLogin(const CString& sReason) override;
private:
protected:
CClient* m_pClient;
CClient* m_pClient;
};
class CClient : public CIRCSocket {
public:
CClient()
: CIRCSocket(),
m_bGotPass(false),
m_bGotNick(false),
m_bGotUser(false),
m_bInCap(false),
m_bCapNotify(false),
m_bAwayNotify(false),
m_bAccountNotify(false),
m_bExtendedJoin(false),
m_bNamesx(false),
m_bUHNames(false),
m_bAway(false),
m_bServerTime(false),
m_bBatch(false),
m_bEchoMessage(false),
m_bSelfMessage(false),
m_bPlaybackActive(false),
m_pUser(nullptr),
m_pNetwork(nullptr),
m_sNick("unknown-nick"),
m_sPass(""),
m_sUser(""),
m_sNetwork(""),
m_sIdentifier(""),
m_spAuth(),
m_ssAcceptedCaps(),
m_mCoreCaps({
{"multi-prefix",
{false, [this](bool bVal) { m_bNamesx = bVal; }}},
{"userhost-in-names",
{false, [this](bool bVal) { m_bUHNames = bVal; }}},
{"echo-message",
{false, [this](bool bVal) { m_bEchoMessage = bVal; }}},
{"server-time",
{false, [this](bool bVal) { m_bServerTime = bVal; }}},
{"batch", {false, [this](bool bVal) { m_bBatch = bVal; }}},
{"cap-notify",
{false, [this](bool bVal) { m_bCapNotify = bVal; }}},
{"away-notify",
{true, [this](bool bVal) { m_bAwayNotify = bVal; }}},
{"account-notify",
{true, [this](bool bVal) { m_bAccountNotify = bVal; }}},
{"extended-join",
{true, [this](bool bVal) { m_bExtendedJoin = bVal; }}},
}) {
EnableReadLine();
// RFC says a line can have 512 chars max, but we are
// a little more gentle ;)
SetMaxBufferThreshold(1024);
// For compatibility with older clients
m_mCoreCaps["znc.in/server-time-iso"] = m_mCoreCaps["server-time"];
m_mCoreCaps["znc.in/batch"] = m_mCoreCaps["batch"];
m_mCoreCaps["znc.in/self-message"] = {
false, [this](bool bVal) { m_bSelfMessage = bVal; }};
}
virtual ~CClient();
CClient(const CClient&) = delete;
CClient& operator=(const CClient&) = delete;
void SendRequiredPasswordNotice();
void AcceptLogin(CUser& User);
void RefuseLogin(const CString& sReason);
CString GetNick(bool bAllowIRCNick = true) const;
CString GetNickMask() const;
CString GetIdentifier() const { return m_sIdentifier; }
bool HasCapNotify() const { return m_bCapNotify; }
bool HasAwayNotify() const { return m_bAwayNotify; }
bool HasAccountNotify() const { return m_bAccountNotify; }
bool HasExtendedJoin() const { return m_bExtendedJoin; }
bool HasNamesx() const { return m_bNamesx; }
bool HasUHNames() const { return m_bUHNames; }
bool IsAway() const { return m_bAway; }
bool HasServerTime() const { return m_bServerTime; }
bool HasBatch() const { return m_bBatch; }
bool HasEchoMessage() const { return m_bEchoMessage; }
bool HasSelfMessage() const { return m_bSelfMessage; }
static bool IsValidIdentifier(const CString& sIdentifier);
void UserCommand(CString& sLine);
void UserPortCommand(CString& sLine);
void StatusCTCP(const CString& sCommand);
void BouncedOff();
bool IsAttached() const { return m_pUser != nullptr; }
bool IsPlaybackActive() const { return m_bPlaybackActive; }
void SetPlaybackActive(bool bActive) { m_bPlaybackActive = bActive; }
void PutIRC(const CString& sLine);
/** Sends a raw data line to the client.
CClient()
: CIRCSocket(),
m_bGotPass(false),
m_bGotNick(false),
m_bGotUser(false),
m_bInCap(false),
m_bCapNotify(false),
m_bAwayNotify(false),
m_bAccountNotify(false),
m_bExtendedJoin(false),
m_bNamesx(false),
m_bUHNames(false),
m_bAway(false),
m_bServerTime(false),
m_bBatch(false),
m_bEchoMessage(false),
m_bSelfMessage(false),
m_bPlaybackActive(false),
m_pUser(nullptr),
m_pNetwork(nullptr),
m_sNick("unknown-nick"),
m_sPass(""),
m_sUser(""),
m_sNetwork(""),
m_sIdentifier(""),
m_spAuth(),
m_ssAcceptedCaps(),
m_mCoreCaps({
{"multi-prefix",
{false, [this](bool bVal) { m_bNamesx = bVal; }}},
{"userhost-in-names",
{false, [this](bool bVal) { m_bUHNames = bVal; }}},
{"echo-message",
{false, [this](bool bVal) { m_bEchoMessage = bVal; }}},
{"server-time",
{false, [this](bool bVal) { m_bServerTime = bVal; }}},
{"batch", {false, [this](bool bVal) { m_bBatch = bVal; }}},
{"cap-notify",
{false, [this](bool bVal) { m_bCapNotify = bVal; }}},
{"away-notify",
{true, [this](bool bVal) { m_bAwayNotify = bVal; }}},
{"account-notify",
{true, [this](bool bVal) { m_bAccountNotify = bVal; }}},
{"extended-join",
{true, [this](bool bVal) { m_bExtendedJoin = bVal; }}},
}) {
EnableReadLine();
// RFC says a line can have 512 chars max, but we are
// a little more gentle ;)
SetMaxBufferThreshold(1024);
// For compatibility with older clients
m_mCoreCaps["znc.in/server-time-iso"] = m_mCoreCaps["server-time"];
m_mCoreCaps["znc.in/batch"] = m_mCoreCaps["batch"];
m_mCoreCaps["znc.in/self-message"] = {
false, [this](bool bVal) { m_bSelfMessage = bVal; }};
}
virtual ~CClient();
CClient(const CClient&) = delete;
CClient& operator=(const CClient&) = delete;
void SendRequiredPasswordNotice();
void AcceptLogin(CUser& User);
void RefuseLogin(const CString& sReason);
CString GetNick(bool bAllowIRCNick = true) const;
CString GetNickMask() const;
CString GetIdentifier() const { return m_sIdentifier; }
bool HasCapNotify() const { return m_bCapNotify; }
bool HasAwayNotify() const { return m_bAwayNotify; }
bool HasAccountNotify() const { return m_bAccountNotify; }
bool HasExtendedJoin() const { return m_bExtendedJoin; }
bool HasNamesx() const { return m_bNamesx; }
bool HasUHNames() const { return m_bUHNames; }
bool IsAway() const { return m_bAway; }
bool HasServerTime() const { return m_bServerTime; }
bool HasBatch() const { return m_bBatch; }
bool HasEchoMessage() const { return m_bEchoMessage; }
bool HasSelfMessage() const { return m_bSelfMessage; }
static bool IsValidIdentifier(const CString& sIdentifier);
void UserCommand(CString& sLine);
void UserPortCommand(CString& sLine);
void StatusCTCP(const CString& sCommand);
void BouncedOff();
bool IsAttached() const { return m_pUser != nullptr; }
bool IsPlaybackActive() const { return m_bPlaybackActive; }
void SetPlaybackActive(bool bActive) { m_bPlaybackActive = bActive; }
void PutIRC(const CString& sLine);
/** Sends a raw data line to the client.
* @param sLine The line to be sent.
*
* The line is first passed \e unmodified to the \ref CModule::OnSendToClient()
@ -200,8 +200,8 @@ class CClient : public CIRCSocket { @@ -200,8 +200,8 @@ class CClient : public CIRCSocket {
* These lines appear in the debug output in the following syntax:
* \code [time] (user/network) ZNC -> CLI [line] \endcode
*/
void PutClient(const CString& sLine);
/** Sends a message to the client.
void PutClient(const CString& sLine);
/** Sends a message to the client.
* @param Message The message to be sent.
* @note Only known and compatible messages and tags are sent.
* @return \c true if the message was sent, or \c false if it was ignored.
@ -247,105 +247,105 @@ class CClient : public CIRCSocket { @@ -247,105 +247,105 @@ class CClient : public CIRCSocket {
* pClient->PutClient(Message.ToString());
* \endcode
*/
bool PutClient(const CMessage& Message);
unsigned int PutStatus(const CTable& table);
void PutStatus(const CString& sLine);
void PutStatusNotice(const CString& sLine);
void PutModule(const CString& sModule, const CString& sLine);
void PutModNotice(const CString& sModule, const CString& sLine);
bool IsCapEnabled(const CString& sCap) const {
return 1 == m_ssAcceptedCaps.count(sCap);
}
void NotifyServerDependentCaps(const SCString& ssCaps);
void ClearServerDependentCaps();
void ReadLine(const CString& sData) override;
bool SendMotd();
void HelpUser(const CString& sFilter = "");
void AuthUser();
void Connected() override;
void Timeout() override;
void Disconnected() override;
void ConnectionRefused() override;
void ReachedMaxBuffer() override;
void SetNick(const CString& s);
void SetAway(bool bAway) { m_bAway = bAway; }
CUser* GetUser() const { return m_pUser; }
void SetNetwork(CIRCNetwork* pNetwork, bool bDisconnect = true,
bool bReconnect = true);
CIRCNetwork* GetNetwork() const { return m_pNetwork; }
const std::vector<CClient*>& GetClients() const;
const CIRCSock* GetIRCSock() const;
CIRCSock* GetIRCSock();
CString GetFullName() const;
bool PutClient(const CMessage& Message);
unsigned int PutStatus(const CTable& table);
void PutStatus(const CString& sLine);
void PutStatusNotice(const CString& sLine);
void PutModule(const CString& sModule, const CString& sLine);
void PutModNotice(const CString& sModule, const CString& sLine);
bool IsCapEnabled(const CString& sCap) const {
return 1 == m_ssAcceptedCaps.count(sCap);
}
void NotifyServerDependentCaps(const SCString& ssCaps);
void ClearServerDependentCaps();
void ReadLine(const CString& sData) override;
bool SendMotd();
void HelpUser(const CString& sFilter = "");
void AuthUser();
void Connected() override;
void Timeout() override;
void Disconnected() override;
void ConnectionRefused() override;
void ReachedMaxBuffer() override;
void SetNick(const CString& s);
void SetAway(bool bAway) { m_bAway = bAway; }
CUser* GetUser() const { return m_pUser; }
void SetNetwork(CIRCNetwork* pNetwork, bool bDisconnect = true,
bool bReconnect = true);
CIRCNetwork* GetNetwork() const { return m_pNetwork; }
const std::vector<CClient*>& GetClients() const;
const CIRCSock* GetIRCSock() const;
CIRCSock* GetIRCSock();
CString GetFullName() const;
private:
void HandleCap(const CMessage& Message);
void RespondCap(const CString& sResponse);
void ParsePass(const CString& sAuthLine);
void ParseUser(const CString& sAuthLine);
void ParseIdentifier(const CString& sAuthLine);
template <typename T>
void AddBuffer(const T& Message);
void EchoMessage(const CMessage& Message);
std::set<CChan*> MatchChans(const CString& sPatterns) const;
unsigned int AttachChans(const std::set<CChan*>& sChans);
unsigned int DetachChans(const std::set<CChan*>& sChans);
bool OnActionMessage(CActionMessage& Message);
bool OnCTCPMessage(CCTCPMessage& Message);
bool OnJoinMessage(CJoinMessage& Message);
bool OnModeMessage(CModeMessage& Message);
bool OnNoticeMessage(CNoticeMessage& Message);
bool OnPartMessage(CPartMessage& Message);
bool OnPingMessage(CMessage& Message);
bool OnPongMessage(CMessage& Message);
bool OnQuitMessage(CQuitMessage& Message);
bool OnTextMessage(CTextMessage& Message);
bool OnTopicMessage(CTopicMessage& Message);
bool OnOtherMessage(CMessage& Message);
void HandleCap(const CMessage& Message);
void RespondCap(const CString& sResponse);
void ParsePass(const CString& sAuthLine);
void ParseUser(const CString& sAuthLine);
void ParseIdentifier(const CString& sAuthLine);
template <typename T>
void AddBuffer(const T& Message);
void EchoMessage(const CMessage& Message);
std::set<CChan*> MatchChans(const CString& sPatterns) const;
unsigned int AttachChans(const std::set<CChan*>& sChans);
unsigned int DetachChans(const std::set<CChan*>& sChans);
bool OnActionMessage(CActionMessage& Message);
bool OnCTCPMessage(CCTCPMessage& Message);
bool OnJoinMessage(CJoinMessage& Message);
bool OnModeMessage(CModeMessage& Message);
bool OnNoticeMessage(CNoticeMessage& Message);
bool OnPartMessage(CPartMessage& Message);
bool OnPingMessage(CMessage& Message);
bool OnPongMessage(CMessage& Message);
bool OnQuitMessage(CQuitMessage& Message);
bool OnTextMessage(CTextMessage& Message);
bool OnTopicMessage(CTopicMessage& Message);
bool OnOtherMessage(CMessage& Message);
protected:
bool m_bGotPass;
bool m_bGotNick;
bool m_bGotUser;
bool m_bInCap;
bool m_bCapNotify;
bool m_bAwayNotify;
bool m_bAccountNotify;
bool m_bExtendedJoin;
bool m_bNamesx;
bool m_bUHNames;
bool m_bAway;
bool m_bServerTime;
bool m_bBatch;
bool m_bEchoMessage;
bool m_bSelfMessage;
bool m_bPlaybackActive;
CUser* m_pUser;
CIRCNetwork* m_pNetwork;
CString m_sNick;
CString m_sPass;
CString m_sUser;
CString m_sNetwork;
CString m_sIdentifier;
std::shared_ptr<CAuthBase> m_spAuth;
SCString m_ssAcceptedCaps;
// The capabilities supported by the ZNC core - capability names mapped
// to a pair which contains a bool describing whether the capability is
// server-dependent, and a capability value change handler.
std::map<CString, std::pair<bool, std::function<void(bool bVal)>>>
m_mCoreCaps;
// A subset of CIRCSock::GetAcceptedCaps(), the caps that can be listed
// in CAP LS and may be notified to the client with CAP NEW (cap-notify).
SCString m_ssServerDependentCaps;
friend class ClientTest;
bool m_bGotPass;
bool m_bGotNick;
bool m_bGotUser;
bool m_bInCap;
bool m_bCapNotify;
bool m_bAwayNotify;
bool m_bAccountNotify;
bool m_bExtendedJoin;
bool m_bNamesx;
bool m_bUHNames;
bool m_bAway;
bool m_bServerTime;
bool m_bBatch;
bool m_bEchoMessage;
bool m_bSelfMessage;
bool m_bPlaybackActive;
CUser* m_pUser;
CIRCNetwork* m_pNetwork;
CString m_sNick;
CString m_sPass;
CString m_sUser;
CString m_sNetwork;
CString m_sIdentifier;
std::shared_ptr<CAuthBase> m_spAuth;
SCString m_ssAcceptedCaps;
// The capabilities supported by the ZNC core - capability names mapped
// to a pair which contains a bool describing whether the capability is
// server-dependent, and a capability value change handler.
std::map<CString, std::pair<bool, std::function<void(bool bVal)>>>
m_mCoreCaps;
// A subset of CIRCSock::GetAcceptedCaps(), the caps that can be listed
// in CAP LS and may be notified to the client with CAP NEW (cap-notify).
SCString m_ssServerDependentCaps;
friend class ClientTest;
};
#endif // !ZNC_CLIENT_H

274
include/znc/Config.h

@ -24,150 +24,150 @@ class CFile; @@ -24,150 +24,150 @@ class CFile;
class CConfig;
struct CConfigEntry {
CConfigEntry();
CConfigEntry(const CConfig& Config);
CConfigEntry(const CConfigEntry& other);
~CConfigEntry();
CConfigEntry& operator=(const CConfigEntry& other);
CConfigEntry();
CConfigEntry(const CConfig& Config);
CConfigEntry(const CConfigEntry& other);
~CConfigEntry();
CConfigEntry& operator=(const CConfigEntry& other);
CConfig* m_pSubConfig;
CConfig* m_pSubConfig;
};
class CConfig {
public:
CConfig() : m_ConfigEntries(), m_SubConfigs() {}
typedef std::map<CString, VCString> EntryMap;
typedef std::map<CString, CConfigEntry> SubConfig;
typedef std::map<CString, SubConfig> SubConfigMap;
typedef EntryMap::const_iterator EntryMapIterator;
typedef SubConfigMap::const_iterator SubConfigMapIterator;
EntryMapIterator BeginEntries() const { return m_ConfigEntries.begin(); }
EntryMapIterator EndEntries() const { return m_ConfigEntries.end(); }
SubConfigMapIterator BeginSubConfigs() const {
return m_SubConfigs.begin();
}
SubConfigMapIterator EndSubConfigs() const { return m_SubConfigs.end(); }
void AddKeyValuePair(const CString& sName, const CString& sValue) {
if (sName.empty() || sValue.empty()) {
return;
}
m_ConfigEntries[sName].push_back(sValue);
}
bool AddSubConfig(const CString& sTag, const CString& sName,
CConfig Config) {
SubConfig& conf = m_SubConfigs[sTag];
SubConfig::const_iterator it = conf.find(sName);
if (it != conf.end()) {
return false;
}
conf[sName] = Config;
return true;
}
bool FindStringVector(const CString& sName, VCString& vsList,
bool bErase = true) {
EntryMap::iterator it = m_ConfigEntries.find(sName);
vsList.clear();
if (it == m_ConfigEntries.end()) return false;
vsList = it->second;
if (bErase) {
m_ConfigEntries.erase(it);
}
return true;
}
bool FindStringEntry(const CString& sName, CString& sRes,
const CString& sDefault = "") {
EntryMap::iterator it = m_ConfigEntries.find(sName);
sRes = sDefault;
if (it == m_ConfigEntries.end() || it->second.empty()) return false;
sRes = it->second.front();
it->second.erase(it->second.begin());
if (it->second.empty()) m_ConfigEntries.erase(it);
return true;
}
bool FindBoolEntry(const CString& sName, bool& bRes,
bool bDefault = false) {
CString s;
if (FindStringEntry(sName, s)) {
bRes = s.ToBool();
return true;
}
bRes = bDefault;
return false;
}
bool FindUIntEntry(const CString& sName, unsigned int& uRes,
unsigned int uDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
uRes = s.ToUInt();
return true;
}
uRes = uDefault;
return false;
}
bool FindUShortEntry(const CString& sName, unsigned short& uRes,
unsigned short uDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
uRes = s.ToUShort();
return true;
}
uRes = uDefault;
return false;
}
bool FindDoubleEntry(const CString& sName, double& fRes,
double fDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
fRes = s.ToDouble();
return true;
}
fRes = fDefault;
return false;
}
bool FindSubConfig(const CString& sName, SubConfig& Config,
bool bErase = true) {
SubConfigMap::iterator it = m_SubConfigs.find(sName);
if (it == m_SubConfigs.end()) {
Config.clear();
return false;
}
Config = it->second;
if (bErase) {
m_SubConfigs.erase(it);
}
return true;
}
bool empty() const {
return m_ConfigEntries.empty() && m_SubConfigs.empty();
}
bool Parse(CFile& file, CString& sErrorMsg);
void Write(CFile& file, unsigned int iIndentation = 0);
CConfig() : m_ConfigEntries(), m_SubConfigs() {}
typedef std::map<CString, VCString> EntryMap;
typedef std::map<CString, CConfigEntry> SubConfig;
typedef std::map<CString, SubConfig> SubConfigMap;
typedef EntryMap::const_iterator EntryMapIterator;
typedef SubConfigMap::const_iterator SubConfigMapIterator;
EntryMapIterator BeginEntries() const { return m_ConfigEntries.begin(); }
EntryMapIterator EndEntries() const { return m_ConfigEntries.end(); }
SubConfigMapIterator BeginSubConfigs() const {
return m_SubConfigs.begin();
}
SubConfigMapIterator EndSubConfigs() const { return m_SubConfigs.end(); }
void AddKeyValuePair(const CString& sName, const CString& sValue) {
if (sName.empty() || sValue.empty()) {
return;
}
m_ConfigEntries[sName].push_back(sValue);
}
bool AddSubConfig(const CString& sTag, const CString& sName,
CConfig Config) {
SubConfig& conf = m_SubConfigs[sTag];
SubConfig::const_iterator it = conf.find(sName);
if (it != conf.end()) {
return false;
}
conf[sName] = Config;
return true;
}
bool FindStringVector(const CString& sName, VCString& vsList,
bool bErase = true) {
EntryMap::iterator it = m_ConfigEntries.find(sName);
vsList.clear();
if (it == m_ConfigEntries.end()) return false;
vsList = it->second;
if (bErase) {
m_ConfigEntries.erase(it);
}
return true;
}
bool FindStringEntry(const CString& sName, CString& sRes,
const CString& sDefault = "") {
EntryMap::iterator it = m_ConfigEntries.find(sName);
sRes = sDefault;
if (it == m_ConfigEntries.end() || it->second.empty()) return false;
sRes = it->second.front();
it->second.erase(it->second.begin());
if (it->second.empty()) m_ConfigEntries.erase(it);
return true;
}
bool FindBoolEntry(const CString& sName, bool& bRes,
bool bDefault = false) {
CString s;
if (FindStringEntry(sName, s)) {
bRes = s.ToBool();
return true;
}
bRes = bDefault;
return false;
}
bool FindUIntEntry(const CString& sName, unsigned int& uRes,
unsigned int uDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
uRes = s.ToUInt();
return true;
}
uRes = uDefault;
return false;
}
bool FindUShortEntry(const CString& sName, unsigned short& uRes,
unsigned short uDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
uRes = s.ToUShort();
return true;
}
uRes = uDefault;
return false;
}
bool FindDoubleEntry(const CString& sName, double& fRes,
double fDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
fRes = s.ToDouble();
return true;
}
fRes = fDefault;
return false;
}
bool FindSubConfig(const CString& sName, SubConfig& Config,
bool bErase = true) {
SubConfigMap::iterator it = m_SubConfigs.find(sName);
if (it == m_SubConfigs.end()) {
Config.clear();
return false;
}
Config = it->second;
if (bErase) {
m_SubConfigs.erase(it);
}
return true;
}
bool empty() const {
return m_ConfigEntries.empty() && m_SubConfigs.empty();
}
bool Parse(CFile& file, CString& sErrorMsg);
void Write(CFile& file, unsigned int iIndentation = 0);
private:
EntryMap m_ConfigEntries;
SubConfigMap m_SubConfigs;
EntryMap m_ConfigEntries;