Support wiki pages names for perl modules.

This commit is contained in:
Alexey Sokolov
2011-06-11 18:21:06 +07:00
parent 262216731b
commit 79e78608b3
3 changed files with 14 additions and 4 deletions
+4 -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;
+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
@@ -8,6 +8,10 @@ sub description {
'Evaluates perl code'
}
sub wiki_page {
'perleval'
}
sub OnLoad {
my $self = shift;
if (!$self->GetUser->IsAdmin) {