Commit Graph

201 Commits

Author SHA1 Message Date
psychon
ea569a2bdc CZNC::AddUser(): Always set the error return on a useful value
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1406 726aef4b-f618-498e-8847-2d620e286838
2009-03-01 16:43:58 +00:00
psychon
3188856a86 Don't write unexpected newlines to znc.conf
This patch fixes the same bug as the last commit and also makes sure that
similar bugs can't happen again.

Thanks to cnu for finding and reporting this bug.
Thanks to kroimon for patch review.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1396 726aef4b-f618-498e-8847-2d620e286838
2009-02-24 16:02:35 +00:00
psychon
7ef9f76bb0 Open the ISpoofFile with mode 'O_RDWR|O_CREAT' instead of '(int)true'
This fixes a bug from r1337


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1352 726aef4b-f618-498e-8847-2d620e286838
2009-01-27 19:54:38 +00:00
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
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
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
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
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
fd5dd4c3b6 Don't append a slash to the paths returns from CZNC::Get*Path()
The old versions didn't do this either and thus we used two slashes.
While this doesn't hurt, it doesn't look good either.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1299 726aef4b-f618-498e-8847-2d620e286838
2008-12-21 17:10:25 +00:00
psychon
804b259f69 Fix a bug introduced in r1289
If the config dir (<datadir>/configs) didn't exist yet, ZNC didn't bother
creating it and thus failed to do write a config.

Thanks to m4v for testing a nightly and for reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1292 726aef4b-f618-498e-8847-2d620e286838
2008-12-17 15:36:47 +00:00
psychon
4b1fbab6eb Remove CZNC::GetConfPath() and rework GetModPath() and GetUserPath()
This removes some unneeded variables.
Idea by kroimon.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1289 726aef4b-f618-498e-8847-2d620e286838
2008-12-12 15:38:57 +00:00
psychon
c03bd91589 Update to latest Csocket and use its new init interface
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1288 726aef4b-f618-498e-8847-2d620e286838
2008-12-10 15:53:07 +00:00
psychon
8db106bf6b Remove our only getcwd() call
We now no longer depend on PATH_MAX which is not defined by POSIX.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1286 726aef4b-f618-498e-8847-2d620e286838
2008-12-07 14:18:23 +00:00
psychon
ce31b29b68 Some changes to the vhost interface from *status
This adds AddVHost, RemVHost and ListVHosts.
If this vhost list (which is the same webadmin uses for displaying drop-down
lists) is none-empty, then users can only set one of these vhosts via SetVHost.
If the list is empty, everything is allowed.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1256 726aef4b-f618-498e-8847-2d620e286838
2008-10-20 13:00:54 +00:00
psychon
4bd90ab9df Make --makeconf check for znc.pem and generate it if it's missing
This patch is based on ideas and an actual patch from
the-me aka Patrick Matthäi. Thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1246 726aef4b-f618-498e-8847-2d620e286838
2008-10-11 15:43:30 +00:00
kroimon
5237a24747 Use CString::Equals() everywhere.
* (CString::CaseCmp() == 0) became CString::Equals()
* (CString::CaseCmp() != 0) became !CString::Equals()
* replaced some occurrences of strn?casecmp

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1234 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 15:15:59 +00:00
kroimon
3b8134c3b0 Another whitespace/tab mixup fix.
Hopefully the last one...
Again, no functional changes in this commit.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1219 726aef4b-f618-498e-8847-2d620e286838
2008-09-27 14:42:34 +00:00
psychon
87a368cb64 Improve both, the code's and the debug output's easy-to-readyiness
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1198 726aef4b-f618-498e-8847-2d620e286838
2008-09-12 15:41:12 +00:00
psychon
92fb0ac62f Small cleanup, removed two unused variables
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1196 726aef4b-f618-498e-8847-2d620e286838
2008-09-12 12:55:03 +00:00
kroimon
d1b3c2b94d Removed AutoCycle from core
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1191 726aef4b-f618-498e-8847-2d620e286838
2008-09-07 11:23:57 +00:00
psychon
da8c892d4f Add a config option 'MaxJoins' to limit the number of joins ZNC does at once
This should hopefully fix a couple of 'Excess flood' problems we were having.

Thanks to SilverLeo for finally writing this :P


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1177 726aef4b-f618-498e-8847-2d620e286838
2008-08-29 15:06:08 +00:00
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
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
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
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
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
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
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
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
psychon
0bd4927d2c Unify some of the webadmin and client authentication code in CZNC::AuthUser()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1114 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:34:32 +00:00
psychon
5c7b586b2d Make it more clear where the 'IRCConnectEnabled'-flag is checked
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1111 726aef4b-f618-498e-8847-2d620e286838
2008-07-03 10:16:49 +00:00
psychon
b2512e55ea Display the uptime in a more readable way
This adds CString::ToTimeStr() which converts a number of seconds into
a human readable time string.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1107 726aef4b-f618-498e-8847-2d620e286838
2008-06-27 09:55:55 +00:00
psychon
bcf59c56ea Add and use CZNC::GetUptime() for getting the current uptime in human readable
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1098 726aef4b-f618-498e-8847-2d620e286838
2008-06-19 08:39:10 +00:00
psychon
d397cb8ad2 Add CZNC::GetVersion()
CZNC::GetVersion() returns something like '0.057-r1234'.

This also cleans up CZNC::GetTag() a little. A theoretical buffer overflow
less and some higher speed is the result.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1097 726aef4b-f618-498e-8847-2d620e286838
2008-06-17 08:25:04 +00:00
psychon
78f8cce2c6 Add 'Uptime' command to *znc
ToDo: Use some readable format for displaying the uptime. Seconds just
don't make it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1095 726aef4b-f618-498e-8847-2d620e286838
2008-06-17 07:52:56 +00:00
psychon
b475f5d69e Make --makeconf more clear
This rephrases one of the questions asked and adds a section to the README that
explains two unclear questions.

This patch is based on a patch from Patrick Matthaei from debian.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1093 726aef4b-f618-498e-8847-2d620e286838
2008-06-14 16:17:46 +00:00
psychon
e08cb72646 Also use /etc/passwd if $HOME is set but empty
Before this, we used ./.znc as datadir in this case. Not good.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1081 726aef4b-f618-498e-8847-2d620e286838
2008-06-03 06:32:18 +00:00
psychon
5c39502342 Fix restarting of the connect user timer during rehashing
Rehashing didn't always properly restart the connect user timer.
This happened e.g. if rehashing fails because the config file doesn't exist.

To fix this, we restart this timer now in the CZNC::RehashConfig() where it
will *always* happen.

This commit fixes a crash bug! (using an invalid iterator)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1073 726aef4b-f618-498e-8847-2d620e286838
2008-05-26 14:59:41 +00:00
psychon
d0f33f8b1c The instructions at the end of makeconf showed a wrong port
This was broken since r964 from Feb 2008.

Thanks to fred for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1072 726aef4b-f618-498e-8847-2d620e286838
2008-05-26 14:56:23 +00:00
psychon
803b34c6dc Simplify this a little by using the new-and-improved (tm) CZNC::Broadcast()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1071 726aef4b-f618-498e-8847-2d620e286838
2008-05-24 21:13:36 +00:00
psychon
a773c13f69 Add bAdminOnly and pSkipClient arguments to CZNC::Broadcast
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1070 726aef4b-f618-498e-8847-2d620e286838
2008-05-24 21:12:53 +00:00
psychon
edb56b1660 Make it possible to add extra strings to the version number
This will be used for the nightly tarballs (perhabs).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1062 726aef4b-f618-498e-8847-2d620e286838
2008-05-24 15:29:52 +00:00
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
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
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
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
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
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
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