Skip to Content.
Sympa Menu

en - Re: [sympa-users] setting list priority

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Matt Taggart <address@concealed>
  • To: David Verdin <address@concealed>
  • Cc: Sympa Users <address@concealed>
  • Subject: Re: [sympa-users] setting list priority
  • Date: Fri, 22 Jul 2011 16:07:13 -0700

> Attached is a patch to the latest unstable version that does exactly
> what you want.
> Apply the patch to sympa.pl and the use the command: sympa.pl
> --set_list_priority --list=<listname> --robot=<robotname>
> --priority=<the new priority value>

I adapted the patch to apply to the version we're running (6.0.6, patch
attached). When I use the new option I get log entries,

Jul 22 15:50:52 hostname sympa[28007]: Setting list priority
Jul 22 15:50:52 hostname sympa[28007]: Setting list address@concealed
priority to 3
Jul 22 15:50:52 hostname sympa[28007]: ###### TRACE MESSAGE ######: Old
priority: 5, New priority: 3

If there is an existing priority setting in the config then it adjusts
it as expected. But if it wasn't already there then it fails to add it.

Thanks,

--
Matt Taggart
address@concealed

--- sympa.pl.orig	2011-07-22 13:54:30.000000000 -0700
+++ sympa.pl	2011-07-22 15:47:29.000000000 -0700
@@ -113,6 +113,7 @@
    --log_level=LEVEL                     : sets Sympa log level
    --md5_digest=password                 : output a MD5 digest of a password (usefull for SOAP client trusted application)
    --test_database_message_buffer        : test the database message buffer size
+   --set_list_priority	--[list=X] --[robot=Y] --[priority=Z] : Sets the priority of list X\@Y to the value Z
    -h, --help                            : print this help
    -v, --version                         : print version number
 
@@ -127,7 +128,7 @@
 unless (&GetOptions(\%main::options, 'dump=s', 'debug|d', ,'log_level=s','foreground', 'service=s','config|f=s', 
                     'lang|l=s', 'mail|m', 'keepcopy|k=s', 'help', 'version', 'import=s','make_alias_file','lowercase','sync_list_db','md5_encode_password',
 		    'close_list=s','purge_list=s','create_list','instantiate_family=s','robot=s','add_list=s','modify_list=s','close_family=s','md5_digest=s',
-		    'input_file=s','sync_include=s','upgrade','upgrade_shared','from=s','to=s','reload_list_config','list=s','quiet','close_unknown','test_database_message_buffer')) {
+		    'input_file=s','sync_include=s','upgrade','upgrade_shared','from=s','to=s','reload_list_config','set_list_priority','priority=n','list=s','quiet','close_unknown','test_database_message_buffer')) {
     &fatal_err("Unknown options.");
 }
 
@@ -153,6 +154,7 @@
 				$main::options{'sync_include'} ||
 				$main::options{'upgrade'} ||
 				$main::options{'upgrade_shared'} ||
+				$main::options{'set_list_priority'} ||
 				$main::options{'test_database_message_buffer'} || 
 				$main::options{'reload_list_config'} ||
                                 $main::options{'sync_list_db'}
@@ -782,6 +784,34 @@
 
     exit 0;
 
+}elsif ($main::options{'set_list_priority'}) {
+
+    &do_log('notice', "Setting list priority");
+
+    my ($listname, $robot, $priority);
+
+    unless (($main::options{'list'}) || ($main::options{'robot'}) || ($main::options{'priority'})){
+		&do_log('err', "listname, domain and priority are required, use --list= --robot= --priority= options");
+		exit 1;
+    }
+    $listname = $main::options{'list'} ;
+    $robot = $main::options{'robot'} ;
+    $priority = $main::options{'priority'} ;
+
+    &do_log('notice', "Setting list %s@%s priority to %s",$listname,$robot,$priority);
+
+    my $list = new List ($listname,$robot);
+
+    unless (defined $list) {
+	printf STDERR "Incorrect list or domain name : %s %s\n",$listname,$robot;
+	exit 1;
+    }
+    &do_log('trace','Old priority: %s, New priority: %s',$list->{'admin'}{'priority'},$priority);
+    $list->{'admin'}{'priority'} = $priority;
+    $list->save_config;
+
+    exit 0;
+
 }elsif ($main::options{'reload_list_config'}) {
 
     if ($main::options{'list'}) {



Archive powered by MHonArc 2.6.19+.

Top of Page