Commit Graph

163 Commits

Author SHA1 Message Date
Kyle Fuller
0b360c0102 Remove OnDCCUserSend module hook 2011-06-01 20:21:27 +01:00
Uli Schlachter
eb229659e5 Warn if a *module message is ignored
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>
2011-05-13 15:48:47 +02:00
Uli Schlachter
3f24f28736 Stop including FileUtils.h in any header
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>
2011-04-03 11:50:44 +02:00
Uli Schlachter
8e59f75125 Don't include FileUtils.h in znc.h or Modules.h
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>
2011-04-03 10:21:59 +02:00
Uli Schlachter
f0bf7134ec Improve the handling of module load messages
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>
2011-04-02 16:52:52 +02:00
Uli Schlachter
23fb4df67a Remove config-related module hooks
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>
2011-03-31 17:29:49 +02:00
Kyle Fuller
7162b01111 Add the OnIRCConnectionError(CIRCSock *pIRCSock) module hook 2011-03-30 19:15:42 +01:00
Alexey Sokolov
3a838d1493 Move module data files to own dir. 2011-03-06 12:32:14 +06:00
Kyle Fuller
6bc36d1708 Make CModule::PutModule use CUser::PutModule 2011-02-22 22:08:08 +00:00
Uli Schlachter
8e59fb957c Add CModule::OnUnknownModCommand()
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>
2011-02-21 15:34:25 +01:00
Uli Schlachter
ebd7e53d7f Add a generic command handling to CModule
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>
2011-02-21 15:33:59 +01:00
Kyle Fuller
c7c12f0b83 CModules::OpenModule shouldn't return false 2011-02-15 20:06:50 +00:00
psychon
b9b0fd4c87 Oh, shiny... NOT
(Yes, it's that time of the year again)

Signed-off-by: Uli Schlachter <psychon@znc.in>

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2260 726aef4b-f618-498e-8847-2d620e286838
2011-01-14 17:03:24 +00:00
darthgandalf
a0c0b73590 Add new parameter to OnPart module hook: part message.
Sorry for API change :)

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2215 726aef4b-f618-498e-8847-2d620e286838
2010-12-30 11:28:41 +00:00
psychon
1023d868e4 Fix some warnings with -pedantic
"invoking macro GLOBALMODULECALL argument 4: empty macro arguments are undefined
in ISO C90 and ISO C++98"


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2177 726aef4b-f618-498e-8847-2d620e286838
2010-11-07 16:12:17 +00:00
psychon
4ffcdc4b55 Document most of CString and MCString
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
2010-10-11 14:24:36 +00:00
darthgandalf
dffabfed2e Modules can now embed web stuff directly to other web pages which support this feature.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2128 726aef4b-f618-498e-8847-2d620e286838
2010-09-11 18:51:54 +00:00
darthgandalf
ffcd42232f Add new global module hooks, which allow global modules to be 'module providers'.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2119 726aef4b-f618-498e-8847-2d620e286838
2010-09-07 09:53:13 +00:00
psychon
a3bc3f6877 Reduce number of module hooks
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
2010-08-05 12:13:44 +00:00
psychon
83db7684f2 Server part of CAP stuff
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
2010-08-04 18:50:44 +00:00
psychon
e4006adc11 DarthGandalf does not approve
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2085 726aef4b-f618-498e-8847-2d620e286838
2010-07-10 17:09:51 +00:00
psychon
86f3d7c745 Mark some functions as const
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
2010-07-10 07:51:35 +00:00
psychon
47a5ab3751 Remove the CClient* argument to all module calls
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
2010-07-09 18:02:04 +00:00
psychon
9ae959b800 Do all module calls through the macros
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
2010-07-08 16:43:23 +00:00
psychon
9d99e4cc8d Add module calls for client CAPs
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
2010-07-07 16:01:15 +00:00
psychon
769f7623d9 Remove fake modules
They aren't needed anymore and most likely won't be needed any time soon.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2013 726aef4b-f618-498e-8847-2d620e286838
2010-06-07 12:35:00 +00:00
cflakes
5a53fb4129 Fixed a source code comment. Patch by DGandalf. Thanks!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2006 726aef4b-f618-498e-8847-2d620e286838
2010-05-29 20:11:48 +00:00
psychon
99f1efc843 Some more fun with tabs
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1966 726aef4b-f618-498e-8847-2d620e286838
2010-05-02 08:36:57 +00:00
psychon
0f6c1f9e16 Look, an invisible pink unicorn!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1928 726aef4b-f618-498e-8847-2d620e286838
2010-04-23 16:38:03 +00:00
psychon
fe6a930a01 Add ./configure --enable-run-from-source
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
2010-04-23 16:27:21 +00:00
psychon
46b70f654d Move the HTTP/IRC switching to CIncomingConnection
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
2010-04-15 18:20:12 +00:00
psychon
72293bed64 Oh look, invisible, pink unicorns!
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
2010-03-29 19:29:20 +00:00
psychon
5d2f3a03d0 Make OnConfigLine() a user module hook
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
2010-03-29 19:23:48 +00:00
psychon
5b29a28a55 Move OnWrite{User,Chan}Config() to CModule
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
2010-03-29 19:04:37 +00:00
cflakes
437eef7fdd Add OnWebPreRequest web module hook to allow modules to do PAGE_DEFERRED style async processing.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1841 726aef4b-f618-498e-8847-2d620e286838
2010-03-23 17:59:42 +00:00
psychon
fffa0f7d36 Remove the spamminess of --debug a little
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1836 726aef4b-f618-498e-8847-2d620e286838
2010-03-16 09:53:58 +00:00
cflakes
28022ca771 Added a new module hook
EModRet OnAddUser(CUser& User, CString& sErrorRet)
for global modules. Idea by BrianC.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1820 726aef4b-f618-498e-8847-2d620e286838
2010-03-09 20:24:43 +00:00
psychon
b0128cf130 Add new module calls for writing config entries
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1803 726aef4b-f618-498e-8847-2d620e286838
2010-03-04 13:20:44 +00:00
psychon
f72e2f8abd Remove --disable-modules
ZNC without modules is like rain without being inside,
you really don't want that!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1794 726aef4b-f618-498e-8847-2d620e286838
2010-02-25 12:29:40 +00:00
prozacx
ad92c58c42 Initial commit of webmods - still lots of work to be done
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1784 726aef4b-f618-498e-8847-2d620e286838
2010-02-22 07:40:22 +00:00
psychon
1d88f564dc Fix a bunch of style suggestions from cppcheck[1]
Thanks to DarthGandalf for this patch. You must be bored. :P

[1] cppcheck.sf.net


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1776 726aef4b-f618-498e-8847-2d620e286838
2010-02-19 16:21:07 +00:00
psychon
f0d125a3a3 Revert r1765
This breaks traffic stats. Thanks to flakes for noticing.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1773 726aef4b-f618-498e-8847-2d620e286838
2010-02-18 17:07:50 +00:00
psychon
b7450b0b21 Remove CModule::m_bGlobal
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
2010-02-18 12:51:59 +00:00
prozacx
c549df9641 Moved CSocket to Socket.cpp/h
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1733 726aef4b-f618-498e-8847-2d620e286838
2010-02-05 02:01:00 +00:00
psychon
5352cb3ded Use RTLD_GLOBAL for opening modules
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
2010-01-15 22:49:17 +00:00
silverleo
07d7477dec It's 2010, where's my hoverboard?
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1693 726aef4b-f618-498e-8847-2d620e286838
2010-01-06 09:37:05 +00:00
psychon
109ece2de6 CModules::OpenModule(): Check the version number first
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
2009-11-16 18:11:53 +00:00
psychon
07fd781c83 Bug fix for my last commit
(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
2009-11-15 18:47:28 +00:00
psychon
03f3e348e4 Micro-optimization: Use existing functions in CModule::RemTimer()
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
2009-10-17 15:50:58 +00:00
psychon
78af088fd7 Fix a memory leak/crash in CModule
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
2009-10-17 15:44:51 +00:00