Mercurial > p > roundup > code
comparison roundup/mailgw.py @ 3482:db856d488de0
fixes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 20 Jan 2006 03:04:14 +0000 |
| parents | d3b02352484f |
| children | 90e2580f21b8 |
comparison
equal
deleted
inserted
replaced
| 3481:63890c29a4ac | 3482:db856d488de0 |
|---|---|
| 70 set() method to add the message to the item's spool; in the second case we | 70 set() method to add the message to the item's spool; in the second case we |
| 71 are calling the create() method to create a new node). If an auditor raises | 71 are calling the create() method to create a new node). If an auditor raises |
| 72 an exception, the original message is bounced back to the sender with the | 72 an exception, the original message is bounced back to the sender with the |
| 73 explanatory message given in the exception. | 73 explanatory message given in the exception. |
| 74 | 74 |
| 75 $Id: mailgw.py,v 1.169 2006-01-13 03:56:36 richard Exp $ | 75 $Id: mailgw.py,v 1.170 2006-01-20 03:04:14 richard Exp $ |
| 76 """ | 76 """ |
| 77 __docformat__ = 'restructuredtext' | 77 __docformat__ = 'restructuredtext' |
| 78 | 78 |
| 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri | 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri |
| 80 import time, random, sys, logging | 80 import time, random, sys, logging |
| 601 # determine the sender's address | 601 # determine the sender's address |
| 602 from_list = message.getaddrlist('resent-from') | 602 from_list = message.getaddrlist('resent-from') |
| 603 if not from_list: | 603 if not from_list: |
| 604 from_list = message.getaddrlist('from') | 604 from_list = message.getaddrlist('from') |
| 605 | 605 |
| 606 # check for registration OTK | |
| 607 # or fallback on the default class | |
| 608 if self.db.config['EMAIL_REGISTRATION_CONFIRMATION']: | |
| 609 otk_re = re.compile('-- key (?P<otk>[a-zA-Z0-9]{32})') | |
| 610 otk = otk_re.search(m.group('title')) | |
| 611 if otk: | |
| 612 self.db.confirm_registration(otk.group('otk')) | |
| 613 subject = 'Your registration to %s is complete' % \ | |
| 614 config['TRACKER_NAME'] | |
| 615 sendto = [from_list[0][1]] | |
| 616 self.mailer.standard_message(sendto, subject, '') | |
| 617 return | |
| 618 | |
| 619 # XXX Don't enable. This doesn't work yet. | 606 # XXX Don't enable. This doesn't work yet. |
| 620 # "[^A-z.]tracker\+(?P<classname>[^\d\s]+)(?P<nodeid>\d+)\@some.dom.ain[^A-z.]" | 607 # "[^A-z.]tracker\+(?P<classname>[^\d\s]+)(?P<nodeid>\d+)\@some.dom.ain[^A-z.]" |
| 621 # handle delivery to addresses like:tracker+issue25@some.dom.ain | 608 # handle delivery to addresses like:tracker+issue25@some.dom.ain |
| 622 # use the embedded issue number as our issue | 609 # use the embedded issue number as our issue |
| 623 # issue_re = config['MAILGW_ISSUE_ADDRESS_RE'] | 610 # issue_re = config['MAILGW_ISSUE_ADDRESS_RE'] |
| 654 sfxmode = config['MAILGW_SUBJECT_SUFFIX_PARSING'] | 641 sfxmode = config['MAILGW_SUBJECT_SUFFIX_PARSING'] |
| 655 | 642 |
| 656 # check for well-formed subject line | 643 # check for well-formed subject line |
| 657 m = subject_re.match(subject) | 644 m = subject_re.match(subject) |
| 658 if m: | 645 if m: |
| 646 # check for registration OTK | |
| 647 # or fallback on the default class | |
| 648 if self.db.config['EMAIL_REGISTRATION_CONFIRMATION']: | |
| 649 otk_re = re.compile('-- key (?P<otk>[a-zA-Z0-9]{32})') | |
| 650 otk = otk_re.search(m.group('title')) | |
| 651 if otk: | |
| 652 self.db.confirm_registration(otk.group('otk')) | |
| 653 subject = 'Your registration to %s is complete' % \ | |
| 654 config['TRACKER_NAME'] | |
| 655 sendto = [from_list[0][1]] | |
| 656 self.mailer.standard_message(sendto, subject, '') | |
| 657 return | |
| 659 # get the classname | 658 # get the classname |
| 660 if pfxmode == 'none': | 659 if pfxmode == 'none': |
| 661 classname = None | 660 classname = None |
| 662 else: | 661 else: |
| 663 classname = m.group('classname') | 662 classname = m.group('classname') |
