This moves stuff to a two-step model. First, the new class CConfig reads the
config file, parses it and creates a in-memory model of stuff. Only then do we
actually go forward and apply the stuff.
The upside of this is that some config errors are caught before we change
anything on the running upside.
Let's see how much stuff this broke...
Signed-off-by: Uli Schlachter <psychon@znc.in>
When we have an error during rehashing / config writing, we continue keeping the
old lock around since we haven't gotten rid of that one yet.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This code now errors out if there is any error while writing the config. I
tested this with a full file system (full tmpfs of size 4k).
Signed-off-by: Uli Schlachter <psychon@znc.in>
Getting an exclusive lock on a file with TryExLock() requires write access,
therefor O_RDONLY is wrong here.
This worked back when we were using flock() for file locking, because flock()
doesn't need write access for an exclusive locks.
This fixes a bug where "--makeconf" claims that there is already a znc instance
running on the config file. This happened because it mis-interpreted the -EBADF
error from fcntl() as "something else already has a lock".
Signed-off-by: Uli Schlachter <psychon@znc.in>
Whenever an error happens with some file operation, the error flag is now set.
This is especially interesting for tracking errors from Write().
Signed-off-by: Uli Schlachter <psychon@znc.in>
This removes the following module hooks:
OnConfigLine()
OnWriteConfig()
OnWriteUserConfig()
OnWriteChanConfig()
Modules could use these hooks for writing/reading their own stuff to/from
znc.conf. However, no module (ever?) did this and IMHO no module should ever do
this either. Modules can save stuff via SetNV(), module arguments (SetArgs())
and in their GetSavePath().
Signed-off-by: Uli Schlachter <psychon@znc.in>
It was defined twice: in modpython.cpp, and in modpython.i
And there is a fake CPyRetString in modpython.i
Now both places which use real CPyRetString include the file instead.
Fake CPyRetString is still in modpython.i
python3-config fails when python is installed not system-wide.
It doesn't return -L/path/to/libs.
pkg-config resurns it.
Note that this changes meaning of optional argument to ./configure --enable-python=...
When modules' static data files were moved to own dir,
install_metadirs was removed from Makefile.
But modperl and modpython's makefiles still had dependance on it.
This fixes various issues with slow connecting users. E.g. the users caused
themselves to be added to the ConnectThrottle map even though they didn't
actually try to connect.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Thanks to this change, linking the following object files produces no unresolved
symbols: FileUtils.o Utils.o ZNCString.o MD5.o SHA256.o
The idea here is that ZNC is a little better modularized.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If getopt_long() (GNU extension) isn't available, we use the plain old getopt()
instead. This means that long options won't work, but at least this compiles.
Tested on Solaris 9, but should also work on Irix.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When a module tries to being loaded, modperl looks for module.pm file.
If there's no such file, it said "unable to find", which is bad
in case when it's non-perl module.
Loader of C++ modules clears sRetMsg string, so the message wasn't seen before
(except debug and ZNC startup). But modpython does nothing with it
(if python module doesn't set it itself), so in result we get stuff like
"Loaded module [xxx] [Unable to find module [xxx]] [/home/user/.znc/modules/xxx.py]"
which is pretty confusing.
So now if perl version of the module isn't found, we just pass control to next
available module loader without any error messages.
Thanks to macmaN for reporting this.