mirror of
https://github.com/znc/znc.git
synced 2026-08-07 09:22:55 +02:00
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:
+27
-1
@@ -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" );
|
||||
|
||||
Reference in New Issue
Block a user