~stefanor/ibid/timeout-344882

« back to all changes in this revision

Viewing changes to ibid/source/smtp.py

  • Committer: Jonathan Hitchcock
  • Date: 2009-03-16 22:35:21 UTC
  • mfrom: (582.2.5 smtp-343784)
  • Revision ID: jonathan@vhata.net-20090316223521-feyejo53kc9xpdqu
Fix SMTP source and improve Launchpad email handling
https://code.edge.launchpad.net/~mgorven/ibid/smtp-343784/+merge/4551

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
        event = Event(self.name, u'message')
55
55
        (realname, address) = parseaddr(mail['from'])
56
56
        event.channel = event.sender['connection'] = event.sender['id'] = unicode(address, 'utf-8', 'replace')
57
 
        event.sender['nick'] = realname != '' and unicode(realname, 'utf-8', 'replace') or address
 
57
        event.sender['nick'] = realname != '' and unicode(realname, 'utf-8', 'replace') or event.channel
58
58
        event.public = False
59
59
        event.addressed = True
60
60
        event.subject = unicode(mail['subject'], 'utf-8', 'replace')
61
61
        event.headers = dict((i[0], unicode(i[1], 'utf-8', 'replace')) for i in mail.items())
62
62
 
63
 
        message = mail.is_multipart() and mail.get_payload()[0] or mail.get_payload()
 
63
        message = mail.is_multipart() and mail.get_payload()[0].get_payload() or mail.get_payload()
64
64
        if len(message) > 0:
65
65
            event.message = stripsig.sub('', message).strip().replace('\n', ' ')
66
66
        else: