mirror of
https://github.com/znc/znc.git
synced 2026-08-07 01:13:25 +02:00
Support wiki pages names for perl modules.
This commit is contained in:
+4
-2
@@ -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;
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
@@ -8,6 +8,10 @@ sub description {
|
||||
'Evaluates perl code'
|
||||
}
|
||||
|
||||
sub wiki_page {
|
||||
'perleval'
|
||||
}
|
||||
|
||||
sub OnLoad {
|
||||
my $self = shift;
|
||||
if (!$self->GetUser->IsAdmin) {
|
||||
|
||||
Reference in New Issue
Block a user