Commit Graph

133 Commits

Author SHA1 Message Date
psychon
84abd9ec1a Remove OnUser{Attached,Detached}
These are unused functions that are only used for generating warning messages
due to -Woverloaded-virtual. These were introduced in 2008. I think nothing
needs this any more, so let's just remove these for good. Bye, bye.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2047 726aef4b-f618-498e-8847-2d620e286838
2010-06-29 19:07:04 +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
psychon
f2d7ae1a08 Change a bunch of tabs into spaces
At the beginning of lines, one uses tabs for indenting. In the middle of the
line, you use spaces. If you want two different lines to line up with each
other, you start them with the same number of tabs and use spaces for the rest
of the indenting in the "other" line.

Really, that's how one does it!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1963 726aef4b-f618-498e-8847-2d620e286838
2010-05-01 20:15:01 +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
cflakes
49df8dc27d Clarify the meaning of returning false from OnWebRequest.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1886 726aef4b-f618-498e-8847-2d620e286838
2010-04-05 15:17:23 +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
c89d8bbb9e Add some doxygen comments for WebMods module stuff.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1844 726aef4b-f618-498e-8847-2d620e286838
2010-03-25 16:57: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
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
45caa26d86 Renamed GetWebNavTitle() to GetWebMenuTitle() to keep in line with the name of the Menu.tmpl file
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1787 726aef4b-f618-498e-8847-2d620e286838
2010-02-23 06:09:21 +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
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
psychon
f86458fe5d Add 'static' to some CModule members
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1757 726aef4b-f618-498e-8847-2d620e286838
2010-02-18 12:07:49 +00:00
psychon
fd9ed4aff1 Fix the OnKick() module call
This call works exactly as it did before (well, it no longer creates a
temporary CNick instance), but it's documentation now also describes its current
behavior.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1737 726aef4b-f618-498e-8847-2d620e286838
2010-02-06 14:54:06 +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
c46616376a Call OnChanAction() after OnChanCTCP()
Now these two module hooks are called in the same order as OnPrivAction() and
OnPrivCTCP().

Additionally, one can now properly block channel action's from reaching the
channel buffer via return HALTCORE; in OnChanAction.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1730 726aef4b-f618-498e-8847-2d620e286838
2010-02-03 14:46:57 +00:00
psychon
ae29c50eb4 Add some more doxygen comments
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1718 726aef4b-f618-498e-8847-2d620e286838
2010-01-23 13:01:00 +00:00
psychon
278e8e9464 Add some doxygen comments
This adds doxygen comments to the most important functions from
CModule and CGlobalModule.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1715 726aef4b-f618-498e-8847-2d620e286838
2010-01-17 12:25: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
f508413444 MODCONSTRUCTOR: Move some stuff to MODCOMMONDEFS
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1664 726aef4b-f618-498e-8847-2d620e286838
2009-11-16 18:13:09 +00:00
psychon
d96d16634b Module ABI: Use a string pointer
Returning a const char* is way easier, makes way more sense and is way
friendlier for an extern "C" function.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1661 726aef4b-f618-498e-8847-2d620e286838
2009-11-15 13:29:17 +00:00
psychon
c88ec5f91d Use a set instead of a vector in CModule
CModule has two vectors: A list of timers and a list of sockets for this
module. Since one shouldn't be able to add items multiple times it makes sense
to use a set here instead.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1643 726aef4b-f618-498e-8847-2d620e286838
2009-10-05 20:44:54 +00:00
psychon
d0a38e41ab Add a new module hook OnIRCConnecting
This hook is called just before some user tries to connect() to an IRC server.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1638 726aef4b-f618-498e-8847-2d620e286838
2009-09-26 14:49:15 +00:00
psychon
5d5493a24f Use a queue instead of a stack for the list of module paths
A queue is a FIFO while a stack is a LIFO. The code which added paths to the
list of available paths expected them to be checked in the order they were
added, but instead they were checked in reverse order. This meant that one could
no longer replace "system modules" with a .so in ~/.znc/modules.

Thanks to DarthGandalf for noticing and reporting this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1629 726aef4b-f618-498e-8847-2d620e286838
2009-09-17 18:39:46 +00:00
psychon
64b0e392fe Add CModules::GetModPathInfo()
This function works like GetModInfo(), but takes the full path to the module,
too.

This is used to speed up GetAvailableMods(). Before it created a list of module
paths, extracted the names and then called GetModInfo() on those module names
which looked up the path for the modules again. This extra step is now skipped
and the module's path is used directly.

To make this work, the call to FindModPath() was moved from OpenModule() into
its two callers LoadModule() and GetModInfo().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1613 726aef4b-f618-498e-8847-2d620e286838
2009-08-23 14:11:37 +00:00
psychon
ab9e2dfd33 Add CModules::GetModDirs()
This function returns a list of <module dir, data dir> pairs which lists all
places in which modules should be looked for.

FindModPath() and GetAvailableMods() are changed to use this new function.

The list of places to look at is the same that was used before, but this now
also adds ./modules/extra so that modules enabled via --enable-extra are found
before 'make install'.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1612 726aef4b-f618-498e-8847-2d620e286838
2009-08-23 12:46:47 +00:00
psychon
6a36100447 Move CZNC::FindModPath() to CModules
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1611 726aef4b-f618-498e-8847-2d620e286838
2009-08-23 11:05:22 +00:00
psychon
f680f242ff Improve the error message from /msg *status loadmod
Ever since r1505 our error messages when loading modules all were the same:
"Unable to find modinfo"

Improve this by giving the user all the information we offered before again. The
most useful one here is most likely the result from dlerror(). This is done by
adding a helper function CModules::OpenModule(). Most of its code is from
CModules::LoadModule() and this function and CModules::GetModInfo() now both use
this helper function for generating error messages.

This commit adds a "#warning", don't worry I'm working on it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1596 726aef4b-f618-498e-8847-2d620e286838
2009-08-10 18:58:55 +00:00
psychon
b25e65dbb6 Add a limit of 10 unidentified connections per IP
Everything which isn't a CClient with a successful login counts as an
unidentified connection in this context. Modules who don't want this kind of
limit on their listening sockets can override CSocket::ConnectionFrom(), but
their sockets will still count towards this limit.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1561 726aef4b-f618-498e-8847-2d620e286838
2009-07-10 13:27:55 +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
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
prozacx
dd6c9a07f5 Added module hooks for when the buffer is being played back
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1494 726aef4b-f618-498e-8847-2d620e286838
2009-04-22 21:48:58 +00:00
psychon
5475361404 Fix some compiler warnings with -Wmissing-declarations
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1439 726aef4b-f618-498e-8847-2d620e286838
2009-03-23 15:26:26 +00:00
psychon
f991274789 Fix a crash bug with recursion in module calls
This was found via partyline and notify_connect. notify_connect calls
CZNC::Broadcast() in OnClientLogin() which calls the OnBroadcast() module call.
When returning from this module calls, m_pUser and m_pClient was reset to NULL
and all the following modules got their OnClientLogin() called with m_pUser and
m_pClient set to NULL.

This patch fixes this by resetting those vars to their old values instead to
NULL when returning from a module call.

This patch also fixes the bug that m_pUser and m_pClient in modules were reset
to NULL after they caused a module call which called back into the current
module. The fix looks similar to the other one (this one is the Modules.h part).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1438 726aef4b-f618-498e-8847-2d620e286838
2009-03-22 19:05:34 +00:00
psychon
994da49638 Remove a mostly unused flag from CModInfo
Nobody cares if a module is found in ~/.znc/modules or in /usr/lib/znc/, right?


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1417 726aef4b-f618-498e-8847-2d620e286838
2009-03-09 17:21:01 +00:00
psychon
ed43e95216 Change the names of all the module entry points to be more ZNC specific
Some of them (eg. GetVersion) where so generic that we even had symbol
clashes (well, on no real worls OS (only windows), but still that's not nice).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1358 726aef4b-f618-498e-8847-2d620e286838
2009-01-29 19:39:21 +00:00
psychon
620c72a2ac Add a ModHandle typedef instead of using void* directly
This makes it clearer what this variable is and it makes porting to windows
easier, because we can just change the typedef to HMODULE.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1344 726aef4b-f618-498e-8847-2d620e286838
2009-01-24 09:11:50 +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
silverleo
d84b9c6e9e Add OnUnknownUserRaw() global module call.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1314 726aef4b-f618-498e-8847-2d620e286838
2008-12-31 12:22:38 +00:00
psychon
1312e6512b Make watch save its settings and add CModule::ClearNV()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1304 726aef4b-f618-498e-8847-2d620e286838
2008-12-26 15:12:25 +00:00
psychon
acd854eb1c Remove virtual where it makes no sense
This commit actually saves memory, since some classes no longer contain a
pointer to their vtable!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1300 726aef4b-f618-498e-8847-2d620e286838
2008-12-22 17:22:34 +00:00
psychon
979f2651f3 Add some API to CModule
This let's module have access to all their active timers/sockets.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1293 726aef4b-f618-498e-8847-2d620e286838
2008-12-18 16:22:31 +00:00
psychon
08088be7d6 Add traffic tracking support to CSocket
Now every module that uses CSocket automatically gets its generated traffic
counted. Those which use Csock directly should be shot and burried anyway ;)

This adds CModule::IsGlobal().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1283 726aef4b-f618-498e-8847-2d620e286838
2008-12-06 19:56:38 +00:00
silverleo
9952e8d2c5 Added OnTimerAutoJoin(). Patch from Freman. Thanks :)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1272 726aef4b-f618-498e-8847-2d620e286838
2008-11-25 10:53:40 +00:00
silverleo
c71565103c Added OnIRCRegistration(). Patch from Freman. Thanks :)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1271 726aef4b-f618-498e-8847-2d620e286838
2008-11-24 17:56:34 +00:00
psychon
db21f88584 Rename OnUserAttached and OnUserDetached and add OnClientConnect
OnUserAttached is renamed to OnClientLogin and
OnUserDetached to OnClientDisconnect.
This adds some new function with different arguments for the old names to cause
warnings from -Woverloaded-virtual while compiling.

This patch also adds OnClientConnect() which is called when the low-level
raw connection is established. (No SSL-handshake was done at this point yet!)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1266 726aef4b-f618-498e-8847-2d620e286838
2008-10-29 17:26:30 +00:00