Allow network specific quit messages (resolves #273)

This commit is contained in:
J-P Nurmi
2014-09-13 23:40:22 +02:00
parent 39d14a55e6
commit fb99593f75
3 changed files with 26 additions and 1 deletions
+22
View File
@@ -162,6 +162,7 @@ void CIRCNetwork::Clone(const CIRCNetwork& Network, bool bCloneName) {
SetRealName(Network.GetRealName());
SetBindHost(Network.GetBindHost());
SetEncoding(Network.GetEncoding());
SetQuitMsg(Network.GetQuitMsg());
// Servers
const vector<CServer*>& vServers = Network.GetServers();
@@ -332,6 +333,7 @@ bool CIRCNetwork::ParseConfig(CConfig *pConfig, CString& sError, bool bUpgrade)
{ "realname", &CIRCNetwork::SetRealName },
{ "bindhost", &CIRCNetwork::SetBindHost },
{ "encoding", &CIRCNetwork::SetEncoding },
{ "quitmsg", &CIRCNetwork::SetQuitMsg },
};
size_t numStringOptions = sizeof(StringOptions) / sizeof(StringOptions[0]);
TOption<bool> BoolOptions[] = {
@@ -480,6 +482,10 @@ CConfig CIRCNetwork::ToConfig() {
config.AddKeyValuePair("FloodBurst", CString(GetFloodBurst()));
config.AddKeyValuePair("Encoding", m_sEncoding);
if (!m_sQuitMsg.empty()) {
config.AddKeyValuePair("QuitMsg", m_sQuitMsg);
}
// Modules
CModules& Mods = GetModules();
@@ -1269,6 +1275,14 @@ const CString& CIRCNetwork::GetEncoding() const {
return m_sEncoding;
}
CString CIRCNetwork::GetQuitMsg() const {
if (m_sQuitMsg.empty()) {
return m_pUser->GetQuitMsg();
}
return m_sQuitMsg;
}
void CIRCNetwork::SetNick(const CString& s) {
if (m_pUser->GetNick().Equals(s)) {
m_sNick = "";
@@ -1313,6 +1327,14 @@ void CIRCNetwork::SetEncoding(const CString& s) {
m_sEncoding = s;
}
void CIRCNetwork::SetQuitMsg(const CString& s) {
if (m_pUser->GetQuitMsg().Equals(s)) {
m_sQuitMsg = "";
} else {
m_sQuitMsg = s;
}
}
CString CIRCNetwork::ExpandString(const CString& sStr) const {
CString sRet;
return ExpandString(sStr, sRet);