本文整理汇总了C++中CModInfo类的典型用法代码示例。如果您正苦于以下问题:C++ CModInfo类的具体用法?C++ CModInfo怎么用?C++ CModInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CModInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
template<> void TModInfo<CLogMod>(CModInfo& Info) {
Info.AddType(CModInfo::NetworkModule);
Info.AddType(CModInfo::GlobalModule);
Info.SetHasArgs(true);
Info.SetArgsHelpText("[-sanitize] Optional path where to store logs.");
Info.SetWikiPage("log");
}
示例2: TryAddModInfo
void TryAddModInfo(const CString& sPath, const CString& sName, set<CModInfo>& ssMods, set<CString>& ssAlready, CModInfo::EModuleType eType) {
if (ssAlready.count(sName)) {
return;
}
PyObject* pyFunc = PyObject_GetAttrString(m_PyZNCModule, "get_mod_info_path");
if (!pyFunc) {
CString sRetMsg = GetPyExceptionStr();
DEBUG("modpython tried to get info about [" << sPath << "] (1) but: " << sRetMsg);
return;
}
CModInfo ModInfo;
PyObject* pyRes = PyObject_CallFunction(pyFunc, const_cast<char*>("ssN"),
sPath.c_str(),
sName.c_str(),
SWIG_NewInstanceObj(&ModInfo, SWIG_TypeQuery("CModInfo*"), 0));
if (!pyRes) {
CString sRetMsg = GetPyExceptionStr();
DEBUG("modpython tried to get info about [" << sPath << "] (2) but: " << sRetMsg);
Py_CLEAR(pyFunc);
return;
}
Py_CLEAR(pyFunc);
long int x = PyLong_AsLong(pyRes);
if (PyErr_Occurred()) {
CString sRetMsg = GetPyExceptionStr();
DEBUG("modpython tried to get info about [" << sPath << "] (3) but: " << sRetMsg);
Py_CLEAR(pyRes);
return;
}
Py_CLEAR(pyRes);
if (x && ModInfo.SupportsType(eType)) {
ssMods.insert(ModInfo);
ssAlready.insert(sName);
}
}
示例3: GetModDirs
void CModules::GetAvailableMods(set<CModInfo>& ssMods, bool bGlobal) {
ssMods.clear();
unsigned int a = 0;
CDir Dir;
ModDirList dirs = GetModDirs();
while (!dirs.empty()) {
Dir.FillByWildcard(dirs.front().first, "*.so");
dirs.pop();
for (a = 0; a < Dir.size(); a++) {
CFile& File = *Dir[a];
CString sName = File.GetShortName();
CString sPath = File.GetLongName();
CModInfo ModInfo;
sName.RightChomp(3);
CString sIgnoreRetMsg;
if (GetModPathInfo(ModInfo, sName, sPath, sIgnoreRetMsg)) {
if (ModInfo.IsGlobal() == bGlobal) {
ssMods.insert(ModInfo);
}
}
}
}
GLOBALMODULECALL(OnGetAvailableMods(ssMods, bGlobal), NULL, NULL, );
}
示例4:
void TModInfo<CNotesMod>(CModInfo& Info) {
Info.SetWikiPage("notes");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
"This user module takes up to one arguments. It can be "
"-disableNotesOnLogin not to show notes upon client login");
}
示例5:
void TModInfo<CFloodDetachMod>(CModInfo& Info) {
Info.SetWikiPage("flooddetach");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
Info.t_s("This user module takes up to two arguments. Arguments are "
"numbers of messages and seconds."));
}
示例6: OnGetAvailableMods
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType) override {
unsigned int a = 0;
CDir Dir;
CModules::ModDirList dirs = CModules::GetModDirs();
while (!dirs.empty()) {
Dir.FillByWildcard(dirs.front().first, "*.pm");
dirs.pop();
for (a = 0; a < Dir.size(); a++) {
CFile& File = *Dir[a];
CString sName = File.GetShortName();
CString sPath = File.GetLongName();
CModInfo ModInfo;
sName.RightChomp(3);
PSTART;
PUSH_STR(sPath);
PUSH_STR(sName);
PUSH_PTR(CModInfo*, &ModInfo);
PCALL("ZNC::Core::ModInfoByPath");
if (SvTRUE(ERRSV)) {
DEBUG(__PRETTY_FUNCTION__ << ": " << sPath << ": " << PString(ERRSV));
} else if (ModInfo.SupportsType(eType)) {
ssMods.insert(ModInfo);
}
PEND;
}
}
}
示例7: OnGetAvailableMods
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, bool bGlobal) {
if (bGlobal) {
return;
}
unsigned int a = 0;
CDir Dir;
CModules::ModDirList dirs = CModules::GetModDirs();
while (!dirs.empty()) {
Dir.FillByWildcard(dirs.front().first, "*.pm");
dirs.pop();
for (a = 0; a < Dir.size(); a++) {
CFile& File = *Dir[a];
CString sName = File.GetShortName();
CString sPath = File.GetLongName();
CModInfo ModInfo;
sName.RightChomp(3);
PSTART;
PUSH_STR(sPath);
PUSH_STR(sName);
PCALL("ZNC::Core::ModInfoByPath");
if (!SvTRUE(ERRSV) && ret == 1) {
ModInfo.SetGlobal(false);
ModInfo.SetDescription(PString(ST(0)));
ModInfo.SetName(sName);
ModInfo.SetPath(sPath);
ssMods.insert(ModInfo);
}
PEND;
}
}
}
示例8:
void TModInfo<CFloodDetachMod>(CModInfo& Info) {
Info.SetWikiPage("flooddetach");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
"This user module takes up to two arguments. Arguments are msgs and "
"secs numbers.");
}
示例9:
void TModInfo<CChanAttach>(CModInfo& Info) {
Info.AddType(CModInfo::UserModule);
Info.SetWikiPage("autoattach");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
"List of channel masks and channel masks with ! before them.");
}
示例10:
void TModInfo<CSimpleAway>(CModInfo& Info) {
Info.SetWikiPage("simple_away");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
Info.t_s("You might enter up to 3 arguments, like -notimer awaymessage "
"or -timer 5 awaymessage."));
}
示例11:
template<> void TModInfo<CCharsetMod>(CModInfo& Info)
{
Info.SetWikiPage("charset");
Info.SetHasArgs(true);
Info.SetArgsHelpText("Two charset lists: [-force] "
"<client_charset1[,client_charset2[,...]]> "
"<server_charset1[,server_charset2[,...]]>");
}
示例12: time
void TModInfo<CCtcpFloodMod>(CModInfo& Info) {
Info.SetWikiPage("ctcpflood");
Info.SetHasArgs(true);
Info.SetArgsHelpText(Info.t_s(
"This user module takes none to two arguments. The first argument is "
"the number of lines after which the flood-protection is triggered. "
"The second argument is the time (sec) to in which the number of lines "
"is reached. The default setting is 4 CTCPs in 2 seconds"));
}
示例13: CFile
bool CUser::LoadModule(const CString& sModName, const CString& sArgs,
const CString& sNotice, CString& sError) {
bool bModRet = true;
CString sModRet;
CModInfo ModInfo;
if (!CZNC::Get().GetModules().GetModInfo(ModInfo, sModName, sModRet)) {
sError = "Unable to find modinfo [" + sModName + "] [" + sModRet + "]";
return false;
}
CUtils::PrintAction(sNotice);
if (!ModInfo.SupportsType(CModInfo::UserModule) &&
ModInfo.SupportsType(CModInfo::NetworkModule)) {
CUtils::PrintMessage(
"NOTICE: Module [" + sModName +
"] is a network module, loading module for all networks in user.");
// Do they have old NV?
CFile fNVFile =
CFile(GetUserPath() + "/moddata/" + sModName + "/.registry");
for (CIRCNetwork* pNetwork : m_vIRCNetworks) {
// Check whether the network already has this module loaded (#954)
if (pNetwork->GetModules().FindModule(sModName)) {
continue;
}
if (fNVFile.Exists()) {
CString sNetworkModPath =
pNetwork->GetNetworkPath() + "/moddata/" + sModName;
if (!CFile::Exists(sNetworkModPath)) {
CDir::MakeDir(sNetworkModPath);
}
fNVFile.Copy(sNetworkModPath + "/.registry");
}
bModRet = pNetwork->GetModules().LoadModule(
sModName, sArgs, CModInfo::NetworkModule, this, pNetwork,
sModRet);
if (!bModRet) {
break;
}
}
} else {
bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::UserModule,
this, nullptr, sModRet);
}
if (!bModRet) {
sError = sModRet;
}
return bModRet;
}
示例14: OnGetModInfo
virtual EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
bool& bSuccess, CString& sRetMsg) {
PSTART;
PUSH_STR(sModule);
PCALL("ZNC::Core::GetModInfo");
EModRet result = CONTINUE;
if (SvTRUE(ERRSV)) {
bSuccess = false;
sRetMsg = PString(ERRSV);
} else if (0 < ret) {
switch(static_cast<ELoadPerlMod>(SvUV(ST(0)))) {
case Perl_NotFound:
result = CONTINUE;
break;
case Perl_Loaded:
result = HALT;
if (3 == ret) {
ModInfo.SetGlobal(false);
ModInfo.SetDescription(PString(ST(2)));
ModInfo.SetName(sModule);
ModInfo.SetPath(PString(ST(1)));
bSuccess = true;
} else {
bSuccess = false;
sRetMsg = "Something weird happened";
}
break;
case Perl_LoadError:
result = HALT;
bSuccess = false;
if (2 == ret) {
sRetMsg = PString(ST(1));
} else {
sRetMsg = "Something weird happened";
}
}
} else {
result = HALT;
bSuccess = false;
sRetMsg = "Something weird happened";
}
PEND;
DEBUG(__PRETTY_FUNCTION__ << " " << sRetMsg);
return result;
}
示例15: GetModPathInfo
bool CModules::GetModPathInfo(CModInfo& ModInfo, const CString& sModule, const CString& sModPath, CString& sRetMsg) {
bool bVersionMismatch;
ModHandle p = OpenModule(sModule, sModPath, bVersionMismatch, ModInfo, sRetMsg);
if (!p)
return false;
ModInfo.SetName(sModule);
ModInfo.SetPath(sModPath);
if (bVersionMismatch) {
ModInfo.SetDescription("--- Version mismatch, recompile this module. ---");
}
dlclose(p);
return true;
}