コード例 #1
0
 def clear(self, username, password):
     '''Clear this GMail mailbox (remove all messages and labels). To avoid
     unintentionally deletion of your messages, you have to reenter your
     mailbox name.'''
     mailbox = raw_input("Do you want to delete all messages from your mailbox (%s)?\nPlease, repeat the name of your mailbox: " % username)
     if mailbox != username:
         print "Mailbox names doesn't match"
         return
     self.notifier = ConsoleNotifier()
     b = GMailBackup(username, password, self.notifier)
     b.clear()
コード例 #2
0
    def list(self, username, password):
        '''List the names and number of messages of GMail IMAP mailboxes.
        
        Usefull for debugging and for gathering information about new supported
        language. If your GMail language is not supported, don't hesitate and
        write us to user support group:
            
            [email protected]

        '''
        self.notifier = ConsoleNotifier()
        b = GMailBackup(username, password, self.notifier)
        for item, n_messages in b.list():
            print item, imap_decode(item).encode('utf-8'), n_messages, ' '*8
コード例 #3
0
    def backup(self, dirname, username, password, since=None, before=None, stamp=False):
        '''Performs backup of your GMail mailbox'''
        self.notifier = ConsoleNotifier()

        where = ['ALL']
        if since:
            since = _convertTime(since)
            where.append('SINCE')
            where.append(since)
        if before:
            before = _convertTime(before)
            where.append('BEFORE')
            where.append(before)

        b = GMailBackup(username, password, self.notifier)
        b.backup(dirname, where, stamp=stamp)
コード例 #4
0
 def version(self):
     self.notifier = ConsoleNotifier()
     b = GMailBackup(None, None, self.notifier)
     b.reportNewVersion()
コード例 #5
0
 def restore(self, dirname, username, password, since=None, before=None):
     '''Performs restore of your previously backed up GMail mailbox'''
     self.notifier = ConsoleNotifier()
     b = GMailBackup(username, password, self.notifier)
     b.restore(dirname, since, before)