Commit Graph

178 Commits

Author SHA1 Message Date
Kyle Fuller
8dd2a704bb Create network modules 2011-08-24 19:07:32 +01:00
Uli Schlachter
26368a6c29 Some more cleanup to module loading
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-21 18:01:58 +02:00
Uli Schlachter
80c76c97a6 Remove GLOBALMODCONSTRUCTOR
MODCONSTRUCTOR does that job just fine (now).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-21 18:01:58 +02:00
Uli Schlachter
cce40e9f71 Move the EModuleType into CModInfo
This also renames the values to shorter and more "well sounding" names.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-21 16:30:36 +02:00
Uli Schlachter
5f53c3509f Fix some minor issues
E.g. a gcc warning about an uninitialized variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-21 15:58:01 +02:00
Kyle Fuller
274d3eb2ec Make modpython support different module types 2011-08-21 13:34:23 +01:00
Kyle Fuller
b2d8f2ed62 Add CModInfo::SupportsType(EModuleType) and supply a module type with CModules::LoadModule
This would allow a module support multiple module types but CModule's do
not support this currently
2011-08-21 13:34:23 +01:00
Alexey Sokolov
76aaafd4d0 Unload modules in reverse order. 2011-08-21 13:34:23 +01:00
Kyle Fuller
c456d20b21 Merge CGlobalModule(s) into CModule(s) 2011-08-21 13:34:22 +01:00
Kyle Fuller
a4b155995c Create EModuleType, creating SetType which replaces SetGlobal 2011-08-21 13:34:22 +01:00
Uli Schlachter
cb6798d36f Fix module data for extra/ modules
No module in extra/ comes with any data currently, so this was tested by moving
perform to extra/. The install is untested.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-05 15:19:09 +02:00
Uli Schlachter
25ce7de020 Only export a single function from modules
This moves the version check into the function which loads the module info. That
way, we just need a single dlsym() call per module and thus can't get any errors
from the second dlsym() call. And IMHO this feels nicer anyway. ;-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-11 18:33:50 +02:00
Uli Schlachter
ca97dca6dc Use references instead of pointers for CModInfo
This works fine and reduces the chances of memory leaks.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-11 18:16:00 +02:00
Alexey Sokolov
0c840f922d Modules can now provide its wiki page name.
It's shown on webadmin as a link.
2011-06-11 17:46:37 +07:00
Alexey Sokolov
ad9f1f8ab9 Change a way for modules to provide description.
Now there're only 2 functions which modules export:
ZNCModVersion() and ZNCModInfo().

ZNCModInfo() returns CModInfo instance, which contains
description, globality, function for loading the module. It needs to be
deleted afterwise.
2011-06-11 17:19:36 +07:00
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