Introduce time zone (string) setting.

Presently unused but intended to supersede the current time zone offset.

The advantage of a string is that it can be set to something like Europe/Copenhagen and thereby adapt to daylight savings time.
This commit is contained in:
Allan Odgaard
2011-10-09 15:48:03 +02:00
parent edaa20e59e
commit b8247095d1
4 changed files with 18 additions and 0 deletions
+6
View File
@@ -61,6 +61,7 @@ CUser::CUser(const CString& sUserName)
// set path that depends on the user name:
m_sUserPath = CZNC::Get().GetUserPath() + "/" + m_sUserName;
m_sTimezone = "GMT";
m_fTimezoneOffset = 0;
m_sNick = m_sCleanUserName;
m_sIdent = m_sCleanUserName;
@@ -221,6 +222,9 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
return false;
}
}
if (pConfig->FindStringEntry("timezone", sValue)) {
SetTimezone(sValue);
}
if (pConfig->FindStringEntry("timezoneoffset", sValue)) {
SetTimezoneOffset(sValue.ToDouble());
}
@@ -662,6 +666,7 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
SetTimestampAppend(User.GetTimestampAppend());
SetTimestampPrepend(User.GetTimestampPrepend());
SetTimestampFormat(User.GetTimestampFormat());
SetTimezone(User.GetTimezone());
SetTimezoneOffset(User.GetTimezoneOffset());
// !Flags
@@ -812,6 +817,7 @@ CConfig CUser::ToConfig() {
config.AddKeyValuePair("TimestampFormat", GetTimestampFormat());
config.AddKeyValuePair("AppendTimestamp", CString(GetTimestampAppend()));
config.AddKeyValuePair("PrependTimestamp", CString(GetTimestampPrepend()));
config.AddKeyValuePair("Timezone", m_sTimezone);
config.AddKeyValuePair("TimezoneOffset", CString(m_fTimezoneOffset));
config.AddKeyValuePair("JoinTries", CString(m_uMaxJoinTries));
config.AddKeyValuePair("MaxJoins", CString(m_uMaxJoins));