added module loading support, should work out of the box now

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@325 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
imaginos
2005-05-16 17:24:31 +00:00
parent 8676e35172
commit a31064dd00
2 changed files with 72 additions and 7 deletions
+27 -1
View File
@@ -42,8 +42,26 @@ sub CallFunc
sub LoadMod
{
my ( $Username, $Module, $ModPath ) = @_;
my ( $Username, $ModPath ) = @_;
my $Module;
if ( $ModPath =~ /\/([^\/.]+)\.pm/ )
{
$Module = $1;
}
if ( !$Module )
{
ZNC::PutModule( "Invalid Module requested!" );
return( HALTMODS() );
}
# TODO need to do module caching to protect name spaces!!!!
my $DPath = GetString( "DataPath" );
my $FileName = $DPath . "/" . $Username . $Module . ".pm";
if ( $Modules{"$Username|$Module"} )
{
ZNC::PutModule( "$Module Already Loaded" );
@@ -70,6 +88,14 @@ sub UnLoadMod
{
my ( $Username, $Module ) = @_;
$Module =~ s/(.+?)\.pm/$1/;
if ( !$Module )
{
ZNC::PutModule( "Invalid Module requested!" );
return( HALTMODS() );
}
if ( !$Modules{"$Username|$Module"} )
{
ZNC::PutModule( "$Module Isn't Loaded" );