This is required to make sure that zncconfig.h is the very first header that is
being included.
This problem was noticed by someone reporting some "macro redefined" warnings.
Signed-off-by: Uli Schlachter <psychon@znc.in>
That macro currently was broken. It added flags to $CFLAGS but then called the
C++ compiler. The result was that ZNC didn't compile with GCC 3, because it
tried to use -fvisibility=hidden which isn't supported in that GCC version.
A list of changes done to this macro is contained in a comment.
Signed-off-by: Uli Schlachter <psychon@znc.in>
ZNC is written in C++ and doesn't need a C compiler. This redefine let's us
catch code which accidentally uses the C compiler.
Currently this means that we break due to gl_VISIBILITY.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Now ZNC saves its version to znc.conf.
When ZNC tries to load znc.conf, it compares stored version with running
one. If the stored version is older, make a backup.
It pretty much always returned an empty string (or rather: whatever was in the
return variable before, which is an empty string in 99% of cases).
Signed-off-by: Uli Schlachter <psychon@znc.in>
These calls really should be network module calls, so this fixed
NETWORKMODULECALL() to again silently do nothing if the network is NULL.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This should turn all network module calls which could use NULL for the network
into user module calls. I'm not sure if this is the right thing to do, but for
now this might be the easiest fix.
Signed-off-by: Uli Schlachter <psychon@znc.in>
A client doesn't necessarily have a network after logging in (e.g. could have
used an invalid network name).
This is another crash found by exoa, thanks.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Depending on which of its arguments where NULL, that macro called network / user
modules or not. While this is nice in that it avoids crashes, this behavior
actually surprised me and I'd rather have the caller explicitly say what it
wanted to do.
This macro is replaced with explicit calls to {GLOBAL,USER,NETWORKMODULECALL}.
Since there are actually module calls which do provide a CClient*, but may
happen before login (OnUnknownUserRaw() and the 3 CAP hooks), those are changed
to get the client pointer as their first argument. This should make it more
obvious that these module calls are special.
This commit should make it easier to catch bugs like the recent
OnClientDisconnected() with m_pUser == NULL.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If a client disconnected before completing the authentication,
OnClientDisconnect() was called with m_pUser == NULL. This problem is new since
previously MODULECALL silently failed if it got a NULL.
Thanks to ex0a for repeatedly crashing his znc to figure this out. :-P
Signed-off-by: Uli Schlachter <psychon@znc.in>
This makes sure that there is a semicolon after his macro call and that this
macro works correctly in an if, e.g. if (foo) MODULECALL(foo);
Signed-off-by: Uli Schlachter <psychon@znc.in>
exoa found a bug where OnClientDisconnected() was called with m_pUser = NULL
when a client disconnected before logging in which blows up further down the
road.
This stuff should *never* be called with NULL pointers, despite the if which it
has. E.g. the above case skipped user modules, but global modules where still
called with a NULL pointer which they didn't expect nor handle for
OnClientDisconnected().
Signed-off-by: Uli Schlachter <psychon@znc.in>
Someone was confused by the "[user]" part since he expected his username to be
printed there. The fix: Just remove that part.
Signed-off-by: Uli Schlachter <psychon@znc.in>