/usr/lib/python2.7/dist-packages/kopano/rule.py is in python-kopano 8.5.5-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | """
Part of the high-level python bindings for Kopano
Copyright 2005 - 2016 Zarafa and its licensors (see LICENSE file for details)
Copyright 2016 - Kopano and its licensors (see LICENSE file for details)
"""
from MAPI.Tags import (
PR_RULE_NAME_W, PR_RULE_STATE, PR_RULE_PROVIDER_W, PR_RULE_ACTIONS, ST_ENABLED,
PR_RULE_CONDITION
)
from .compat import repr as _repr
from .restriction import Restriction
class Rule(object):
"""Rule class"""
def __init__(self, mapirow):
self.mapirow = mapirow
self.name = mapirow[PR_RULE_NAME_W]
self.provider = mapirow[PR_RULE_PROVIDER_W]
self.active = bool(mapirow[PR_RULE_STATE] & ST_ENABLED)
@property
def restriction(self):
return Restriction(mapiobj=self.mapirow[PR_RULE_CONDITION])
def actions(self):
for action in self.mapirow[PR_RULE_ACTIONS].lpAction:
yield Action(action)
def __unicode__(self):
return u"Rule('%s')" % self.name
def __repr__(self):
return _repr(self)
class Action(object):
acttype_str = {
1: 'move',
2: 'copy',
3: 'reply',
4: 'oof_reply',
5: 'defer',
6: 'bounce',
7: 'forward',
8: 'delegate',
9: 'tag',
10: 'delete',
11: 'mark_read',
}
def __init__(self, mapiobj):
self.mapiobj = mapiobj
self.operator = self.acttype_str[mapiobj.acttype]
def __unicode__(self):
return u"Action('%s')" % self.operator
def __repr__(self):
return _repr(self)
|