# -*- python -*-

# {{ ansible_managed }}

# Note - if you're looking for something that is imported from mm_cfg, but you
# didn't find it in this file, it's probably in /usr/lib/mailman/Mailman/Defaults.py

# Here's where we get the distributed defaults.
from Defaults import *


# Web interface configuration
DEFAULT_URL_PATTERN = 'https://%s/mailman/'
PUBLIC_ARCHIVE_URL  = 'https://%(hostname)s/pipermail/%(listname)s'
PRIVATE_ARCHIVE_URL = '/mailman/private/'
IMAGE_LOGOS         = '/images/mailman/'

# Default domain for email addresses of newly created MLs
DEFAULT_EMAIL_HOST = '{{ mailman__site_domain }}'

# Default host for web interface of newly created MLs
DEFAULT_URL_HOST   = '{{ mailman__site_domain }}'

# Required when setting any of its arguments.
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)

{% if mailman__virtual_domains %}
# Additional Mailman virtual domains
{%   for domain in mailman__virtual_domains %}
add_virtualhost('{{ domain }}', '{{ domain }}')
{%   endfor %}

{% endif %}
# Postfix virtual domains
POSTFIX_STYLE_VIRTUAL_DOMAINS = [ "{{ ([ mailman__site_domain ] + mailman__virtual_domains) | join('", "') }}" ]

# Mail server configuration
MTA = 'Postfix'
SMTP_MAX_RCPTS = {{ mailman__smtp_max_recipients | default('500') }}

# Settings for postfix-to-mailman.py script (used only when Postfix has no
# local delivery)
DEB_LISTMASTER = '{{ mailman__site_postmaster }}'

# Default language for this server.
DEFAULT_SERVER_LANGUAGE = '{{ mailman__site_language }}'

# Allow download of .mbox files on public mailing lists
PUBLIC_MBOX = {{ "Yes" if mailman__public_mbox|bool else "No" }}

# Unset send_reminders on newly created lists
DEFAULT_SEND_REMINDERS = 0

# Maximum message size in kilobytes
DEFAULT_MAX_MESSAGE_SIZE = {{ mailman__max_message_size | default('40') }}

# Do not send notifications to non-members by default (minimize backscatter)
DEFAULT_RESPOND_TO_POST_REQUESTS = No

# How much of the original message to include in automatic responses
RESPONSE_INCLUDE_LEVEL = {{ mailman__response_include_level | default('0') }}

# What to do with messages from non-members by default?
DEFAULT_GENERIC_NONMEMBER_ACTION = {{ mailman__default_generic_nonmember_action | default('3') }}

# Forward discarded messages to list owner by default?
DEFAULT_FORWARD_AUTO_DISCARDS = {{ "Yes" if mailman__default_forward_auto_discards|bool else "No" }}

# Default haracter set
DEFAULT_CHARSET = 'utf-8'

# Do not encode UTF-8 emails as base64, use 8bit instead
# https://mail.python.org/pipermail/mailman-developers/2009-May/020608.html
import email.Charset
email.Charset.add_charset('utf-8',email.Charset.SHORTEST, None, None)

# Password configuration
USER_FRIENDLY_PASSWORDS = {{ "Yes" if mailman__user_friendly_passwords|bool else "No" }}
ADMIN_PASSWORD_LENGTH = {{ mailman__admin_password_length | default('10') }}
MEMBER_PASSWORD_LENGTH = {{ mailman__member_password_length | default('8') }}

# The name of the list Mailman uses to send password reminders
# and similar. Don't change if you want mailman-owner to be
# a valid local part.
MAILMAN_SITE_LIST = '{{ mailman__site_list }}'

{% if mailman__custom_options %}
{{ mailman__custom_options }}

{% endif %}
