コード例 #1
0
ファイル: mail.py プロジェクト: pombredanne/mail-trends-1
    def __ParseFetchReply(self, fetch_reply):
        s = stringscanner.StringScanner(fetch_reply)

        message_infos = []

        while s.Peek():
            current_message_info = messageinfo.MessageInfo()
            message_infos.append(current_message_info)

            # The sequence ID is first, with all the data in parentheses
            sequence_id = s.ReadUntil(" ")
            s.ConsumeAll(" ")

            s.ConsumeChar("(")

            while s.Peek() != ")":
                s.ConsumeAll(" ")
                name = s.ReadUntil(" ")
                s.ConsumeAll(" ")

                value = s.ConsumeValue()

                current_message_info.PopulateField(name, value)

            s.ConsumeChar(")")

        return message_infos
コード例 #2
0
  def GetMailboxes(self):
	logging.info("Getting mailboxes")

	r, mailboxes_data = self.__mail.list()
	self.__AssertOk(r)

	mailboxes = []
	for mailbox_data in mailboxes_data:
	  s = stringscanner.StringScanner(mailbox_data)

	  attributes = s.ConsumeValue()
	  s.ConsumeAll(" ")
	  delimiter = s.ConsumeValue()
	  s.ConsumeAll(" ")
	  name = s.ConsumeValue()
	  logging.info("Found %s",name)
	  mailboxes.append(name)

	return mailboxes
コード例 #3
0
ファイル: mail.py プロジェクト: pombredanne/mail-trends-1
    def GetMailboxes(self):
        logging.info("Getting mailboxes")

        r, mailboxes_data = self.__mail.list()
        self.__AssertOk(r)

        mailboxes = []
        for mailbox_data in mailboxes_data:
            s = stringscanner.StringScanner(mailbox_data)

            attributes = s.ConsumeValue()
            s.ConsumeAll(" ")
            delimiter = s.ConsumeValue()
            s.ConsumeAll(" ")
            name = s.ConsumeValue()

            if not "\\Noselect" in attributes and \
                    name.find(self.GetPrefix()) != 0:
                mailboxes.append(name)

        return mailboxes