Commit Graph

1538 Commits

Author SHA1 Message Date
psychon
76b40e35f2 configure: Error out if pkg-config is not found
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1553 726aef4b-f618-498e-8847-2d620e286838
2009-06-30 13:33:42 +00:00
psychon
8a2ef66b22 Mention c-ares in README
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1552 726aef4b-f618-498e-8847-2d620e286838
2009-06-30 11:54:56 +00:00
psychon
f77e526652 Add c-ares support
Every socket which is based on CZNCSock will now use c-ares for its name
resolving. This is possible thanks to CSocket's Csock::GetAddrInfo() which
lets one override the DNS lookup.

This can be disabled with --disable-c-ares.

If IPv6 is enabled and Csocket didn't specify which kind of lookup (ipv4/ipv6)
it wants, we first do an ipv4 lookup. If that lookup doesn't yield any useful
result, we try again with an ipv6 lookup. If one wants to force ipv6 usage on a
domain which also resolves to an ipv4 address, he has to set an ipv6 vhost.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1551 726aef4b-f618-498e-8847-2d620e286838
2009-06-30 09:56:01 +00:00
psychon
442aee2baf Add and use CZNCSock instead of Csock everywhere
This class will be used to implement async DNS in a later commit.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1550 726aef4b-f618-498e-8847-2d620e286838
2009-06-29 11:26:19 +00:00
psychon
65510446df Move CSockManager into Socket.h
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1549 726aef4b-f618-498e-8847-2d620e286838
2009-06-29 07:50:45 +00:00
psychon
5678220d34 Remove some useless casts
Classes derived from Csock* can be casted implicitly to their base class, this
explicit casts are rather pointless.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1548 726aef4b-f618-498e-8847-2d620e286838
2009-06-26 18:13:40 +00:00
psychon
ef3b8d4c37 CNick: Fix bug in RemPerm()
The following sequence triggered this bug:

 /mode <chan> +ov-o <you> <you> <you>

The deop called CNick::RemPerm('@') which removed the '@' from the list of
perms via std::string::erase(<positiong of '@' in that string>). The bug was
that erase() by default erases till the end of the string, but we only wanted
to remove a single character. The fix is easy, just pass in '1' as a second
parameter. :)

Thanks to sp219 for finding and reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1547 726aef4b-f618-498e-8847-2d620e286838
2009-06-26 10:34:42 +00:00
psychon
763e3b2c9f Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1546 726aef4b-f618-498e-8847-2d620e286838
2009-06-26 08:45:08 +00:00
psychon
31b5df8b73 CTempalte: Fix a minor error in a debug message
Patch by KiNgMaR, thanks


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1545 726aef4b-f618-498e-8847-2d620e286838
2009-06-19 15:34:59 +00:00
psychon
7f7341dc2a CSocket: Close sockets which cause a EMFILE
This now closes listening sockets if we hit some fd limit like we are already
doing in CRealListener.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1544 726aef4b-f618-498e-8847-2d620e286838
2009-06-18 19:32:12 +00:00
psychon
b56f173804 Fix a harmless compiler warning
Kuja is messing with GCC snapshots again (thanks!).
(btw the warning was 'value computed is not used')


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1543 726aef4b-f618-498e-8847-2d620e286838
2009-06-17 12:30:39 +00:00
sebastinas
af13278f4f made string, boolean and integer static
Made string, boolean and integer in PrintHelp static sinve vars
is static too.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1542 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 19:16:20 +00:00
psychon
220aab468d admin: Require a username argument
This patch makes set, setchan and addserver require a username argument.
(One can just use $me)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1541 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 14:41:50 +00:00
psychon
87a7672638 I fail (fix the admin module)
Thanks SilverLeo :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1540 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 12:21:37 +00:00
psychon
062989595c Admin: Some minor cleanup
Move some code from GetUser()'s callers into GetUser() itself.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1539 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 11:40:14 +00:00
prozacx
f7a3c42969 Added znc.pc and znc-uninstalled.pc
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1538 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 05:56:31 +00:00
prozacx
c4a6f39b53 Pulled in CString changes from my common repository to help facilitate the upcoming webmods changes
Changes include...

- CString -
Addition of LCString typedef to list<CString>

Added four more args to CString::Token()...
	bool bAllowEmpty = false        <-- This default of false is NOT backward compatible but seems way more intuitive
	const CString& sLeft = ""
	const CString& sRight = ""
	bool bTrimQuotes = true

Added CString::OptionSplit()
Added CString::QuoteSplit()

Added two new args to CString::Split()...
	bool bTrimQuotes = true,
	bool bTrimWhiteSpace = false

- CTemplate -
Added new class CTemplateTagHandler to provide capability to add custom tags and vars
Added var name pointer dereferencing in the form of <? VAR Name=*other_var ?> (use ** to start with a literal star)
Added a list of paths that can be used to look for a given filename in multiple locations
Added CTemplate::PrependPath()
Added CTemplate::AppendPath()
Added CTemplate::RemovePath()
Added CTemplate::ClearPath()
Added CTemplate::PrintString() for filling a CString& instead of a stream
Added <? LT ?> which outputs a literal "<?"
Added <? GT ?> which outputs a literal "?>"
Added <? SETBLOCK ?> and <? ENDSETBLOCK ?> for setting a variable's value to the contents between the tags
Added <? EXPAND ?> for expanding a filename to a path using the settable list of paths
Added <? BREAK ?> and <? CONTINUE ?> inner loop tags
Added <? EXIT ?> tag to stop processing
Added <? DEBUG ?> tag for printing to DEBUG()
Added REVERSE keyword to the <? LOOP ?> tag



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1537 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 05:48:12 +00:00
prozacx
00613bc90f Made home dir optional in CDir::ChangeDir() and have it default to CZNC::Get().GetHomePath()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1536 726aef4b-f618-498e-8847-2d620e286838
2009-06-09 00:25:20 +00:00
psychon
2206e19ad2 admin: Add set/get Nick/Altnick to help
Dunno why these commands weren't documented before...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1535 726aef4b-f618-498e-8847-2d620e286838
2009-06-06 18:09:07 +00:00
psychon
9c1f2ee462 stickychan: Accept a channel list as module arguments
If you now load stickychan with "#chan1,#chan2 bla" as its argument, both
channels are stuck where "bla" is the channel key for #chan2.

Thanks to FB-eYe for the suggestion.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1534 726aef4b-f618-498e-8847-2d620e286838
2009-06-05 19:56:23 +00:00
psychon
226ccbf56d Fix a small bug from r1531
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1533 726aef4b-f618-498e-8847-2d620e286838
2009-05-30 20:18:29 +00:00
psychon
901af25984 CBuffer: Use std::deque instead of std::vector
deque got constant time removal of elements at the beginning of the sequence,
vector doesn't. The plan is that this saves some CPU time in CBuffer::AddLine()


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1532 726aef4b-f618-498e-8847-2d620e286838
2009-05-30 19:43:32 +00:00
psychon
f80a0f6326 Handle e.g. --allow-root in /msg *status restart
When ZNC is restarted we have to pass on most of ZNC's arguments. Until now we
only handled --datadir. Now we also handle --debug, --foreground, --no-color
and --allow-root.

Thanks to kopn3ft0r for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1531 726aef4b-f618-498e-8847-2d620e286838
2009-05-30 18:49:00 +00:00
psychon
64fbd54527 Install znc.pc in the correct dir
Thanks to Douglas E. Warner (silfreed) for providing the patch.
(SF.net issue ID: 2797531)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1530 726aef4b-f618-498e-8847-2d620e286838
2009-05-30 11:04:17 +00:00
psychon
8b2ee2a940 Minor fixup
Meh, there is a point in saving the file *before* generating a diff...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1529 726aef4b-f618-498e-8847-2d620e286838
2009-05-29 20:33:45 +00:00
psychon
fc52e805dc Remove some useless check
The code checked if every line received from the IRC server started with a
colon and contained at least two spaces using a wildcard comparison. Since not
doing this would violate the IRC specs, we can safely assume this.

This command removes this if and reindents a shitload of code. The only change
in there is a removed comment, everything else should be the same.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1528 726aef4b-f618-498e-8847-2d620e286838
2009-05-29 20:29:18 +00:00
psychon
ffe92a4b66 Some minor optimizations
I doubt this makes much of a difference, but some callgrind run with one hour
of #ubuntu pointed to this stuff. Let's hope it's at least a little little
little bit faster now


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1527 726aef4b-f618-498e-8847-2d620e286838
2009-05-29 20:26:37 +00:00
psychon
aae356c8d5 Let everyone use /msg *status uptime, not only admins
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1526 726aef4b-f618-498e-8847-2d620e286838
2009-05-27 13:28:58 +00:00
psychon
dbfad62840 CString now takes a precision for converting floating point numbers
Because the precision defaults to 2, e.g. the traffic stats are now way more
readable.

Thanks to KiNgMaR for the idea and the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1525 726aef4b-f618-498e-8847-2d620e286838
2009-05-27 11:24:26 +00:00
psychon
aa4425bda5 Fix webadmin favicons
r1481 moved the /img/ subdir into /data/, but forgot to fix the path which
is used for the favicon, which meant we generated a 404 for the favicon.
Fix this by using the correct path and everyone is happy again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1524 726aef4b-f618-498e-8847-2d620e286838
2009-05-27 10:59:36 +00:00
psychon
85dce87d6a Traffic API breakage again
The last commit broke the order in which the traffic stats used to be displayed
and it turns out that KiNgMaR cannot live with that, so now we are back to the
old order.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1523 726aef4b-f618-498e-8847-2d620e286838
2009-05-27 10:49:48 +00:00
sebastinas
d724a4776c Some cleanup in CSmartPtr
Removed CSmartPtr's GetCount and renamed GetClientCount to GetCount.
The version returning a pointer is not used anyway. Furthermore removed
a check for a null pointer which is already checked some lines above
and replaced m_pType = &(*CopyFrom) with m_tType = CopyFrom.m_pType,
since an overloaded operator & could break this code (it doesn't matter
if we check the m_pType afterwards. It could be nonezero and invalid
anyway).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1522 726aef4b-f618-498e-8847-2d620e286838
2009-05-26 20:09:30 +00:00
psychon
f36ad9e6e7 Change the API for getting traffic stats
We now have a central function CZNC::GetTrafficStats() which does all the ugly
stuff and just returns the data which the caller can then display. We now also
include all unknown sockets (e.g. imapauth or webadmin sockets) in the traffic
stats in the "<ZNC>" section.

The only downside to all this gloriousness is that this breaks the ordering of
/msg *status traffic which is now sorted alphabetically which means that <ZNC>
<Users> and <Total> aren't anymore in the places in which they used to be.
I hope one can live with that...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1521 726aef4b-f618-498e-8847-2d620e286838
2009-05-26 18:38:58 +00:00
psychon
376a73283c Remove some unnecessary TCacheMap::Cleanup() calls
Why do we have to clean up expired entries when a new one is added? (both these
calls where in AddItem())


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1520 726aef4b-f618-498e-8847-2d620e286838
2009-05-26 13:49:36 +00:00
psychon
a8f8fade57 Fix some color escapes in znc --no-color --makeconf
(Well, is bold a color?...)

Thanks to KiNgMaR for finding this and providing a patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1519 726aef4b-f618-498e-8847-2d620e286838
2009-05-26 11:54:21 +00:00
psychon
b21000a731 Increase the version number to 0.071
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1518 726aef4b-f618-498e-8847-2d620e286838
2009-05-23 10:47:07 +00:00
psychon
29dd48dbd0 Increase the version number to 0.070
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1516 726aef4b-f618-498e-8847-2d620e286838
znc-0.070
2009-05-23 10:45:12 +00:00
psychon
08924f499f Add CListener::GetRealListener()
This allows access to the Csock* which does the actual listening


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1515 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 11:56:15 +00:00
psychon
9a7956f522 Revert rev 1510 "Ask SSL clients for a ssl cert"
This commit breaks webadmin. This was found with firefox. If you got any client
certificates imported into firefox, it will ask you to select which certificate
to use a couple of times per click (once per HTTP request which means also when
loading images etc).

Since webadmin by default shares the listen port with znc, we can't limit this
SSL_VERIFY_PEER to webadmin listening ports. The simplest solution is thus to
just drop this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1514 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 11:19:17 +00:00
silverleo
0ad7756e85 Revert rev1504 that introduced an error with modtcl.
Tcl fork()s to create a child process, the child exits and tcl tries to get
the child's exit code via waitpid() but when the child process exits, we get
SIGCHLD, call waitpid() ourselves and thus the exit code (and the whole
zombie) is discarded and tcl can't get the child's exit code.



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1513 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 10:36:34 +00:00
psychon
309339091a Add CAuthBase::GetSocket()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1512 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 09:32:28 +00:00
psychon
4e31d49209 CAuthBase: Use a Csock* instead of a CString "sRemoteIP"
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1511 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 09:30:19 +00:00
psychon
d980b42b90 Ask SSL clients for a ssl cert
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1510 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 08:48:22 +00:00
psychon
37d0c5e58e Update to latest Csocket
Thanks to Imaginos for implementing this. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1509 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 08:10:00 +00:00
prozacx
facb308ca9 Added a cast to stop the compilier from complaining about signed/unsigned mismatch
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1508 726aef4b-f618-498e-8847-2d620e286838
2009-05-11 21:17:38 +00:00
psychon
bc77d8b261 Fix a wrong cached /mode reply
ZNC replies to /mode #chan with the cached channel modes without querying the
IRCd. This was added to avoid traffic spikes to the ircd when a client
logged in.

The logic in this code had a bug that made it also reply with stale cached
values if we once were but aren't anymore in that channel (e.g. after
you've been kicked).

Thanks to tomaw for reporting this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1507 726aef4b-f618-498e-8847-2d620e286838
2009-05-11 16:16:10 +00:00
psychon
1a859f3806 Close client sockets only after all pending data was sent
Now e.g. the message "Invalid Password" on login even reaches the other end
before the connection shoots itself in the foot.

There is one place in Client.cpp which I didn't change: ReachedMaxBuffer()
If a client is flooding is, why should we wait until we are done answering
that flood?...

Thanks to morelia for making me notice this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1506 726aef4b-f618-498e-8847-2d620e286838
2009-05-11 16:06:40 +00:00
prozacx
7140873bd8 Auto-detect globalness in the re/un/loadmod commands using GetModInfo()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1505 726aef4b-f618-498e-8847-2d620e286838
2009-05-10 09:50:37 +00:00
psychon
c0ee24f313 Handle SIGCHLD for collecting zombie processes
The old code failed to collect the following command to *shell correctly:
 exec > /dev/null 2> /dev/null < /dev/null ; sleep 10

The timeout in CExecSock::close2() was over before the child processes exited
and a zombie was left behind. Plus we used some ugly busy looping while
waiting for the child to exit. Using SIGCHLD for collecting zombies is
soooooo much nicer.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1504 726aef4b-f618-498e-8847-2d620e286838
2009-05-04 19:21:26 +00:00
psychon
bbb62bed08 Install a file for pkg-config
configure now generates to files for pkg-config:
znc.pc and znc-uninstalled.pc

This is supposed to replace the znc-config binary. Everything which can be done
with znc-config can now also be done with pkg-config.

znc-uninstalled.pc is only generated by configure, but not installed by the
Makefiles. It's there to fix some kind of bug we have with znc-config.

ZNC can run quite fine from the source, there is no need to ever run
"make install". The only problem is that e.g. znc-extra won't build, since
it gets -I/usr/local/include/znc from znc-config which doesn't work since znc
was never installed.

pkg-config has a nice fix for this: If you ask for "a", but "a-uninstalled"
exists, pkg-config will use the later one instead. This is used in
znc-uninstalled.pc to output a different -I flag which works for the
uninstalled headers.
(You only have to set $PKG_CONFIG_PATH to znc's source dir for this to work)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1503 726aef4b-f618-498e-8847-2d620e286838
2009-05-03 11:23:05 +00:00