Skip to Content.
Sympa Menu

devel - Adding a list config parameter

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Chris Hastie <address@concealed>
  • To: address@concealed
  • Subject: Adding a list config parameter
  • Date: Sat, 20 Mar 2004 16:00:32 +0000

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.

I have added list_headers to @param_order in List.pm, and have then put the following into %::pinfo

'list_headers' => { 'format' => {
'list_archive' => {'format' => '.+',
'length' => 70,
'occurrence' => '1',
},
'list_help' => {'format' => '.+',
'length' => 70,
'occurrence' => '1',
},
'list_unsubscribe' => {'format' => '.+',
'length' => 70,
'occurrence' => '1',
},
'list_subscribe' => {'format' => '.+',
'length' => 70,
'occurrence' => '1',
},
'list_post' => {'format' => '.+',
'length' => 70,
'occurrence' => '1',
},
'list_owner' => {'format' => '.+',
'length' => 70,
'occurrence' => '1',
},
'list_id' => {'format' => '.+',
'length' => 70,
'occurrence' => '1',
}
},
'group' => 'description'

The format entries at least need some attention, but with some alteration to the code that adds the headers this works mostly. Where I have a problem is with wwsympa. Suitable edit boxes are displayed, data entered into them is accepted, written to the list's config file and acted upon. BUT, the edit boxes always appear empty, with the value attribute set to "", even when there is an entry in the config file.

Where do I need to look to get the values read and entered in these edit boxes?

By the way, this is what I have for adding the headers:

## Add RFC 2919 header field
if ($hdr->get('List-Id')) {
&do_log('notice', 'Found List-Id: %s', $hdr->get('List-Id'));
$hdr->delete('List-ID');
}
if ($self->{'admin'}{'list_headers'}{'list_id'}) {
$hdr->add('List-Id', sprintf ('"%s" <%s>',
&MIME::Words::encode_mimewords($self->{'admin'}{'subject'}),
$self->{'admin'}{'list_headers'}{'list_id'}));
} else {
$hdr->add('List-Id', sprintf ('"%s" <%s.%s>',
&MIME::Words::encode_mimewords($self->{'admin'}{'subject'}), $self->{'name'},
$self->{'admin'}{'host'}));
}

## Add RFC 2369 header fields
foreach my $field (@{$Conf{'rfc2369_header_fields'}}) {
if ($field eq 'help') {
if ($self->{'admin'}{'list_headers'}{'list_help'}) {
$hdr->add('List-Help', sprintf ('<%s>',
$self->{'admin'}{'list_headers'}{'list_help'}));
} else {
$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') {
if ($self->{'admin'}{'list_headers'}{'list_unsubscribe'}) {
$hdr->add('List-Unsubscribe', sprintf ('<%s>',
$self->{'admin'}{'list_headers'}{'list_unsubscribe'}));
} else {
$hdr->add('List-Unsubscribe', sprintf
('<mailto:%s@%s?subject=unsubscribe%%20%s>', &Conf::get_robot_conf($robot, 'email'),
&Conf::get_robot_conf($robot, 'host'), $self->{'name'}));
}
}elsif ($field eq 'subscribe') {
if ($self->{'admin'}{'list_headers'}{'list_subscribe'}) {
$hdr->add('List-Subscribe', sprintf ('<%s>',
$self->{'admin'}{'list_headers'}{'list_subscribe'}));
} else {
$hdr->add('List-Subscribe', sprintf ('<mailto:%s@%s?subject=subscribe%%20%s>',
&Conf::get_robot_conf($robot, 'email'), &Conf::get_robot_conf($robot, 'host'),
$self->{'name'}));
}
}elsif ($field eq 'post') {
if ($self->{'admin'}{'list_headers'}{'list_post'}) {
$hdr->add('List-Post', sprintf ('<%s>',
$self->{'admin'}{'list_headers'}{'list_post'}));
} else {
$hdr->add('List-Post', sprintf ('<mailto:%s@%s>', $self->{'name'},
$self->{'admin'}{'host'}));
}
}elsif ($field eq 'owner') {
if ($self->{'admin'}{'list_headers'}{'list_owner'}) {
$hdr->add('List-Owner', sprintf ('<%s>',
$self->{'admin'}{'list_headers'}{'list_owner'}));
} else {
$hdr->add('List-Owner', sprintf ('<mailto:%s-request@%s>',
$self->{'name'}, $self->{'admin'}{'host'}));
}
}elsif ($field eq 'archive') {
if ($self->{'admin'}{'list_headers'}{'list_archive'}) {
$hdr->add('List-Archive', sprintf ('<%s>',
$self->{'admin'}{'list_headers'}{'list_archive'}));
}
elsif (&Conf::get_robot_conf($robot, 'wwsympa_url') and
$self->is_web_archived()) {
$hdr->add('List-Archive', sprintf ('<%s/arc/%s>',
Conf::get_robot_conf($robot, 'wwsympa_url'), $self->{'name'}));
}
}
}

--
Chris Hastie




Archive powered by MHonArc 2.6.19+.

Top of Page