mirror of
https://github.com/znc/znc.git
synced 2026-08-07 09:22:55 +02:00
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:
@@ -123,6 +123,7 @@ public:
|
||||
void SetTimestampFormat(const CString& s) { m_sTimestampFormat = s; }
|
||||
void SetTimestampAppend(bool b) { m_bAppendTimestamp = b; }
|
||||
void SetTimestampPrepend(bool b) { m_bPrependTimestamp = b; }
|
||||
void SetTimezone(const CString& s) { m_sTimezone = s; }
|
||||
void SetTimezoneOffset(float b) { m_fTimezoneOffset = b; }
|
||||
void SetJoinTries(unsigned int i) { m_uMaxJoinTries = i; }
|
||||
void SetMaxJoins(unsigned int i) { m_uMaxJoins = i; }
|
||||
@@ -164,6 +165,7 @@ public:
|
||||
unsigned int GetBufferCount() const;
|
||||
bool KeepBuffer() const;
|
||||
bool IsBeingDeleted() const { return m_bBeingDeleted; }
|
||||
CString GetTimezone() const { return m_sTimezone; }
|
||||
float GetTimezoneOffset() const { return m_fTimezoneOffset; }
|
||||
unsigned long long BytesRead() const { return m_uBytesRead; }
|
||||
unsigned long long BytesWritten() const { return m_uBytesWritten; }
|
||||
@@ -189,6 +191,7 @@ protected:
|
||||
CString m_sQuitMsg;
|
||||
MCString m_mssCTCPReplies;
|
||||
CString m_sTimestampFormat;
|
||||
CString m_sTimezone;
|
||||
float m_fTimezoneOffset;
|
||||
eHashType m_eHashType;
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ class CAdminMod : public CModule {
|
||||
{"Password", str},
|
||||
{"JoinTries", integer},
|
||||
{"MaxJoins", integer},
|
||||
{"Timezone", str},
|
||||
{"TimezoneOffset", doublenum},
|
||||
{"Admin", boolean},
|
||||
{"AppendTimestamp", boolean},
|
||||
@@ -158,6 +159,8 @@ class CAdminMod : public CModule {
|
||||
PutModule("MaxJoins = " + CString(pUser->MaxJoins()));
|
||||
else if (sVar == "jointries")
|
||||
PutModule("JoinTries = " + CString(pUser->JoinTries()));
|
||||
else if (sVar == "timezone")
|
||||
PutModule("Timezone = " + pUser->GetTimezone());
|
||||
else if (sVar == "timezoneoffset")
|
||||
PutModule("TimezoneOffset = " + CString(pUser->GetTimezoneOffset()));
|
||||
else if (sVar == "appendtimestamp")
|
||||
@@ -276,6 +279,10 @@ class CAdminMod : public CModule {
|
||||
pUser->SetJoinTries(i);
|
||||
PutModule("JoinTries = " + CString(pUser->JoinTries()));
|
||||
}
|
||||
else if (sVar == "timezone") {
|
||||
pUser->SetTimezone(sValue);
|
||||
PutModule("Timezone = " + pUser->GetTimezone());
|
||||
}
|
||||
else if (sVar == "timezoneoffset") {
|
||||
double d = sValue.ToDouble();
|
||||
pUser->SetTimezoneOffset(d);
|
||||
|
||||
@@ -229,6 +229,7 @@ public:
|
||||
pNewUser->SetMultiClients(WebSock.GetParam("multiclients").ToBool());
|
||||
pNewUser->SetTimestampAppend(WebSock.GetParam("appendtimestamp").ToBool());
|
||||
pNewUser->SetTimestampPrepend(WebSock.GetParam("prependtimestamp").ToBool());
|
||||
pNewUser->SetTimezone(WebSock.GetParam("timezone"));
|
||||
pNewUser->SetTimezoneOffset(WebSock.GetParam("timezoneoffset").ToDouble());
|
||||
pNewUser->SetJoinTries(WebSock.GetParam("jointries").ToUInt());
|
||||
pNewUser->SetMaxJoins(WebSock.GetParam("maxjoins").ToUInt());
|
||||
@@ -868,6 +869,7 @@ public:
|
||||
Tmpl["DefaultChanModes"] = pUser->GetDefaultChanModes();
|
||||
Tmpl["BufferCount"] = CString(pUser->GetBufferCount());
|
||||
Tmpl["TimestampFormat"] = pUser->GetTimestampFormat();
|
||||
Tmpl["Timezone"] = pUser->GetTimezone();
|
||||
Tmpl["TimezoneOffset"] = CString(pUser->GetTimezoneOffset());
|
||||
Tmpl["JoinTries"] = CString(pUser->JoinTries());
|
||||
Tmpl["MaxJoins"] = CString(pUser->MaxJoins());
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user