Commit Graph

155 Commits

Author SHA1 Message Date
Uli Schlachter
f97a6a8a26 Fix network module calls
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>
2011-09-16 11:07:36 +02: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
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
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
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
d252a2b4e2 Change "znc" to "ZNC". 2011-09-04 18:04:07 +07: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
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
Kyle Fuller
d3ffdbb2a6 Part the client from the channels they are in when they used /znc JumpNetwork 2011-08-25 21:17:39 +01:00
Kyle Fuller
9b746dcc31 Change the order that modules are looked up in /msg *module
The new order is as follows:
    Network Module
    User Module
    Global Module
2011-08-24 19:07:33 +01:00
Kyle Fuller
ef2b2cf601 Make CClient network aware 2011-08-24 19:07:31 +01:00
Kyle Fuller
16047eaf81 Move dcc file transfers to their own module 2011-06-01 20:21:27 +01:00
Kyle Fuller
8f508cb4a5 Migrate dcc bouncing to its own module 2011-06-01 20:21:27 +01:00
Kyle Fuller
0b360c0102 Remove OnDCCUserSend module hook 2011-06-01 20:21:27 +01:00
Uli Schlachter
3f24f28736 Stop including FileUtils.h in any header
This causes every piece of code which wants to use CFile or CDir to have to
include FileUtils.h. This causes quite some noise.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 11:50:44 +02:00
Uli Schlachter
d2f3b8c508 Raise our IRC connection timeouts
ZNC will now send a PING if the connection was idle for 270 to 300 seconds.
After 540 seconds (that is, about 270 to 240 seconds later) the timeout is
triggered and ZNC reconnects.

These values are "inspired" by the values eggdrop uses.

The old timeouts were 180 to 210 secs for the PING and 240 secs for the timeout.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-02 23:03:33 +02:00
psychon
b9b0fd4c87 Oh, shiny... NOT
(Yes, it's that time of the year again)

Signed-off-by: Uli Schlachter <psychon@znc.in>

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2260 726aef4b-f618-498e-8847-2d620e286838
2011-01-14 17:03:24 +00:00
cflakes
7bb4ed34bd Some grammar and capitalization fixes.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2233 726aef4b-f618-498e-8847-2d620e286838
2010-12-31 15:20:40 +00:00
psychon
1023d868e4 Fix some warnings with -pedantic
"invoking macro GLOBALMODULECALL argument 4: empty macro arguments are undefined
in ISO C90 and ISO C++98"


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2177 726aef4b-f618-498e-8847-2d620e286838
2010-11-07 16:12:17 +00:00
psychon
8af157cc69 CClient: Only auth users that sent a password
We introduced a bug where sending "USER foo\r\nNICK foo\r\n" to znc would cause
an "invalid password" message even though no password was sent yet. This was
caused by a missing check.

This is easily fixed by checking whether we already received a password before
checking if the password is valid.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2117 726aef4b-f618-498e-8847-2d620e286838
2010-09-05 15:57:35 +00:00
psychon
341263f9ec Rename "vhost" to "bindhost"
"virtual host" seems to be confusing to users since they wonder why
i.am.superman doesn't work. Let's rename this to "bindhost" and perhaps it
becomes clearer what this setting does.

Thanks to SilverLeo!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2113 726aef4b-f618-498e-8847-2d620e286838
2010-08-30 08:58:29 +00:00
psychon
3dd57bdf06 Call client module hooks for built-in-core capabilities
Patch (and commit message) by DarthGandalf, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2098 726aef4b-f618-498e-8847-2d620e286838
2010-08-03 17:25:59 +00:00
psychon
88daf2fa5a Add support for CAP CLEAR from clients
Thanks to DarthGandalf for the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2097 726aef4b-f618-498e-8847-2d620e286838
2010-08-03 17:23:37 +00:00
psychon
e86008ffe0 Fix an out-of-range access to std::string
When we received a "PING" from a client without an argument, std::string would
throw a std::out_of_range exception which killed znc.

Thanks to Sm0ke0ut for reporting this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2093 726aef4b-f618-498e-8847-2d620e286838
2010-08-03 09:50:32 +00:00
psychon
47a5ab3751 Remove the CClient* argument to all module calls
OnUnknownUserRaw() and OnClientCapRequest() were both getting a CClient* as
their first argument, but the proper way to pass a CClient* argument to a module
is via GetClient(). Since recently, all the places where this module hooks are
called do this properly, so we can remove this bogus argument.

No module that is part of znc is affected by this change.
Let's see how many external ones break. ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2077 726aef4b-f618-498e-8847-2d620e286838
2010-07-09 18:02:04 +00:00
psychon
9ae959b800 Do all module calls through the macros
This commit should make sure that all module calls are done through either
MODULECALL, GLOBALMODULECALL or ALLMODULECALL. Also, in the process some module
calls where ("accidentally" ;) ) fixed to set correct values for a global
module's m_pUser during a module call.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2076 726aef4b-f618-498e-8847-2d620e286838
2010-07-08 16:43:23 +00:00
psychon
9d99e4cc8d Add module calls for client CAPs
This commit adds new module calls which make it possibly to announce new
capabilities from a module.

Thanks to DarthGandalf for the patch and for not going mad from my comments. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2071 726aef4b-f618-498e-8847-2d620e286838
2010-07-07 16:01:15 +00:00
psychon
22a641a08c Correctly handle CAP REQ
The old code only looked at the first capability request.

Found and patched by DarthGandalf, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2048 726aef4b-f618-498e-8847-2d620e286838
2010-06-30 17:39:39 +00:00
psychon
9c92d93ac4 Remove CZNC::GetUser()
CZNC::FindUser() does the same thing and we don't need two of these. GetUser()
was removed because FindUser() is used more than GetUser().

Thanks to Sthebig for noticing this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2046 726aef4b-f618-498e-8847-2d620e286838
2010-06-29 18:58:14 +00:00
psychon
bc40713b61 Rethink PING/PONG handling
All PINGs are replied by ZNC, only PINGs from the client are forwarded.
All PONGs are blocked.

This should solve all issues with annoying PONGs showing up in clients.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2043 726aef4b-f618-498e-8847-2d620e286838
2010-06-25 15:51:16 +00:00
psychon
e5ecd9c944 Micro optimization
Only call GetUser() when we actually need the result


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2028 726aef4b-f618-498e-8847-2d620e286838
2010-06-16 19:11:07 +00:00
psychon
e00fa2176e Support disabling CAPabilities
This commits adds support for cap commands like this one:
CAP REQ :-multi-prefix


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2027 726aef4b-f618-498e-8847-2d620e286838
2010-06-16 18:48:30 +00:00
psychon
d73933156a Add support for some capabilities
multi-prefix is just NAMESX' CAP name and userhost-in-names is just UHNAMES for
CAP. This makes it pretty easy to make them work. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2024 726aef4b-f618-498e-8847-2d620e286838
2010-06-13 07:46:57 +00:00
psychon
99ea9c6ff7 Implement CAP between clients and znc
Right now, znc doesn't support any capabilities, but the general protocol works.
This also has the plus point that it stops direct CAP commands between the IRCd
and clients. That's a good thing because different clients might not support the
same CAPs and thus znc would have to translate between them.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2022 726aef4b-f618-498e-8847-2d620e286838
2010-06-13 07:36:32 +00:00
psychon
f6f4e6a6f8 Move some common code into CClient::AuthUser()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2021 726aef4b-f618-498e-8847-2d620e286838
2010-06-13 07:15:35 +00:00
psychon
99f1efc843 Some more fun with tabs
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1966 726aef4b-f618-498e-8847-2d620e286838
2010-05-02 08:36:57 +00:00
psychon
82129aa2b5 MOTD: Use ExpandString()
Thanks to Un1matr1x for the idea.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1956 726aef4b-f618-498e-8847-2d620e286838
2010-04-30 18:15:50 +00:00
psychon
46b70f654d Move the HTTP/IRC switching to CIncomingConnection
This new class waits for the first line from the client and checks if it's an
HTTP request and then passes the connection on to the irc or http code.

Before this, the IRC parser handled this as a special case which wasn't as
nice-looking as this is. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1925 726aef4b-f618-498e-8847-2d620e286838
2010-04-15 18:20:12 +00:00
psychon
5d9a22f6cc Use CString::Split() in more places
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1808 726aef4b-f618-498e-8847-2d620e286838
2010-03-07 11:08:26 +00:00
psychon
f72e2f8abd Remove --disable-modules
ZNC without modules is like rain without being inside,
you really don't want that!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1794 726aef4b-f618-498e-8847-2d620e286838
2010-02-25 12:29:40 +00:00
prozacx
ad92c58c42 Initial commit of webmods - still lots of work to be done
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1784 726aef4b-f618-498e-8847-2d620e286838
2010-02-22 07:40:22 +00:00
psychon
e87f440d1c CClient::PutIRC(): Use CUser::PutIRC()
This won't save the world, but it won't destroy it either. ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1726 726aef4b-f618-498e-8847-2d620e286838
2010-01-28 19:46:06 +00:00
psychon
f99e5190cd CClient: Use CUser's IRC Socket pointer
CUser already saves the pointer to the IRC socket, so why would CClient's have
to do the same?


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1725 726aef4b-f618-498e-8847-2d620e286838
2010-01-28 19:44:37 +00:00
psychon
b50d944bb9 Use GetIRCSock() instead of m_pIRCSock directly
This patch makes the code in CClient use a wrapper function for accessing the
IRC socket. Wait and see for why I do this. ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1724 726aef4b-f618-498e-8847-2d620e286838
2010-01-28 19:40:38 +00:00
psychon
f24b1bb890 Remove a pointless if
If there is no connection to the IRC server, we can't forward a nick change
anyway, so there is no need to check for this case.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1723 726aef4b-f618-498e-8847-2d620e286838
2010-01-28 19:29:24 +00:00
psychon
72b782d93e Move all of Timers.h into User.cpp
Timers.h only contained CUserTimer and that one is only used in CUser.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1696 726aef4b-f618-498e-8847-2d620e286838
2010-01-08 16:32:27 +00:00
silverleo
07d7477dec It's 2010, where's my hoverboard?
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1693 726aef4b-f618-498e-8847-2d620e286838
2010-01-06 09:37:05 +00:00