Commit Graph

2038 Commits

Author SHA1 Message Date
psychon
235b10c200 Use that new define everywhere
Now there are no uses of DEBUG_ONLY() left :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1349 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 16:51:54 +00:00
psychon
8d8bbb0920 Add a DEBUG() define which can be used for outputting debug info
DEBUG_ONLY() is only ever used for debug output, so adding a separate define
for this sounds like a good idea.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1348 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 16:50:40 +00:00
psychon
136a62707b savebuff: substr() could throw an exception, use Left() instead
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1347 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 15:33:47 +00:00
psychon
48ee5c71c5 Check in CZNC::AddUser() if the username is still available
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1346 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 11:12:36 +00:00
psychon
74f9f3e864 Savebuff: Don't reload old channel buffers
Channel buffers are loaded from disk when we join a channel (OnJoin) and when
the module is loaded (OnBoot(), called from OnLoad()) and only if KeepBuffer
for that channel is turned on. So every case is handled.
If we now also load channel buffers in SaveBufferToDisk() we will only reload
old channel buffers which were deleted since then
(e.g. /msg *status clearallchannelbuffers).

Thanks to Julian for finding this bug and helping me debug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1345 726aef4b-f618-498e-8847-2d620e286838
2009-01-24 19:10:05 +00:00
psychon
620c72a2ac Add a ModHandle typedef instead of using void* directly
This makes it clearer what this variable is and it makes porting to windows
easier, because we can just change the typedef to HMODULE.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1344 726aef4b-f618-498e-8847-2d620e286838
2009-01-24 09:11:50 +00:00
psychon
7ab0b8d959 Make GetPass() return a CString instead of a char*
In theory this could lead to extra copies of the password in memory, but since
no caller actually makes sure that those passwords are forgotten as fast as
possible, I don't see why this should be done the Old Way(tm).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1343 726aef4b-f618-498e-8847-2d620e286838
2009-01-23 18:46:39 +00:00
psychon
a92694c471 Use unsigned int instead of uint in the one place where it is currently used
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1342 726aef4b-f618-498e-8847-2d620e286838
2009-01-23 14:20:24 +00:00
psychon
fb54bc2fc4 Cleanup: Remove an unnecessary scope operator
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1341 726aef4b-f618-498e-8847-2d620e286838
2009-01-23 13:50:53 +00:00
psychon
f4618594b6 Fix a bug where ZNC would fail to send out its own ip for DCC bouncing
CUtils::GetLongIP() had a bug where it would overflow an integer for IPs
which started which a number higher than 127.
This is now fixed by using unsigned integers and doing that shift on a long.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1340 726aef4b-f618-498e-8847-2d620e286838
2009-01-22 17:52:35 +00:00
psychon
accb2e46c9 Check if lstat() is available and use stat() instead if it isn't
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1339 726aef4b-f618-498e-8847-2d620e286838
2009-01-22 11:19:42 +00:00
psychon
34337d7b76 Don't build the znc binary with position independent code
This is only needed for code that ends up in a shared object which is the
module code for us.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1338 726aef4b-f618-498e-8847-2d620e286838
2009-01-21 13:30:07 +00:00
psychon
127347825e Remove CLockFile and let CFile do its job
This shouldn't contain any major behaviour change, but there are some minor
ones. Also, the API for a shared lock wasn't used and thus is dropped.

Thanks to cnu for this idea.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1337 726aef4b-f618-498e-8847-2d620e286838
2009-01-20 13:21:29 +00:00
psychon
6345ce12fa Make O_RDONLY the default mode when opening files through CFile
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1336 726aef4b-f618-498e-8847-2d620e286838
2009-01-19 15:55:41 +00:00
psychon
9210bdc97e Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1335 726aef4b-f618-498e-8847-2d620e286838
2009-01-18 10:32:16 +00:00
psychon
3a2772eafa MD5: Dunno if this makes the code better or worse...
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1334 726aef4b-f618-498e-8847-2d620e286838
2009-01-17 10:25:09 +00:00
psychon
55fcaa9489 Watch: Add timestamps to the cached messages
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1333 726aef4b-f618-498e-8847-2d620e286838
2009-01-16 11:36:27 +00:00
psychon
c44d3f1751 Use RTLD_NOW instead of RTLD_LAZY when dlopen()ing modules
Now a module with unresolved symbols will fail to load instead of
potentially getting ZNC killed when an undefined symbol was used.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1332 726aef4b-f618-498e-8847-2d620e286838
2009-01-15 18:56:36 +00:00
psychon
2efea2157a webadmin: reload global modules whose settings were changed
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1331 726aef4b-f618-498e-8847-2d620e286838
2009-01-14 15:17:30 +00:00
psychon
6e880c5930 Remove maxlength="16" from the password input boxes in webadmin
This lead to silently truncated passwords which made logins a no-go.

Thanks to Julian for finding this one.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1330 726aef4b-f618-498e-8847-2d620e286838
2009-01-13 17:10:05 +00:00
silverleo
45ae051e58 Move SetArgs above the OnLoad module calls so a module can reset the args.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1329 726aef4b-f618-498e-8847-2d620e286838
2009-01-12 16:15:29 +00:00
psychon
a5f6bc3668 Makefile: Use @includedir@ instead of @prefix@/include
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1328 726aef4b-f618-498e-8847-2d620e286838
2009-01-12 16:02:20 +00:00
psychon
abc0cf82c5 Handle JOIN redirects due to +L
Without this, ZNC would keep trying to join the channel which is full
and which caused the redirect.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1327 726aef4b-f618-498e-8847-2d620e286838
2009-01-11 08:47:27 +00:00
psychon
7cb4c3fcc3 Some updates to the README file
The biggest change is that it now knows that rehashing is possible
and that we have a module data directory.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1326 726aef4b-f618-498e-8847-2d620e286838
2009-01-10 10:12:10 +00:00
psychon
9a3ff5f851 Update channel buffers for detached channels
Now ZNC produces a normal buffer playback if you re-attach a detached channel.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1325 726aef4b-f618-498e-8847-2d620e286838
2009-01-09 17:22:15 +00:00
psychon
a3169af5bd Add CUtils::SaltedHash() for doing salted hashes and do some cleanup
The stuff in CUtils::GetHashPass() and CUtils::GetSaltedHashPass() shouldn't
hurt, since we don't do such stuff in other places for passwords either.

This should improve the readability of the code a lot.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1324 726aef4b-f618-498e-8847-2d620e286838
2009-01-08 15:57:32 +00:00
psychon
efcbf7884f Always allow /msg *status setbuffer <chan>, even if we are not in <chan>
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1323 726aef4b-f618-498e-8847-2d620e286838
2009-01-07 17:38:49 +00:00
psychon
f5eff8196f Make CString::Trim*() faster
Before, they would remove one character at a time.
Now they do everything at once.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1322 726aef4b-f618-498e-8847-2d620e286838
2009-01-06 09:43:18 +00:00
psychon
9933ba9c3e Use CString::TrimRight() to make this code more readable
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1321 726aef4b-f618-498e-8847-2d620e286838
2009-01-05 11:45:12 +00:00
psychon
607a7f1c16 Get rid of most strtoul() and atoi() calls and use CString's features instead
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1320 726aef4b-f618-498e-8847-2d620e286838
2009-01-04 10:48:02 +00:00
psychon
cae48ab256 Add back substitute for @VERSION@ to configure
znc-config.in wants @VERSION@ and should also get it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1319 726aef4b-f618-498e-8847-2d620e286838
2009-01-03 09:55:21 +00:00
psychon
36505a8d29 access() is evil and we never want a controlling TTY
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1318 726aef4b-f618-498e-8847-2d620e286838
2009-01-02 17:48:20 +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
69279c516e Use fchmod() instead of chmod() if the file is already open
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1316 726aef4b-f618-498e-8847-2d620e286838
2008-12-31 14:34:55 +00:00
silverleo
3538290068 Show client IP in debug when username is not available.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1315 726aef4b-f618-498e-8847-2d620e286838
2008-12-31 13:49:29 +00:00
silverleo
d84b9c6e9e Add OnUnknownUserRaw() global module call.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1314 726aef4b-f618-498e-8847-2d620e286838
2008-12-31 12:22:38 +00:00
silverleo
d6525a8efe Fixed awaynick so it doesnt evaluate the awaynick multiple times. Also fixed a timer problem if the client disconnected before the backnicktimer fired.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1313 726aef4b-f618-498e-8847-2d620e286838
2008-12-30 23:17:50 +00:00
silverleo
e16f744ed8 Allow custom compiler flags for znc-buildmod via environment variables. Patch from flakes.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1312 726aef4b-f618-498e-8847-2d620e286838
2008-12-30 18:49:47 +00:00
psychon
b7f38c4d4a Remove some code duplications and move functions into classes
This removes ReadFile(), WriteFile(), ReadLine(), Lower() and Upper() from
Utils.h and adds CFile::ReadFile().

The biggest part of this patch fixes modules to use CFile and CString instead
of these global functions.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1311 726aef4b-f618-498e-8847-2d620e286838
2008-12-30 13:05:04 +00:00
silverleo
fdb451a908 Show arguments used to load the module instead of the description in listmods.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1310 726aef4b-f618-498e-8847-2d620e286838
2008-12-29 18:46:39 +00:00
silverleo
cc3fcc17bb Block pong replies that we requested.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1309 726aef4b-f618-498e-8847-2d620e286838
2008-12-29 18:43:47 +00:00
silverleo
05b259baef Append an * to the current server in *status listservers
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1308 726aef4b-f618-498e-8847-2d620e286838
2008-12-29 18:11:17 +00:00
psychon
8728c994db Make CChan::AddNicks() easier to understand and probably a little faster
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1307 726aef4b-f618-498e-8847-2d620e286838
2008-12-29 09:32:36 +00:00
psychon
751f267f30 Improve CFile::ReadLine() a little
IMHO it is now a little clearer how this function works and it might be
a little faster. Biggest change is that we now read 4k of the file at once
instead of reading it in 64byte chunks. I doubt that this causes a lot more
memory usage, because CFile instances usually dont live for long, but it
should really lower the number of syscalls we need for reading a file.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1306 726aef4b-f618-498e-8847-2d620e286838
2008-12-28 13:03:43 +00:00
psychon
fe86b92359 Use CSocket instead of Csock in the email module
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1305 726aef4b-f618-498e-8847-2d620e286838
2008-12-27 09:06:49 +00:00
psychon
1312e6512b Make watch save its settings and add CModule::ClearNV()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1304 726aef4b-f618-498e-8847-2d620e286838
2008-12-26 15:12:25 +00:00
psychon
458baa17f5 Some cleanup and fixes to schat
- schat now works again (yay)
- it now uses CSocket instead of Csock directly
- list only displays schat's own sockets
- other minor stuff


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1303 726aef4b-f618-498e-8847-2d620e286838
2008-12-25 08:48:59 +00:00
psychon
dd96f21d17 Make CNick smaller
This removes some not-so-important cache and uses a CString instead of a
set<unsigned char> for saving the flags this nick has (op, voice, ...).
set is huge!

Before the virtual removal (r1300), CNick had 144 bytes, without the virtuals
it only took 112 bytes. Now after this commit it is down to 40 bytes. (amd64)

Happy Christmas tomaw ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1302 726aef4b-f618-498e-8847-2d620e286838
2008-12-24 10:34:07 +00:00
psychon
7ba58aba72 Make CChan smaller
This is mostly done by removing unused members, but there is also removes a
cache which saved how many opped, voiced etc users are on a channel.
This shouldn't result in a big slowdown, since this data is only ever used
for /msg *status listchans.
Also, this replaces the API to access this data with a version which should
be faster especially for big channels.

On amd64 the size of CChan was 600 bytes before and is 400 bytes now.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1301 726aef4b-f618-498e-8847-2d620e286838
2008-12-23 10:07:54 +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