Commit Graph

130 Commits

Author SHA1 Message Date
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
psychon
91eefcf87b Fix a bug introduced by SilverLeo :P
If a topic was unset, this wasn't forwarded to the client the way it should be.

Thanks to SilverLeo for the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1089 726aef4b-f618-498e-8847-2d620e286838
2008-06-08 09:43:21 +00:00
psychon
d701809ac1 Allow the OnTopic module call to modify the topic
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1085 726aef4b-f618-498e-8847-2d620e286838
2008-06-06 14:26:04 +00:00
psychon
2583b7e9ff Handle channel CTCP the same way we do for private CTCPs
This patch doesn't actually change anything for private CTCPs, it's
only the indentation level that changes! (Well, and that this code gets
its own function...)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1082 726aef4b-f618-498e-8847-2d620e286838
2008-06-03 07:15:52 +00:00
psychon
ff7a6c231a Remove some unneedef #ifdef's
MODULECALL doesn't need to be wrapped in #ifdef _MODULES, since main.h
already does this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1049 726aef4b-f618-498e-8847-2d620e286838
2008-05-10 15:09:46 +00:00
psychon
7d0314f416 *Always* forward our own nick changes to clients
Thanks to SilverLeo for finding and debugging this one.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1037 726aef4b-f618-498e-8847-2d620e286838
2008-05-04 14:55:21 +00:00
psychon
c64d7bc108 Force a space between if, for, while and (
This was done via:
   sed -ir 's/if(/if (/g; s/for(/for (/g; s/while(/while (/g' \
        *.h *.cpp modules/*.cpp



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1030 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 13:08:44 +00:00
psychon
011ddfe499 Fix some stupid bug which even GCC found and warned on
Yeah, I *really* feel stupid for letting something like this slip :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1024 726aef4b-f618-498e-8847-2d620e286838
2008-04-17 15:52:55 +00:00
psychon
5f293039b5 Display better error messages if we can't connect to IRC
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1023 726aef4b-f618-498e-8847-2d620e286838
2008-04-16 19:46:26 +00:00
psychon
0a5d3013d2 Add OnTopic() module call
Thanks to SilverLeo, again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1011 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 09:03:17 +00:00
psychon
54867320dc Fix sf bug #1915864 (patch from x-x)
If you do /names #chan when you are not in #chan, you never got
the reply.

Thanks to Xaquseg for reporting.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@990 726aef4b-f618-498e-8847-2d620e286838
2008-03-22 18:39:11 +00:00
psychon
7c56ddd603 Don't forward TOPIC changes for detached channels
Thanks to JamesOff (:P) for reporting.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@976 726aef4b-f618-498e-8847-2d620e286838
2008-03-04 18:12:46 +00:00
psychon
8f22dcc60d Fix all those warnings from -Wshadow
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@964 726aef4b-f618-498e-8847-2d620e286838
2008-02-19 20:25:21 +00:00
psychon
e72c445694 Clean up includes
All the headers are now self-contained (g++ Header.h -o /dev/null).

Some system headers where moved to the .cpp they are actually needed in,
some of our own headers are includes less. (Especially MD5.h)

Headers are sorted alphabetically while in e.g. FileUtils.cpp FileUtils.h
is the first file included.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@915 726aef4b-f618-498e-8847-2d620e286838
2008-01-07 21:31:16 +00:00
psychon
eeec633e30 Update copyright header for 2008
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@910 726aef4b-f618-498e-8847-2d620e286838
2008-01-07 21:13:07 +00:00
psychon
d78369fee0 Main part is: Add disconnect and connect to *status
Other stuff included here:
- Always send the quit message when disconnecting from IRC
- Partly rewrite CConnectUserTimer::RunJob() for some de-uglification


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@874 726aef4b-f618-498e-8847-2d620e286838
2007-11-16 22:37:27 +00:00
psychon
65eb10a30e Make 'CTCPReply = VERSION' in the config cause ZNC to ignore CTCP VERSIONs
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@871 726aef4b-f618-498e-8847-2d620e286838
2007-11-12 21:32:29 +00:00
psychon
936c8f1cc9 Fix NAMESX / UHNAMES, round two (I already did so once -.-)
Only the first client having either one enabled got a proper reply, all the
following ones got an empty one.

And btw prettify this code a little. (That Token() stuff is gone)

(More lines removed then added if you dont count comments)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@857 726aef4b-f618-498e-8847-2d620e286838
2007-10-29 11:11:25 +00:00