|
From: <jgr...@us...> - 2003-11-10 20:15:55
|
Update of /cvsroot/popfile/engine/UI
In directory sc8-pr-cvs1:/tmp/cvs-serv4335/UI
Modified Files:
XMLRPC.pm
Log Message:
"Unixification of POPFile"
--------------------------
1. Change command line parsing to use Getopt so that in future
we can have real command line options. In the past an option
was equivalent to a configuration file item. So you could set
module_param value
inside popfile.cfg, but you could also to
popfile.pl -module_param value
on the command line. The new form of the latter is
popfile.pl --set module_param=value
For the ultimate in laziness you can also use the old style
if you precede the first old style parameter with --, e.g.
the old style command line above would work in the new scheme
if specified as follows
popfile.pl -- -module_param value
It is still even possible to use very old style parameters
from pre-OO days of POPFile with the addition of the --
popfile.pl -- -ui_port 8080
2. Make it possible for a module to disable itself and hence be
unloaded. Unloadable modules have an 'enabled' paramter (currently
supported by all proxies (POP3, NNTP and SMTP) and XML-RPC). If
this parameter is 0 then use if to return the value '2' from start()
which indicates to Loader that the module wishes to be removed.
POPFile/Configuration.pm:
Use Getopt to handle new style command line options. Make
parse_command_line return 0 if there's an error.
POPFile/Module.pm:
Update documentation on start().
POPFile/Loader.pm:
Check the return code from start() and if it is 2 unload the module.
Check the return code from parse_command_line so we halt if there's an
error in command-line parsing.
Proxy/Proxy.pm:
Initialize the 'enabled' parameter to 1.
Proxy/POP3.pm
Proxy/SMTP.pm
Proxy/NNTP.pm:
Use the 'enabled' parameter to return 2 from start() so that if we
are not enabled we get unloaded. Also if not enabled don't register
any UI components.
UI/XMLRPC.pm:
Use the 'enabled' parameter to return 2 from start() so that if we
are not enabled we get unloaded. Also if not enabled don't register
any UI components.
Classifier/Bayes.pm:
When classifying a message without saving to disk, still add the
XPL link.
tests.pl:
Code layout clean up.
tests/TestConfiguration.pm:
Update and improve tests for command-line parsing.
tests/TestProxy.pm:
Check for the initial setting of the 'enabled' parameter.
tests/TestPOP3.pm:
Check that the enabled parameter is interpreted by start() to mean
no start and return 2. Make the XTP tests less time sensitive.
Index: XMLRPC.pm
===================================================================
RCS file: /cvsroot/popfile/engine/UI/XMLRPC.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** XMLRPC.pm 10 Nov 2003 10:37:03 -0000 1.8
--- XMLRPC.pm 10 Nov 2003 20:15:21 -0000 1.9
***************
*** 74,80 ****
my ( $self ) = @_;
! # Disabled by default
! $self->config_( 'enabled', 0);
# XML-RPC is available on port 8081 initially
--- 74,80 ----
my ( $self ) = @_;
! # By default we are disabled
! $self->config_( 'disabled', 1 );
# XML-RPC is available on port 8081 initially
***************
*** 86,100 ****
$self->config_( 'local', 1 );
- # Tell the user interface module that we having a configuration
- # item that needs a UI component
-
- $self->register_configuration_item_( 'configuration', # PROFILE BLOCK START
- 'xmlrpc_port',
- $self ); # PROFILE BLOCK STOP
-
- $self->register_configuration_item_( 'security', # PROFILE BLOCK START
- 'xmlrpc_local',
- $self ); # PROFILE BLOCK STOP
-
return 1;
}
--- 86,89 ----
***************
*** 110,113 ****
--- 99,117 ----
{
my ( $self ) = @_;
+
+ if ( $self->config_( 'enabled' ) == 0 ) {
+ return 2;
+ }
+
+ # Tell the user interface module that we having a configuration
+ # item that needs a UI component
+
+ $self->register_configuration_item_( 'configuration', # PROFILE BLOCK START
+ 'xmlrpc_port',
+ $self ); # PROFILE BLOCK STOP
+
+ $self->register_configuration_item_( 'security', # PROFILE BLOCK START
+ 'xmlrpc_local',
+ $self ); # PROFILE BLOCK STOP
# We use a single XMLRPC::Lite object to handle requests for access to the
|