Merge branch 'modinfo'

This commit is contained in:
Alexey Sokolov
2011-06-11 18:32:09 +07:00
45 changed files with 262 additions and 112 deletions
+34 -70
View File
@@ -816,16 +816,15 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
GLOBALMODULECALL(OnModuleLoading(sModule, sArgs, bSuccess, sRetMsg), pUser, NULL, return bSuccess);
CString sModPath, sDataPath;
CString sDesc;
bool bVersionMismatch;
bool bIsGlobal;
CModInfo* Info;
if (!FindModPath(sModule, sModPath, sDataPath)) {
sRetMsg = "Unable to find module [" + sModule + "]";
return false;
}
ModHandle p = OpenModule(sModule, sModPath, bVersionMismatch, bIsGlobal, sDesc, sRetMsg);
ModHandle p = OpenModule(sModule, sModPath, bVersionMismatch, Info, sRetMsg);
if (!p)
return false;
@@ -836,10 +835,11 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
return false;
}
if ((pUser == NULL) != bIsGlobal) {
if ((pUser == NULL) != Info->IsGlobal()) {
delete Info;
dlclose(p);
sRetMsg = "Module [" + sModule + "] is ";
sRetMsg += (bIsGlobal) ? "" : "not ";
sRetMsg += Info->IsGlobal() ? "" : "not ";
sRetMsg += "a global module.";
return false;
}
@@ -847,37 +847,19 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
CModule* pModule = NULL;
if (pUser) {
typedef CModule* (*fp)(ModHandle, CUser* pUser,
const CString& sModName, const CString& sDataPath);
fp Load = (fp) dlsym(p, "ZNCModLoad");
if (!Load) {
dlclose(p);
sRetMsg = "Could not find ZNCModLoad() in module [" + sModule + "]";
return false;
}
pModule = Load(p, pUser, sModule, sDataPath);
pModule = Info->GetLoader()(p, pUser, sModule, sDataPath);
} else {
typedef CModule* (*fp)(ModHandle, const CString& sModName,
const CString& sDataPath);
fp Load = (fp) dlsym(p, "ZNCModLoad");
if (!Load) {
dlclose(p);
sRetMsg = "Could not find ZNCModLoad() in module [" + sModule + "]";
return false;
}
pModule = Load(p, sModule, sDataPath);
pModule = Info->GetGlobalLoader()(p, sModule, sDataPath);
}
pModule->SetDescription(sDesc);
pModule->SetGlobal(bIsGlobal);
pModule->SetDescription(Info->GetDescription());
pModule->SetGlobal(Info->IsGlobal());
pModule->SetArgs(sArgs);
pModule->SetModPath(CDir::ChangeDir(CZNC::Get().GetCurPath(), sModPath));
push_back(pModule);
delete Info;
bool bLoaded;
try {
bLoaded = pModule->OnLoad(sArgs, sRetMsg);
@@ -923,27 +905,19 @@ bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
ModHandle p = pModule->GetDLL();
if (p) {
typedef void (*fp)(CModule*);
fp Unload = (fp)dlsym(p, "ZNCModUnload");
delete pModule;
if (Unload) {
Unload(pModule);
for (iterator it = begin(); it != end(); ++it) {
if (*it == pModule) {
erase(it);
break;
}
for (iterator it = begin(); it != end(); ++it) {
if (*it == pModule) {
erase(it);
break;
}
dlclose(p);
sRetMsg = "Module [" + sMod + "] unloaded";
return true;
} else {
sRetMsg = "Unable to unload module [" + sMod + "] could not find ZNCModUnload()";
return false;
}
dlclose(p);
sRetMsg = "Module [" + sMod + "] unloaded";
return true;
}
sRetMsg = "Unable to unload module [" + sMod + "]";
@@ -980,17 +954,17 @@ bool CModules::GetModInfo(CModInfo& ModInfo, const CString& sModule, CString& sR
}
bool CModules::GetModPathInfo(CModInfo& ModInfo, const CString& sModule, const CString& sModPath, CString& sRetMsg) {
CString sDesc;
bool bVersionMismatch;
bool bIsGlobal;
CModInfo* Info;
ModHandle p = OpenModule(sModule, sModPath, bVersionMismatch, bIsGlobal, sDesc, sRetMsg);
ModHandle p = OpenModule(sModule, sModPath, bVersionMismatch, Info, sRetMsg);
if (!p)
return false;
ModInfo.SetGlobal(bIsGlobal);
ModInfo.SetDescription(sDesc);
if (Info) {
ModInfo = *Info;
}
ModInfo.SetName(sModule);
ModInfo.SetPath(sModPath);
@@ -998,6 +972,7 @@ bool CModules::GetModPathInfo(CModInfo& ModInfo, const CString& sModule, const C
ModInfo.SetDescription("--- Version mismatch, recompile this module. ---");
}
delete Info;
dlclose(p);
return true;
@@ -1082,11 +1057,10 @@ CModules::ModDirList CModules::GetModDirs() {
}
ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath, bool &bVersionMismatch,
bool &bIsGlobal, CString& sDesc, CString& sRetMsg) {
CModInfo*& Info, CString& sRetMsg) {
// Some sane defaults in case anything errors out below
bVersionMismatch = false;
bIsGlobal = false;
sDesc.clear();
Info = NULL;
sRetMsg.clear();
for (unsigned int a = 0; a < sModule.length(); a++) {
@@ -1124,21 +1098,12 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
return NULL;
}
typedef bool (*bFP)();
bFP IsGlobal = (bFP) dlsym(p, "ZNCModGlobal");
typedef CModInfo* (*InfoFP)();
InfoFP ZNCModInfo = (InfoFP) dlsym(p, "ZNCModInfo");
if (!IsGlobal) {
if (!ZNCModInfo) {
dlclose(p);
sRetMsg = "Could not find ZNCModGlobal() in module [" + sModule + "]";
return NULL;
}
typedef const char *(*sFP)();
sFP GetDesc = (sFP) dlsym(p, "ZNCModDescription");
if (!GetDesc) {
dlclose(p);
sRetMsg = "Could not find ZNCModDescription() in module [" + sModule + "]";
sRetMsg = "Could not find ZNCModInfo() in module [" + sModule + "]";
return NULL;
}
@@ -1146,10 +1111,9 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
bVersionMismatch = true;
sRetMsg = "Version mismatch, recompile this module.";
} else {
Info = ZNCModInfo();
sRetMsg = "";
bVersionMismatch = false;
bIsGlobal = IsGlobal();
sDesc = GetDesc();
}
return p;
+53 -35
View File
@@ -24,6 +24,9 @@ class CClient;
class CWebSock;
class CTemplate;
class CIRCSock;
class CModule;
class CGlobalModule;
class CModInfo;
// !Forward Declarations
// User Module Macros
@@ -39,13 +42,31 @@ class CIRCSock;
typedef void* ModHandle;
#define MODCOMMONDEFS(DESCRIPTION, GLOBAL) \
const char *ZNCModDescription(); \
bool ZNCModGlobal(); \
double ZNCModVersion(); \
const char *ZNCModDescription() { return DESCRIPTION; } \
double ZNCModVersion() { return VERSION; } \
bool ZNCModGlobal() { return GLOBAL; } \
template<class M> void TModInfo(CModInfo& Info) {}
template<class M> CModule* TModLoad(ModHandle p, CUser* pUser,
const CString& sModName, const CString& sModPath) {
return new M(p, pUser, sModName, sModPath);
}
template<class M> CGlobalModule* TModLoadGlobal(ModHandle p,
const CString& sModName, const CString& sModPath) {
return new M(p, sModName, sModPath);
}
#define MODCOMMONDEFS(CLASS, DESCRIPTION, GLOBAL, LOADER) \
extern "C" { \
double ZNCModVersion(); \
double ZNCModVersion() { return VERSION; } \
CModInfo* ZNCModInfo(); \
CModInfo* ZNCModInfo() { \
CModInfo* Info = new CModInfo(); \
Info->SetDescription(DESCRIPTION); \
Info->SetGlobal(GLOBAL); \
LOADER; \
TModInfo<CLASS>(*Info); \
return Info; \
} \
}
/** 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
@@ -75,17 +96,7 @@ typedef void* ModHandle;
* @see For global modules you need GLOBALMODULEDEFS.
*/
#define MODULEDEFS(CLASS, DESCRIPTION) \
extern "C" { \
MODCOMMONDEFS(DESCRIPTION, false) \
/* First the definitions to shut up some compiler warnings */ \
CModule* ZNCModLoad(ModHandle p, CUser* pUser, const CString& sModName, \
const CString& sModPath); \
void ZNCModUnload(CModule* pMod); \
CModule* ZNCModLoad(ModHandle p, CUser* pUser, const CString& sModName, \
const CString& sModPath) \
{ return new CLASS(p, pUser, sModName, sModPath); } \
void ZNCModUnload(CModule* pMod) { if (pMod) { delete pMod; } } \
}
MODCOMMONDEFS(CLASS, DESCRIPTION, false, Info->SetLoader(TModLoad<CLASS>))
// !User Module Macros
// Global Module Macros
@@ -96,17 +107,7 @@ typedef void* ModHandle;
/** This works exactly like MODULEDEFS, but for global modules. */
#define GLOBALMODULEDEFS(CLASS, DESCRIPTION) \
extern "C" { \
MODCOMMONDEFS(DESCRIPTION, true) \
/* First the definitions to shut up some compiler warnings */ \
CGlobalModule* ZNCModLoad(ModHandle p, const CString& sModName, \
const CString& sModPath); \
void ZNCModUnload(CGlobalModule* pMod); \
CGlobalModule* ZNCModLoad(ModHandle p, const CString& sModName, \
const CString& sModPath) \
{ return new CLASS(p, sModName, sModPath); } \
void ZNCModUnload(CGlobalModule* pMod) { if (pMod) { delete pMod; } } \
}
MODCOMMONDEFS(CLASS, DESCRIPTION, true, Info->SetGlobalLoader(TModLoadGlobal<CLASS>))
// !Global Module Macros
// Forward Declarations
@@ -166,11 +167,19 @@ private:
class CModInfo {
public:
CModInfo() {}
typedef CModule* (*ModLoader)(ModHandle p, CUser* pUser, const CString& sModName, const CString& sModPath);
typedef CGlobalModule* (*GlobalModLoader)(ModHandle p, const CString& sModName, const CString& sModPath);
CModInfo() {
m_fGlobalLoader = NULL;
m_fLoader = NULL;
}
CModInfo(const CString& sName, const CString& sPath, bool bGlobal) {
m_bGlobal = bGlobal;
m_sName = sName;
m_sPath = sPath;
m_fGlobalLoader = NULL;
m_fLoader = NULL;
}
~CModInfo() {}
@@ -182,21 +191,30 @@ public:
const CString& GetName() const { return m_sName; }
const CString& GetPath() const { return m_sPath; }
const CString& GetDescription() const { return m_sDescription; }
const CString& GetWikiPage() const { return m_sWikiPage; }
bool IsGlobal() const { return m_bGlobal; }
ModLoader GetLoader() const { return m_fLoader; }
GlobalModLoader GetGlobalLoader() const { return m_fGlobalLoader; }
// !Getters
// Setters
void SetName(const CString& s) { m_sName = s; }
void SetPath(const CString& s) { m_sPath = s; }
void SetDescription(const CString& s) { m_sDescription = s; }
void SetWikiPage(const CString& s) { m_sWikiPage = s; }
void SetGlobal(bool b) { m_bGlobal = b; }
void SetLoader(ModLoader fLoader) { m_fLoader = fLoader; }
void SetGlobalLoader(GlobalModLoader fGlobalLoader) { m_fGlobalLoader = fGlobalLoader; }
// !Setters
private:
protected:
bool m_bGlobal;
CString m_sName;
CString m_sPath;
CString m_sDescription;
bool m_bGlobal;
CString m_sName;
CString m_sPath;
CString m_sDescription;
CString m_sWikiPage;
ModLoader m_fLoader;
GlobalModLoader m_fGlobalLoader;
};
/** A helper class for handling commands in modules. */
@@ -964,7 +982,7 @@ public:
private:
static ModHandle OpenModule(const CString& sModule, const CString& sModPath,
bool &bVersionMismatch, bool &bIsGlobal, CString& sDesc, CString& sRetMsg);
bool &bVersionMismatch, CModInfo*& Info, CString& sRetMsg);
protected:
CUser* m_pUser;
+4
View File
@@ -857,4 +857,8 @@ public:
virtual ~CAdminMod() {}
};
template<> void TModInfo<CAdminMod>(CModInfo& Info) {
Info.SetWikiPage("admin");
}
MODULEDEFS(CAdminMod, "Dynamic configuration of users/settings through IRC")
+4
View File
@@ -163,4 +163,8 @@ private:
CString m_sLogFile;
};
template<> void TModInfo<CAdminLogMod>(CModInfo& Info) {
Info.SetWikiPage("adminlog");
}
GLOBALMODULEDEFS(CAdminLogMod, "Log ZNC events to file and/or syslog.")
+4
View File
@@ -246,4 +246,8 @@ private:
VAttachMatch m_vMatches;
};
template<> void TModInfo<CChanAttach>(CModInfo& Info) {
Info.SetWikiPage("autoattach");
}
MODULEDEFS(CChanAttach, "Reattaches you to channels on activity.")
+4
View File
@@ -224,4 +224,8 @@ private:
vector<CString> m_vsNegChans;
};
template<> void TModInfo<CAutoCycleMod>(CModInfo& Info) {
Info.SetWikiPage("autocycle");
}
MODULEDEFS(CAutoCycleMod, "Rejoins channels to gain Op if you're the only user left")
+4
View File
@@ -463,4 +463,8 @@ void CAutoOpTimer::RunJob() {
m_pParent->ProcessQueue();
}
template<> void TModInfo<CAutoOpMod>(CModInfo& Info) {
Info.SetWikiPage("autoop");
}
MODULEDEFS(CAutoOpMod, "Auto op the good guys")
+4
View File
@@ -88,5 +88,9 @@ private:
TCacheMap<CString> m_Messaged;
};
template<> void TModInfo<CAutoReplyMod>(CModInfo& Info) {
Info.SetWikiPage("autoreply");
}
MODULEDEFS(CAutoReplyMod, "Reply to queries when you are away")
+4
View File
@@ -186,4 +186,8 @@ void CAwayNickTimer::RunJob() {
}
}
template<> void TModInfo<CAwayNickMod>(CModInfo& Info) {
Info.SetWikiPage("awaynick");
}
MODULEDEFS(CAwayNickMod, "Change your nick while you are away")
+4
View File
@@ -168,4 +168,8 @@ private:
}
};
template<> void TModInfo<CBlockUser>(CModInfo& Info) {
Info.SetWikiPage("blockuser");
}
GLOBALMODULEDEFS(CBlockUser, "Block certain users from logging in")
+4
View File
@@ -66,5 +66,9 @@ public:
}
};
template<> void TModInfo<CBuffExtras>(CModInfo& Info) {
Info.SetWikiPage("buffextras");
}
MODULEDEFS(CBuffExtras, "Add joins, parts etc. to the playback buffer")
+4
View File
@@ -85,4 +85,8 @@ public:
}
};
template<> void TModInfo<CCertMod>(CModInfo& Info) {
Info.SetWikiPage("cert");
}
MODULEDEFS(CCertMod, "Use a ssl certificate to connect to a server")
+4
View File
@@ -276,4 +276,8 @@ private:
MSCString m_PubKeys;
};
template<> void TModInfo<CSSLClientCertMod>(CModInfo& Info) {
Info.SetWikiPage("certauth");
}
GLOBALMODULEDEFS(CSSLClientCertMod, "Allow users to authenticate via SSL client certificates")
+4
View File
@@ -72,4 +72,8 @@ private:
bool m_bWriteConf;
};
template<> void TModInfo<CChanSaverMod>(CModInfo& Info) {
Info.SetWikiPage("chansaver");
}
MODULEDEFS(CChanSaverMod, "Keep config up-to-date when user joins/parts")
+4
View File
@@ -102,5 +102,9 @@ public:
}
};
template<> void TModInfo<CClientNotifyMod>(CModInfo& Info) {
Info.SetWikiPage("clientnotify");
}
MODULEDEFS(CClientNotifyMod, "Notifies you when another IRC client logs into or out of your account. Configurable.")
+4
View File
@@ -151,4 +151,8 @@ public:
}
};
template<> void TModInfo<CCryptMod>(CModInfo& Info) {
Info.SetWikiPage("crypt");
}
MODULEDEFS(CCryptMod, "Encryption for channel/private messages")
@@ -136,7 +136,7 @@
<? LOOP ModuleLoop ?>
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
<td class="mod_name">
<input type="checkbox" name="loadmod" id="lm_<? VAR Name ?>" value="<? VAR Name ?>"<? IF Checked ?> checked="checked"<? ENDIF ?><? IF Disabled ?> disabled="disabled"<? ENDIF ?> /><label for="lm_<? VAR Name ?>"> <? VAR Name ?></label>
<input type="checkbox" name="loadmod" id="lm_<? VAR Name ?>" value="<? VAR Name ?>"<? IF Checked ?> checked="checked"<? ENDIF ?><? IF Disabled ?> disabled="disabled"<? ENDIF ?> /><label for="lm_<? VAR Name ?>"> <? IF Wiki ?><a href="http://wiki.znc.in/<? VAR Wiki ?>"><? VAR Name ?></a> <? ELSE ?> <? VAR Name ?> <? ENDIF ?></label>
</td>
<td class="mod_args">
<? IF Disabled ?><? VAR Args ?><? ELSE ?><input class="third" type="text" name="modargs_<? VAR Name ?>" value="<? VAR Args ?>" /><? ENDIF ?>
+1 -1
View File
@@ -132,7 +132,7 @@
<tbody>
<? LOOP ModuleLoop ?>
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
<td class="mod_name"><input type="checkbox" name="loadmod" id="lm_<? VAR Name ?>" value="<? VAR Name ?>"<? IF Checked ?> checked="checked"<? ENDIF ?><? IF Disabled ?> disabled="disabled"<? ENDIF ?> /><label for="lm_<? VAR Name ?>"> <? VAR Name ?></label></td>
<td class="mod_name"><input type="checkbox" name="loadmod" id="lm_<? VAR Name ?>" value="<? VAR Name ?>"<? IF Checked ?> checked="checked"<? ENDIF ?><? IF Disabled ?> disabled="disabled"<? ENDIF ?> /><label for="lm_<? VAR Name ?>"> <? IF Wiki ?> <a href="http://wiki.znc.in/<? VAR Wiki ?>"><? VAR Name ?></a> <? ELSE ?> <? VAR Name ?> <? ENDIF ?></label></td>
<td class="mod_args"><input type="text" name="modargs_<? VAR Name ?>" value="<? VAR Args ?>" /></td>
<td class="mod_descr"><? VAR Description ?></td>
</tr>
+4
View File
@@ -29,4 +29,8 @@ public:
}
};
template<> void TModInfo<CKickClientOnIRCDisconnect>(CModInfo& Info) {
Info.SetWikiPage("disconkick");
}
MODULEDEFS(CKickClientOnIRCDisconnect, "Kicks the client from all channels when the connection to the IRC server is lost")
+4
View File
@@ -95,4 +95,8 @@ private:
unsigned int m_uiAllowedFailed;
};
template<> void TModInfo<CFailToBanMod>(CModInfo& Info) {
Info.SetWikiPage("fail2ban");
}
GLOBALMODULEDEFS(CFailToBanMod, "Block IPs for some time after a failed login")
+4
View File
@@ -22,4 +22,8 @@ public:
}
};
template<> void TModInfo<CPreventIdMsgMod>(CModInfo& Info) {
Info.SetWikiPage("fixfreenode");
}
MODULEDEFS(CPreventIdMsgMod, "Prevent client from sending IDENTIFY-MSG to server")
+4
View File
@@ -162,4 +162,8 @@ public:
}
};
template<> void TModInfo<CIdentFileModule>(CModInfo& Info) {
Info.SetWikiPage("identfile");
}
GLOBALMODULEDEFS(CIdentFileModule, "Write the ident of a user to a file when they are trying to connect")
+4
View File
@@ -192,4 +192,8 @@ void CKeepNickTimer::RunJob() {
m_pMod->KeepNick();
}
template<> void TModInfo<CKeepNickMod>(CModInfo& Info) {
Info.SetWikiPage("keepnick");
}
MODULEDEFS(CKeepNickMod, "Keep trying for your primary nick")
+4
View File
@@ -108,4 +108,8 @@ public:
}
};
template<> void TModInfo<CRejoinMod>(CModInfo& Info) {
Info.SetWikiPage("kickrejoin");
}
MODULEDEFS(CRejoinMod, "Autorejoin on kick")
+4
View File
@@ -148,4 +148,8 @@ public:
};
template<> void TModInfo<CLastSeenMod>(CModInfo& Info) {
Info.SetWikiPage("lastseen");
}
GLOBALMODULEDEFS(CLastSeenMod, "Collects data about when a user last logged in")
+8 -2
View File
@@ -147,11 +147,12 @@ public:
break;
case Perl_Loaded:
result = HALT;
if (3 == ret) {
if (4 == ret) {
ModInfo.SetGlobal(false);
ModInfo.SetDescription(PString(ST(2)));
ModInfo.SetName(sModule);
ModInfo.SetPath(PString(ST(1)));
ModInfo.SetWikiPage(PString(ST(3)));
bSuccess = true;
} else {
bSuccess = false;
@@ -201,11 +202,12 @@ public:
PUSH_STR(sPath);
PUSH_STR(sName);
PCALL("ZNC::Core::ModInfoByPath");
if (!SvTRUE(ERRSV) && ret == 1) {
if (!SvTRUE(ERRSV) && ret == 2) {
ModInfo.SetGlobal(false);
ModInfo.SetDescription(PString(ST(0)));
ModInfo.SetName(sName);
ModInfo.SetPath(sPath);
ModInfo.SetWikiPage(PString(ST(1)));
ssMods.insert(ModInfo);
}
PEND;
@@ -316,4 +318,8 @@ CPerlSocket::~CPerlSocket() {
}
}
template<> void TModInfo<CModPerl>(CModInfo& Info) {
Info.SetWikiPage("modperl");
}
GLOBALMODULEDEFS(CModPerl, "Loads perl scripts as ZNC modules")
+6 -2
View File
@@ -154,7 +154,7 @@ sub GetModInfo {
return ($ZNC::Perl_LoadError, "Incorrect perl module.") unless IsModule $modpath, $modname;
require $modpath;
my $pmod = bless {}, $modname;
return ($ZNC::Perl_Loaded, $modpath, $pmod->description)
return ($ZNC::Perl_Loaded, $modpath, $pmod->description, $pmod->wiki_page)
}
sub ModInfoByPath {
@@ -162,7 +162,7 @@ sub ModInfoByPath {
die "Incorrect perl module." unless IsModule $modpath, $modname;
require $modpath;
my $pmod = bless {}, $modname;
return ($pmod->description)
return ($pmod->description, $pmod->wiki_page)
}
sub CallModFunc {
@@ -279,6 +279,10 @@ sub description {
"< Placeholder for a description >"
}
sub wiki_page {
''
}
# Default implementations for module hooks. They can be overriden in derived modules.
sub OnLoad {1}
sub OnBoot {}
+4
View File
@@ -478,4 +478,8 @@ PyObject* CPySocket::WriteBytes(PyObject* data) {
}
}
template<> void TModInfo<CModPython>(CModInfo& Info) {
Info.SetWikiPage("modpython");
}
GLOBALMODULEDEFS(CModPython, "Loads python scripts as ZNC modules")
+5 -1
View File
@@ -151,6 +151,8 @@ class ModuleNV(collections.MutableMapping):
class Module:
description = '< Placeholder for a description >'
wiki_page = ''
def __str__(self):
return self.GetModName()
@@ -498,6 +500,7 @@ def get_mod_info(modname, retmsg, modinfo):
cl = pymodule.__dict__[modname]
modinfo.SetGlobal(False)
modinfo.SetDescription(cl.description)
modinfo.SetWikiPage(cl.wiki_page)
modinfo.SetName(modname)
modinfo.SetPath(pymodule.__file__)
return 2
@@ -524,7 +527,8 @@ def get_mod_info_path(path, modname, modinfo):
return 0
cl = pymodule.__dict__[modname]
modinfo.SetGlobal(False)
modinfo.SetDescription(get_descr(cl))
modinfo.SetDescription(cl.description)
modinfo.SetWikiPage(cl.wiki_page)
modinfo.SetName(modname)
modinfo.SetPath(pymodule.__file__)
return 1
+4
View File
@@ -494,4 +494,8 @@ void CModTclStartTimer::RunJob() {
p->Start();
}
template<> void TModInfo<CModTcl>(CModInfo& Info) {
Info.SetWikiPage("modtcl");
}
MODULEDEFS(CModTcl, "Loads Tcl scripts as ZNC modules")
+4
View File
@@ -76,4 +76,8 @@ private:
CString m_sPass;
};
template<> void TModInfo<CNickServ>(CModInfo& Info) {
Info.SetWikiPage("nickserv");
}
MODULEDEFS(CNickServ, "Auths you with NickServ")
+4
View File
@@ -212,4 +212,8 @@ public:
}
};
template<> void TModInfo<CNotesMod>(CModInfo& Info) {
Info.SetWikiPage("notes");
}
MODULEDEFS(CNotesMod, "Keep and replay notes")
+4
View File
@@ -715,4 +715,8 @@ private:
set<CString> m_ssDefaultChans;
};
template<> void TModInfo<CPartylineMod>(CModInfo& Info) {
Info.SetWikiPage("partyline");
}
GLOBALMODULEDEFS(CPartylineMod, "Internal channels and queries for users connected to znc")
+4
View File
@@ -166,4 +166,8 @@ private:
VCString m_vPerform;
};
template<> void TModInfo<CPerform>(CModInfo& Info) {
Info.SetWikiPage("perform");
}
MODULEDEFS(CPerform, "Keeps a list of commands to be executed when ZNC connects to IRC.")
+4
View File
@@ -8,6 +8,10 @@ sub description {
'Evaluates perl code'
}
sub wiki_page {
'perleval'
}
sub OnLoad {
my $self = shift;
if (!$self->GetUser->IsAdmin) {
+4
View File
@@ -483,4 +483,8 @@ private:
}
};
template<> void TModInfo<CQModule>(CModInfo& Info) {
Info.SetWikiPage("Q");
}
MODULEDEFS(CQModule, "Auths you with QuakeNet's Q bot.")
+4
View File
@@ -28,5 +28,9 @@ public:
}
};
template<> void TModInfo<CRawMod>(CModInfo& Info) {
Info.SetWikiPage("raw");
}
MODULEDEFS(CRawMod, "View all of the raw traffic")
+4
View File
@@ -422,4 +422,8 @@ void CRouteTimeout::RunJob()
pMod->Timeout();
}
template<> void TModInfo<CRouteRepliesMod>(CModInfo& Info) {
Info.SetWikiPage("route_replies");
}
MODULEDEFS(CRouteRepliesMod, "Send replies (e.g. to /who) to the right client only")
+4
View File
@@ -230,5 +230,9 @@ public:
}
};
template<> void TModInfo<CSampleMod>(CModInfo& Info) {
Info.SetWikiPage("sample");
}
MODULEDEFS(CSampleMod, "To be used as a sample for writing modules")
+4
View File
@@ -335,5 +335,9 @@ void CSaveBuffJob::RunJob()
p->SaveBufferToDisk();
}
template<> void TModInfo<CSaveBuff>(CModInfo& Info) {
Info.SetWikiPage("savebuff");
}
MODULEDEFS(CSaveBuff, "Stores channel buffers to disk, encrypted")
+5
View File
@@ -463,5 +463,10 @@ void CRemMarkerJob::RunJob()
// store buffer
}
template<> void TModInfo<CSChat>(CModInfo& Info) {
Info.SetWikiPage("schat");
}
MODULEDEFS(CSChat, "Secure cross platform (:P) chat system")
+3
View File
@@ -216,5 +216,8 @@ void CSimpleAwayJob::RunJob() {
((CSimpleAway*)m_pModule)->SetAway(false);
}
template<> void TModInfo<CSimpleAway>(CModInfo& Info) {
Info.SetWikiPage("simple_away");
}
MODULEDEFS(CSimpleAway, "Auto away when last client disconnects")
+4
View File
@@ -187,4 +187,8 @@ bool CStickyChan::OnLoad(const CString& sArgs, CString& sMessage)
return(true);
}
template<> void TModInfo<CStickyChan>(CModInfo& Info) {
Info.SetWikiPage("stickychan");
}
MODULEDEFS(CStickyChan, "configless sticky chans, keeps you there very stickily even")
+4
View File
@@ -550,4 +550,8 @@ private:
CBuffer m_Buffer;
};
template<> void TModInfo<CWatcherMod>(CModInfo& Info) {
Info.SetWikiPage("watch");
}
MODULEDEFS(CWatcherMod, "Copy activity from a specific user into a separate window")
+6
View File
@@ -745,6 +745,7 @@ public:
l["Name"] = Info.GetName();
l["Description"] = Info.GetDescription();
l["Args"] = GetModArgs(pUser, Info.GetName());
l["Wiki"] = Info.GetWikiPage();
if (pUser && pUser->GetModules().FindModule(Info.GetName())) {
l["Checked"] = "true";
@@ -1039,6 +1040,7 @@ public:
l["Name"] = Info.GetName();
l["Description"] = Info.GetDescription();
l["Args"] = GetModArgs(NULL, Info.GetName(), true);
l["Wiki"] = Info.GetWikiPage();
}
return true;
@@ -1124,4 +1126,8 @@ public:
}
};
template<> void TModInfo<CWebAdminMod>(CModInfo& Info) {
Info.SetWikiPage("webadmin");
}
GLOBALMODULEDEFS(CWebAdminMod, "Web based administration module")