Commit Graph

1047 Commits

Author SHA1 Message Date
psychon a77de4ea65 CUser: Save CIRCSock* instead of looking it up every time
Via profiling ZNC it was found that much CPU time was spent inside FindSockByName()
which in turn was called by CUser::GetIRCSock():

w00t volunteered to write a patch to save that pointer inside CUser and
here is the result. Thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1053 726aef4b-f618-498e-8847-2d620e286838
2008-05-13 18:18:51 +00:00
psychon 5ddf977b16 Fix CString::RandomString() to not insert NULL bytes in its result
sizeof() also includes the trailing NULL byte and thus that character was
chosen sometimes, too.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1052 726aef4b-f618-498e-8847-2d620e286838
2008-05-12 19:35:15 +00:00
psychon 4e6c6fea4a Cleanup CUtils::GetLongIP()
The new version should be faster (no malloc with pseudo-memset) and it
certainly is a lot more readable.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1051 726aef4b-f618-498e-8847-2d620e286838
2008-05-12 15:38:12 +00:00
psychon bc2af5d49a Never link the ZNC binary against libsasl2
Stupid autoconf...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1050 726aef4b-f618-498e-8847-2d620e286838
2008-05-11 18:32:17 +00:00
psychon ff7a6c231a Remove some unneedef #ifdef's
MODULECALL doesn't need to be wrapped in #ifdef _MODULES, since main.h
already does this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1049 726aef4b-f618-498e-8847-2d620e286838
2008-05-10 15:09:46 +00:00
psychon 7e34dd3bfa Use -Wno-unused-parameter instead of -Wno-unused
This one causes no extra warnings and -Wno-unused-parameter is exactly the
reason why we had -Wno-unused.

According to [1], this flag exists since GCC 3.

Thanks to pippijn for telling me about this flag.

[1] http://lists.auriga.wearlab.de/pipermail/dillo-dev/2003-December/001565.html


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1048 726aef4b-f618-498e-8847-2d620e286838
2008-05-10 11:32:34 +00:00
psychon ac2dc42f18 Make CString::RandomString() produce something more random
Instead of A-Z we now use A-Z,a-z,0-9,!?.,:;/*-+()
This means our random strings are now 2.5 times more random :).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1047 726aef4b-f618-498e-8847-2d620e286838
2008-05-10 06:46:53 +00:00
psychon dde7921e6c Remove OnRehashDone and add OnPre/PostRehash
This patch is from SilverLeo.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1046 726aef4b-f618-498e-8847-2d620e286838
2008-05-09 14:48:06 +00:00
psychon b16e3ebe6c Replace CDir::MakeDir() with a version that doesn't do chdir()
This means that ZNC now doesn't break with relative data dirs (for me)
any more!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1045 726aef4b-f618-498e-8847-2d620e286838
2008-05-08 17:47:55 +00:00
psychon 01bc68b1cb Move ChangeDir() and MakeDir() from CUtils to CDir
Those function were not modified. Only change is the name.

Those *Dir() functions really made no sense in CUtils when there is FileUtils
stuff. They really fit much better into here. I'll bet they'll make new friends
fast. I mean, why shouldn't they?
Uhm... sorry ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1044 726aef4b-f618-498e-8847-2d620e286838
2008-05-08 16:58:32 +00:00
psychon 8c24ebb641 Webadmin: Remove the special rule for CVS and ignore .svn instead
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1043 726aef4b-f618-498e-8847-2d620e286838
2008-05-08 13:45:16 +00:00
psychon 8cf12e8931 Clean up FileUtils.h
This removes some commented out functions and it also
removes CFir::Exists() since CFile::IsDir() does exactly
the same job (and it uses fewer syscalls for that).



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1042 726aef4b-f618-498e-8847-2d620e286838
2008-05-08 13:32:34 +00:00
psychon 005af9c2c3 CString::Split(): Skip empty tokens at the beginning for bAllowEmpty = false
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1041 726aef4b-f618-498e-8847-2d620e286838
2008-05-08 13:23:47 +00:00
psychon 5665fd872d Update to latest Csocket
This breaks (& fixes again, as far as ZNC itself is concerened) API!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1040 726aef4b-f618-498e-8847-2d620e286838
2008-05-06 14:47:13 +00:00
psychon 6857394d71 Remove CString::ToKBytes()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1039 726aef4b-f618-498e-8847-2d620e286838
2008-05-05 21:39:09 +00:00
psychon 4ada00f542 Format traffic stats to not show bytes, but stuff like KiB and MiB etc
This adds CString::ToByteStr() for such jobs!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1038 726aef4b-f618-498e-8847-2d620e286838
2008-05-05 21:33:34 +00:00
psychon 7d0314f416 *Always* forward our own nick changes to clients
Thanks to SilverLeo for finding and debugging this one.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1037 726aef4b-f618-498e-8847-2d620e286838
2008-05-04 14:55:21 +00:00
psychon 311d20495f Call setsid() after forking
This way we get rid of our controlling terminal.
Now ZNC won't stay in the session of the shell anymore...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1036 726aef4b-f618-498e-8847-2d620e286838
2008-05-04 14:08:10 +00:00
psychon 3775748270 watch: Remove the raw /watch command
There is actually a 'real' /watch command which was blocked by this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1035 726aef4b-f618-498e-8847-2d620e286838
2008-04-30 14:09:15 +00:00
psychon 3dd274f6a6 Make znc-buildmod report failures via exit code
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1034 726aef4b-f618-498e-8847-2d620e286838
2008-04-29 18:29:59 +00:00
psychon fe361f7a18 Display a better error message if znc.conf cannot be opened
If znc.conf was a regular file which we just couldn't open (chmod 0), ZNC
reported that it was already running on this config.
This patch fixes this message.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1033 726aef4b-f618-498e-8847-2d620e286838
2008-04-29 12:15:48 +00:00
psychon c4f1eb3da3 Print a warning if a msg / notice gets lost because we are not connected to IRC
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1032 726aef4b-f618-498e-8847-2d620e286838
2008-04-25 16:30:11 +00:00
psychon c0a91af22e Makefile.in: Use $(bindir) instead of $(prefix)/bin
Also this removes a double 'prefix :=' line.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1031 726aef4b-f618-498e-8847-2d620e286838
2008-04-25 16:27:00 +00:00
psychon c64d7bc108 Force a space between if, for, while and (
This was done via:
   sed -ir 's/if(/if (/g; s/for(/for (/g; s/while(/while (/g' \
        *.h *.cpp modules/*.cpp



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1030 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 13:08:44 +00:00
psychon b0a1714b86 Remove useless spaces inside of braces "( stuff )"
This was generated via the following command:

  cat <file> | \
  tr "\n" "€"| \
  sed -r 's/€[\t ]*\{€/ {€/g; s/\( */(/g; s/ *\)/)/g' | \
  tr "€" "\n"

Thanks to SilverLeo for producing this mess :P


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1029 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 13:00:19 +00:00
psychon 0470977497 schat: Use CString's features instead of strcasecmp and friends
This also breaks long lines (longest line is now 114 chars, was 180).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1028 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 12:39:21 +00:00
psychon 5822a2de75 Fix the Makefile's dependency tracking
Turns out that .depend's mtime changes when you modify files in there
and since every .cpp file depended on .depend, make regenerated everything.
Not good.

Fix this by inlining the mkdir for .depend.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1027 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 12:21:26 +00:00
psychon 5c5cde9c34 Makefile: Always do dependency tracking
If you now change znc.h, every file that '#include's znc.h is *always*
regenerated.

According to [1], these compiler flags were already around with GCC 3.2, so
this change shouldn't hurt anyone.

[1] http://lists.samba.org/archive/ccache/2002q4/000003.html


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1026 726aef4b-f618-498e-8847-2d620e286838
2008-04-20 07:00:40 +00:00
psychon 8d5fa6bc3b Break some way too long lines into way less long lines
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1025 726aef4b-f618-498e-8847-2d620e286838
2008-04-18 09:25:28 +00:00
psychon 011ddfe499 Fix some stupid bug which even GCC found and warned on
Yeah, I *really* feel stupid for letting something like this slip :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1024 726aef4b-f618-498e-8847-2d620e286838
2008-04-17 15:52:55 +00:00
psychon 5f293039b5 Display better error messages if we can't connect to IRC
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1023 726aef4b-f618-498e-8847-2d620e286838
2008-04-16 19:46:26 +00:00
psychon 51dd3e2b32 Use unix EOLs (\n) instead of DOS ones (\r\n) for writing znc.conf
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1022 726aef4b-f618-498e-8847-2d620e286838
2008-04-15 14:33:37 +00:00
psychon 5a34291455 Shell: Don't send invalid nonsense like empty strings as ident
The shell module uses the current nick for that user as the ident for queries
from *shell. This makes no sense I once managed to get an empty ident, which
confused irssi badly.

Since there is no good reason to use this as ident, just use some
static string as ident instead.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1021 726aef4b-f618-498e-8847-2d620e286838
2008-04-11 12:25:41 +00:00
psychon 52f755f0fd Reuse the FD for locking the config for reading it
This saves us one whole open() :P
Honestly, this fixes some (stupid) locking problems with cygwin and shouldn't
hurt much otherwise (And no, cygwin still isn't supported yet).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1020 726aef4b-f618-498e-8847-2d620e286838
2008-04-08 18:53:05 +00:00
psychon 0afd0cf5dd Support channels other than #chan or &chan
Without this e.g. +chans are changed to #+chans in CChan::CChan()
because IsChan() pretends it's sure that this can't be a channel.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1019 726aef4b-f618-498e-8847-2d620e286838
2008-04-08 08:21:40 +00:00
psychon 5590307909 chansaver: Add all channels to the config when this module is loaded
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1018 726aef4b-f618-498e-8847-2d620e286838
2008-04-07 20:19:17 +00:00
psychon e24fdab787 Mark znc-config.in as executable, that way znc-config gets that too
This fixes something which long annoyed me :P


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1017 726aef4b-f618-498e-8847-2d620e286838
2008-04-05 17:09:30 +00:00
psychon 654a55a507 Send PONGs for client's PINGs if we are not connected to a server
Thanks to SilverLeo for the patch (I changed those spaces into tabs and added
some *huge* comment on top).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1016 726aef4b-f618-498e-8847-2d620e286838
2008-04-04 14:12:16 +00:00
imaginos 1f4963c452 extra line breaking shit, its not supposed to be there :P
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1015 726aef4b-f618-498e-8847-2d620e286838
2008-04-03 15:43:52 +00:00
psychon f642a493a7 Fix configure on FreeBSD (It didn't find dlopen)
I guess I broke configure recently :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1014 726aef4b-f618-498e-8847-2d620e286838
2008-04-02 19:02:23 +00:00
imaginos 3583b4b5de fix state bug when connecting to a remote host thats ssl, results from a hostname that resolves to multiple ip's
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1013 726aef4b-f618-498e-8847-2d620e286838
2008-04-02 16:15:24 +00:00
psychon 6d957ed93c Use MODFLAGS instead of CXXFLAGS for the modules
This also removes the duplicate check for dlopen() in configure.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1012 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 09:09:23 +00:00
psychon 0a5d3013d2 Add OnTopic() module call
Thanks to SilverLeo, again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1011 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 09:03:17 +00:00
psychon 3be33dd6c8 Don't create empty .registry files for module data
This command showed a *lot* of empty files in ZNC's data dir
  find ~/.znc -iname ".registry" -size 0|wc -l

Thanks to SilverLeo


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1010 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 09:01:55 +00:00
psychon 58a6a8f0e8 The disconnected warning you get on-connect should *not* be broadcasted *fix*
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1009 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 09:00:21 +00:00
psychon ffe31fccd2 Shell module: Also read incomplete lines (no trailing newline) and display them
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1008 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 08:59:13 +00:00
psychon 617e732f66 Only allow admins to load the shell module
The exception to this is if ZNC is compiled with -DMOD_SHELL_ALLOW_EVERYONE
x-x wanted this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1007 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 08:57:21 +00:00
psychon cbdfaf0ed3 Make CModule::DelNV() return false if it didn't remove anything
This fixes e.g. <*crypt> Target [543534532] deleted

Thanks to SilverLeo for the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1006 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 08:55:44 +00:00
psychon 9b757c6f6a CUser::Clone() didn't handle the JoinTries and TimezoneOffset options *fix*
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1005 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 08:53:57 +00:00
psychon 73d8456dff Mark all FDs as close-on-exec
This marks all FDs which are valid after the function creating them returns
as close-on-exec, so that processes started from ZNC (e.g. through the shell
module) don't inherit a copy of all of our FDs.

Csocket already does this for its FDs.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1004 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 08:52:13 +00:00