Commit Graph

332 Commits

Author SHA1 Message Date
Alexey Sokolov
f7919bbee3 Compare floats as floats. 2011-09-16 23:43:39 +07:00
Alexey Sokolov
b90bdf21dd Warn if config was saved in too new version. 2011-09-16 23:42:33 +07:00
Alexey Sokolov
689c330d51 Backup znc.conf when upgrading ZNC.
Now ZNC saves its version to znc.conf.
When ZNC tries to load znc.conf, it compares stored version with running
one. If the stored version is older, make a backup.
2011-09-16 23:37:30 +07:00
Uli Schlachter
b07f37b23d Backup znc.conf once when updating to networks
This copies znc.conf to znc.conf.backup, if that file doesn't exist yet.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-16 11:41:01 +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
Alexey Sokolov
fa9321ac2d Make 1st parameter of CConfig::Write() a reference.
Pointer doesn't make much sense, because File can't be NULL.
2011-09-07 02:17:42 +07:00
Kyle Fuller
855e0778ac Destroy the CIRCSock for a network when the CIRCNetwork is destroyed 2011-09-05 20:16:10 +00:00
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
b3b4e08769 Allow a user to add networks in znc --makeconfig 2011-08-25 21:17:38 +01: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
Alexey Sokolov
88033a5b3e Save listeners as a section in znc.conf 2011-08-22 03:05:11 +07: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
c456d20b21 Merge CGlobalModule(s) into CModule(s) 2011-08-21 13:34:22 +01:00
Kyle Fuller
a4b155995c Create EModuleType, creating SetType which replaces SetGlobal 2011-08-21 13:34:22 +01:00
Uli Schlachter
dcf357b1f6 Stop asking for the host name in --makepem
Come on, it's a self-signed certificate, how much value does it have anyway?
Also, it gets rid of a question during --makeconf which confuses some people.

This should now use $HOSTNAME and fall back to "host.unknown" if that isn't set.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-03 22:05:21 +02:00
Alexey Sokolov
795126031b Fix verifying listener in --makeconf.
If ZNC is compiled with IPv6, ZNC tried to verify the listener using
IPv6 regardless of what user said.

Thanks to wodim for reporting this.
2011-07-19 08:48:57 +07:00
Un1matr1x
708366d9ae remove some more of the evil trailing white spaces & tabs 2011-06-09 21:29:13 +02:00
Michael Edgar
a9ba4020db Added a global config option for IP-based session protection.
The new setting defaults to true, and is settable in the web admin panel. When
set to false, IP address checks are ignored. For users behind proxies (students,
large corporate networks) that don't guarantee a consistent IP, this makes the
web admin panel much more usable.
2011-04-13 20:24:26 -04: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
ac5c021c93 Move DEBUG() from Utils.h into new ZNCDebug.h
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 10:41:27 +02:00
Uli Schlachter
8e59f75125 Don't include FileUtils.h in znc.h or Modules.h
Both these headers only really need CFile* which can be handled with a forward
declaration.

To make this possible, some methods are moved from the header file into the
corresponding implementation file, because they used CFile or CDir static
members.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 10:21:59 +02:00
Uli Schlachter
3fa04f8c0a Handle Listeners after SSLCertFile
Else, the Listeners will ignore the SSLCertFile config option.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 09:27:08 +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
90fb9e8c29 Re-add the ISpoof{File,Format} handling which was lost
Whoops, someone here failed at rebasing stuff.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-01 21:46:14 +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
ee9686e422 Fix a stupid memleak
Where's my brown paper back...?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 19:18:11 +02:00
Uli Schlachter
a4d388b56d Improve lock file error handling
When we have an error during rehashing / config writing, we continue keeping the
old lock around since we haven't gotten rid of that one yet.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 19:07:36 +02:00
Uli Schlachter
7f3e55e72f Check for errors while writing the config
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 18:21:36 +02:00
Uli Schlachter
bff969f404 CZNC::WriteNewConfig() check for errors
This code now errors out if there is any error while writing the config. I
tested this with a full file system (full tmpfs of size 4k).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 18:15:49 +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
64b89a7f49 Update old znc config to work with the new identfile module 2011-03-30 19:48:26 +01:00
Kyle Fuller
703f2cd5bb Remove ident spoof from znc core 2011-03-30 19:16:53 +01:00
Uli Schlachter
000efa6be3 Don't try connecting users if the ISpoof is locked
This fixes various issues with slow connecting users. E.g. the users caused
themselves to be added to the ConnectThrottle map even though they didn't
actually try to connect.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 21:17:18 +02:00
Uli Schlachter
f9ffe6f417 Move m_sHomePath from CZNC to CFile
Thanks to this change, linking the following object files produces no unresolved
symbols: FileUtils.o Utils.o ZNCString.o MD5.o SHA256.o

The idea here is that ZNC is a little better modularized.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 21:05:39 +02:00
Alexey Sokolov
36ffa163a8 Make znc.cpp to be compilable again.
This was broken since d735e9d881
2011-03-28 17:26:08 +07:00
Kyle Fuller
d735e9d881 Remove some pointless if statements 2011-03-27 23:35:41 +01:00
Uli Schlachter
f69aeff3d9 Some minor cleanup
This makes the code use GetISpoofFile() instead of accessing m_sISpoofFile
directly. Additonally, CFile::GetLongName() is used for printing the filepath.

(This also removes an useless if branch, because nothing here cares if
m_sISpoofFile is empty, we just need the lock file.)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-20 11:14:56 +01:00
Uli Schlachter
cd78225482 Don't expand ~ in ISpoofFile
This way, we can write the original value back to the config. Also, this "fixes"
a bug because webadmin didn't do this step.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-20 11:14:56 +01:00
Alexey Sokolov
92304835ef Show list of common modules in --makeconfig without any question before it.
"Don't ask to ask!"
2011-02-19 21:24:50 +06:00
Alexey Sokolov
f5fe9868e1 Provide link to wiki page from header comment of znc.conf 2011-02-19 10:04:25 +06:00
Uli Schlachter
32e89efa95 Fix some minor spelling weirdness
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-18 10:46:53 +01:00
Nick Bebout
087f01e99b Fix URL to not point to sourceforge 2011-02-15 20:48:49 -06: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
8cadb672f0 Add some more infos to the recently introduced znc.conf warning header.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2237 726aef4b-f618-498e-8847-2d620e286838
2010-12-31 16:45:29 +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
0456e3f0f2 Add Getter/Setter for ConnectDelay, ServerThrottle and AnonIPLimit
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2228 726aef4b-f618-498e-8847-2d620e286838
2010-12-31 09:14:03 +00:00
psychon
128af8e893 Improve debug output for ISpoof
We now generate a DEBUG() message for all errors during ISpoof. Also, the
message from *status "ISpoof could not be written" now includes the expanded
ISpoofFile that we tried writing to.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2221 726aef4b-f618-498e-8847-2d620e286838
2010-12-30 21:11:40 +00:00
darthgandalf
2472ea7a13 Add warning header to znc.conf
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2218 726aef4b-f618-498e-8847-2d620e286838
2010-12-30 18:29:15 +00:00