Skip to Content.
Sympa Menu

devel - Re: [sympa-dev] Adding a list config parameter

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Olivier Salaun - CRU <address@concealed>
  • To: Chris Hastie <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [sympa-dev] Adding a list config parameter
  • Date: Mon, 22 Mar 2004 14:32:50 +0100

The per-list 'rfc2369_header_fields' parameter makes sense.
Attached is a patch (against a 4.1) that provides this feature ; you can compare it to what you coded yourself...

Chris Hastie a écrit :

Well parameters, actually.

I need to exert a little more control over the content of the List-* headers, so I've been looking at making these a configurable option.
[...]

--
Olivier Salaun
Comite Reseau des Universites

diff -u -r1.171 sympa.tex.tpl
--- doc/sympa.tex.tpl 15 Mar 2004 12:49:54 -0000 1.171
+++ doc/sympa.tex.tpl 22 Mar 2004 13:27:09 -0000
@@ -6470,6 +6470,18 @@

\example {custom\_header X-url:
http://www.cru.fr/listes/apropos/sedesabonner.faq.html}.

+\subsection {rfc2369\_header\_fields}
+ \label {par-rfc2369-header-fields}
+ \index{rfc2369-header-fields}
+
+ \default {\cfkeyword {rfc2369\_header\_fields} sympa.conf parameter}
+ \lparam {rfc2369\_header\_fields} \textit {help,archive}
+
+RFC2369 compliant header fields (List-xxx) to be added to distributed
messages.
+These header-fields should be implemented by MUA's, adding menus.
+
+\example {custom\_header X-url:
http://www.cru.fr/listes/apropos/sedesabonner.faq.html}.
+
\subsection {custom\_subject}

\label {par-custom-subject}
Index: nls/fr.msg
===================================================================
RCS file: /home/sympa/cvsroot/sympa/nls/fr.msg,v
retrieving revision 1.32
diff -u -r1.32 fr.msg
--- nls/fr.msg 24 Dec 2002 08:50:24 -0000 1.32
+++ nls/fr.msg 22 Mar 2004 13:27:09 -0000
@@ -401,6 +401,7 @@
208 "Certificat pour authentification de la connection"
209 "nom court pour cette source"
212 "Archivage des messages cryptés"
+213 "Champs d'entête compatibles RFC 2369"

$set 17 Cookie expiration periods
1 "la session"
Index: nls/us.msg
===================================================================
RCS file: /home/sympa/cvsroot/sympa/nls/us.msg,v
retrieving revision 1.36
diff -u -r1.36 us.msg
--- nls/us.msg 24 Dec 2002 08:50:24 -0000 1.36
+++ nls/us.msg 22 Mar 2004 13:27:09 -0000
@@ -388,6 +388,7 @@
210 "a listname or list address or *@<domain> or *@*"
211 "admin role selection"
212 "Archive encrypted mails as cleartext"
+213 "RFC 2369 Header fields"

$set 17 Cookie expiration periods
1 "session"
Index: src/List.pm
===================================================================
RCS file: /home/sympa/cvsroot/sympa/src/List.pm,v
retrieving revision 1.429
diff -u -r1.429 List.pm
--- src/List.pm 22 Mar 2004 10:02:40 -0000 1.429
+++ src/List.pm 22 Mar 2004 13:27:09 -0000
@@ -890,6 +890,13 @@
'title_id' => 67,
'group' => 'command'
},
+ 'rfc2369_header_fields' => {'format' =>
['help','subscribe','unsubscribe','post','owner','archive'],
+ 'default' => {'conf' =>
'rfc2369_header_fields'},
+ 'occurrence' => '0-n',
+ 'split_char' => ',',
+ 'title_id' => 213,
+ 'group' => 'sending'
+ },
'send' => {'scenario' => 'send',
'title_id' => 68,
'group' => 'sending'
@@ -1445,7 +1452,7 @@
}

$self->{'admin'} = $admin if ($admin);
-
+
# default list host is robot domain
$self->{'admin'}{'host'} ||= $self->{'domain'};
# uncomment the following line if you want virtual robot to overwrite
list->host
@@ -2096,7 +2103,7 @@
$hdr->add('List-Id', sprintf ('<%s.%s>', $self->{'name'},
$self->{'admin'}{'host'}));

## Add RFC 2369 header fields
- foreach my $field (@{$Conf{'rfc2369_header_fields'}}) {
+ foreach my $field (@{$self->{'admin'}{'rfc2369_header_fields'}}) {
if ($field eq 'help') {
$hdr->add('List-Help', sprintf ('<mailto:%s@%s?subject=help>',
&Conf::get_robot_conf($robot, 'email'), &Conf::get_robot_conf($robot,
'host')));
}elsif ($field eq 'unsubscribe') {
Index: wwsympa/wwsympa.fcgi
===================================================================
RCS file: /home/sympa/cvsroot/sympa/wwsympa/wwsympa.fcgi,v
retrieving revision 1.389
diff -u -r1.389 wwsympa.fcgi
--- wwsympa/wwsympa.fcgi 22 Mar 2004 10:16:57 -0000 1.389
+++ wwsympa/wwsympa.fcgi 22 Mar 2004 13:27:09 -0000
@@ -5523,7 +5523,7 @@
if($in{'extended'}){
foreach my $directory (keys %{$Conf{'ldap_export'}}){
next unless(%lists =
&Ldap::get_exported_lists($param->{'regexp'},$directory));
-
+
foreach my $list_name (keys %lists) {
$param->{'occurrence'}++
unless($param->{'which'}{$list_name});
next if($param->{'which'}{$list_name});
@@ -5533,15 +5533,15 @@
'list_address' =>
"$lists{$list_name}{'list_address'}",
'export' => 'yes',
};
- }
+ }
}
- }
-
+ }
+
return 1;
}

- sub do_edit_list {
- &wwslog('info', 'do_edit_list()');
+sub do_edit_list {
+ &wwslog('info', 'do_edit_list()');

unless ($param->{'user'}{'email'}) {
&error_message('no_user');
@@ -5562,7 +5562,7 @@

foreach my $key (sort keys %in) {
next unless ($key =~ /^(single_param|multiple_param)\.(\S+)$/);
-
+
$key =~ /^(single_param|multiple_param)\.(\S+)$/;
my ($type, $name) = ($1, $2);

@@ -5600,7 +5600,7 @@
my (%changed, %delete);
my @syntax_error;
foreach my $pname (sort List::by_order keys %{$edited_param}) {
-
+
my ($p, $new_p);
## Check privileges first
next unless ($list->may_edit($pname,$param->{'user'}{'email'}) eq
'write');
@@ -5951,16 +5951,16 @@
# &tools::dump_var($param->{'param'},0);

$param->{'serial'} = $list->{'admin'}{'serial'};
-
+
return 1;
}

## Prepare config data to be send in the
## edition form
- sub _prepare_edit_form {
- my $list_config = shift;
+ sub _prepare_edit_form {
+ my $list_config = shift;

- foreach my $pname (sort List::by_order keys %{$pinfo}) {
+ foreach my $pname (sort List::by_order keys %{$pinfo}) {
next if ($pname =~ /^comment|defaults$/);
next if ($in{'group'} && ($pinfo->{$pname}{'group'} ne
$in{'group'}));

@@ -5974,7 +5974,7 @@
$p->{'changed'} = $::changed_params{$pname};

## Exceptions...too many
- if ($pname eq 'topics') {
+ if ($pname eq 'topics') {
$p->{'type'} = 'enum';

my @topics;
@@ -5983,23 +5983,22 @@
}
undef $p->{'value'};
my %list_of_topics = &List::load_topics($robot);
- foreach my $selected_topic (@topics) {
- my $menu = {};
- foreach my $topic (keys %list_of_topics) {
- $menu->{'value'}{$topic}{'selected'} = 0;
- $menu->{'value'}{$topic}{'title'} =
$list_of_topics{$topic}{'title'};
-
- if ($list_of_topics{$topic}{'sub'}) {
- foreach my $subtopic (keys
%{$list_of_topics{$topic}{'sub'}}) {
- $menu->{'value'}{"$topic/$subtopic"}{'selected'}
= 0;
- $menu->{'value'}{"$topic/$subtopic"}{'title'} =
"$list_of_topics{$topic}{'title'}/$list_of_topics{$topic}{'sub'}{$subtopic}{'title'}";
- }
+ foreach my $topic (keys %list_of_topics) {
+ $p->{'value'}{$topic}{'selected'} = 0;
+ $p->{'value'}{$topic}{'title'} =
$list_of_topics{$topic}{'title'};
+
+ if ($list_of_topics{$topic}{'sub'}) {
+ foreach my $subtopic (keys
%{$list_of_topics{$topic}{'sub'}}) {
+ $p->{'value'}{"$topic/$subtopic"}{'selected'} = 0;
+ $p->{'value'}{"$topic/$subtopic"}{'title'} =
"$list_of_topics{$topic}{'title'}/$list_of_topics{$topic}{'sub'}{$subtopic}{'title'}";
}
}
- $menu->{'value'}{$selected_topic}{'selected'} = 1;
- $menu->{'value'}{$selected_topic}{'title'} = "Unknown
($selected_topic)"
- unless (defined
$menu->{'value'}{$selected_topic}{'title'});
- push @{$p->{'value'}}, $menu;
+ }
+ foreach my $selected_topic (@topics) {
+ next unless (defined $selected_topic);
+ $p->{'value'}{$selected_topic}{'selected'} = 1;
+ $p->{'value'}{$selected_topic}{'title'} = "Unknown
($selected_topic)"
+ unless (defined $p->{'value'}{$selected_topic}{'title'});
}
}elsif ($pname eq 'digest') {
foreach my $v (@{$p->{'value'}}) {
@@ -6043,7 +6042,7 @@
$data2 = $data;

## Add an empty entry
- unless (($name eq 'days') || ($name eq 'reception')) {
+ unless (($name eq 'days') || ($name eq 'reception') || ($name eq
'rfc2369_header_fields') || ($name eq 'topics')) {
push @{$data2}, undef;
## &do_log('debug2', 'Add 1 %s', $name);
}
Index: wwsympa/wws_templates/fr/edit_list_request.fr.tpl
===================================================================
RCS file:
/home/sympa/cvsroot/sympa/wwsympa/wws_templates/fr/edit_list_request.fr.tpl,v
retrieving revision 1.8
diff -u -r1.8 edit_list_request.fr.tpl
--- wwsympa/wws_templates/fr/edit_list_request.fr.tpl 26 Feb 2002 16:54:36
-0000 1.8
+++ wwsympa/wws_templates/fr/edit_list_request.fr.tpl 22 Mar 2004 13:27:10
-0000
@@ -54,6 +54,35 @@
[IF p->occurrence=multiple]
<!-- Multiple params -->

+ [IF p->type=enum]
+ <!-- Multiple Enum -->
+ [IF p->may_edit=write]
+ <SELECT NAME="multiple_param.[p->name]" MULTIPLE>
+ [FOREACH enum IN p->value]
+ <OPTION VALUE="[enum->NAME]"
+ [IF enum->selected=1]
+ SELECTED
+ [ENDIF]
+ [IF enum->title]
+ >[enum->title]
+ [ELSE]
+ >[enum->NAME]
+ [ENDIF]
+ [END]
+ </SELECT>
+ [ELSIF p->may_edit=read]
+ [FOREACH enum IN p->value]
+ [IF enum->selected=1]
+ [IF enum->title]
+ [enum->title]
+ [ELSE]
+ [enum->NAME]
+ [ENDIF]
+ [ENDIF]
+ [END]
+ [ENDIF]
+ [ELSE]
+
[FOREACH o IN p->value]
<!-- Foreach occurrence -->
<DD>
@@ -104,30 +133,6 @@
[END]
<HR>

- [ELSIF p->type=enum]
- <!-- Enum -->
- [IF p->may_edit=write]
- <SELECT NAME="single_param.[p->name].[o->INDEX]">
- [FOREACH enum IN o->value]
- <OPTION VALUE="[enum->NAME]"
- [IF enum->selected=1]
- SELECTED
- [ENDIF]
- [IF enum->title]
- >[enum->title]
- [ELSE]
- >[enum->NAME]
- [ENDIF]
- [END]
- </SELECT>
- [ELSIF p->may_edit=read]
- [FOREACH enum IN o->value]
- [IF enum->selected=1]
- [enum->NAME]
- [ENDIF]
- [END]
- [ENDIF]
-
[ELSE]
<!-- Scalar -->

@@ -141,6 +146,8 @@
<BR>
[END]
<!-- END Foreach occurrence -->
+ [ENDIF]
+ <!-- ENDIF Enum -->

[ELSE]
<!-- Single params -->
Index: wwsympa/wws_templates/us/edit_list_request.us.tpl
===================================================================
RCS file:
/home/sympa/cvsroot/sympa/wwsympa/wws_templates/us/edit_list_request.us.tpl,v
retrieving revision 1.10
diff -u -r1.10 edit_list_request.us.tpl
--- wwsympa/wws_templates/us/edit_list_request.us.tpl 13 Nov 2003 08:58:30
-0000 1.10
+++ wwsympa/wws_templates/us/edit_list_request.us.tpl 22 Mar 2004 13:27:10
-0000
@@ -54,6 +54,35 @@
[IF p->occurrence=multiple]
<!-- Multiple params -->

+ [IF p->type=enum]
+ <!-- Multiple Enum -->
+ [IF p->may_edit=write]
+ <SELECT NAME="multiple_param.[p->name]" MULTIPLE>
+ [FOREACH enum IN p->value]
+ <OPTION VALUE="[enum->NAME]"
+ [IF enum->selected=1]
+ SELECTED
+ [ENDIF]
+ [IF enum->title]
+ >[enum->title]
+ [ELSE]
+ >[enum->NAME]
+ [ENDIF]
+ [END]
+ </SELECT>
+ [ELSIF p->may_edit=read]
+ [FOREACH enum IN p->value]
+ [IF enum->selected=1]
+ [IF enum->title]
+ [enum->title]
+ [ELSE]
+ [enum->NAME]
+ [ENDIF]
+ [ENDIF]
+ [END]
+ [ENDIF]
+ [ELSE]
+
[FOREACH o IN p->value]
<!-- Foreach occurrence -->
<DD>
@@ -104,30 +133,6 @@
[END]
<HR>

- [ELSIF p->type=enum]
- <!-- Enum -->
- [IF p->may_edit=write]
- <SELECT NAME="single_param.[p->name].[o->INDEX]">
- [FOREACH enum IN o->value]
- <OPTION VALUE="[enum->NAME]"
- [IF enum->selected=1]
- SELECTED
- [ENDIF]
- [IF enum->title]
- >[enum->title]
- [ELSE]
- >[enum->NAME]
- [ENDIF]
- [END]
- </SELECT>
- [ELSIF p->may_edit=read]
- [FOREACH enum IN o->value]
- [IF enum->selected=1]
- [enum->NAME]
- [ENDIF]
- [END]
- [ENDIF]
-
[ELSE]
<!-- Scalar -->

@@ -141,6 +146,8 @@
<BR>
[END]
<!-- END Foreach occurrence -->
+ [ENDIF]
+ <!-- ENDIF Enum -->

[ELSE]
<!-- Single params -->

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.19+.

Top of Page