Ticket #188: update-by-subject-enhancement.patch

File update-by-subject-enhancement.patch, 1.4 KB (added by Konstantin Ryabitsev <icon@…>, 14 years ago)

Enhancement to update-by-subject routines.

  • email2trac.py.in

    old new  
    949950                matched_id = None
    950951                if self.parameters.ticket_update and self.parameters.ticket_update_by_subject:
    951952                               
    952                         SUBJECT_RE = re.compile(r'^(RE|AW|VS|SV):(.*:)*\s*(.*)', re.IGNORECASE)
     953                        SUBJECT_RE = re.compile(r'^(?:(?:RE|AW|VS|SV|FW|FWD):\s*)+(.*)', re.IGNORECASE)
    953954                        result = SUBJECT_RE.search(subject)
    954955
    955956                        if result:
    956957                                ## This is a reply
    957958                                #
    958                                 orig_subject = result.group(3)
     959                                orig_subject = result.group(1)
    959960
    960961                                self.logger.debug('subject search string: %s' %(orig_subject))
    961962
     
    985986
    986987                                        if matched_id:
    987988                                                matched_id = '#%d' % matched_id
    988                                                 return matched_id
     989                                                return (matched_id, orig_subject)
     990                                       
     991                                        subject = orig_subject
    989992
    990                 return matched_id
     993                return (matched_id, subject)
    991994
    992995
    993996        def new_ticket(self, msg, subject, spam, set_fields = None):
     
    15861590
    15871591                else:
    15881592                        self.system = 'ticket'
    1589                         result = self.ticket_update_by_subject(subject)
    1590                         if result:
    1591                                 if not self.ticket_update(m, result, spam_msg):
     1593                        (matched_id, subject) = self.ticket_update_by_subject(subject)
     1594                        if matched_id:
     1595                                if not self.ticket_update(m, matched_id, spam_msg):
    15921596                                        self.new_ticket(m, subject, spam_msg)
    15931597                        else:
    15941598                                ## No update by subject, so just create a new ticket