mirror of
https://github.com/znc/znc.git
synced 2026-07-02 16:02:02 +02:00
Add some ExpandString() 'vars'
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1101 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -132,6 +132,17 @@ CString CUser::ExpandString(const CString& sStr) const {
|
||||
}
|
||||
|
||||
CString& CUser::ExpandString(const CString& sStr, CString& sRet) const {
|
||||
// offset is in hours, so * 60 * 60 gets us seconds
|
||||
time_t iUserTime = time(NULL) + (time_t)(m_fTimezoneOffset * 60 * 60);
|
||||
char *szTime = ctime(&iUserTime);
|
||||
CString sTime;
|
||||
|
||||
if (szTime) {
|
||||
sTime = szTime;
|
||||
// ctime() adds a trailing newline
|
||||
sTime.Trim();
|
||||
}
|
||||
|
||||
sRet = sStr;
|
||||
sRet.Replace("%user%", GetUserName());
|
||||
sRet.Replace("%defnick%", GetNick());
|
||||
@@ -140,6 +151,13 @@ CString& CUser::ExpandString(const CString& sStr, CString& sRet) const {
|
||||
sRet.Replace("%ident%", GetIdent());
|
||||
sRet.Replace("%realname%", GetRealName());
|
||||
sRet.Replace("%vhost%", GetVHost());
|
||||
sRet.Replace("%version%", CZNC::GetVersion());
|
||||
sRet.Replace("%time%", sTime);
|
||||
sRet.Replace("%uptime%", CZNC::Get().GetUptime());
|
||||
// The following lines do not exist. You must be on DrUgS!
|
||||
sRet.Replace("%znc%", "All your IRC are belong to ZNC");
|
||||
// Chosen by fair zocchihedron dice roll by SilverLeo
|
||||
sRet.Replace("%rand%", "42");
|
||||
|
||||
return sRet;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user