ZNC trunk
Loading...
Searching...
No Matches
Modules.h File Reference
#include <znc/zncconfig.h>
#include <znc/WebModules.h>
#include <znc/Utils.h>
#include <znc/Threads.h>
#include <znc/Message.h>
#include <znc/main.h>
#include <znc/Translation.h>
#include <functional>
#include <memory>
#include <set>
#include <queue>
#include <sys/time.h>
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

struct  CModuleEntry
 C-style entry point to the module. More...
class  CCapability
class  CTimer
class  CFPTimer
class  CModuleJob
 A CJob version which can be safely used in modules. More...
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 ZNC_EXPORT_LIB_EXPORT
#define MODCOMMONDEFS(CLASS, DESCRIPTION, TYPE)
#define MODCONSTRUCTOR(CLASS)
 Instead of writing a constructor, you should call this macro.
#define USERMODULEDEFS(CLASS, DESCRIPTION)
 This works exactly like MODULEDEFS, but for user modules.
#define GLOBALMODULEDEFS(CLASS, DESCRIPTION)
 This works exactly like MODULEDEFS, but for global modules.
#define NETWORKMODULEDEFS(CLASS, DESCRIPTION)
 This works exactly like MODULEDEFS, but for network modules.
#define MODULEDEFS(CLASS, DESCRIPTION)
 At the end of your source file, you must call this macro in global context.

Typedefs

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

Functions

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

Macro Definition Documentation

◆ GLOBALMODULEDEFS

#define GLOBALMODULEDEFS ( CLASS,
DESCRIPTION )
Value:
#define MODCOMMONDEFS(CLASS, DESCRIPTION, TYPE)
Definition Modules.h:88
@ GlobalModule
Definition Modules.h:261

This works exactly like MODULEDEFS, but for global modules.

◆ MODCOMMONDEFS

#define MODCOMMONDEFS ( CLASS,
DESCRIPTION,
TYPE )
Value:
static void FillModInfo(CModInfo& Info) { \
auto t_s = [&](const CString& sEnglish, \
const CString& sContext = "") { \
return sEnglish.empty() ? "" : Info.t_s(sEnglish, sContext); \
}; \
t_s(CString()); \
Info.SetDescription(DESCRIPTION); \
Info.SetDefaultType(TYPE); \
Info.AddType(TYPE); \
TModInfo<CLASS>(Info); \
} \
extern "C" { \
\
ZNC_EXPORT_LIB_EXPORT const CModuleEntry* ZNCModuleEntry(); \
ZNC_EXPORT_LIB_EXPORT const CModuleEntry* ZNCModuleEntry() { \
static const CModuleEntry ThisModule = {VERSION_STR, VERSION_EXTRA, \
FillModInfo}; \
return &ThisModule; \
} \
}
#define ZNC_EXPORT_LIB_EXPORT
Definition Modules.h:61
CModule * TModLoad(ModHandle p, CUser *pUser, CIRCNetwork *pNetwork, const CString &sModName, const CString &sModPath, CModInfo::EModuleType eType)
Definition Modules.h:345
Definition Modules.h:259
void SetLoader(ModLoader fLoader)
Definition Modules.h:322
CString t_s(const CString &sEnglish, const CString &sContext="") const
void AddType(EModuleType eType)
Definition Modules.h:289
void SetDefaultType(EModuleType eType)
Definition Modules.h:323
void SetDescription(const CString &s)
Definition Modules.h:318
String class that is used inside ZNC.
Definition ZNCString.h:50
CString()
Definition ZNCString.h:81
#define VERSION_EXTRA
Definition version.h:24
#define ZNC_COMPILE_OPTIONS_STRING
Definition version.h:67

◆ MODCONSTRUCTOR

#define MODCONSTRUCTOR ( CLASS)
Value:
CLASS(ModHandle pDLL, CUser* pUser, CIRCNetwork* pNetwork, \
const CString& sModName, const CString& sModPath, \
: CModule(pDLL, pUser, pNetwork, sModName, sModPath, eType)
void * ModHandle
Definition Modules.h:257
Definition IRCNetwork.h:40
EModuleType
Definition Modules.h:261
CModule(ModHandle pDLL, CUser *pUser, CIRCNetwork *pNetwork, const CString &sModName, const CString &sDataDir, CModInfo::EModuleType eType=CModInfo::NetworkModule)
Definition User.h:38

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
}
}
#define MODCONSTRUCTOR(CLASS)
Instead of writing a constructor, you should call this macro.
Definition Modules.h:128
The base class for your own ZNC modules.
Definition Modules.h:421
Parameters
CLASSThe name of your module's class.

◆ MODULEDEFS

#define MODULEDEFS ( CLASS,
DESCRIPTION )
Value:
NETWORKMODULEDEFS(CLASS, DESCRIPTION)
#define NETWORKMODULEDEFS(CLASS, DESCRIPTION)
This works exactly like MODULEDEFS, but for network modules.
Definition Modules.h:148

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.

◆ NETWORKMODULEDEFS

#define NETWORKMODULEDEFS ( CLASS,
DESCRIPTION )
Value:
@ NetworkModule
Definition Modules.h:261

This works exactly like MODULEDEFS, but for network modules.

◆ USERMODULEDEFS

#define USERMODULEDEFS ( CLASS,
DESCRIPTION )
Value:
MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::UserModule)
@ UserModule
Definition Modules.h:261

This works exactly like MODULEDEFS, but for user modules.

◆ ZNC_EXPORT_LIB_EXPORT

#define ZNC_EXPORT_LIB_EXPORT

Typedef Documentation

◆ FPTimer_t

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

◆ ModHandle

typedef void* ModHandle

Function Documentation

◆ TModInfo()

template<class M>
void TModInfo ( CModInfo & Info)

References TModInfo().

Referenced by TModInfo().

◆ TModLoad()

template<class M>
CModule * TModLoad ( ModHandle p,
CUser * pUser,
CIRCNetwork * pNetwork,
const CString & sModName,
const CString & sModPath,
CModInfo::EModuleType eType )

References TModLoad().

Referenced by TModLoad().