Commit Graph

4514 Commits

Author SHA1 Message Date
psychon
cc5c771699 Some changes to CZNC::WriteNewConfig (znc --makeconf)
I think this is intended to make this more user-friendly. If it is not, well
I think this patch does exactly this, so what?

Thanks to kroimon for the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1173 726aef4b-f618-498e-8847-2d620e286838
2008-08-26 13:54:17 +00:00
psychon
7c45658993 Add some proper cleanup to some places in main()
This adds a bunch of 'delete pZNC', turns some exit()s into returns
and does some whitespace fun.

kroimon (partly) gets the kudos for this, too.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1172 726aef4b-f618-498e-8847-2d620e286838
2008-08-25 14:46:22 +00:00
psychon
971aa39e10 Don't start a new process for starting znc after --makeconf
The code now just falls through to the normal bootup code.

Thanks to kroimon for this idea and also for writing this patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1171 726aef4b-f618-498e-8847-2d620e286838
2008-08-25 14:42:11 +00:00
psychon
840d1ba15a Move some code around
No actual changes in here, just some preparation.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1170 726aef4b-f618-498e-8847-2d620e286838
2008-08-25 14:39:06 +00:00
psychon
adcca250e1 Use the new CModule::PutModule(const CTable&) in various modules
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1169 726aef4b-f618-498e-8847-2d620e286838
2008-08-24 12:51:04 +00:00
psychon
b70a115a28 Add a new function CModule::PutModule(const CTable&)
This function displays a CTable via PutModule(), something that is often
needed. The function returns the number of lines displayed.

The idea for this function is from the user-contributed admin module
by Sebastian Ramacher. Thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1168 726aef4b-f618-498e-8847-2d620e286838
2008-08-24 12:49:40 +00:00
psychon
09a122ef92 Move some common code in main() in front of all those if()s
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1167 726aef4b-f618-498e-8847-2d620e286838
2008-08-24 10:41:01 +00:00
psychon
87d062a5c5 Unify some of the preprocessor macros in Modules.cpp
The only difference between MODUNLOADCHK and GLOBALMODCALL and between
MODHALTCHK and GLOBALMODHALTCHK was that the one used CModule while the other
one used CGlobalModule.

Create two new macros that expects the class name as an extra parameter and
make all those other macros just call these two.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1166 726aef4b-f618-498e-8847-2d620e286838
2008-08-24 06:25:11 +00:00
psychon
074adc94c1 Don't check if perl is enabled in modperl
The Makefile only compiles this module if it is enabled.
I think it's better to error out if for some reason this doesn't work instead
of silently producing an empty modperl.so.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1165 726aef4b-f618-498e-8847-2d620e286838
2008-08-24 06:19:14 +00:00
psychon
b0903c0208 Handle a theoretically possible 'throw UNLOAD' in CModule::OnLoad()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1164 726aef4b-f618-498e-8847-2d620e286838
2008-08-23 20:20:36 +00:00
psychon
c0c563de55 Fix FTBFS with CTable on g++ 3
g++ 3 doesnt like map<>.at().

This changes how CTable stores its data internally.
This *might* be faster than the older system.

Thanks to kroimon for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1163 726aef4b-f618-498e-8847-2d620e286838
2008-08-23 13:24:28 +00:00
psychon
ecabbd2bcd Fix some of the direct module calls in Client.cpp
OnModCTCP(), OnModCommand() and OnModNotice() are now called through a
preprocessor macro that does all the magic. This fixes a couple of bugs:
- the m_pUser member of global modules for OnModNotice() was wrong
- OnModCTCP() wasn't called for global modules
- Finally handle 'throw UNLOAD' for all of this three module calls


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1162 726aef4b-f618-498e-8847-2d620e286838
2008-08-22 12:48:56 +00:00
psychon
ef31d6e239 Connect and reconnect faster to IRC
The first reconnect now happens when the timer is created which is
possibly thanks to latest Csocket.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1161 726aef4b-f618-498e-8847-2d620e286838
2008-08-21 10:47:09 +00:00
psychon
ec58e6f183 Some cleanup and optimizations to CTable
CTable now caches the width of each column instead of recalculating it
each time it is needed. The code for this was there before, but it was not
used. Now the widths are calculated when the table is filled, not when the
width is needed the first time.

This caching leads to a huge speedup (3-4 times faster) if there are many rows
in the table.

This also cleans up the interface by making it possible to mark
GetColumnWidth and GetLine as const.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1160 726aef4b-f618-498e-8847-2d620e286838
2008-08-20 08:13:23 +00:00
psychon
c3b6a4b29a Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1159 726aef4b-f618-498e-8847-2d620e286838
2008-08-18 11:10:27 +00:00
imaginos
5f0846fc9a changing data types back to proper notation, and down cast the array passed in
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1158 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 18:46:43 +00:00
imaginos
5fbc0aa538 remove const keywords for perl's sake
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1157 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 18:02:09 +00:00
imaginos
03213ae279 fix arg to PERL_SYS_INIT3
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1156 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 17:48:18 +00:00
imaginos
b3bfb1b9ba bug fix as reported by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495076, still needs to be tested
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1155 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 14:53:18 +00:00
psychon
2f74755d7a Fix a bug where ZNC always thought all channels where empty
Due to the recent change that ZNC calls SetIsOn(true) when we receive the JOIN,
not the 'end of names' reply, the nick list of a channel was always ignored.
This fixes this bug.

Thanks to cnu for using a svn version and reporting this bug. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1154 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 18:49:52 +00:00
psychon
8fa9122cdb Fix the keepnick module
- Properly initialize that pointer-beast.
- Actually compile.

Yeah, I know, I fail...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1153 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:54:26 +00:00
psychon
5d58910d24 Add a new module that implements KeepNick
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1152 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:36:30 +00:00
psychon
03e34ac6e6 Remove KeepNick
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1151 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:34:11 +00:00
psychon
3ec3f07523 Move CClient's UserCommand() and HelpUser() into a new file ClientCommand.cpp
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1150 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:38:24 +00:00
psychon
30404699e3 Handle the on-connect 433 in an own function
When our primary nick is already taken, we try a couple of different nicks in
order to be able to connect to the IRC server. This code is now in an
own function.

BTW: CIRCSock::Readline() is still waaay too long.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1149 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:34:15 +00:00
psychon
cd2fb1b1b5 Move the forwarding of raw 353 into an own function
This also contains some minor changes to the code. One of those is that we now
also handle namesx and uhnames for channels we don't know.
BTW: CIRCSock::ReadLine() is waaay too long.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1148 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:22:17 +00:00
psychon
3106f3b90e modperl: Fail if modperl.pm can not be loaded
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1147 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:16:52 +00:00
psychon
13dd3996d5 Remove some unused arguments and unimplemented functions
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1146 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:14:41 +00:00
psychon
48d53876d6 Even more weird and broken clients sending even more and broken stuff
PART :#channel... Why do IRCds even parse this correctly? :(
Oh and yeah, it's eggdrop.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1145 726aef4b-f618-498e-8847-2d620e286838
2008-07-23 15:05:35 +00:00
psychon
cd8318370a Some weird clients might send a nickmask prefix, handle this correctly
*cough* eggdrop is evil *cough*

Thanks to dare for debugging this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1144 726aef4b-f618-498e-8847-2d620e286838
2008-07-23 13:36:04 +00:00
psychon
abeba8aea7 Simplify the connect user code a little
The old code used a timer. That timer needed to be restarted if the user list
was changed (adding / removing of users), because it saved an iterator into
that map between runs, which would become invalid.

The new code in CConnectUserTimer::RunJob() is actually more complicated now,
but the iterator is gone. This also means no need to restart that timer
more or less always. ;) (This also means one theoretical source of bugs less)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1143 726aef4b-f618-498e-8847-2d620e286838
2008-07-22 11:34:38 +00:00
psychon
cc3d99515d awaynick: Disable KeepNick on load instead of failing to load
This should make someone in #znc really happy. :P
This is based on a patch from SilverLeo.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1142 726aef4b-f618-498e-8847-2d620e286838
2008-07-22 08:39:18 +00:00
psychon
1f6abb6468 partyline: Some fixes for users who are not connected to IRC
This was found via default channels (LoadModule = partyline ~#chan).

- Always use a valid (=non-empty) server name
- If a user is not connected to IRC, all clients might have a different idea of
  the current nick. Handle this for SendNickList() via a new function
  PutUserIRCNick() that uses the irc nick if we are connected to IRC and else
  correctly uses the nick that clients thinks it curretnly has.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1141 726aef4b-f618-498e-8847-2d620e286838
2008-07-21 13:58:24 +00:00
psychon
1a1cc4c756 We are in a channel when we received the JOIN for it, not it's "end of /names"
This moves some calls from the raw 366 handler to the JOIN handler and it might
even fix a bug (well, which no one would ever have triggered).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1140 726aef4b-f618-498e-8847-2d620e286838
2008-07-21 10:15:16 +00:00
psychon
1c2c52651a Make webadmin generate salted passwords, too
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1139 726aef4b-f618-498e-8847-2d620e286838
2008-07-20 15:06:33 +00:00
psychon
c07347b9a0 Enable some more debug flags with --enable-debug
See these links for info on these defines:
 http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch29.html
 http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1138 726aef4b-f618-498e-8847-2d620e286838
2008-07-18 09:37:11 +00:00
psychon
10210e4619 Don't throw any exceptions in CModules::LoadModule() on version mismatch
This also removes all the code catching those exceptions. There was nothing
which justified these exceptions and removing them doesn't hurt.

ByeBye CException::EX_BadModVersion


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1137 726aef4b-f618-498e-8847-2d620e286838
2008-07-17 12:01:44 +00:00
psychon
27c1a76cf8 Shell module: Don't give any stdin to executed apps
We now close the write end of the pipe that serves as stdin for the apps
we run. This means that any read attempts will return EOD (read() returns 0)
which should hopefully tell our apps that we don't have stdin for them.
Sadly vim doesn't care... (Only thing I tested that still broke)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1136 726aef4b-f618-498e-8847-2d620e286838
2008-07-17 10:30:32 +00:00
psychon
0003c28f7b Shell module: Small cleanup
We already have a special function for stripping of special chars, so
why does the shell module still do it 'by hand'?


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1135 726aef4b-f618-498e-8847-2d620e286838
2008-07-17 10:16:40 +00:00
psychon
3c1e610cf5 Make CClient::GetNickMask() always return a valid nickmask
The recent removal of CUser::m_bIRCConnected lead to a bug here which is now
fixed.
In addition to this, this function now also works properly for users without
a vhost.

Oh and in User.cpp: Make sure CUser::GetIRCServer() returns an empty string
when we are no longer connected to an IRCd.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1134 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 10:44:37 +00:00
psychon
3e2b71263f Fix a potential crash bug on channel part (CChan::RemNick())
This function didn't properly check it had a valid iterator *before* using
this iterator (.begin()->second).

Now we first check if that iterator is valid (size() is *not* zero) before we
run this. No behaviour is changed, but the bug is gone. Yay. ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1133 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 10:42:27 +00:00
psychon
f7dcfcfa6e Replace usage of getresuid() with getuid() and geteuid()
getresuid() is a non-standard extension and is actually not defined on
some (older) boxes. Since we gain nothing with also checking the saved user id,
we can use this instead and, voila, znc compiles again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1132 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:58:54 +00:00
psychon
bf3acfe88a Remove CUser::m_bIRCConnected
CUser::GetIRCSock() != NULL is the replacement. This is a small chance in
sematics. Before this, a user only counted as connected to IRC when the 001
numeric was received. Now it already counts as connected when the connection
was established. This change doesn't hurt any of the current users of
CUser::IsIRCConnected() and so this change should be fine.

Yay, one var less ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1131 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:19:57 +00:00
psychon
7059bf02f6 CUser::GetIRCSock() only returns a member var, so it can be moved to the header
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1130 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:16:43 +00:00
psychon
86924339a3 Add some 'const' attributes to various functions
No real changes in here, only way more constness...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1129 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:13:06 +00:00
psychon
4a62fca388 Fix CUser::Clone() to work with salted passwords
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1128 726aef4b-f618-498e-8847-2d620e286838
2008-07-13 16:25:53 +00:00
psychon
bf2bd39769 Add supports for salted hashes to znc.conf
These changes the format of the 'Pass' config option. The old format is
still accepted. The new format is:

  Pass = plain#<plain text password>
  Pass = md5#<password hash>
  Pass = md5#<hash of password with salt appended>#<salt>#

This also makes ZNC only write configs in the new format.

znc --makeconf and znc --makepass now always generate salted hashes.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1127 726aef4b-f618-498e-8847-2d620e286838
2008-07-13 15:32:27 +00:00
psychon
ac2caa0f22 znc-config: Don't link in any libraries
Any library the znc binary links to is automatically available to modules.
So there is no point in linking modules to @LIBS@ as znc is linked against
those already. modules/Makefile.in already does it this way, not also
znc-config does it


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1126 726aef4b-f618-498e-8847-2d620e286838
2008-07-12 21:43:47 +00:00
psychon
a35af71121 __GNU_LIBRARY__ doesn't seem to be needed on FreeBSD
This defines was added in rev 586 saying it's needed for 'older BSD boxes'.
I don't know how old 'old' is in this context, but since we don't compile
on FreeBSD 4 anyway (which really is old), because getopt_long is missing
(added in FreeBSD 5), we should give this a try.

I have no FreeBSD 5 box for testing if znc compiled/compiles there, so
suprise me!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1125 726aef4b-f618-498e-8847-2d620e286838
2008-07-12 07:26:56 +00:00
psychon
3b0a4dc4b5 Config reading: Apply a small (unnoticeable) optimization
Trim() always removes all trailing and leading spaces and line endings from
that string, so there is no point in this main loop. It will always run once,
anyway.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1124 726aef4b-f618-498e-8847-2d620e286838
2008-07-11 09:58:04 +00:00