Commit Graph

2558 Commits

Author SHA1 Message Date
Alexey Sokolov 0ccc815dd4 Merge branch 'master' of github.com:znc/znc 2011-09-13 02:49:07 +07:00
Alexey Sokolov 3947ea9cb0 Partyline compiles again! Yay!
I didn't test this fix at all.
Any crashy (or weird behavioury) feedback welcome :)
2011-09-13 02:46:54 +07:00
Alexey Sokolov c25e24017c CString should be const& in parameters.
Especially when it's not copied inside the function.
2011-09-13 01:30:36 +07:00
Uli Schlachter a3226c2954 Anyone seen my brown paper bag?
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-12 20:04:20 +02:00
Uli Schlachter bdf0d19ce8 (Hopefully) fix all remaining module calls
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>
2011-09-12 19:55:32 +02:00
Kyle Fuller fa7ec788dd Add CIRCNetwork::ExpandString 2011-09-12 16:31:30 +00:00
Kyle Fuller 6686c0de79 Support having a nickname per network 2011-09-12 15:59:15 +00:00
Uli Schlachter 64ae6f30fb Fix ALLMODULECALL()
It didn't call network modules, so stuff like OnBoot() wasn't sent to network
modules.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-12 17:36:28 +02:00
Uli Schlachter 3e9ad07d85 Fix a crash with OnClientLogin()
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>
2011-09-12 17:31:13 +02:00
Uli Schlachter 9e3019db72 Remove MODULECALL macro
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>
2011-09-12 17:26:32 +02:00
Kyle Fuller 895d766499 Only run NETWORKMODULECALL from MODULECALL if we have a network 2011-09-12 14:32:43 +00:00
Kyle Fuller cb604a0b0d webadmin: Show a field for the network name when someone add's a network
Finally fix this before any more people complain its broken
2011-09-12 14:20:02 +00:00
Uli Schlachter ff35970318 OnClientDisconnect() always needs a valid user
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>
2011-09-11 10:50:27 +02:00
Uli Schlachter 893a631aa5 Wrap MODULECALL macros in a do-while
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>
2011-09-10 14:00:58 +02:00
Uli Schlachter 924381f663 Add a missing semicolon
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-10 14:00:47 +02:00
Uli Schlachter 3e913d49ec assert that we have a user/network on module calls
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>
2011-09-10 11:51:29 +02:00
Uli Schlachter 1e3b73c7b2 Make the debug output for raw query line up
This adds the network name to stuff sent to clients.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-08 09:57:16 +02:00
Alexey Sokolov fa9321ac2d Make 1st parameter of CConfig::Write() a reference.
Pointer doesn't make much sense, because File can't be NULL.
2011-09-07 02:17:42 +07:00
Alexey Sokolov 508ca27a4c Move CConfigEntry out of CConfig.
This exposes CConfigEntry to SWIG, and therefore to modperl/modpython.
2011-09-07 02:09:40 +07:00
Kyle Fuller eb5ac35466 modpython: We are modpython not modperl 2011-09-05 21:56:18 +00:00
Kyle Fuller b75e0b71ae modpython: Supress "Nested struct not currently supported (ignored)." warnings from 2011-09-05 21:39:59 +00:00
Kyle Fuller 855e0778ac Destroy the CIRCSock for a network when the CIRCNetwork is destroyed 2011-09-05 20:16:10 +00:00
Kyle Fuller 8945fbeb48 Check we have a network before we try to get its modules (in /msg *status listavailmods) 2011-09-05 17:38:44 +00:00
Kyle Fuller 12d1a5a422 modpython: Show (module/__init__.py) in listavailmods 2011-09-05 17:38:37 +00:00
Alexey Sokolov 9e95d1c3e1 Don't crash when loading python network modules. 2011-09-05 22:57:49 +07:00
Uli Schlachter b9fe573814 route_replies: Improve the timeout message
Fixes #57.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-05 08:22:58 +02:00
Kyle Fuller c6b74fa29d Fix CChan::TrimBuffer() (#63)
CChan::TrimBuffer() was trying to do "m_vsBuffer.begin() + -<some number>" which would cause a segmentation fault

Fixes #63
2011-09-04 19:18:26 +00:00
Uli Schlachter dbf8c2705e Upgrading to networks: Slightly rephrase a message
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>
2011-09-04 21:02:42 +02:00
Uli Schlachter 6ed10a1cf4 autocycle: Only cycle once in 15 seconds
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>
2011-09-04 21:00:06 +02:00
Alexey Sokolov 78859672e7 Move autocycle module to extra.
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.
2011-09-05 00:51:09 +07:00
Jonas Gorski 461c61fd0f fix build error when compiling against uclibc(++)
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>
2011-09-04 14:58:55 +02:00
Alexey Sokolov d252a2b4e2 Change "znc" to "ZNC". 2011-09-04 18:04:07 +07:00
Alexey Sokolov 3fe70390f5 Fix compilation after merge of 'redirects' branch.
I tested only before the merge ><
2011-09-04 11:12:41 +07:00
Alexey Sokolov 27d51d9341 Merge branch 'master' of github.com:znc/znc 2011-09-04 10:34:37 +07:00
Alexey Sokolov 982812e282 Add -r parameter of ZNC to man.
It was missing.

Thanks to flaccid for noticing that.
2011-09-04 10:33:06 +07:00
Uli Schlachter ce5d73c9cd admin: Fix getchan {inconfig,keepbuffer,detached}
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>
2011-09-02 18:21:50 +02:00
Uli Schlachter 013d0d2773 Drop @DEFS@ from the build system
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>
2011-09-02 18:21:50 +02:00
Alexey Sokolov fa7de5a11a Merge branch 'redirects' 2011-09-02 20:35:09 +07:00
Alexey Sokolov 5e73af632a Install .py files along with .pyc 2011-09-01 02:55:13 +07:00
Alexey Sokolov 8f98384512 Add a message sent to user in case of redirect. 2011-09-01 02:41:12 +07:00
Kyle Fuller d14528b59e Allow loading python modules with modpython (ex. modname/__init__.py)
Fixes #58
2011-08-31 17:26:04 +00:00
Kyle Fuller 1f16d6dc32 Let a user filter the result of help CModule::HandleHelpCommand 2011-08-31 16:26:28 +00:00
Kyle Fuller 3eaa308d28 Don't timeout bouncedcc connections, inactive bounced DCC chat's would be dropped otherwise 2011-08-31 02:09:06 +00:00
Kyle Fuller bf8b1624c9 Unload user and network modules once all the clients are gone and we are disconencted from any IRC servers.
The OnIRCDisconnected module call would cause a segmentation fault
because it would try m_pNetwork->GetModules().GetNetwork(). GetModules()
would return NULL.
2011-08-31 01:22:21 +00:00
Kyle Fuller 75d7cdffd9 Fix CALLMOD, m_pNetwork could be NULL, in this case CALLMOD would be passed a NULL network. But CALLMOD will try calling its modules anyway 2011-08-31 01:05:13 +00:00
Kyle Fuller e70b6854a3 Fix modp{erl,ython}, these modules should set a "default" module type for its submodules
These modules were broken by d48ae679c4
2011-08-30 20:50:06 +00:00
Kyle Fuller 9006fecf08 Turn stickchan into a network module, this prevents a segfault 2011-08-30 20:48:16 +00:00
Uli Schlachter 10c33112c4 Fix logging in with PASS after USER
First, we set m_sUser to the argument of USER. Later, when the PASS came in, the
username which was specified here (user/network:pass) was ignored, because
m_sUser was already set ("if (m_sUser.empty() &&" in ParseAuthLine).

The fix is to ignore if m_sUser was already set when parsing "PASS". Since this
means that the handling of PASS and USER becomes even more different, this
commit removes CClient::ParseAuthLine() again.

(The check for m_sUser.empty() can't just be dropped, because if USER comes in
after PASS, we should use the user name from PASS and ignore the USER one)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-29 13:02:55 +02:00
Uli Schlachter 9c9e40a3d7 Remove some IMHO dangerous functions
Instead, these functions are now inlined into their only caller. This should
make the user and network destruction a little saner. At least I hope so...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-29 12:52:21 +02:00
Uli Schlachter bd3e6d3f7b Partyline: Drop support for fixed channels
This doesn't fix partyline yet, but makes it a lot easier to fix.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-29 12:26:57 +02:00