示例#1
0
    def processDone(self, view, protocol, client,
                    account, request):
        if __debug__:
            trace("processDone")

        if self.shuttingDown:
            return None

        # request
        #     0: cmd
        #     1: client
        #     2: accountUUID
        dt = self.getDownloadTracker(account)

        if dt.totalDownloaded > 0:
            # This is a PyICU.ChoiceFormat class
            txt = constants.DOWNLOAD_CHANDLER_MESSAGES.format(dt.totalDownloaded)

            setStatusMessage(txt % \
                             {'accountName': account.displayName,
                              'numberTotal': dt.totalDownloaded,
                              'numberNew': dt.totalNewDownloaded,
                              'numberUpdates': dt.totalUpdateDownloaded,
                              'numberDuplicates': dt.totalIgnoreDownloaded,
                              'numberErrors': dt.totalErrorDownloaded})
        else:
            setStatusMessage(constants.DOWNLOAD_NO_MESSAGES % \
                            {'accountName': account.displayName})

        self._resetWorker(account)

        # Post a notification to the Mail Protocol Client
        # That the requested actions are finished.
        reactor.callFromThread(client.requestsComplete)
示例#2
0
    def processError(self, view, protocol, client,
                     account, request):
        if __debug__:
            trace("processError")

        if self.shuttingDown:
            return None

        #Clear the status bar message
        setStatusMessage(u"")
        self._resetWorker(account)
示例#3
0
                logging.exception(e)

                # This is used to track the total number of messages
                # that failed to be converted to Items.
                numError += 1

        if numToProcess != numError:
            # If all the messages failed to be converted to Items then
            # there is a bug in the mail code or some other major error.
            # In this case we don't want to save the lastMessageUID since
            # this will prevent the messages from being downloaded and
            # processed again once the error or bug is resolved.
            if protocol == "IMAP":
                args.lastMessageUID = request[5][1]

            setStatusMessage(msg)
            view.commit()

            dt.lastTotalDownloaded = dt.totalDownloaded

        else:
            # Unable to process any messages so cancel the view
            view.cancel()

        if constants.WAIT_FOR_COMMIT:
            reactor.callFromThread(client.nextAction)

    def processMessage(self, view, protocol, client,
                       account, mRequest, dt, args):
        if __debug__:
            trace("processMessage")