Permalink
Browse files

Deprecate TimezoneOffset

  • Loading branch information...
1 parent f0cab46 commit 1d4d657e23be4d4946256148c0d340164054ecb6 @DarthGandalf DarthGandalf committed Mar 22, 2012
Showing with 6 additions and 20 deletions.
  1. +0 −3 include/znc/User.h
  2. +1 −9 modules/admin.cpp
  3. +2 −2 modules/data/webadmin/tmpl/add_edit_user.tmpl
  4. +0 −2 modules/webadmin.cpp
  5. +3 −4 src/User.cpp
View
3 include/znc/User.h
@@ -123,7 +123,6 @@ class CUser {
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 SetSkinName(const CString& s) { m_sSkinName = s; }
// !Setters
@@ -162,7 +161,6 @@ class CUser {
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; }
unsigned int JoinTries() const { return m_uMaxJoinTries; }
@@ -187,7 +185,6 @@ class CUser {
MCString m_mssCTCPReplies;
CString m_sTimestampFormat;
CString m_sTimezone;
- float m_fTimezoneOffset;
eHashType m_eHashType;
// Paths
View
10 modules/admin.cpp
@@ -42,7 +42,7 @@ class CAdminMod : public CModule {
static const char* str = "String";
static const char* boolean = "Boolean (true/false)";
static const char* integer = "Integer";
- static const char* doublenum = "Double";
+ //static const char* doublenum = "Double";
static const char* vars[][2] = {
{"Nick", str},
{"Altnick", str},
@@ -59,7 +59,6 @@ class CAdminMod : public CModule {
{"Password", str},
{"JoinTries", integer},
{"Timezone", str},
- {"TimezoneOffset", doublenum},
{"Admin", boolean},
{"AppendTimestamp", boolean},
{"PrependTimestamp", boolean},
@@ -158,8 +157,6 @@ class CAdminMod : public CModule {
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")
PutModule("AppendTimestamp = " + CString(pUser->GetTimestampAppend()));
else if (sVar == "prependtimestamp")
@@ -275,11 +272,6 @@ class CAdminMod : public CModule {
pUser->SetTimezone(sValue);
PutModule("Timezone = " + pUser->GetTimezone());
}
- else if (sVar == "timezoneoffset") {
- double d = sValue.ToDouble();
- pUser->SetTimezoneOffset(d);
- PutModule("TimezoneOffset = " + CString(pUser->GetTimezoneOffset()));
- }
else if (sVar == "admin") {
if(m_pUser->IsAdmin() && pUser != m_pUser) {
bool b = sValue.ToBool();
View
4 modules/data/webadmin/tmpl/add_edit_user.tmpl
@@ -216,8 +216,8 @@
<div><input type="text" name="timestampformat" value="<? VAR TimestampFormat ?>" class="half" /></div>
</div>
<div class="subsection">
- <div class="inputlabel">Timezone Offset:</div>
- <div><input type="text" name="timezoneoffset" value="<? VAR TimezoneOffset ?>" class="third" /></div>
+ <div class="inputlabel">Timezone:</div>
+ <div><input type="text" name="timezone" value="<? VAR Timezone ?>" class="half" /></div>
</div>
<div class="subsection">
<div class="inputlabel">Join Tries:</div>
View
2 modules/webadmin.cpp
@@ -231,7 +231,6 @@ class CWebAdminMod : public CModule {
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());
if (spSession->IsAdmin()) {
@@ -920,7 +919,6 @@ class CWebAdminMod : public CModule {
Tmpl["BufferCount"] = CString(pUser->GetBufferCount());
Tmpl["TimestampFormat"] = pUser->GetTimestampFormat();
Tmpl["Timezone"] = pUser->GetTimezone();
- Tmpl["TimezoneOffset"] = CString(pUser->GetTimezoneOffset());
Tmpl["JoinTries"] = CString(pUser->JoinTries());
const set<CString>& ssAllowedHosts = pUser->GetAllowedHosts();
View
7 src/User.cpp
@@ -63,7 +63,6 @@ CUser::CUser(const CString& sUserName)
m_sUserPath = CZNC::Get().GetUserPath() + "/" + m_sUserName;
m_sTimezone = "";
- m_fTimezoneOffset = 0;
m_sNick = m_sCleanUserName;
m_sIdent = m_sCleanUserName;
m_sRealName = sUserName;
@@ -224,7 +223,9 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
SetTimezone(sValue);
}
if (pConfig->FindStringEntry("timezoneoffset", sValue)) {
- SetTimezoneOffset(sValue.ToDouble());
+ if (abs(sValue.ToDouble()) > 0.1) {
+ CUtils::PrintError("WARNING: TimezoneOffset has been deprecated, now you can set your timezone by name");
+ }
}
if (pConfig->FindStringEntry("timestamp", sValue)) {
if (!sValue.Trim_n().Equals("true")) {
@@ -670,7 +671,6 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneNetworks) {
SetTimestampPrepend(User.GetTimestampPrepend());
SetTimestampFormat(User.GetTimestampFormat());
SetTimezone(User.GetTimezone());
- SetTimezoneOffset(User.GetTimezoneOffset());
// !Flags
// Modules
@@ -821,7 +821,6 @@ CConfig CUser::ToConfig() {
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));
// Allow Hosts

0 comments on commit 1d4d657

Please sign in to comment.