Commit Graph

207 Commits

Author SHA1 Message Date
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
Uli Schlachter
288f450ea7 Save passwords as a section in znc.conf
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-21 18:01:58 +02:00
Uli Schlachter
cce40e9f71 Move the EModuleType into CModInfo
This also renames the values to shorter and more "well sounding" names.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-21 16:30:36 +02:00
Kyle Fuller
f44f307b24 Add a config writer 2011-08-21 13:40:14 +01:00
Kyle Fuller
b2d8f2ed62 Add CModInfo::SupportsType(EModuleType) and supply a module type with CModules::LoadModule
This would allow a module support multiple module types but CModule's do
not support this currently
2011-08-21 13:34:23 +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
Alexey Sokolov
63e8d42e3d Don't fail to load if can't find fixfreenode. 2011-07-10 19:46:34 +07:00
Alexey Sokolov
4a4104a480 Add regex comment for CUser::IsValidUserName() 2011-06-02 08:10:46 +07: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
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
Uli Schlachter
f0bf7134ec Improve the handling of module load messages
Instead of doing ugly stuff to shorten the "Loaded Module [foo]" message, we now
just always generate the shorter version of that message. The code paths which
didn't do this shortening now prepend that message themselves.

The result is that every message looks the same as it did before, but the code
for generating these is a little nicer.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-02 16:52:52 +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
23fb4df67a Remove config-related module hooks
This removes the following module hooks:

OnConfigLine()
OnWriteConfig()
OnWriteUserConfig()
OnWriteChanConfig()

Modules could use these hooks for writing/reading their own stuff to/from
znc.conf. However, no module (ever?) did this and IMHO no module should ever do
this either. Modules can save stuff via SetNV(), module arguments (SetArgs())
and in their GetSavePath().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 17:29:49 +02:00
Kyle Fuller
d735e9d881 Remove some pointless if statements 2011-03-27 23:35:41 +01: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
Uli Schlachter
e7fc8fa907 CUser::AddCTCPReply(): Reject CTCP requests containing spaces
CTCP requests can't contain spaces so it's useless to specify rules for those.

This doesn't affect any of the existing callers because those use Token(0) for
generating the first argument to this function.

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
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
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
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
cflakes
a09ad1249f Raised the number of PM lines in the PM buffer to 250 (from 100)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2089 726aef4b-f618-498e-8847-2d620e286838
2010-07-17 15:02:16 +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
25fd29f594 $COMMIT_MSG
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2084 726aef4b-f618-498e-8847-2d620e286838
2010-07-10 08:11:55 +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
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
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
b9abdf06f4 Remember "automatically connect + reconnect" flag across restarts by writing it to the config file.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1852 726aef4b-f618-498e-8847-2d620e286838
2010-03-30 09:24:24 +00:00
cflakes
bb79dd338f Added "Connect to IRC & automatically re-connect" checkbox to webadmin.
Sets the internal "automatically connect" flag just like /msg *status connect and
/msg *status disconnect do. Idea by Advis0r, thanks!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1851 726aef4b-f618-498e-8847-2d620e286838
2010-03-30 09:16:09 +00:00
psychon
5b29a28a55 Move OnWrite{User,Chan}Config() to CModule
That way, user modules can write stuff to the user section, too.

OnWriteConfig() is still a global module call. A later commit will have to make
OnConfigLine() a user module hook...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1848 726aef4b-f618-498e-8847-2d620e286838
2010-03-29 19:04:37 +00:00
psychon
b0128cf130 Add new module calls for writing config entries
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1803 726aef4b-f618-498e-8847-2d620e286838
2010-03-04 13:20:44 +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
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
291ad47907 Use empty() instead of size() == 0 where appropriate
This was found by cppcheck (cppcheck.sf.net).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1761 726aef4b-f618-498e-8847-2d620e286838
2010-02-18 12:39:41 +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
psychon
596fb7aec4 Don't request the MOTD if there is none
If a new client logs in and we don't have a MOTD cached, we request it via
/motd. Since the IRC server sends it to use on connect anyway, there is no point
in requesting it if there is none. (And even if there is no MOTD, we should get
a "422 MOTD File is missing" which would be cached, so still no empty MOTD
buffer)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1728 726aef4b-f618-498e-8847-2d620e286838
2010-02-01 19:46:26 +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
cflakes
543bc51f00 Replaced the "Another client authenticated as your user, use the 'ListClients' command to see all clients" message with a configurable module ("clientnotify").
This means that you can now:
- turn off the message (it's even off by default until you load the module)
- have the message sent to you as a notice instead of a privmsg
- restrict messages to previously unseen client ip addresses only (no more spam on sucky connections)
- be notified of disconnecting clients if you want to.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1698 726aef4b-f618-498e-8847-2d620e286838
2010-01-10 11:47:56 +00:00