ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
CUtils Class Reference

#include <Utils.h>

+ Collaboration diagram for CUtils:

Public Member Functions

 CUtils ()
 
 ~CUtils ()
 

Static Public Member Functions

static CString GetIP (unsigned long addr)
 
static unsigned long GetLongIP (const CString &sIP)
 
static void PrintError (const CString &sMessage)
 
static void PrintMessage (const CString &sMessage, bool bStrong=false)
 
static void PrintPrompt (const CString &sMessage)
 
static void PrintAction (const CString &sMessage)
 
static void PrintStatus (bool bSuccess, const CString &sMessage="")
 
static CString GetSaltedHashPass (CString &sSalt)
 
static CString GetSalt ()
 
static CString SaltedMD5Hash (const CString &sPass, const CString &sSalt)
 
static CString SaltedSHA256Hash (const CString &sPass, const CString &sSalt)
 
static CString GetPass (const CString &sPrompt)
 
static bool GetInput (const CString &sPrompt, CString &sRet, const CString &sDefault="", const CString &sHint="")
 
static bool GetBoolInput (const CString &sPrompt, bool bDefault)
 
static bool GetBoolInput (const CString &sPrompt, bool *pbDefault=nullptr)
 
static bool GetNumInput (const CString &sPrompt, unsigned int &uRet, unsigned int uMin=0, unsigned int uMax=~0, unsigned int uDefault=~0)
 
static timeval GetTime ()
 
static unsigned long long GetMillTime ()
 
static void GenerateCert (FILE *pOut, const CString &sHost="")
 
static CString CTime (time_t t, const CString &sTZ)
 
static CString FormatTime (time_t t, const CString &sFormat, const CString &sTZ)
 
static CString FormatTime (const timeval &tv, const CString &sFormat, const CString &sTZ)
 Supports an additional format specifier for formatting sub-second values: More...
 
static CString FormatServerTime (const timeval &tv)
 
static timeval ParseServerTime (const CString &sTime)
 
static SCString GetTimezones ()
 
static SCString GetEncodings ()
 
static bool CheckCIDR (const CString &sIP, const CString &sRange)
 CIDR notation checker, e.g. More...
 
static MCString GetMessageTags (const CString &sLine)
 
static void SetMessageTags (CString &sLine, const MCString &mssTags)
 

Static Public Attributes

static const CString sDefaultHash
 

Constructor & Destructor Documentation

CUtils::CUtils ( )
CUtils::~CUtils ( )

Member Function Documentation

static bool CUtils::CheckCIDR ( const CString sIP,
const CString sRange 
)
static

CIDR notation checker, e.g.

"192.0.2.0/24" or "2001:db8::/32"

For historical reasons also allows wildcards, e.g. "192.168.*"

static CString CUtils::CTime ( time_t  t,
const CString sTZ 
)
static
static CString CUtils::FormatServerTime ( const timeval &  tv)
static
static CString CUtils::FormatTime ( time_t  t,
const CString sFormat,
const CString sTZ 
)
static
static CString CUtils::FormatTime ( const timeval &  tv,
const CString sFormat,
const CString sTZ 
)
static

Supports an additional format specifier for formatting sub-second values:

  • f - sub-second fraction
    • %3f - millisecond (default, if no width is specified)
    • %6f - microsecond

However, note that timeval only supports microsecond precision (thus, formatting with higher-than-microsecond precision will always result in trailing zeroes), and IRC server-time is specified in millisecond precision (thus formatting received timestamps with higher-than-millisecond precision will always result in trailing zeroes).

static void CUtils::GenerateCert ( FILE *  pOut,
const CString sHost = "" 
)
static
static bool CUtils::GetBoolInput ( const CString sPrompt,
bool  bDefault 
)
static
static bool CUtils::GetBoolInput ( const CString sPrompt,
bool *  pbDefault = nullptr 
)
static
static SCString CUtils::GetEncodings ( )
static
static bool CUtils::GetInput ( const CString sPrompt,
CString sRet,
const CString sDefault = "",
const CString sHint = "" 
)
static
static CString CUtils::GetIP ( unsigned long  addr)
static
static unsigned long CUtils::GetLongIP ( const CString sIP)
static
static MCString CUtils::GetMessageTags ( const CString sLine)
static
Deprecated:
Use CMessage instead
static unsigned long long CUtils::GetMillTime ( )
static
static bool CUtils::GetNumInput ( const CString sPrompt,
unsigned int &  uRet,
unsigned int  uMin = 0,
unsigned int  uMax = ~0,
unsigned int  uDefault = ~0 
)
static
static CString CUtils::GetPass ( const CString sPrompt)
static
static CString CUtils::GetSalt ( )
static
static CString CUtils::GetSaltedHashPass ( CString sSalt)
static
static timeval CUtils::GetTime ( )
static
static SCString CUtils::GetTimezones ( )
static
static timeval CUtils::ParseServerTime ( const CString sTime)
static
static void CUtils::PrintAction ( const CString sMessage)
static
static void CUtils::PrintError ( const CString sMessage)
static
static void CUtils::PrintMessage ( const CString sMessage,
bool  bStrong = false 
)
static
static void CUtils::PrintPrompt ( const CString sMessage)
static
static void CUtils::PrintStatus ( bool  bSuccess,
const CString sMessage = "" 
)
static
static CString CUtils::SaltedMD5Hash ( const CString sPass,
const CString sSalt 
)
static
static CString CUtils::SaltedSHA256Hash ( const CString sPass,
const CString sSalt 
)
static

Referenced by CUser::SaltedHash().

static void CUtils::SetMessageTags ( CString sLine,
const MCString mssTags 
)
static
Deprecated:
Use CMessage instead

Member Data Documentation

const CString CUtils::sDefaultHash
static

The documentation for this class was generated from the following file: