Commit Graph

1487 Commits

Author SHA1 Message Date
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
9f1f8950f8 Fix crash bug in stickychan
When you are already in #znc and you did 'stick znc' (# prefix missing!),
stickychan caused segfaults or different weird behavior. This happened because
stickychan didn't handle errors from CUser::AddChan(). AddChan() can only error
out if the channel already exists, but since stickychan already checked this,
were does the error come from?
CChan's constructor does some sanity checks on the channel name. It
automatically adds the proper channel prefix (most likely #) if it's missing.
This means when stickychan checked for the channel "znc" it correctly didn't
find one. When it then tried to add "znc", it really tried adding "#znc" which
could fail if the channel was already added.

Thanks to DM8Mydog for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1500 726aef4b-f618-498e-8847-2d620e286838
2009-04-27 18:56:03 +00:00
psychon
dfd95078dd modperl also needs -Wno-missing-declarations
Now ZNC compiles with -Wmissing-declarations :)
(BTW I hate the perl headers, could some fix them app so that they cause
less warnings?)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1499 726aef4b-f618-498e-8847-2d620e286838
2009-04-26 10:14:42 +00:00
psychon
ebc79689fd Don't try to use -mimpure-text
This seems to be an unknown compiler flag in some cases.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1498 726aef4b-f618-498e-8847-2d620e286838
2009-04-26 10:08:51 +00:00
psychon
be4da7424e Utils.h: Include fcntl.h
fcntl.h is needed for fcntl() and defines like FD_CLOEXEC, F_SETFD and F_GETFD.
This worked so far, because some C++ header pulled in fcntl.h, but there are
systems out there for which this is not true. (Found on solaris)

Thanks to sartek.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1497 726aef4b-f618-498e-8847-2d620e286838
2009-04-26 07:24:57 +00:00
psychon
c963815f7b Fix configure's check for libperl
perl's LDFLAGS where included in $LIBS when checking for libperl. This meant
that e.g. the -L flag necessary for finding libperl was after the "-lperl"
argument. This made the test fail.

This moves these flags into $LDFLAGS (and later restores the old $LDFLAGS
since only modperl needs those flags, modules/Makefile.in handles that).

Thanks to sartek for reporting this is broken on solaris and testing the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1496 726aef4b-f618-498e-8847-2d620e286838
2009-04-24 18:57:25 +00:00
psychon
b03f495b2b Remove znc --encrypt-pem
ZNC can't read encrypted pem files, so it's kinda pointless that it can
generate those...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1495 726aef4b-f618-498e-8847-2d620e286838
2009-04-24 16:47:49 +00:00
prozacx
dd6c9a07f5 Added module hooks for when the buffer is being played back
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1494 726aef4b-f618-498e-8847-2d620e286838
2009-04-22 21:48:58 +00:00
prozacx
924d5717cd Removed repeat sentence since sModRet already says it was unable to load
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1493 726aef4b-f618-498e-8847-2d620e286838
2009-04-22 05:10:36 +00:00
prozacx
7d326b3c0c Added svn:ignore entries for files created during ./configure and make
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1492 726aef4b-f618-498e-8847-2d620e286838
2009-04-19 22:37:06 +00:00
psychon
9f698f61ec Fix a crash bug in CNick
CNick::GetPermStr() segfaulted if called on e.g. the CNick from OnChanMsg().

Thanks to stebi3 for the bug report via the sf.net bug tracker.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1491 726aef4b-f618-498e-8847-2d620e286838
2009-04-16 10:33:28 +00:00
psychon
6faf0980b9 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1490 726aef4b-f618-498e-8847-2d620e286838
2009-04-13 08:18:35 +00:00
psychon
c4972caafe fail2ban: Add number of allowed failed logins
This adds a new, second argument to fail2ban which is the number of failed
logins one is allowed before being banned. Each login attempt resets the
timeout. This value defaults to 2.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1489 726aef4b-f618-498e-8847-2d620e286838
2009-04-11 20:06:13 +00:00
psychon
8c8577e71d Add TCacheMap::GetTTL()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1488 726aef4b-f618-498e-8847-2d620e286838
2009-04-11 20:04:21 +00:00
psychon
557b096714 Turn TCacheMap into more of a map
This adds a second template parameter to TCacheMap which is the value which is
saved in the map. This second parameter can be retrived with the new
TCacheMap::GetItem() and set with a new second argument to TCacheMap::AddItem()


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1487 726aef4b-f618-498e-8847-2d620e286838
2009-04-11 19:24:55 +00:00
psychon
424e6c1820 partyline: Fix the KICK sent for deleted users
Before this, the KICK message was missing a target which was kicked.
Now the user kicks himself. :)

Thanks to JoeK for reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1486 726aef4b-f618-498e-8847-2d620e286838
2009-04-09 08:22:20 +00:00
psychon
2f64dffee3 Partyline: Add defines for the used channel prefix
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1485 726aef4b-f618-498e-8847-2d620e286838
2009-04-07 16:14:14 +00:00
psychon
02d6546a0b Add support for per-channel settings to admin
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1484 726aef4b-f618-498e-8847-2d620e286838
2009-04-07 11:38:17 +00:00
psychon
e553116891 Print more useful error messages when binding a listening port fails
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1483 726aef4b-f618-498e-8847-2d620e286838
2009-04-07 06:48:51 +00:00
psychon
23494aa4c2 Get rid of some now-empty dirs
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1482 726aef4b-f618-498e-8847-2d620e286838
2009-04-06 16:03:53 +00:00
psychon
3b9a9c2b80 Webadmin: Make this work with the browser cache
This moves all static webadmin files (images, css) to the data/ subdirectory
of the skin dir. The webadmin module is changed to redirect requests to
/<skin name>/ to that data directory. The skins are changed to use the
new URL when linking to their stuff. (I only needed to change the path to
the main.css file in each Header.tmpl. Since the .css and the images are now
in the same directory, relative URLs work just fine).

This means that we now generate different URLs after changing the webadmin
skins and the browser cache can do its thing.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1481 726aef4b-f618-498e-8847-2d620e286838
2009-04-06 16:00:23 +00:00
psychon
694b60d53b Admin: Use CString's constructor instead of reinventing the wheel
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1480 726aef4b-f618-498e-8847-2d620e286838
2009-04-06 06:45:19 +00:00
psychon
8bc4b736cd Fix a compiler warning in email
Now that GetMTime() returns a time_t...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1479 726aef4b-f618-498e-8847-2d620e286838
2009-04-05 19:09:03 +00:00
psychon
c80690a9fc admin: DelUser can now handle spaces in user names
The new CloneUser command allows one to create a user with a space in
its name and the code for reading znc.conf allows spaces too. So now
one can even get rid of this users again...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1478 726aef4b-f618-498e-8847-2d620e286838
2009-04-04 18:43:24 +00:00
psychon
5618aa2a47 admin: Add a CloneUser command
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1477 726aef4b-f618-498e-8847-2d620e286838
2009-04-04 18:41:14 +00:00
psychon
22b219dbe0 CFile::Close(): check return value of close() for errors
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1476 726aef4b-f618-498e-8847-2d620e286838
2009-04-04 11:49:15 +00:00
psychon
36707be076 Add KiNgMaR to AUTHORS
He provides native win32 builds of ZNC and writes patches to make
ZNC compile and work there. Plus he knows how to use google ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1475 726aef4b-f618-498e-8847-2d620e286838
2009-04-02 13:05:05 +00:00
psychon
0af674ac89 First argument to CHTTPSock::PrintHeader() should be of type off_t
Thanks to KiNgMaR


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1474 726aef4b-f618-498e-8847-2d620e286838
2009-04-02 12:54:12 +00:00
psychon
43e401d483 webadmin: Remove some completely useless argument to IsAdmin()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1473 726aef4b-f618-498e-8847-2d620e286838
2009-04-02 12:34:13 +00:00
psychon
63b437374d Don't ask me, I don't know
That false/true thing makes no sense and pUser was passed in to a bool
argument which means it was always true... weird...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1472 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 15:49:49 +00:00
psychon
2f5a1cafc5 Switch some code to use the new return type of GetSize()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1471 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 15:11:32 +00:00
psychon
5dda2a4098 Mark g_LongOpts in main.cpp as const
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1470 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 12:38:02 +00:00
psychon
ef27fee39b Remove some places where "znc.conf" is mentioned needlessly
CZNC::ExpandConfigPath() handles an empty string as its argument quite well, so
make all those other places use this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1469 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 12:34:07 +00:00
psychon
de2f07ecc4 Make znc --datadir some-dir --makeconf work
Without this the restart after the config is written fails, because the file
name it wants to open went through ExpandConfigPath() twice. This lead to a
path like ./some-dir/configs/some-dir/configs.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1468 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 12:25:24 +00:00
psychon
46e702ab4c Mention znc --foreground and --debug in the man page
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1467 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 12:13:33 +00:00
psychon
f9a8094455 Fix some brown paper bag bug (I hope nobody notices...)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1466 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 11:44:22 +00:00
psychon
158c189e48 Remove some unneeded magic from CString::Escape_n() (nothing major)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1465 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 09:32:16 +00:00
psychon
14ff7a85f6 Make CUser::PrintLine() a little more readable and fix the return value
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1464 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 09:18:04 +00:00
psychon
9439291e2d DCCSock: Make sure we don't cache too much data in memory
This now only reads new data from disk if there is less than 1 MiB left to be
sent, which is still a lot. Before this there was no limit and the other end of
the socket could try to make us run out of memory.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1463 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 09:07:02 +00:00
psychon
ef8b28fb68 Micro optimization
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1462 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 09:04:47 +00:00
psychon
5faa1d1d60 DCC only allows file transfers of up to 4 GiB big files
Make CDCCSock use uint32_t to generate the "unsigned, 4 byte integer in network
byte order" which is used to acknowledge the received data. Also make
OpenFile() abort for files bigger than 4 GiB, because we would run into
integer overflows later on. These transfers might work with some remote client,
but ZNC is (no longer?) one of them. ;)

Thanks to KiNgMaR for the original patch and some help with the uint32_t stuff.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1461 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 08:24:34 +00:00
psychon
90859a3f5f Small fix for ReadLine() for multi-byte line delimiters
(Oh and empty() is better (tm) than size())


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1460 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 07:56:55 +00:00
psychon
4f6d72fe49 Minor cleanup to CFile::ReadLine(), no behavior changes (I hope)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1459 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 07:52:24 +00:00
psychon
4e767b3ea7 Make CFile::Seek() take an off_t as param, not an unsigned long
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1458 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 07:34:42 +00:00
psychon
eb0d9d439e Some changes to the code rewriting znc.conf
Added some error checking and fixes a bug where the exclusive lock we use on
the config file was removed. This was because we made the kernel allocate a
new inode for the config while our lock was still on the old version of the
config file. This should now be fixed.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1457 726aef4b-f618-498e-8847-2d620e286838
2009-03-30 18:28:09 +00:00
psychon
a6300e37fa Some more const_iterator instead of iterator
Thanks KiNgMaR again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1456 726aef4b-f618-498e-8847-2d620e286838
2009-03-30 14:42:03 +00:00
psychon
57341209cb The "isSSL" param to some CSockManager functions should be a boolean
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1455 726aef4b-f618-498e-8847-2d620e286838
2009-03-30 09:36:26 +00:00
psychon
fa285b7cf9 Switch some more CFile members to more appropriate return types
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1454 726aef4b-f618-498e-8847-2d620e286838
2009-03-30 09:03:54 +00:00
psychon
5eed1f43b8 Change the return type of CFile::Get*Time() to time_t, which is more correct
Thanks to KiNgMaR for the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1453 726aef4b-f618-498e-8847-2d620e286838
2009-03-30 08:27:23 +00:00
psychon
cfdf299ae4 Remove some unneeded stuff from the --makeconf code
The ".so" suffix was already stripped in GetAvailableMods().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1452 726aef4b-f618-498e-8847-2d620e286838
2009-03-29 16:25:17 +00:00