コード例 #1
0
ファイル: notifier.py プロジェクト: sunny5156/xiaohei
    def handleEmailNotifications(self, lastDate):
        """Places new email notifications in the Notifier's queue."""
        emails = Email.fetchUnreadEmails(self.profile, since=lastDate)
        if emails is None:
            return
        if emails:
            lastDate = Email.getMostRecentDate(emails)

        def styleEmail(e):
            subject = Email.getSubject(e, self.profile)
            if Email.isEchoEmail(e, self.profile):
                if Email.isNewEmail(e):
                    return subject.replace('[echo]', '')
                else:
                    return ""
            elif Email.isControlEmail(e, self.profile):
                self.brain.query([subject.replace('[control]', '')
                                  .strip()], None, True)
                return ""
            sender = Email.getSender(e)
            return "您有来自 %s 的新邮件 %s" % (sender, subject)
        for e in emails:
            self.q.put(styleEmail(e))

        return lastDate
コード例 #2
0
    def handleEmailNotifications(self, lastDate):
        """Places new email notifications in the Notifier's queue."""
        emails = Email.fetchUnreadEmails(self.profile, since=lastDate)
        if emails:
            lastDate = Email.getMostRecentDate(emails)

        def styleEmail(e):
            subject = Email.getSubject(e, self.profile)
            if '[echo]' in subject:
                return subject.replace('[echo]', '')
            sender = Email.getSender(e)
            return "您有来自 %s 的新邮件 %s" % (sender, subject)
        for e in emails:
            self.q.put(styleEmail(e))

        return lastDate