~tgc/mailman/2.1-da

« back to all changes in this revision

Viewing changes to Mailman/Handlers/CookHeaders.py

  • Committer: Mark Sapiro
  • Date: 2013-09-28 23:08:15 UTC
  • Revision ID: mark@msapiro.net-20130928230815-86m44evqe74e4b4e
Tags: 2.1.16rc3
Renamed author_is_list to from_is_list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    return Header(s, charset, maxlinelen, header_name, continuation_ws)
66
66
 
67
67
def change_header(name, value, mlist, msg, msgdata, delete=True, repl=True):
68
 
    if mm_cfg.ALLOW_AUTHOR_IS_LIST and mlist.author_is_list == 2:
 
68
    if mm_cfg.ALLOW_FROM_IS_LIST and mlist.from_is_list == 2:
69
69
        msgdata.setdefault('add_header', {})[name] = value
70
70
    elif repl or not msg.has_key(name):
71
71
        if delete:
116
116
    change_header('Precedence', 'list',
117
117
                  mlist, msg, msgdata, repl=False)
118
118
    # Do we change the from so the list takes ownership of the email
119
 
    if mm_cfg.ALLOW_AUTHOR_IS_LIST and mlist.author_is_list:
 
119
    if mm_cfg.ALLOW_FROM_IS_LIST and mlist.from_is_list:
120
120
        realname, email = parseaddr(msg['from'])
121
121
        replies = getaddresses(msg.get('reply-to', ''))
122
122
        reply_addrs = [x[1].lower() for x in replies]
132
132
                      formataddr(('%s via %s' % (realname, mlist.real_name),
133
133
                                 mlist.GetListEmail())),
134
134
                      mlist, msg, msgdata)
135
 
        if mlist.author_is_list != 2:
 
135
        if mlist.from_is_list != 2:
136
136
            del msg['sender']
137
137
        #MAS ?? mlist.include_sender_header = 0
138
138
    # Reply-To: munging.  Do not do this if the message is "fast tracked",
190
190
        # is already in From and Reply-To in this case and similarly for
191
191
        # an 'author is list' list.
192
192
        if mlist.personalize == 2 and mlist.reply_goes_to_list <> 1 \
193
 
           and not mlist.anonymous_list and not (mlist.author_is_list and
194
 
                                                 mm_cfg.ALLOW_AUTHOR_IS_LIST):
 
193
           and not mlist.anonymous_list and not (mlist.from_is_list and
 
194
                                                 mm_cfg.ALLOW_FROM_IS_LIST):
195
195
            # Watch out for existing Cc headers, merge, and remove dups.  Note
196
196
            # that RFC 2822 says only zero or one Cc header is allowed.
197
197
            new = []
202
202
            add((str(i18ndesc), mlist.GetListEmail()))
203
203
            # We don't worry about what AvoidDuplicates may have done with a
204
204
            # Cc: header or using change_header here since we never get here
205
 
            # if author_is_list is allowed and True.
 
205
            # if from_is_list is allowed and True.
206
206
            del msg['Cc']
207
207
            msg['Cc'] = COMMASPACE.join([formataddr(pair) for pair in new])
208
208
    # Add list-specific headers as defined in RFC 2369 and RFC 2919, but only