#152 add sequencial number in subject prefix

Mailman 2.2 / 3.0
closed
nobody
7
2004-10-09
2002-08-28
No

This patch for 'CookHeaders.py' add an ability to add a
sequencial number in the subject prefix. You can define
a subject prefix like:
[listname %d]
Then, the subject line of delivered mail becomes:
Subject: [listname 123] Hoge hoge
When someone replied this mail, mailman receives a
messages with:
Subject: Re: [listname 123] Hoge hoge
Then, this patch removes [listname \d+] part and
deliver it with:
Subject: [listname 124] Re: Hoge hoge
And next, another person replies with
Subject: Re: [listname 124] Re: Hoge hoge
Then, (magically!) you get:
Subject: [listname 125] Re: Hoge hoge
Not with Re: Re: Hoge hoge.

Looks like complicated but this patch has been working
well with Japanese-enhanced Mailman for more than a year.

Without %d, this patch works like current version, I
believe.

Discussion

  • Tokio Kikuchi

    Tokio Kikuchi - 2002-10-31

    Logged In: YES
    user_id=67709

    Patch ID 625482 (i18n List-Id) and this was merged for 2.1b4+

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2002-10-31

    Logged In: YES
    user_id=67709

    I have uploaded the patch with the same name as the old one.
    Please download the upper one because it's newer.
    Sorry for the inconvenience.

     
  • Barry Warsaw

    Barry Warsaw - 2002-11-19
    • milestone: 172188 --> Mailman 2.2 / 3.0
     
  • Barry Warsaw

    Barry Warsaw - 2002-11-19
    • priority: 5 --> 3
     
  • Tokio Kikuchi

    Tokio Kikuchi - 2002-12-20

    Logged In: YES
    user_id=67709

    update for 2.1b6+

     
  • Fabio Rossetti

    Fabio Rossetti - 2003-02-14

    Logged In: YES
    user_id=693899

    If you need a quick fix to make the patch work with 2.1.1
    here's my take (it's the diff file adapted to work with 2.1.1
    CookHeaders.py)

    17a18
    > (sequence version)
    221c222,223
    < prefix = mlist.subject_prefix
    ---
    > prefix = mlist.subject_prefix.strip();
    > if not prefix: return
    237,243c239,250
    < if prefix and subject:
    < pattern = re.escape(prefix.strip())
    < for decodedsubj, charset in headerbits:
    < if re.search(pattern, decodedsubj,
    re.IGNORECASE):
    < # The subject's already got the prefix, so don't
    change it
    < return
    < del msg['subject']
    ---
    > headerstring = ''
    > fws = ''
    > cset = None
    > for (s, c) in headerbits:
    > headerstring += fws + s
    > if c == None or c == 'us-ascii':
    > fws = ' '
    > cset = Utils.GetCharSet(mlist.preferred_language)
    > else:
    > fws = ''
    > cset = c
    > # Note: searching prefix in subject is REMOVED. (seq
    version)
    245a253,275
    > else:
    > subject = headerstring
    > # If the subject_prefix contains '%d', it is replaced with
    the
    > # mailing list sequential number. Also, if the prefix is
    closed with
    > # [],(), or {}, the prefix in the responding post subject will
    be cared.
    > # sequential number format allows '%05d' like pattern.
    > p = re.compile('%\d*d')
    > if p.search(prefix,1):
    > # prefix have number, so we should search prefix
    w/number
    > # in subject.
    > prefix_pattern = p.sub(r'\s*\d+\s*', prefix)
    > else:
    > prefix_pattern = prefix
    > prefix_pattern = re.sub('([\[\(\{])', '\\\\\g<1>', prefix_pattern)
    > subject = re.sub(prefix_pattern, '', subject)
    > subject = re.compile('(RE:\s*)+', re.I).sub('Re: ', subject,
    1)
    > # and substitute %d in prefix with post_id
    > try:
    > prefix = prefix % mlist.post_id
    > except:
    > pass
    > # Note that trailing space was stripped in seq version
    (TK)
    > prefix += ' '
    248,262c278,288
    < for s, c in headerbits:
    < # Once again, convert the string to unicode.
    < if c is None:
    < c = Charset('iso-8859-1')
    < if not isinstance(c, Charset):
    < c = Charset(c)
    < if not _isunicode(s):
    < codec = c.input_codec or 'ascii'
    < try:
    < s = unicode(s, codec, 'replace')
    < except LookupError:
    < # Unknown codec, is this default reasonable?
    < s = unicode(s, Utils.GetCharSet
    (mlist.preferred_language),
    < 'replace')
    < h.append(s, c)
    ---
    > # in seq version, subject header is already concatnated
    > if not _isunicode(subject):
    > try:
    > subject = unicode(subject, cset, 'replace')
    > except LookupError:
    > # unknown codec
    > cset = Utils.GetCharSet(mlist.preferred_language)
    > subject = unicode(subject, cset, 'replace')
    > subject = subject.encode(cset)
    > h.append(subject, cset)
    > del msg['subject']

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2003-02-14

    Logged In: YES
    user_id=67709

    Hi, I am pleased you like this patch.
    Here is my current version attached.

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2003-02-26

    Logged In: YES
    user_id=67709

    update of patch for 2.1.1
    if the subject is all ascii, then cat the prefix and subject
    before it is instantiated. Hope to solve prefix only subject
    1st line.

    Note: with this patch without $d, Re: [prefix] is now
    mungled to [prefix] Re:. This is useful if someone post new
    issue as follow up to old subject like;
    New subject bah bah was Re: [prefix] foo

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2003-02-26
    • priority: 3 --> 7
     
  • Tokio Kikuchi

    Tokio Kikuchi - 2003-02-27

    Logged In: YES
    user_id=67709

    sorry for daily update but there was an error in i18n
    handling of '(no subject)'

     
  • Mitchell Marks

    Mitchell Marks - 2003-05-17

    Logged In: YES
    user_id=718482

    Is there a version vor MM 2.1.2? I'm trying the older one but
    doesn't seem to work.

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2003-05-18

    Logged In: YES
    user_id=67709

    Here is update of my patch for 2.1.2

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2003-09-29

    Logged In: YES
    user_id=67709

    Now the patch includes instruction in General admin page.
    (in detail part). In source dir you should type:
    patch -p0 < /path/to/seqnum.patch

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2003-09-29

    patch for 2.1.3 includes instructions

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2004-02-08

    Logged In: YES
    user_id=67709

    This patch for 2.1.3 is also applicable to 2.1.4. Though one
    patch fails to apply, it can safely be neglected. You can
    also get a newer and more convenient patch at:
    http://mm.tkikuchi.net/mailman-2.1.4+patch.20040123.gz

    Cheers,
    TK

     
  • yoda

    yoda - 2004-09-14

    Logged In: YES
    user_id=598275

    Hi tkikuchi,

    There are some gibberish text within the patch, are they
    Japanesh chars..??

    If possible can you look at this tracker and give your
    suggestions.https://sourceforge.net/tracker/index.php?func=detail&aid=1024289&group_id=103&atid=300103

    This is basically I want to implement threading in Mailman.
    Yes Mailman implements threading I agree but when the mail
    replies are sent using Lotus Notes 5.0.8/5.0.9 the threading
    doesn't work because Lotus Notes doesn't set the
    "In-Reply-To" header.

    Thanks for your time

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2004-10-09

    Logged In: YES
    user_id=67709

    Merged in CVS.
    Checking in Gui/General.py;
    new revision: 2.22.2.3; previous revision: 2.22.2.2
    Checking in Handlers/CookHeaders.py;
    new revision: 2.33.2.7; previous revision: 2.33.2.6

     
  • Tokio Kikuchi

    Tokio Kikuchi - 2004-10-09
    • status: open --> closed
     

Log in to post a comment.