Пример #1
0
CConfig CChan::ToConfig() {
	CConfig config;
	CUser *pUser = m_pNetwork->GetUser();

	if (pUser->GetBufferCount() != GetBufferCount())
		config.AddKeyValuePair("Buffer", CString(GetBufferCount()));
	if (pUser->KeepBuffer() != KeepBuffer())
		config.AddKeyValuePair("KeepBuffer", CString(KeepBuffer()));
	if (IsDetached())
		config.AddKeyValuePair("Detached", "true");
	if (!GetKey().empty())
		config.AddKeyValuePair("Key", GetKey());
	if (!GetDefaultModes().empty())
		config.AddKeyValuePair("Modes", GetDefaultModes());

	return config;
}
Пример #2
0
bool CChan::WriteConfig(CFile& File) {
	if (!InConfig()) {
		return false;
	}

	File.Write("\t<Chan " + GetName().FirstLine() + ">\n");

	if (m_pUser->GetBufferCount() != GetBufferCount())
		m_pUser->PrintLine(File, "\tBuffer", CString(GetBufferCount()));
	if (m_pUser->KeepBuffer() != KeepBuffer())
		m_pUser->PrintLine(File, "\tKeepBuffer", CString(KeepBuffer()));
	if (IsDetached())
		m_pUser->PrintLine(File, "\tDetached", "true");
	if (!GetKey().empty())
		m_pUser->PrintLine(File, "\tKey", GetKey());
	if (!GetDefaultModes().empty())
		m_pUser->PrintLine(File, "\tModes", GetDefaultModes());

	File.Write("\t</Chan>\n");
	return true;
}