Commit Graph

4514 Commits

Author SHA1 Message Date
Uli Schlachter
2003465489 Config: Fix some errors in the comment handling
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-01 21:46:14 +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
Kyle Fuller
233566edb6 Cleanup znc.py 2011-04-01 18:23:36 +01:00
Kyle Fuller
14452a1cb5 Make znc.py follow pep8 2011-04-01 18:23:24 +01:00
Kyle Fuller
1fc9aeefec Add __repr__ methods to CUser, CChan, CNick in modpython 2011-04-01 17:13:17 +01:00
Kyle Fuller
9db98d7cee Add __str__ methods to CModule, CUser, CChan, and CNick in modpython 2011-04-01 01:19:57 +01: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
cc2d84d4a6 CFile::TryExLock(): Use O_RDWR by default
Getting an exclusive lock on a file with TryExLock() requires write access,
therefor O_RDONLY is wrong here.

This worked back when we were using flock() for file locking, because flock()
doesn't need write access for an exclusive locks.

This fixes a bug where "--makeconf" claims that there is already a znc instance
running on the config file. This happened because it mis-interpreted the -EBADF
error from fcntl() as "something else already has a lock".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 18:10:02 +02:00
Uli Schlachter
70358cabdd CFile: Add an error flag
Whenever an error happens with some file operation, the error flag is now set.
This is especially interesting for tracking errors from Write().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 18:00:07 +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
Alexey Sokolov
45209eca33 modpython: Make strings to be stringable.
Now you can use str() on objects of znc.String.
The same is true for arguments which represent CString&.
2011-03-31 20:41:59 +07:00
Alexey Sokolov
63250c2b47 Fix recent commit of moving python to pkg-config. 2011-03-31 20:27:23 +07:00
Alexey Sokolov
b8043c3aac modpython: move CPyRetString to own header.
It was defined twice: in modpython.cpp, and in modpython.i
And there is a fake CPyRetString in modpython.i

Now both places which use real CPyRetString include the file instead.
Fake CPyRetString is still in modpython.i
2011-03-31 20:13:19 +07:00
Alexey Sokolov
ba915eb9c4 Use pkg-config for modpython.
python3-config fails when python is installed not system-wide.
It doesn't return -L/path/to/libs.
pkg-config resurns it.

Note that this changes meaning of optional argument to ./configure --enable-python=...
2011-03-31 20:13:19 +07: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
51ac51a252 Create a identfile module, this replaces the old ident spoofing built into znc 2011-03-30 19:48:12 +01:00
Kyle Fuller
703f2cd5bb Remove ident spoof from znc core 2011-03-30 19:16:53 +01:00
Kyle Fuller
7162b01111 Add the OnIRCConnectionError(CIRCSock *pIRCSock) module hook 2011-03-30 19:15:42 +01:00
Uli Schlachter
0ff6cd7491 Merge branch 'notes' of https://github.com/kylef/znc 2011-03-30 10:38:07 +02:00
Kyle Fuller
4303278424 Add a option to the notes module so that you can prevent it from sending you notes when you connect 2011-03-30 01:20:29 +01:00
Kyle Fuller
71888506b8 Make the notes module use CModCommand 2011-03-30 00:57:58 +01:00
Uli Schlachter
1042795c96 Merge branch 'pem' of https://github.com/kylef/znc 2011-03-29 20:30:11 +02:00
Alexey Sokolov
6db2ac8ac6 Fix modperl and modpython installations.
When modules' static data files were moved to own dir,
install_metadirs was removed from Makefile.
But modperl and modpython's makefiles still had dependance on it.
2011-03-30 01:21:05 +07:00
Uli Schlachter
97ce939558 Merge branch 'lastseen' of https://github.com/kylef/znc 2011-03-29 20:02:42 +02:00
Kyle Fuller
016fe49a79 Update the lastseen module to use the new CModCommand API 2011-03-28 22:46:57 +01:00
Kyle Fuller
f5665481fe If we have not seen a user in *lastseen say we never seen them. 2011-03-28 22:34:58 +01:00
Kyle Fuller
4f89834934 Make lastseen use CUser::IsIRCConnected() instead of CUser::GetCurrentServer() to determine if the user is connected to a server. 2011-03-28 22:23:08 +01:00
Kyle Fuller
4819c9ec68 Remove CreatePem.sh as this is no longer used 2011-03-28 20:38:46 +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
Uli Schlachter
fbe2b7403a Make znc compile without getopt_long
If getopt_long() (GNU extension) isn't available, we use the plain old getopt()
instead. This means that long options won't work, but at least this compiles.

Tested on Solaris 9, but should also work on Irix.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 12:30:35 +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
Alexey Sokolov
076929bb50 Merge branch 'modulesdata'
Conflicts:
	modules/Makefile.in
2011-03-28 17:15:00 +07:00
Uli Schlachter
64e565c96e Merge branch 'log' of https://github.com/MentalFS/znc 2011-03-28 11:43:03 +02:00
Uli Schlachter
b6ea6994db Merge branch 'away' of https://github.com/kylef/znc 2011-03-28 11:41:04 +02:00
Uli Schlachter
4473146018 Remove some evil trailing whitespaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 11:40:50 +02:00
Uli Schlachter
0e2b1dcc19 Merge branch 'perform' of https://github.com/kylef/znc 2011-03-28 11:40:30 +02:00
Uli Schlachter
e12c0a517e Merge branch 'attach' of https://github.com/kylef/znc 2011-03-28 11:40:08 +02:00
Uli Schlachter
61f89a0b3c Merge branch 'buildmod' of https://github.com/kylef/znc 2011-03-28 11:39:56 +02:00
Uli Schlachter
e0b7291b2d Merge branch 'notes' of https://github.com/kylef/znc 2011-03-28 11:39:39 +02:00
Uli Schlachter
1109455f30 Merge branch 'cleanup' of https://github.com/kylef/znc 2011-03-28 11:38:33 +02:00
Uli Schlachter
bc67400daa Increase the version number to 0.099
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 11:22:34 +02:00
Uli Schlachter
add7d7953e Increase the version number to 0.098
Signed-off-by: Uli Schlachter <psychon@znc.in>
znc-0.098
2011-03-28 11:22:34 +02:00
Kyle Fuller
d735e9d881 Remove some pointless if statements 2011-03-27 23:35:41 +01:00
Alexey Sokolov
e62ec2dc82 Remove bogus "Unable to find module" from modperl.
When a module tries to being loaded, modperl looks for module.pm file.
If there's no such file, it said "unable to find", which is bad
in case when it's non-perl module.

Loader of C++ modules clears sRetMsg string, so the message wasn't seen before
(except debug and ZNC startup). But modpython does nothing with it
(if python module doesn't set it itself), so in result we get stuff like
"Loaded module [xxx] [Unable to find module [xxx]] [/home/user/.znc/modules/xxx.py]"
which is pretty confusing.

So now if perl version of the module isn't found, we just pass control to next
available module loader without any error messages.

Thanks to macmaN for reporting this.
2011-03-21 11:38:34 +06:00
Kyle Fuller
0537a6cbae Add a "Get" command to the notes module which allows you to lookup a note via the key 2011-03-12 19:19:58 +00:00