Commit Graph

147 Commits

Author SHA1 Message Date
psychon
e4e9d295e5 Add a ":" to the argument list of our CAP REQ
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2012 726aef4b-f618-498e-8847-2d620e286838
2010-06-07 11:40:34 +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
cflakes
16ad0950ea Add support for an optional user-specified quit message to the DISCONNECT command that would be used instead of the message specified in the config file.
Patch by reed! Thanks!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1926 726aef4b-f618-498e-8847-2d620e286838
2010-04-23 09:09:07 +00:00
psychon
ff4c3f4f03 Don't forward our own QUITs to clients
Colloquy disconnects if it receives a QUIT from the server. Also, the old
behavior wasn't really consistent, a quit was only forwarded if the user was in
any non-detached channels.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1860 726aef4b-f618-498e-8847-2d620e286838
2010-03-30 15:09:32 +00:00
psychon
19ecd6e508 Add basic support for CAP
This adds support for the general CAP protocol and the multi-prefix and
userhost-in-names (NAMESX and UHNAMES) to znc. There is no module call for CAP
tokens yet, but if modules really want to "catch" capabilities, we should most
likely add one.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1812 726aef4b-f618-498e-8847-2d620e286838
2010-03-07 13:44:56 +00:00
psychon
ec0d52e675 Split up CIRCSock::ForwardRaw353() into two function, one which is per-client
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1810 726aef4b-f618-498e-8847-2d620e286838
2010-03-07 13:16:17 +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
698965777a Optimize our ISUPPORT token parsing
CString::Split() is nice and beautiful and way better than what we did before.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1807 726aef4b-f618-498e-8847-2d620e286838
2010-03-06 15:34:48 +00:00
psychon
1d88f564dc Fix a bunch of style suggestions from cppcheck[1]
Thanks to DarthGandalf for this patch. You must be bored. :P

[1] cppcheck.sf.net


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1776 726aef4b-f618-498e-8847-2d620e286838
2010-02-19 16:21:07 +00:00
psychon
57fe412a35 Don't let a ZNC user connect to itself
If you let your ZNC user to itself, you generate a loop. ZNC will send the
"Welcome to ZNC message" to the connected client, which is itself. So it
receives that messages and sends it to its client again, which...

We detect this situation because we see raw 001 two times, which should never
happen on a normal IRC server. To get even less than zero ;) false positive, we
only disconnect if the second raw 001 is from a server called "irc.znc.in".


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1760 726aef4b-f618-498e-8847-2d620e286838
2010-02-18 12:13:22 +00:00
psychon
fd9ed4aff1 Fix the OnKick() module call
This call works exactly as it did before (well, it no longer creates a
temporary CNick instance), but it's documentation now also describes its current
behavior.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1737 726aef4b-f618-498e-8847-2d620e286838
2010-02-06 14:54:06 +00:00
psychon
c46616376a Call OnChanAction() after OnChanCTCP()
Now these two module hooks are called in the same order as OnPrivAction() and
OnPrivCTCP().

Additionally, one can now properly block channel action's from reaching the
channel buffer via return HALTCORE; in OnChanAction.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1730 726aef4b-f618-498e-8847-2d620e286838
2010-02-03 14:46:57 +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
psychon
0f2a3b089b Query buffer: Include /me's
Before, the query buffer did include regular channel messages, but CTCP ACTIONs
were just discarded. This is now fixed.

Thanks to jarryd for finding and reporting this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1687 726aef4b-f618-498e-8847-2d620e286838
2010-01-02 13:02:33 +00:00
silverleo
13b1295119 Revert a commit from r1527 that made some PONG replies pass through to the client.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1668 726aef4b-f618-498e-8847-2d620e286838
2009-11-24 13:06:25 +00:00
psychon
ed6db33d13 Reorder the numerics in IRCSock.cpp
They are now sorted (where possible).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1656 726aef4b-f618-498e-8847-2d620e286838
2009-11-07 15:08:27 +00:00
psychon
ff4e09c594 Send correct away status on client login
If some client now sets "us" away via /away, new clients will be sent a 306
numeric after login to inform them that they are set /away.

Thanks to nobswolf for the suggestion.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1655 726aef4b-f618-498e-8847-2d620e286838
2009-11-07 14:54:45 +00:00
psychon
ade1ee5418 Add a new DCCVHost config option
If this option is set to an ip address, this one is used as the local address
for DCC connections. This can e.g. be used to "fix" DCC bouncing with ipv6
connections. Without it, this just more or less fails badly.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1647 726aef4b-f618-498e-8847-2d620e286838
2009-10-10 12:45:25 +00:00
psychon
0104d3c5dc Improve the AltNick handling
Thanks to ViciousPotato for reporting that AltNicks were truncated to 9
characters.

We assumed the server's maximum nick length to be 9 by default which made the
code truncate the AltNick to 9 characters.

Now we save the nick we sent last to the IRC server. If the server reports a
"nick is already in use" with a nick shorter than we sent it, we assume this
that the server truncated our nick to the allowed length and use this length for
our retries (appending different characters to the default nick).

Not all irc servers truncate the nick this way if it's too long, on those that
don't this patch shouldn't cause any behavior change.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1620 726aef4b-f618-498e-8847-2d620e286838
2009-09-09 10:15:36 +00:00
psychon
22bc2a6fa1 Send a "remove all user mode" MODE to clients when we lose the irc connections
Without this we could cause a client desync (ZNC still got the correct
information).

Bug reported by tomaw and patch provided by flakes, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1583 726aef4b-f618-498e-8847-2d620e286838
2009-08-01 08:59:06 +00:00
psychon
94f64333ca Fix a bug if a user uses /version
/version generates a 005 server reply. We used to cache this reply in the raw
buffer and the next user who logs in then received the same 005 reply multiple
times.

We fix this by adding CBuffer::UpdateExactLine() which does nothing if the exact
same line is already in the buffer. The only place where we (currently?) use
this is the raw 005 reply.

This should fix sf bug #2817124.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1579 726aef4b-f618-498e-8847-2d620e286838
2009-07-25 22:31:11 +00:00
psychon
442aee2baf Add and use CZNCSock instead of Csock everywhere
This class will be used to implement async DNS in a later commit.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1550 726aef4b-f618-498e-8847-2d620e286838
2009-06-29 11:26:19 +00:00
psychon
8b2ee2a940 Minor fixup
Meh, there is a point in saving the file *before* generating a diff...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1529 726aef4b-f618-498e-8847-2d620e286838
2009-05-29 20:33:45 +00:00
psychon
fc52e805dc Remove some useless check
The code checked if every line received from the IRC server started with a
colon and contained at least two spaces using a wildcard comparison. Since not
doing this would violate the IRC specs, we can safely assume this.

This command removes this if and reindents a shitload of code. The only change
in there is a removed comment, everything else should be the same.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1528 726aef4b-f618-498e-8847-2d620e286838
2009-05-29 20:29:18 +00:00
psychon
ffe92a4b66 Some minor optimizations
I doubt this makes much of a difference, but some callgrind run with one hour
of #ubuntu pointed to this stuff. Let's hope it's at least a little little
little bit faster now


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1527 726aef4b-f618-498e-8847-2d620e286838
2009-05-29 20:26:37 +00:00
psychon
860ccb7dec Remove/fix some dead code
All of this was found via warnings ("remarks") from icc.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1435 726aef4b-f618-498e-8847-2d620e286838
2009-03-20 10:00:31 +00:00
silverleo
28b23955b4 Added raw 432 processing for illegal and erroneous nicks and changed the condition to trigger SendAltNick() since ircds like to interpret the standards.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1425 726aef4b-f618-498e-8847-2d620e286838
2009-03-13 17:24:36 +00:00
psychon
e302611bd3 Only add WALLOPS to the buffer if no client is attached
Thanks to flakes for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1405 726aef4b-f618-498e-8847-2d620e286838
2009-03-01 13:07:11 +00:00
psychon
ba5610654b Improve the error messages we give for failed connect attempts... again
EADDRNOTAVAIL is generated for these failed vhosts instead of EDOM as it did
before. Yay for Csocket.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1367 726aef4b-f618-498e-8847-2d620e286838
2009-02-03 18:21:33 +00:00
psychon
235b10c200 Use that new define everywhere
Now there are no uses of DEBUG_ONLY() left :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1349 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 16:51:54 +00:00
psychon
abc0cf82c5 Handle JOIN redirects due to +L
Without this, ZNC would keep trying to join the channel which is full
and which caused the redirect.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1327 726aef4b-f618-498e-8847-2d620e286838
2009-01-11 08:47:27 +00:00
psychon
9a3ff5f851 Update channel buffers for detached channels
Now ZNC produces a normal buffer playback if you re-attach a detached channel.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1325 726aef4b-f618-498e-8847-2d620e286838
2009-01-09 17:22:15 +00:00
psychon
9933ba9c3e Use CString::TrimRight() to make this code more readable
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1321 726aef4b-f618-498e-8847-2d620e286838
2009-01-05 11:45:12 +00:00
psychon
607a7f1c16 Get rid of most strtoul() and atoi() calls and use CString's features instead
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1320 726aef4b-f618-498e-8847-2d620e286838
2009-01-04 10:48:02 +00:00
psychon
08ad0291ea Happy New Year 2009 everyone!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1317 726aef4b-f618-498e-8847-2d620e286838
2009-01-01 12:22:21 +00:00
silverleo
cc3fcc17bb Block pong replies that we requested.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1309 726aef4b-f618-498e-8847-2d620e286838
2008-12-29 18:43:47 +00:00
psychon
7ba58aba72 Make CChan smaller
This is mostly done by removing unused members, but there is also removes a
cache which saved how many opped, voiced etc users are on a channel.
This shouldn't result in a big slowdown, since this data is only ever used
for /msg *status listchans.
Also, this replaces the API to access this data with a version which should
be faster especially for big channels.

On amd64 the size of CChan was 600 bytes before and is 400 bytes now.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1301 726aef4b-f618-498e-8847-2d620e286838
2008-12-23 10:07:54 +00:00
silverleo
110485eaaf Changed ping timers and timeout settings to use more reasonable values. Also changed timeout type for irc and client sockets.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1297 726aef4b-f618-498e-8847-2d620e286838
2008-12-21 09:03:04 +00:00
silverleo
c71565103c Added OnIRCRegistration(). Patch from Freman. Thanks :)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1271 726aef4b-f618-498e-8847-2d620e286838
2008-11-24 17:56:34 +00:00
kroimon
5237a24747 Use CString::Equals() everywhere.
* (CString::CaseCmp() == 0) became CString::Equals()
* (CString::CaseCmp() != 0) became !CString::Equals()
* replaced some occurrences of strn?casecmp

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1234 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 15:15:59 +00:00
psychon
18ce52e32d Limit the maximal read buffer space that is used for every socket
CSocket caches the data read from a socket and then looks for lines in there.
If there is no line end, this buffer can grow quite large. This patch now
closes sockets if they get a huge read buffer.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1233 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 14:43:51 +00:00
psychon
03e34ac6e6 Remove KeepNick
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1151 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:34:11 +00:00
psychon
30404699e3 Handle the on-connect 433 in an own function
When our primary nick is already taken, we try a couple of different nicks in
order to be able to connect to the IRC server. This code is now in an
own function.

BTW: CIRCSock::Readline() is still waaay too long.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1149 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:34:15 +00:00
psychon
cd2fb1b1b5 Move the forwarding of raw 353 into an own function
This also contains some minor changes to the code. One of those is that we now
also handle namesx and uhnames for channels we don't know.
BTW: CIRCSock::ReadLine() is waaay too long.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1148 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:22:17 +00:00
psychon
1a1cc4c756 We are in a channel when we received the JOIN for it, not it's "end of /names"
This moves some calls from the raw 366 handler to the JOIN handler and it might
even fix a bug (well, which no one would ever have triggered).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1140 726aef4b-f618-498e-8847-2d620e286838
2008-07-21 10:15:16 +00:00
psychon
e2cb9b41e0 Please just ignore this commit and pretend the previous commit already did this
I'm ashamed...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1119 726aef4b-f618-498e-8847-2d620e286838
2008-07-08 10:24:48 +00:00
psychon
b141ef44b6 Fix a crash with NAMESX
If we were joining a channel on a server with NAMESX support while a client was
connected that didn't know NAMESX and we received a raw 353 with a trailing
whitespace (UnrealIRCd does this), we were calling std::string::at(0) for an
empty string, which caused some assert to fail and ZNC to die.

This patch fixes this crash bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1118 726aef4b-f618-498e-8847-2d620e286838
2008-07-08 10:00:42 +00:00
psychon
9e5ec2d563 CIRCSock: Only say we are reconnecting if there is a server to connect to
If you '/msg *status delserver'd your last server, you would get a message
saying ZNC will reconnect, but it didn't. Now those messages look much better.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1117 726aef4b-f618-498e-8847-2d620e286838
2008-07-08 09:38:50 +00:00
psychon
9e6d05a0bd Remove some unneeded includes from DCCBounce.h
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1106 726aef4b-f618-498e-8847-2d620e286838
2008-06-27 09:27:34 +00:00
psychon
0f3f305a87 Use ExpandString() for CTCPReply
You can now use 'wildcards' like %nick%, %user%, etc in CTCPReply


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1096 726aef4b-f618-498e-8847-2d620e286838
2008-06-17 08:22:27 +00:00