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>
This should stop all fights against ChanServ. Please note that nothing will
happen if we are the only one in the channel after 15 secs since this module
only checks if it needs to do something when someone leaves a channel.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Modern/decent networks have services anyway, and for registered channels
this module is useless. Also it tends to fight ChanServ in case if
ChanServ joins/parts the channel to remove ops.
Users of deprecated ne^W^Wnetworks without services can use it from extra.
Fixes the following error:
In file included from ZNCString.cpp:10:0:
FileUtils.h: In static member function 'static CString CDir::GetCWD()':
FileUtils.h:246:36: error: 'getcwd' was not declared in this scope
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of giving a useful result, they returned their result by sometimes
omitting the first character of the option name. Whoops.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This will only ever be set to -DHAVE_CONFIG_H. However, we shouldn't give this
flag to other people's code (e.g. through znc-config). Since we don't need it,
it's best to just drop it completely.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The OnIRCDisconnected module call would cause a segmentation fault
because it would try m_pNetwork->GetModules().GetNetwork(). GetModules()
would return NULL.