mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/tglx/remail.git
synced 2024-12-28 05:20:56 +01:00
remail: Fix default list-id value to conform to RFC2919
According to RFC2919, List-Id header should be in the form of a hostname value enclosed inside angle brackets. This change does two things: 1. Fixes the default to be the list address with "@" replaced by a "." 2. Allows setting custom list-id values inside remail.yaml 3. Documents the "listid" optional setting in the manpage Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://tools.ietf.org/html/rfc2919
This commit is contained in:
parent
0eecc8bd2d
commit
18a16b08fb
2 changed files with 10 additions and 3 deletions
|
@ -257,6 +257,7 @@ The list base configuration for each list consists of the following items:
|
|||
listname:
|
||||
enabled: True
|
||||
moderated: True
|
||||
listid: ...
|
||||
archive:
|
||||
...
|
||||
listaccount:
|
||||
|
@ -286,6 +287,11 @@ The list base items:
|
|||
with a subscriber. Mails from non-subscribers are not delivered to the
|
||||
list, they are delivered to the list administrator
|
||||
|
||||
listid:
|
||||
|
||||
Optional item to override the default list-id with a custom value.
|
||||
Default: list address with the "@" replaced by a period.
|
||||
|
||||
The archive section:
|
||||
""""""""""""""""""""
|
||||
|
||||
|
|
|
@ -120,10 +120,10 @@ def list_account_config(cfgdict, base):
|
|||
raise RemailListConfigException(txt)
|
||||
return laccs.pop()
|
||||
|
||||
def build_listheaders(mailaddr):
|
||||
def build_listheaders(mailaddr, listid):
|
||||
addr, domain = mailaddr.split('@')
|
||||
headers = {}
|
||||
headers['List-Id'] = mailaddr
|
||||
headers['List-Id'] = '<%s>' % listid
|
||||
headers['List-Owner'] = '<mailto:%s-owner@%s>' % (addr, domain)
|
||||
headers['List-Post'] = '<mailto:%s>' % mailaddr
|
||||
return headers
|
||||
|
@ -280,7 +280,8 @@ class list_config(object):
|
|||
self.listaccount = list_account_config(acc, base + '.listaccount')
|
||||
|
||||
self.listaddrs = listaddrs(self.listaccount.addr)
|
||||
self.listheaders = build_listheaders(self.listaccount.addr)
|
||||
listid = cfgdict.get('listid', self.listaccount.addr.replace('@', '.'))
|
||||
self.listheaders = build_listheaders(self.listaccount.addr, listid)
|
||||
|
||||
self.smime = smime_config(self.listdir, None)
|
||||
self.gpg = gpg_config(self.listdir, None)
|
||||
|
|
Loading…
Reference in a new issue