Commit Graph

123 Commits

Author SHA1 Message Date
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
Kyle Fuller
fec1a3fe91 Add CIRCNetwork which now hold each IRC Connection.
This allows a user to have multiple networks.

A user can login as a network by supplying PASS [user[/network]:]pass or
USER user[/network] on connect. A user can also switch between networks
by using /msg *status JumpNetwork <network>
2011-08-24 19:07:26 +01:00
Kyle Fuller
f44f307b24 Add a config writer 2011-08-21 13:40:14 +01:00
Kyle Fuller
90f741d2ca Make the CUser::IsIRCConnected method check if the IRC connection is authed because may of its callers expect this behaviour.
This fixes a bug reported by Robby where a channel could become disabled while a the user is connected to irc, but before they have authenticated.
2011-07-29 19:21:25 +01:00
Kyle Fuller
98d8e5e37e CUser: remove some non-existant methods from the headers
These include:

- SendFile
- GetFile
- ResumeFile

Which were removed when DCC was moved out of the core
2011-06-08 04:04:08 +01:00
Kyle Fuller
c635caeab2 Use the module save path for dcc's, and remove DLPath since it is no longer used. 2011-06-01 20:21:27 +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
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
70c7745899 Overhaul the config parsing
This moves stuff to a two-step model. First, the new class CConfig reads the
config file, parses it and creates a in-memory model of stuff. Only then do we
actually go forward and apply the stuff.

The upside of this is that some config errors are caught before we change
anything on the running upside.

Let's see how much stuff this broke...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-01 21:43:05 +02:00
Uli Schlachter
d44e590336 Make CUser::m_sUserName constant
Changing the user name for a CUser instance is a really, really bad idea. There
are lots of paths that depend on the user name and only few of them are fixed up
when the user name changes.

This fixes a problem where admin's "CloneUser from to" caused problems with
modules, because all modules where loaded under the old user name and thus they
read/write NV data from the wrong directory in ~/.znc/users.

Thanks to un1matr1x for reporting this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-24 19:13:06 +01:00
Kyle Fuller
6bc36d1708 Make CModule::PutModule use CUser::PutModule 2011-02-22 22:08:08 +00:00
Uli Schlachter
c1bb18b9e8 Add CUser::DelCTCPReply()
This function is the counterpart for CUser::AddCTCPReply(). Guess what? It
removes an entry from CUser::m_mssCTCPReplies again! It's magic!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-18 14:50:12 +01: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
psychon
3ecbf13390 Use autoheader
This commit adds a zncconfig.h to ZNC that is automatically generated by
configure. This is done because the -DPACKAGE_STRING=\"znc\ 0.097\" that
configure adds to CXXFLAGS breaks znc-buildmod.

This means that we have to include zncconfig.h as the very first header in every
C++ file that is compiled. This commit kinda cheats and instead adds this
include as the very first thing to all header files we have. This should
hopefully mean that modules don't have to include this.

Because Csocket includes defines.h too late, this commit causes znc to divert
from upstream Csocket once again. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2250 726aef4b-f618-498e-8847-2d620e286838
2011-01-07 15:01:08 +00:00
psychon
6a1d27d149 Overhaul channel join handling
Instead of sending a single JOIN line for each channel, znc now tries to stuff
all of the channel that it has decided to join into a single JOIN command.

Apparently this helps with some IRCds which decide when to flood someone off
based on the number of lines received, not based on the number of bytes.

Let's hope for the best...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2182 726aef4b-f618-498e-8847-2d620e286838
2010-11-15 21:06:18 +00:00
psychon
3327a974fe Change the way CUser::JoinChans() works
Hopefully you'll soon see why I did this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2181 726aef4b-f618-498e-8847-2d620e286838
2010-11-15 20:34:36 +00:00
psychon
612b61dada Remove CUser::ConnectPaused()
Once Upon A Time, this was the only mechanism that throttled users that wanted
to connect to IRC servers. ConnectDelay and ServerThrottle now do a much better
job on this problem.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2174 726aef4b-f618-498e-8847-2d620e286838
2010-11-06 16:52:19 +00:00
psychon
b359f96886 Avoid a possibly expensive FindSockByName() for finding IRC socks
While a user is connecting to an IRC server, the CUser instance didn't know
about the CIRCSock instance (due to historic reasons). This meant that we needed
to use FindSockByName() when we had to check if there is any CIRCSock associated
with this user. However, this is a bad idea since FindSockByName() is O(n) on
the number of sockets that the socket manager is managing.

Instead, we now already set CUser::m_pIRCSock when the CIRCSock is created so
that checking for an irc socket becomes O(1).

This was inspired by the results of profiling a znc instance with 900 users.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2171 726aef4b-f618-498e-8847-2d620e286838
2010-11-06 15:21:59 +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
2becac12ba Add an optional argument to /znc jump
If you have 10 servers in your server list and you want to directly jump to e.g.
irc.foo.bar, you can now do "/znc jump irc.foo.bar".

Thanks to PsWii60 for constantly bugging me for this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2109 726aef4b-f618-498e-8847-2d620e286838
2010-08-22 12:09:47 +00:00
psychon
e4006adc11 DarthGandalf does not approve
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2085 726aef4b-f618-498e-8847-2d620e286838
2010-07-10 17:09:51 +00:00
psychon
86f3d7c745 Mark some functions as const
Thanks to vBm for running cppcheck against znc and sharing the results.
This should fix all the "foo can be const" messages.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2081 726aef4b-f618-498e-8847-2d620e286838
2010-07-10 07:51:35 +00:00
psychon
e62ca4112d Add new global setting MaxBufferSize
Previously, /znc setbuffer had a hardcoded limit of 500, other ways of setting
the buffer size didn't have any limit built-in.

This patch makes that limit configurable and makes sure the various places
honour it.

Thanks to DarthGandalf for the idea with the bForce argument, I were too
small-minded to come up with it myself. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2020 726aef4b-f618-498e-8847-2d620e286838
2010-06-12 20:20:33 +00:00
psychon
f2d7ae1a08 Change a bunch of tabs into spaces
At the beginning of lines, one uses tabs for indenting. In the middle of the
line, you use spaces. If you want two different lines to line up with each
other, you start them with the same number of tabs and use spaces for the rest
of the indenting in the "other" line.

Really, that's how one does it!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1963 726aef4b-f618-498e-8847-2d620e286838
2010-05-01 20:15:01 +00:00
cflakes
837f1f62a8 Refuse harder and print a debug warning in case some bad code
tries to write invalid lines to the config file.
Patch by DGandalf, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1962 726aef4b-f618-498e-8847-2d620e286838
2010-05-01 18:47:52 +00:00
cflakes
62a46f6fca Cleanup: Remove unused/dead "WebLogoutCounters" code from User.h.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1921 726aef4b-f618-498e-8847-2d620e286838
2010-04-15 14:58:00 +00:00
psychon
f8d0174054 Add a getter for CUser::m_bIRCAway
Patch by Loriaki via sf.net patch tracker, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1903 726aef4b-f618-498e-8847-2d620e286838
2010-04-11 11:29:55 +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
702faeeed5 Revert r1738-1742
This broke webadmin, changed CString::Token()'s behavior possibly breaking a lot
of stuff just before a release and added an unused config entry.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1748 726aef4b-f618-498e-8847-2d620e286838
2010-02-08 13:49:44 +00:00
prozacx
166f08e671 Added global/user level skin settings which will be used by a future commit of webmods
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1742 726aef4b-f618-498e-8847-2d620e286838
2010-02-07 05:06:40 +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
a68f3a6b89 Some small cleanup to CUser::Clone()
This shouldn't change anything except the readers ability to understand this
snippet (hopefully).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1658 726aef4b-f618-498e-8847-2d620e286838
2009-11-14 11:36:19 +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
4d35bd482e delserver: Allow selecting the server more exactly
Before this you could only give the hostname of a server and delserver would
delete the first server with that hostname. Now you can also specify port and
password to select the server to remove more exactly.

One can't specify the ssl flag for delserver since this would be a little ugly,
but since you can't do ssl/plain-text on the same port anyway this shouldn't be
a big problem.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1640 726aef4b-f618-498e-8847-2d620e286838
2009-09-26 18:41:24 +00:00
psychon
ab71a24bba Micro-Optimizations
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1639 726aef4b-f618-498e-8847-2d620e286838
2009-09-26 15:04:08 +00:00
psychon
5fea8a69c1 Unify CJoinTimer and CMiscTimer to CUserTimer
The CJoinTimer which fired every 20s made the user try to join channels if there
were still some channels pending.

The CMiscTimer checked every 30s if a irc or client socket is near its timeout
and sent a "PING" if it was.

The new CUserTimer now does both every 30s.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1623 726aef4b-f618-498e-8847-2d620e286838
2009-09-10 10:50:48 +00:00
psychon
cd63bae006 Add sha256 support
This imports the sha256 code from http://www.ouah.org/ogay/sha2/ (The other
hashes from sha-2 were removed). sha256 is a much stronger hashing algorithm
than md5 is (There were successful birthday attacks against md5).

All the code now defaults to creating sha256 salted hashes (The salting used is
the same as before).

Old znc.conf files can still be read.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1618 726aef4b-f618-498e-8847-2d620e286838
2009-09-07 18:55:07 +00:00
psychon
6782ba987e Split up CUser::JoinChans()
This adds CUser::JoinChan() as a helper function


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1601 726aef4b-f618-498e-8847-2d620e286838
2009-08-17 18:49:39 +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
f8178e9bc8 Fix a user-after-free bug
When a user is deleted we didn't properly clean up after it. Active DCC
connections (CDCCBounce and CDCCSock) where left laying around and at some later
point of time they used their CUser* pointer which now pointed to invalid data.

This bug is similar to the one from r1557.

Thanks to cnu, our beloved master of destruction, for finding yet another way to
make ZNC break and for testing the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1575 726aef4b-f618-498e-8847-2d620e286838
2009-07-22 16:54:52 +00:00
psychon
aaaae4e51a Micro-optimization
!m.empty() might be a littler faster than m.size() > 0, but I doubt one can
measure the difference here...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1501 726aef4b-f618-498e-8847-2d620e286838
2009-04-30 19:15:21 +00:00
psychon
c3e4a7a1e7 Add /msg *status UpdateMod[ule] which reloads an user module on all users
This command allows admins to really reload a module when they have updated it.
Because the dynamic linker does not really reload a shared object until all
handles to this object where dlclose()'d, this new command is necessary.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1418 726aef4b-f618-498e-8847-2d620e286838
2009-03-09 17:37:35 +00:00
psychon
177a5d24db Include Utils.h in less headers and move some code out of the header
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1350 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 20:07:14 +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
psychon
acd854eb1c Remove virtual where it makes no sense
This commit actually saves memory, since some classes no longer contain a
pointer to their vtable!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1300 726aef4b-f618-498e-8847-2d620e286838
2008-12-22 17:22:34 +00:00
psychon
d254240866 Remove some unused code for ipv6 from CServer (and from CUser)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1294 726aef4b-f618-498e-8847-2d620e286838
2008-12-19 13:43:56 +00:00
kroimon
d1b3c2b94d Removed AutoCycle from core
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1191 726aef4b-f618-498e-8847-2d620e286838
2008-09-07 11:23:57 +00:00