Permalink
Browse files

Add server time CAP and Client flag.

  • Loading branch information...
1 parent a253167 commit f7e5b41ab1f52164e73a3eda56a6fb69056d18af @stephank stephank committed Oct 15, 2011
Showing with 10 additions and 2 deletions.
  1. +2 −0 include/znc/Client.h
  2. +8 −2 src/Client.cpp
View
@@ -85,6 +85,7 @@ class CClient : public CZNCSock {
m_bNamesx = false;
m_bUHNames = false;
m_bAway = false;
+ m_bServerTime = false;
EnableReadLine();
// RFC says a line can have 512 chars max, but we are
// a little more gentle ;)
@@ -151,6 +152,7 @@ class CClient : public CZNCSock {
bool m_bNamesx;
bool m_bUHNames;
bool m_bAway;
+ bool m_bServerTime;
CUser* m_pUser;
CIRCNetwork* m_pNetwork;
CString m_sNick;
View
@@ -768,7 +768,7 @@ void CClient::HandleCap(const CString& sLine)
for (SCString::iterator i = ssOfferCaps.begin(); i != ssOfferCaps.end(); ++i) {
sRes += *i + " ";
}
- RespondCap("LS :" + sRes + "userhost-in-names multi-prefix");
+ RespondCap("LS :" + sRes + "userhost-in-names multi-prefix znc.in/server-time");
m_bInCap = true;
} else if (sSubCmd.Equals("END")) {
m_bInCap = false;
@@ -784,7 +784,7 @@ void CClient::HandleCap(const CString& sLine)
if (sCap.TrimPrefix("-"))
bVal = false;
- bool bAccepted = ("multi-prefix" == sCap) || ("userhost-in-names" == sCap);
+ bool bAccepted = ("multi-prefix" == sCap) || ("userhost-in-names" == sCap) || ("znc.in/server-time" == sCap);
GLOBALMODULECALL(IsClientCapSupported(this, sCap, bVal), bAccepted = true);
if (!bAccepted) {
@@ -804,6 +804,8 @@ void CClient::HandleCap(const CString& sLine)
m_bNamesx = bVal;
} else if ("userhost-in-names" == *it) {
m_bUHNames = bVal;
+ } else if ("znc.in/server-time" == *it) {
+ m_bServerTime = bVal;
}
GLOBALMODULECALL(OnClientCapRequest(this, *it, bVal), NOTHING);
@@ -839,6 +841,10 @@ void CClient::HandleCap(const CString& sLine)
m_bUHNames = false;
ssRemoved.insert("userhost-in-names");
}
+ if (m_bServerTime) {
+ m_bServerTime = false;
+ ssRemoved.insert("znc.in/server-time");
+ }
CString sList = "";
for (SCString::iterator i = ssRemoved.begin(); i != ssRemoved.end(); ++i) {
m_ssAcceptedCaps.erase(*i);

0 comments on commit f7e5b41

Please sign in to comment.