ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Typedefs | Functions
Modules.h File Reference
#include <znc/zncconfig.h>
#include <znc/WebModules.h>
#include <znc/main.h>
#include <set>
#include <queue>
+ Include dependency graph for Modules.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CTimer
 
class  CFPTimer
 
class  CModInfo
 
class  CModCommand
 A helper class for handling commands in modules. More...
 
class  CModule
 The base class for your own ZNC modules. More...
 
class  CModules
 

Macros

#define MODULE_EXPORT
 
#define MODCOMMONDEFS(CLASS, DESCRIPTION, TYPE)
 
#define MODCONSTRUCTOR(CLASS)
 Instead of writing a constructor, you should call this macro. More...
 
#define USERMODULEDEFS(CLASS, DESCRIPTION)   MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::UserModule)
 This works exactly like MODULEDEFS, but for user modules. More...
 
#define GLOBALMODULEDEFS(CLASS, DESCRIPTION)   MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::GlobalModule)
 This works exactly like MODULEDEFS, but for global modules. More...
 
#define NETWORKMODULEDEFS(CLASS, DESCRIPTION)   MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::NetworkModule)
 This works exactly like MODULEDEFS, but for network modules. More...
 
#define MODULEDEFS(CLASS, DESCRIPTION)   NETWORKMODULEDEFS(CLASS, DESCRIPTION)
 At the end of your source file, you must call this macro in global context. More...
 

Typedefs

typedef void * ModHandle
 
typedef void(* FPTimer_t )(CModule *, CFPTimer *)
 

Functions

template<class M >
void TModInfo (CModInfo &Info)
 
template<class M >
CModuleTModLoad (ModHandle p, CUser *pUser, CIRCNetwork *pNetwork, const CString &sModName, const CString &sModPath)
 

Macro Definition Documentation

#define GLOBALMODULEDEFS (   CLASS,
  DESCRIPTION 
)    MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::GlobalModule)

This works exactly like MODULEDEFS, but for global modules.

#define MODCOMMONDEFS (   CLASS,
  DESCRIPTION,
  TYPE 
)
Value:
extern "C" { \
MODULE_EXPORT bool ZNCModInfo(double dCoreVersion, CModInfo& Info); \
bool ZNCModInfo(double dCoreVersion, CModInfo& Info) { \
if (dCoreVersion != VERSION) \
return false; \
Info.SetDescription(DESCRIPTION); \
Info.SetDefaultType(TYPE); \
Info.AddType(TYPE); \
Info.SetLoader(TModLoad<CLASS>); \
TModInfo<CLASS>(Info); \
return true; \
} \
}
#define VERSION
Definition: version.h:8
Definition: Modules.h:180
#define MODULE_EXPORT
Definition: Modules.h:61
#define MODCONSTRUCTOR (   CLASS)
Value:
CLASS(ModHandle pDLL, CUser* pUser, CIRCNetwork* pNetwork, const CString& sModName, \
const CString& sModPath) \
: CModule(pDLL, pUser, pNetwork, sModName, sModPath)
Definition: User.h:37
void * ModHandle
Definition: Modules.h:35
Definition: IRCNetwork.h:36
String class that is used inside ZNC.
Definition: ZNCString.h:67
The base class for your own ZNC modules.
Definition: Modules.h:322

Instead of writing a constructor, you should call this macro.

It accepts all the necessary arguments and passes them on to CModule's constructor. You should assume that there are no arguments to the constructor.

Usage:

* class MyModule : public CModule {
* MODCONSTRUCTOR(MyModule) {
* // Your own constructor's code here
* }
* }
*
Parameters
CLASSThe name of your module's class.
#define MODULE_EXPORT
#define MODULEDEFS (   CLASS,
  DESCRIPTION 
)    NETWORKMODULEDEFS(CLASS, DESCRIPTION)

At the end of your source file, you must call this macro in global context.

It defines some static functions which ZNC needs to load this module. By default the module will be a network module.

Parameters
CLASSThe name of your module's class.
DESCRIPTIONA short description of your module.
#define NETWORKMODULEDEFS (   CLASS,
  DESCRIPTION 
)    MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::NetworkModule)

This works exactly like MODULEDEFS, but for network modules.

#define USERMODULEDEFS (   CLASS,
  DESCRIPTION 
)    MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::UserModule)

This works exactly like MODULEDEFS, but for user modules.

Typedef Documentation

typedef void(* FPTimer_t)(CModule *, CFPTimer *)
typedef void* ModHandle

Function Documentation

template<class M >
void TModInfo ( CModInfo Info)
template<class M >
CModule* TModLoad ( ModHandle  p,
CUser pUser,
CIRCNetwork pNetwork,
const CString sModName,
const CString sModPath 
)