Commit Graph

177 Commits

Author SHA1 Message Date
psychon
abeba8aea7 Simplify the connect user code a little
The old code used a timer. That timer needed to be restarted if the user list
was changed (adding / removing of users), because it saved an iterator into
that map between runs, which would become invalid.

The new code in CConnectUserTimer::RunJob() is actually more complicated now,
but the iterator is gone. This also means no need to restart that timer
more or less always. ;) (This also means one theoretical source of bugs less)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1143 726aef4b-f618-498e-8847-2d620e286838
2008-07-22 11:34:38 +00:00
psychon
10210e4619 Don't throw any exceptions in CModules::LoadModule() on version mismatch
This also removes all the code catching those exceptions. There was nothing
which justified these exceptions and removing them doesn't hurt.

ByeBye CException::EX_BadModVersion


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1137 726aef4b-f618-498e-8847-2d620e286838
2008-07-17 12:01:44 +00:00
psychon
86924339a3 Add some 'const' attributes to various functions
No real changes in here, only way more constness...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1129 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:13:06 +00:00
psychon
bf2bd39769 Add supports for salted hashes to znc.conf
These changes the format of the 'Pass' config option. The old format is
still accepted. The new format is:

  Pass = plain#<plain text password>
  Pass = md5#<password hash>
  Pass = md5#<hash of password with salt appended>#<salt>#

This also makes ZNC only write configs in the new format.

znc --makeconf and znc --makepass now always generate salted hashes.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1127 726aef4b-f618-498e-8847-2d620e286838
2008-07-13 15:32:27 +00:00
psychon
3b0a4dc4b5 Config reading: Apply a small (unnoticeable) optimization
Trim() always removes all trailing and leading spaces and line endings from
that string, so there is no point in this main loop. It will always run once,
anyway.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1124 726aef4b-f618-498e-8847-2d620e286838
2008-07-11 09:58:04 +00:00
psychon
0bd4927d2c Unify some of the webadmin and client authentication code in CZNC::AuthUser()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1114 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:34:32 +00:00
psychon
5c7b586b2d Make it more clear where the 'IRCConnectEnabled'-flag is checked
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1111 726aef4b-f618-498e-8847-2d620e286838
2008-07-03 10:16:49 +00:00
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
bcf59c56ea Add and use CZNC::GetUptime() for getting the current uptime in human readable
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1098 726aef4b-f618-498e-8847-2d620e286838
2008-06-19 08:39:10 +00:00
psychon
d397cb8ad2 Add CZNC::GetVersion()
CZNC::GetVersion() returns something like '0.057-r1234'.

This also cleans up CZNC::GetTag() a little. A theoretical buffer overflow
less and some higher speed is the result.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1097 726aef4b-f618-498e-8847-2d620e286838
2008-06-17 08:25:04 +00:00
psychon
78f8cce2c6 Add 'Uptime' command to *znc
ToDo: Use some readable format for displaying the uptime. Seconds just
don't make it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1095 726aef4b-f618-498e-8847-2d620e286838
2008-06-17 07:52:56 +00:00
psychon
b475f5d69e Make --makeconf more clear
This rephrases one of the questions asked and adds a section to the README that
explains two unclear questions.

This patch is based on a patch from Patrick Matthaei from debian.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1093 726aef4b-f618-498e-8847-2d620e286838
2008-06-14 16:17:46 +00:00
psychon
e08cb72646 Also use /etc/passwd if $HOME is set but empty
Before this, we used ./.znc as datadir in this case. Not good.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1081 726aef4b-f618-498e-8847-2d620e286838
2008-06-03 06:32:18 +00:00
psychon
5c39502342 Fix restarting of the connect user timer during rehashing
Rehashing didn't always properly restart the connect user timer.
This happened e.g. if rehashing fails because the config file doesn't exist.

To fix this, we restart this timer now in the CZNC::RehashConfig() where it
will *always* happen.

This commit fixes a crash bug! (using an invalid iterator)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1073 726aef4b-f618-498e-8847-2d620e286838
2008-05-26 14:59:41 +00:00
psychon
d0f33f8b1c The instructions at the end of makeconf showed a wrong port
This was broken since r964 from Feb 2008.

Thanks to fred for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1072 726aef4b-f618-498e-8847-2d620e286838
2008-05-26 14:56:23 +00:00
psychon
803b34c6dc Simplify this a little by using the new-and-improved (tm) CZNC::Broadcast()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1071 726aef4b-f618-498e-8847-2d620e286838
2008-05-24 21:13:36 +00:00
psychon
a773c13f69 Add bAdminOnly and pSkipClient arguments to CZNC::Broadcast
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1070 726aef4b-f618-498e-8847-2d620e286838
2008-05-24 21:12:53 +00:00
psychon
edb56b1660 Make it possible to add extra strings to the version number
This will be used for the nightly tarballs (perhabs).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1062 726aef4b-f618-498e-8847-2d620e286838
2008-05-24 15:29:52 +00:00
psychon
a77de4ea65 CUser: Save CIRCSock* instead of looking it up every time
Via profiling ZNC it was found that much CPU time was spent inside FindSockByName()
which in turn was called by CUser::GetIRCSock():

w00t volunteered to write a patch to save that pointer inside CUser and
here is the result. Thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1053 726aef4b-f618-498e-8847-2d620e286838
2008-05-13 18:18:51 +00:00
psychon
ff7a6c231a Remove some unneedef #ifdef's
MODULECALL doesn't need to be wrapped in #ifdef _MODULES, since main.h
already does this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1049 726aef4b-f618-498e-8847-2d620e286838
2008-05-10 15:09:46 +00:00
psychon
dde7921e6c Remove OnRehashDone and add OnPre/PostRehash
This patch is from SilverLeo.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1046 726aef4b-f618-498e-8847-2d620e286838
2008-05-09 14:48:06 +00:00
psychon
01bc68b1cb Move ChangeDir() and MakeDir() from CUtils to CDir
Those function were not modified. Only change is the name.

Those *Dir() functions really made no sense in CUtils when there is FileUtils
stuff. They really fit much better into here. I'll bet they'll make new friends
fast. I mean, why shouldn't they?
Uhm... sorry ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1044 726aef4b-f618-498e-8847-2d620e286838
2008-05-08 16:58:32 +00:00
psychon
fe361f7a18 Display a better error message if znc.conf cannot be opened
If znc.conf was a regular file which we just couldn't open (chmod 0), ZNC
reported that it was already running on this config.
This patch fixes this message.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1033 726aef4b-f618-498e-8847-2d620e286838
2008-04-29 12:15:48 +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
51dd3e2b32 Use unix EOLs (\n) instead of DOS ones (\r\n) for writing znc.conf
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1022 726aef4b-f618-498e-8847-2d620e286838
2008-04-15 14:33:37 +00:00
psychon
52f755f0fd Reuse the FD for locking the config for reading it
This saves us one whole open() :P
Honestly, this fixes some (stupid) locking problems with cygwin and shouldn't
hurt much otherwise (And no, cygwin still isn't supported yet).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1020 726aef4b-f618-498e-8847-2d620e286838
2008-04-08 18:53:05 +00:00
psychon
246e71fe45 Fix a memory leak in rehashing
The fake user rehashing uses was leaked completly (BAD)

Thanks to SilverLeo for reporting and x-x for making me track this one down :P


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@992 726aef4b-f618-498e-8847-2d620e286838
2008-03-24 22:22:41 +00:00
imaginos
322483ab8e decided to restore the config checking during rehash to original state. I came to what i figure is a good compromise which is to allow global modules to have config lines that are prefixed with 'GM:', thus allowing core config checking and allowing global modules to do their own config checking
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@985 726aef4b-f618-498e-8847-2d620e286838
2008-03-17 18:26:06 +00:00
imaginos
6f80fdd02f could be a global config line
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@984 726aef4b-f618-498e-8847-2d620e286838
2008-03-17 15:30:28 +00:00
imaginos
fd614b5555 inverted condition, woops
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@983 726aef4b-f618-498e-8847-2d620e286838
2008-03-17 15:13:02 +00:00
imaginos
df1c36ca08 added back the ability for global modules to handle unhandled config lines
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@980 726aef4b-f618-498e-8847-2d620e286838
2008-03-17 04:21:53 +00:00
psychon
f6d86fac43 Only save a single backup of the znc config file
The ~/.znc/configs/backups/ directory quickly got quite big, so we don't do
that but instead only save on backup as ~/.znc/configs/znc.conf-backup


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@975 726aef4b-f618-498e-8847-2d620e286838
2008-03-01 16:30:08 +00:00
psychon
cb066e2425 Add OnRehashDone() module call
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@969 726aef4b-f618-498e-8847-2d620e286838
2008-02-29 16:47:34 +00:00
psychon
46f6651ba1 Try to get the user's home (~) from the env ($HOME) by default
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@966 726aef4b-f618-498e-8847-2d620e286838
2008-02-21 16:40:14 +00:00
psychon
8f22dcc60d Fix all those warnings from -Wshadow
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@964 726aef4b-f618-498e-8847-2d620e286838
2008-02-19 20:25:21 +00:00
psychon
f74ab87e19 And fix a shitload of trailing whitespaces and space / tab mixups in ZNC
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@959 726aef4b-f618-498e-8847-2d620e286838
2008-02-16 12:52:11 +00:00
psychon
cbb0fcf881 Only read from stdin if stdin is a TTY
This fixes an endless loop on rehash.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@952 726aef4b-f618-498e-8847-2d620e286838
2008-02-10 16:46:28 +00:00
psychon
e326f6eb35 Rehash on SIGHUP
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@951 726aef4b-f618-498e-8847-2d620e286838
2008-02-10 16:45:18 +00:00
psychon
8e33a7370f Add rehashing
This is only stuff for core which users can't use yet!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@950 726aef4b-f618-498e-8847-2d620e286838
2008-02-10 16:38:57 +00:00
psychon
9a1c3874bc Remove the pid file when ZNC exits
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@948 726aef4b-f618-498e-8847-2d620e286838
2008-02-08 20:52:20 +00:00
psychon
0adf4e5af3 Remove OnConfigLine() module call
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@945 726aef4b-f618-498e-8847-2d620e286838
2008-02-07 22:25:58 +00:00
psychon
64d6d0d5af Error if a channel is defined more than once
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@944 726aef4b-f618-498e-8847-2d620e286838
2008-02-07 22:23:51 +00:00
psychon
c20f8427bb Start the connect user time in ParseConfig()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@943 726aef4b-f618-498e-8847-2d620e286838
2008-02-07 22:23:14 +00:00
psychon
077b25e77d Move the check for listeners from main() to CZNC::ParseConfig()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@942 726aef4b-f618-498e-8847-2d620e286838
2008-02-07 22:22:03 +00:00
psychon
05df4919f6 Increase the connect timeout to 2 mins
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@936 726aef4b-f618-498e-8847-2d620e286838
2008-01-20 16:55:17 +00:00
psychon
45dae8a109 Move user deletion to CUser::HandleUserDeletion()
This does not include any behaviour change.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@934 726aef4b-f618-498e-8847-2d620e286838
2008-01-20 16:24:20 +00:00
psychon
5370a54012 Add DenySetVHost patch from Veit Wahlich aka cru
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@925 726aef4b-f618-498e-8847-2d620e286838
2008-01-18 22:18:36 +00:00
psychon
47c0cb9b82 Some code clean up and change KeepBuffer and KeepNick default for --makeconf
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@924 726aef4b-f618-498e-8847-2d620e286838
2008-01-18 22:11:53 +00:00
psychon
cc20744683 Small cleanup to calling of OnBoot() for user modules
There is no reason to call it indirectly and this should also
decrease the binary size a little.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@919 726aef4b-f618-498e-8847-2d620e286838
2008-01-08 19:48:45 +00:00