Some modules (e.g. webadmin) don't handle messages to *module in any way. Make
it clear to the user why they didn't get any reply back in this case.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This causes every piece of code which wants to use CFile or CDir to have to
include FileUtils.h. This causes quite some noise.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Both these headers only really need CFile* which can be handled with a forward
declaration.
To make this possible, some methods are moved from the header file into the
corresponding implementation file, because they used CFile or CDir static
members.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of doing ugly stuff to shorten the "Loaded Module [foo]" message, we now
just always generate the shorter version of that message. The code paths which
didn't do this shortening now prepend that message themselves.
The result is that every message looks the same as it did before, but the code
for generating these is a little nicer.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This removes the following module hooks:
OnConfigLine()
OnWriteConfig()
OnWriteUserConfig()
OnWriteChanConfig()
Modules could use these hooks for writing/reading their own stuff to/from
znc.conf. However, no module (ever?) did this and IMHO no module should ever do
this either. Modules can save stuff via SetNV(), module arguments (SetArgs())
and in their GetSavePath().
Signed-off-by: Uli Schlachter <psychon@znc.in>
This module hook is called to generate messages for unknown commands. This hook
has a default implementation that actually does something!
Signed-off-by: Uli Schlachter <psychon@znc.in>
With this, modules can use AddCommand() to register commands. CModule will
dispatch all calls to OnModCommand() to the correct command handler.
If a module calls AddHelpCommand(), it will also generate help output.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There are only some "minor" functions that are still undocumented now.
This also sneaks in an API change: A useless file mode argument to
MCString::ReadFromDisk() is gone. Opening a file doesn't ask for a file mode.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2157 726aef4b-f618-498e-8847-2d620e286838
The new hooks OnServerCapAccepted() and OnServerCapRejected() are replaced by
OnServerCapResult(). This should force people who want to use this to handle
possible failures in requesting the capability.
Again, thanks to DarthGandalf for the patch.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2100 726aef4b-f618-498e-8847-2d620e286838
This introduces the code for modules to request CAPs on the IRC server. They
will get a callback when the capability was accepted or rejected.
Thanks to DarthGandalf for this patch. This should turn DarthGandalf and tomaw
into happy znc users again. ;)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2099 726aef4b-f618-498e-8847-2d620e286838
Thanks to vBm for running cppcheck against znc and sharing the results.
This should fix all the "foo can be const" messages.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2081 726aef4b-f618-498e-8847-2d620e286838
OnUnknownUserRaw() and OnClientCapRequest() were both getting a CClient* as
their first argument, but the proper way to pass a CClient* argument to a module
is via GetClient(). Since recently, all the places where this module hooks are
called do this properly, so we can remove this bogus argument.
No module that is part of znc is affected by this change.
Let's see how many external ones break. ;)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2077 726aef4b-f618-498e-8847-2d620e286838
This commit should make sure that all module calls are done through either
MODULECALL, GLOBALMODULECALL or ALLMODULECALL. Also, in the process some module
calls where ("accidentally" ;) ) fixed to set correct values for a global
module's m_pUser during a module call.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2076 726aef4b-f618-498e-8847-2d620e286838
This commit adds new module calls which make it possibly to announce new
capabilities from a module.
Thanks to DarthGandalf for the patch and for not going mad from my comments. :)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2071 726aef4b-f618-498e-8847-2d620e286838
Unless this flag is used, znc will no longer look for modules in ./modules/
because this might be exploitable by lucky attackers.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1927 726aef4b-f618-498e-8847-2d620e286838
This new class waits for the first line from the client and checks if it's an
HTTP request and then passes the connection on to the irc or http code.
Before this, the IRC parser handled this as a special case which wasn't as
nice-looking as this is. :)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1925 726aef4b-f618-498e-8847-2d620e286838
No really, over there! You really should take a look. Come on, I'm not messing
with you. There really are those IPU (invisible pink unicorns) right behind you.
DarthGandalf found them. Oh, now they flew away. :(
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1850 726aef4b-f618-498e-8847-2d620e286838
It's only called for stuff defined in that user's section. The stuff outside of
a user section still can only be caught by global modules.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1849 726aef4b-f618-498e-8847-2d620e286838
That way, user modules can write stuff to the user section, too.
OnWriteConfig() is still a global module call. A later commit will have to make
OnConfigLine() a user module hook...
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1848 726aef4b-f618-498e-8847-2d620e286838
This one is partly due to cppcheck, too, because it warned that one of CModule's
constructors didn't initialize m_bGlobal.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1765 726aef4b-f618-498e-8847-2d620e286838
This fixes a bug where perl (loaded from modperl) tried to load some perl module
which tied with a symbol lookup error since perl's symbols were private. This
also adds a rather long comment explaining why we use the RTLD_-flags we do use.
Thanks to tylerdu for finding this, reporting it and testing the fix.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1714 726aef4b-f618-498e-8847-2d620e286838
At the time that OpenModule() verified that the module's version number matched
the version of the currently running ZNC, it had already called two of the
functions exported from the module.
Reorder this so that we don't do *any* other calls if we get a version mismatch.
Thanks to KiNgMaR for noticing this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1663 726aef4b-f618-498e-8847-2d620e286838
(aka: Brown Paper Bag commit)
When I tested it, it did work. I swear!
Thanks to everyone who pointed out that I broke his znc.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1662 726aef4b-f618-498e-8847-2d620e286838
CModule::RemTimer(const CString& sLabel) now uses FindTimer() and
RemTimer(CTimer *) to do the work instead of doing all of this by itself.
Thanks to KiNgMaR again.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1651 726aef4b-f618-498e-8847-2d620e286838
CModule::RemTimer(CTimer* pTimer) only removed the timer from CModule's own list
of timers but didn't actually destroy the timer. This meant that the timer could
continue to run after it was supposed to be deleted.
Because CModule's destructor used this function this means that all timers
active when a module is unloaded where leaked. When these timers where then
later destroyed this caused a crash because their vtable points inside the
module which was already unloaded (not good!).
Thanks to KiNgMaR for finding and reporting this crash bug.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1650 726aef4b-f618-498e-8847-2d620e286838