Esempio n. 1
0
def test_math(item):
    item.subject = 'test'

    restriction = Restriction(
        SPropertyRestriction(RELOP_EQ, PR_SUBJECT_W,
                             SPropValue(PR_SUBJECT_W, 'test')))
    assert item.match(restriction)

    restriction = Restriction(
        SPropertyRestriction(RELOP_EQ, PR_SUBJECT_W,
                             SPropValue(PR_SUBJECT_W, 'boo')))
    assert not item.match(restriction)
Esempio n. 2
0
def main():
    options, _ = parser('ksplu').parse_args()
    log = logger(options)
    server = server(options=options,
                    auth_user='******',
                    auth_pass='',
                    parse_args=True)
    restriction = Restriction(
        mapiobj=SNotRestriction(SExistRestriction(PR_EC_IMAP_EMAIL_SIZE)))

    for user in server.users():  # XXX multi-company..
        # Skip users without IMAP enabled
        if not 'imap' in user.features:
            log.info('Skipping user %s, IMAP disabled', user.name)
            continue

        log.debug('Processing user %s', user.name)
        for folder in user.store.folders():
            # Inbox folder's container class is None..
            if folder.container_class != 'IPF.Note' and folder.container_class != None:
                continue

            log.info('Processing folder %s', folder.name)
            for item in folder.items(restriction=restriction):
                log.debug('Processing item %s', item.subject)
                generate_imap_message(item)
Esempio n. 3
0
    def get_all(cls, req, resp, store, server, userid):
        restriction = None
        if cls.needs_restriction:
            restriction = Restriction(
                SPropertyRestriction(
                    RELOP_EQ, PR_CONTAINER_CLASS_W,
                    SPropValue(PR_CONTAINER_CLASS_W, cls.container_class)))

        data = cls.generator(req, cls.default_folders_list(store), 0,
                             restriction)
        cls.respond(req, resp, data, cls.fields)