Commit Graph

48 Commits

Author SHA1 Message Date
psychon
b2512e55ea Display the uptime in a more readable way
This adds CString::ToTimeStr() which converts a number of seconds into
a human readable time string.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1107 726aef4b-f618-498e-8847-2d620e286838
2008-06-27 09:55:55 +00:00
psychon
daef16a3eb Replace CString::Token() with a rewritten version
In my testing this saves between 29% and 97% (!) of CPU usage. Biggest speedup
happens with long tokens being returned.
This is because the old version uses std::string::operator+(char) to construct
the returned string, while the new one uses std::string::substr() only once.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1065 726aef4b-f618-498e-8847-2d620e286838
2008-05-24 17:05:07 +00:00
psychon
5ddf977b16 Fix CString::RandomString() to not insert NULL bytes in its result
sizeof() also includes the trailing NULL byte and thus that character was
chosen sometimes, too.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1052 726aef4b-f618-498e-8847-2d620e286838
2008-05-12 19:35:15 +00:00
psychon
ac2dc42f18 Make CString::RandomString() produce something more random
Instead of A-Z we now use A-Z,a-z,0-9,!?.,:;/*-+()
This means our random strings are now 2.5 times more random :).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1047 726aef4b-f618-498e-8847-2d620e286838
2008-05-10 06:46:53 +00:00
psychon
005af9c2c3 CString::Split(): Skip empty tokens at the beginning for bAllowEmpty = false
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1041 726aef4b-f618-498e-8847-2d620e286838
2008-05-08 13:23:47 +00:00
psychon
6857394d71 Remove CString::ToKBytes()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1039 726aef4b-f618-498e-8847-2d620e286838
2008-05-05 21:39:09 +00:00
psychon
4ada00f542 Format traffic stats to not show bytes, but stuff like KiB and MiB etc
This adds CString::ToByteStr() for such jobs!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1038 726aef4b-f618-498e-8847-2d620e286838
2008-05-05 21:33:34 +00:00
psychon
c64d7bc108 Force a space between if, for, while and (
This was done via:
   sed -ir 's/if(/if (/g; s/for(/for (/g; s/while(/while (/g' \
        *.h *.cpp modules/*.cpp



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1030 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 13:08:44 +00:00
psychon
b0a1714b86 Remove useless spaces inside of braces "( stuff )"
This was generated via the following command:

  cat <file> | \
  tr "\n" "€"| \
  sed -r 's/€[\t ]*\{€/ {€/g; s/\( */(/g; s/ *\)/)/g' | \
  tr "€" "\n"

Thanks to SilverLeo for producing this mess :P


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1029 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 13:00:19 +00:00
psychon
3be33dd6c8 Don't create empty .registry files for module data
This command showed a *lot* of empty files in ZNC's data dir
  find ~/.znc -iname ".registry" -size 0|wc -l

Thanks to SilverLeo


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1010 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 09:01:55 +00:00
imaginos
c73cb82006 added optional length to CaseCmp
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@978 726aef4b-f618-498e-8847-2d620e286838
2008-03-17 04:19:36 +00:00
psychon
e72c445694 Clean up includes
All the headers are now self-contained (g++ Header.h -o /dev/null).

Some system headers where moved to the .cpp they are actually needed in,
some of our own headers are includes less. (Especially MD5.h)

Headers are sorted alphabetically while in e.g. FileUtils.cpp FileUtils.h
is the first file included.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@915 726aef4b-f618-498e-8847-2d620e286838
2008-01-07 21:31:16 +00:00
psychon
eeec633e30 Update copyright header for 2008
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@910 726aef4b-f618-498e-8847-2d620e286838
2008-01-07 21:13:07 +00:00
psychon
a09a7e79f6 Switch to the copyright headers the GPLv2 wants us to have
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@843 726aef4b-f618-498e-8847-2d620e286838
2007-09-21 18:55:33 +00:00
psychon
a1cf02b2ce Eliminate some dead code and remove code duplication
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@832 726aef4b-f618-498e-8847-2d620e286838
2007-08-19 18:08:27 +00:00
prozacx
6dcacaa79e Added contact info
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@752 726aef4b-f618-498e-8847-2d620e286838
2006-09-13 07:39:48 +00:00
prozacx
61a07301a1 Fixed bug when escaping FROM html
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@715 726aef4b-f618-498e-8847-2d620e286838
2006-03-26 20:45:04 +00:00
prozacx
3572582995 Call base class ctors
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@694 726aef4b-f618-498e-8847-2d620e286838
2006-03-16 05:37:36 +00:00
prozacx
a9e60b43c5 Migrated away from CString::ToString() in favor of explicit constructors
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@669 726aef4b-f618-498e-8847-2d620e286838
2006-02-25 09:43:35 +00:00
prozacx
ecf431f246 Added CTemplate support which included upgrading String.cpp/h and FileUtils.cpp/h and fixing some issues
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@603 726aef4b-f618-498e-8847-2d620e286838
2006-02-05 05:01:53 +00:00
prozacx
ec9e0b5614 Added Split() for splitting into a set
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@597 726aef4b-f618-498e-8847-2d620e286838
2006-01-22 06:02:29 +00:00
prozacx
8e52d497bd Added Replace_n() and fixed internal loop bug in Replace() (thanks psycho for finding it)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@595 726aef4b-f618-498e-8847-2d620e286838
2006-01-06 18:53:09 +00:00
prozacx
a50644dd8a Added ifdefs for HAVE_LIBSSL
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@536 726aef4b-f618-498e-8847-2d620e286838
2005-09-26 06:28:57 +00:00
prozacx
5e4ba2e39f Added Encrypt/Decrypt functions for doing blowfish CBC - also added some base64 wrapper functions
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@535 726aef4b-f618-498e-8847-2d620e286838
2005-09-26 06:20:52 +00:00
prozacx
a88cea430b Fixed a unsigned vs signed issue with Base64Decode()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@534 726aef4b-f618-498e-8847-2d620e286838
2005-09-26 02:59:34 +00:00
prozacx
0e126ee090 Added *Chomp_n() functions and Base64Encode()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@533 726aef4b-f618-498e-8847-2d620e286838
2005-09-25 07:54:29 +00:00
prozacx
04ae4db71a Fixed Base64Decode() to be binary safe
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@512 726aef4b-f618-498e-8847-2d620e286838
2005-09-20 01:56:07 +00:00
prozacx
6249e41c6f Renamed md5.cpp/h to MD5.cpp/h
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@468 726aef4b-f618-498e-8847-2d620e286838
2005-09-07 05:16:01 +00:00
prozacx
69ef944abc Added HTML escaping
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@463 726aef4b-f618-498e-8847-2d620e286838
2005-09-06 23:10:12 +00:00
prozacx
30e98ba2bb Added ToBool()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@409 726aef4b-f618-498e-8847-2d620e286838
2005-07-05 09:21:16 +00:00
prozacx
0148a28aec Added Trim*_n() functions and renamed Right/LeftTrim to TrimLeft/Right
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@406 726aef4b-f618-498e-8847-2d620e286838
2005-07-04 23:25:36 +00:00
prozacx
98378cd86b Added Base64Decode
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@403 726aef4b-f618-498e-8847-2d620e286838
2005-07-01 23:50:22 +00:00
prozacx
a5be6f70d4 Added Split()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@400 726aef4b-f618-498e-8847-2d620e286838
2005-07-01 18:50:20 +00:00
prozacx
edf0434fde Added Escape() and Split() - Changed Token to split on a string rather than char
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@397 726aef4b-f618-498e-8847-2d620e286838
2005-06-30 21:50:21 +00:00
prozacx
e5e9a5875a Changed some whitespace
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@381 726aef4b-f618-498e-8847-2d620e286838
2005-06-11 16:08:11 +00:00
prozacx
abfa561648 Added ToShort() and ToUShort()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@380 726aef4b-f618-498e-8847-2d620e286838
2005-06-06 03:51:36 +00:00
prozacx
4cf53fc7dc Added Replace()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@360 726aef4b-f618-498e-8847-2d620e286838
2005-05-26 09:14:40 +00:00
prozacx
30c3bff700 Added ToUInt() and ToInt()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@312 726aef4b-f618-498e-8847-2d620e286838
2005-05-16 01:27:56 +00:00
imaginos
1f4f4aab64 finished building out module/user based registry system (round 1)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@299 726aef4b-f618-498e-8847-2d620e286838
2005-05-15 03:49:11 +00:00
imaginos
8a1b797187 added MCString, including some filtering capabilities and disk writing
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@298 726aef4b-f618-498e-8847-2d620e286838
2005-05-15 03:05:08 +00:00
prozacx
fec4e87687 Added ToString() overloads for char and unsigned char
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@279 726aef4b-f618-498e-8847-2d620e286838
2005-05-14 00:20:07 +00:00
imaginos
3b3944efbe added some number conversion code
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@274 726aef4b-f618-498e-8847-2d620e286838
2005-05-12 19:31:54 +00:00
prozacx
956f203b6e Fixed bug in RightTrim() and LeftTrim() for empty strings
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@257 726aef4b-f618-498e-8847-2d620e286838
2005-05-10 21:40:00 +00:00
prozacx
ae8d522a99 Added code for WildCmp()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@255 726aef4b-f618-498e-8847-2d620e286838
2005-05-10 21:06:56 +00:00
prozacx
1c5981ee6d Added AsUpper() and AsLower()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@250 726aef4b-f618-498e-8847-2d620e286838
2005-05-08 07:50:20 +00:00
prozacx
511832a8d6 Moved CUtils::Trim() into CString class
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@247 726aef4b-f618-498e-8847-2d620e286838
2005-05-08 04:30:14 +00:00
prozacx
5f61128b18 Changed Token() and Ellipsize() to const
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@243 726aef4b-f618-498e-8847-2d620e286838
2005-05-07 08:56:25 +00:00
prozacx
7f0215de40 CString class
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@239 726aef4b-f618-498e-8847-2d620e286838
2005-05-03 22:12:22 +00:00