Ejemplo n.º 1
0
        folders.extend(imap.lm('shared/%%@%s' % (primary)))
        folders.extend(imap.lm('user/%%@%s' % (primary)))

        for secondary in secondaries:
            folders.extend(imap.lm('shared/%%@%s' % (secondary)))
            folders.extend(imap.lm('user/%%@%s' % (secondary)))

        auth = Auth(domain=primary)
        auth.connect()

        for folder in folders:
            server = imap.user_mailbox_server(folder)
            r_folder = folder

            if folder.startswith('shared/'):
                recipient = auth.find_folder_resource(folder)
            else:
                r_folder = '/'.join(folder.split('/')[1:])
                recipient = auth.find_recipient(
                    r_folder, search_attrs=[result_attribute])

            if (isinstance(recipient, list)):
                if len(recipient) > 1:
                    log.warning(
                        _("Multiple recipients for '%s'!") % (r_folder))
                    continue
                elif len(recipient) == 0:
                    if conf.delete:
                        if conf.dry_run:
                            if not folder.startswith('shared/'):
                                log.warning(