예제 #1
0
파일: tags.py 프로젝트: sagaboy/Mailpile
_plugins.register_config_section('tags', ["Tags", {
    'name': ['Tag name', 'str', ''],
    'slug': ['URL slug', 'slashslug', ''],

    # Functional attributes
    'type': ['Tag type', [
        'tag', 'group', 'attribute', 'unread',
        # Maybe TODO: 'folder', 'shadow',
        'drafts', 'blank', 'outbox', 'sent',          # composing and sending
        'replied', 'fwded', 'tagged', 'read', 'ham',  # behavior tracking tags
        'trash', 'spam'                               # junk mail tags
    ], 'tag'],
    'flag_hides': ['Hide tagged messages from searches?', 'bool', False],
    'flag_editable': ['Mark tagged messages as editable?', 'bool', False],

    # Tag display attributes for /in/tag or searching in:tag
    'template': ['Default tag display template', 'str', 'index'],
    'search_terms': ['Terms to search for on /in/tag/', 'str', 'in:%(slug)s'],
    'search_order': ['Default search order for /in/tag/', 'str', ''],
    'magic_terms': ['Extra terms to search for', 'str', ''],

    # Tag display attributes for search results/lists/UI placement
    'icon': ['URL to default tag icon', 'url', ''],
    'label': ['Display as label in results', 'bool', True],
    'label_color': ['Color to use in label', 'str', ''],
    'display': ['Display context in UI', ['priority', 'tag', 'subtag',
                                          'archive', 'invisible'], 'tag'],
    'display_order': ['Order in lists', 'float', 0],
    'parent': ['ID of parent tag, if any', 'str', ''],

    # Outdated crap
    'hides_flag': ['DEPRECATED', 'ignore', None],
    'write_flag': ['DEPRECATED', 'ignore', None],
}, {}])
예제 #2
0
_plugins.register_config_section(
    'tags',
    [
        "Tags",
        {
            'name': ['Tag name', 'str', ''],
            'slug': ['URL slug', 'slashslug', ''],

            # Functional attributes
            'type': [
                'Tag type',
                [
                    'tag',
                    'group',
                    'attribute',
                    'unread',
                    'inbox',
                    'search',
                    # Maybe TODO: 'folder', 'shadow',
                    'profile',
                    'mailbox',  # Accounts, Mailboxes
                    'drafts',
                    'blank',
                    'outbox',
                    'sent',  # composing and sending
                    'replied',
                    'fwded',
                    'tagged',
                    'read',
                    'ham',  # behavior tracking tags
                    'trash',
                    'spam'  # junk mail tags
                ],
                'tag'
            ],
            'flag_hides':
            ['Hide tagged messages from searches?', 'bool', False],
            'flag_editable':
            ['Mark tagged messages as editable?', 'bool', False],
            'flag_msg_only':
            ['Never apply to entire conversations', 'bool', False],

            # Tag display attributes for /in/tag or searching in:tag
            'template': ['Default tag display template', 'str', 'index'],
            'search_terms':
            ['Terms to search for on /in/tag/', 'str', 'in:%(slug)s'],
            'search_order': ['Default search order for /in/tag/', 'str', ''],
            'magic_terms': ['Extra terms to search for', 'str', ''],

            # Tag display attributes for search results/lists/UI placement
            'icon': ['URL to default tag icon', 'str', 'icon-tag'],
            'label': ['Display as label in results', 'bool', True],
            'label_color': ['Color to use in label', 'str', '#4D4D4D'],
            'display': [
                'Display context in UI',
                ['priority', 'tag', 'subtag', 'archive', 'invisible'], 'tag'
            ],
            'display_order': ['Order in lists', 'float', 0],
            'parent': ['ID of parent tag, if any', 'str', '']
        },
        {}
    ])
예제 #3
0
TAGGERS = {}
TRAINERS = {}

AUTO_TAG_CONFIG = {
    'match_tag': ['Tag we are adding to automatically', str, ''],
    'unsure_tag': ['If unsure, add to this tag', str, ''],
    'exclude_tags': ['Tags on messages we should never match (ham)', str, []],
    'ignore_kws': ['Ignore messages with these keywords', str, []],
    'corpus_size': ['How many messages do we train on?', int, 1200],
    'threshold': ['Size of the sure/unsure ranges', float, 0.1],
    'tagger': ['Internal class name or |shell command', str, ''],
    'trainer': ['Internal class name or |shell commant', str, '']
}

_plugins.register_config_section('prefs', 'autotag',
                                 ["Auto-tagging", AUTO_TAG_CONFIG, []])


def at_identify(at_config):
    return md5_hex(at_config.match_tag, at_config.tagger,
                   at_config.trainer)[:12]


def autotag_configs(config):
    done = []
    for at_config in config.prefs.autotag:
        yield at_config
        done.append(at_config.match_tag)
    for tid, tag_info in config.tags.iteritems():
        auto_tagging = tag_info.auto_tag
        if (tid not in done
예제 #4
0
from mailpile.i18n import ngettext as _n
from mailpile.mailutils import Email
from mailpile.plugins import PluginManager
from mailpile.smtp_client import sha512_512kCheck, sha512_512kCollide
from mailpile.smtp_client import SMTORP_HASHCASH_RCODE, SMTORP_HASHCASH_FORMAT
from mailpile.util import *


_plugins = PluginManager(builtin=__file__)


##[ Configuration ]##########################################################

_plugins.register_config_section(
    'sys', 'smtpd', [_('SMTP Daemon'), False, {
        'host': (_('Listening host for SMTP daemon'), 'hostname', 'localhost'),
        'port': (_('Listening port for SMTP daemon'), int, 0),
    }])


class SMTPChannel(smtpd.SMTPChannel):
    MAX_MESSAGE_SIZE = 1024 * 1024 * 50
    HASHCASH_WANT_BITS = 8  # Only 128-or-so expensive sha512_512k ops
    HASHCASH_URL = 'https://www.mailpile.is/hashcash/'

    def __init__(self, session, *args, **kwargs):
        smtpd.SMTPChannel.__init__(self, *args, **kwargs)
        self.session = session
        # Lie lie lie lie...
        self.__fqdn = 'cs.utah.edu'
        self.too_much_data = False
예제 #5
0
from mailpile.util import *

_plugins = PluginManager(builtin=__file__)

##[ Configuration ]###########################################################

TAGGERS = {}
TRAINERS = {}

_plugins.register_config_section('prefs', 'autotag', [
    "Auto-tagging", {
        'match_tag': ['Tag we are adding to automatically', str, ''],
        'unsure_tag': ['If unsure, add to this tag', str, ''],
        'exclude_tags':
        ['Tags on messages we should never match (ham)', str, []],
        'ignore_kws': ['Ignore messages with these keywords', str, []],
        'corpus_size': ['How many messages do we train on?', int, 1200],
        'threshold': ['Size of the sure/unsure ranges', float, 0.1],
        'tagger': ['Internal class name or |shell command', str, ''],
        'trainer': ['Internal class name or |shell commant', str, ''],
    }, []
])


def at_identify(at_config):
    return md5_hex(at_config.match_tag, at_config.tagger,
                   at_config.trainer)[:12]


class AutoTagger(object):
    def __init__(self, tagger, trainer):
예제 #6
0
_plugins.register_config_section('tags', ["Tags", {
    'name': ['Tag name', 'str', ''],
    'slug': ['URL slug', 'slashslug', ''],

    # Functional attributes
    'type': ['Tag type', [
        'tag', 'group', 'attribute', 'unread', 'inbox', 'search',
        # Maybe TODO: 'folder', 'shadow',
        'profile', 'mailbox',                         # Accounts, Mailboxes
        'drafts', 'blank', 'outbox', 'sent',          # composing and sending
        'replied', 'fwded', 'tagged', 'read', 'ham',  # behavior tracking tags
        'trash', 'spam'                               # junk mail tags
    ], 'tag'],
    'flag_hides': ['Hide tagged messages from searches?', 'bool', False],
    'flag_editable': ['Mark tagged messages as editable?', 'bool', False],
    'flag_msg_only': ['Never apply to entire conversations', 'bool', False],

    # Tag display attributes for /in/tag or searching in:tag
    'template': ['Default tag display template', 'str', 'index'],
    'search_terms': ['Terms to search for on /in/tag/', 'str', 'in:%(slug)s'],
    'search_order': ['Default search order for /in/tag/', 'str', ''],
    'magic_terms': ['Extra terms to search for', 'str', ''],

    # Tag display attributes for search results/lists/UI placement
    'icon': ['URL to default tag icon', 'str', 'icon-tag'],
    'label': ['Display as label in results', 'bool', True],
    'label_color': ['Color to use in label', 'str', '#4D4D4D'],
    'display': ['Display context in UI', ['priority', 'tag', 'subtag',
                                          'archive', 'invisible'], 'tag'],
    'display_order': ['Order in lists', 'float', 0],
    'parent': ['ID of parent tag, if any', 'str', ''],

    # Automation settings
    'auto_after': ['After N days, perform automatic action', 'int', 0],
    'auto_action': ['Action to perform', 'str', ''],
    'auto_tag': ['Enable machine-learning for this tag', 'str', '']
}, {}])
예제 #7
0
_plugins.register_config_section(
    'tags',
    [
        "Tags",
        {
            'name': ['Tag name', 'str', ''],
            'slug': ['URL slug', 'slashslug', ''],

            # Functional attributes
            'type': [
                'Tag type',
                [
                    'tag',
                    'group',
                    'attribute',
                    'unread',
                    # Maybe TODO: 'folder', 'shadow',
                    'drafts',
                    'blank',
                    'outbox',
                    'sent',  # composing and sending
                    'replied',
                    'fwded',
                    'tagged',
                    'read',
                    'ham',  # behavior tracking tags
                    'trash',
                    'spam'  # junk mail tags
                ],
                'tag'
            ],
            'flag_hides': ['Hide tagged messages from searches?', bool, False],
            'flag_editable':
            ['Mark tagged messages as editable?', bool, False],

            # Tag display attributes for /in/tag or searching in:tag
            'template': ['Default tag display template', 'str', 'index'],
            'search_terms': ['Terms to search for', 'str', 'in:%(slug)s'],
            'search_order': ['Default search order', 'str', ''],

            # Tag display attributes for search results/lists/UI placement
            'icon': ['URL to default tag icon', 'url', ''],
            'label': ['Display as label in results', bool, True],
            'label_color': ['Color to use in label', 'str', ''],
            'display': [
                'Display context in UI',
                ['priority', 'tag', 'subtag', 'archive', 'invisible'], 'tag'
            ],
            'display_order': ['Order in lists', float, 0],
            'parent': ['ID of parent tag, if any', str, ''],

            # Outdated crap
            'hides_flag': ['DEPRECATED', 'ignore', None],
            'write_flag': ['DEPRECATED', 'ignore', None],
        },
        {}
    ])
예제 #8
0
from mailpile.i18n import ngettext as _n
from mailpile.mailutils import Email
from mailpile.plugins import PluginManager
from mailpile.smtp_client import sha512_512kCheck, sha512_512kCollide
from mailpile.smtp_client import SMTORP_HASHCASH_RCODE, SMTORP_HASHCASH_FORMAT
from mailpile.util import *


_plugins = PluginManager(builtin=__file__)


##[ Configuration ]##########################################################

_plugins.register_config_section(
    'sys', 'smtpd', [_('SMTP Daemon'), False, {
        'host': (_('Listening host for SMTP daemon'), 'hostname', 'localhost'),
        'port': (_('Listening port for SMTP daemon'), int, 0),
    }])


class SMTPChannel(smtpd.SMTPChannel):
    MAX_MESSAGE_SIZE = 1024 * 1024 * 50
    HASHCASH_WANT_BITS = 8  # Only 128-or-so expensive sha512_512k ops
    HASHCASH_URL = 'https://www.mailpile.is/hashcash/'

    def __init__(self, session, *args, **kwargs):
        smtpd.SMTPChannel.__init__(self, *args, **kwargs)
        self.session = session
        # Lie lie lie lie...
        self.__fqdn = 'cs.utah.edu'
        self.too_much_data = False
예제 #9
0
_ = lambda s: s
_plugins = PluginManager(builtin=__file__)


##[ Configuration ]###########################################################

_plugins.register_config_section(
    'oauth', ['OAuth configuration and state', False, {
        'providers': ('Known OAuth providers', {
            'protocol':      ('OAuth* protocol', str, ''),
            'server_re':     ('Regular expression to match servers', str, ''),
            'client_id':     ('The OAuth Client ID', str, ''),
            'client_secret': ('The OAuth token itself', str, ''),
            'token_url':     ('The OAuth token endpoint', str, ''),
            'oauth_url':     ('The OAuth authentication endpoint', str, ''),
        }, {}),

        'tokens': ('Current OAuth tokens', {
            'provider':      ('Provider ID', str, ''),
            'access_token':  ('Access token', str, ''),
            'token_type':    ('Access token type', str, ''),
            'expires_at':    ('Access token expiration time', int, 0),
            'refresh_token': ('Refresh token', str, '')
        }, {})
    }])


##[ Commands ]################################################################

class OAuth2(TestableWebbable):
    SYNOPSIS = (None, None, 'setup/oauth2', None)
예제 #10
0
파일: autotag.py 프로젝트: 4myPAL/Mailpile

_plugins = PluginManager(builtin=__file__)


##[ Configuration ]###########################################################

TAGGERS = {}
TRAINERS = {}

_plugins.register_config_section(
    'prefs', 'autotag', ["Auto-tagging", {
        'match_tag': ['Tag we are adding to automatically', str, ''],
        'unsure_tag': ['If unsure, add to this tag', str, ''],
        'exclude_tags': ['Tags on messages we should never match (ham)',
                         str, []],
        'ignore_kws': ['Ignore messages with these keywords', str, []],
        'corpus_size': ['How many messages do we train on?', int, 1000],
        'threshold': ['Size of the sure/unsure ranges', float, 0.1],
        'tagger': ['Internal class name or |shell command', str, ''],
        'trainer': ['Internal class name or |shell commant', str, ''],
    }, []])


def at_identify(at_config):
    return md5_hex(at_config.match_tag,
                   at_config.tagger,
                   at_config.trainer)[:12]


class AutoTagger(object):
    def __init__(self, tagger, trainer):
예제 #11
0
파일: autotag.py 프로젝트: DaLynX/Mailpile
TAGGERS = {}
TRAINERS = {}

AUTO_TAG_DISABLED = (None, False, '', 'off', 'false', 'fancy', 'builtin')

AUTO_TAG_CONFIG = {
    'match_tag': ['Tag we are adding to automatically', str, ''],
    'unsure_tag': ['If unsure, add to this tag', str, ''],
    'exclude_tags': ['Tags on messages we should never match (ham)', str, []],
    'ignore_kws': ['Ignore messages with these keywords', str, []],
    'corpus_size': ['How many messages do we train on?', int, 1200],
    'threshold': ['Size of the sure/unsure ranges', float, 0.1],
    'tagger': ['Internal class name or |shell command', str, ''],
    'trainer': ['Internal class name or |shell commant', str, '']}

_plugins.register_config_section(
    'prefs', 'autotag', ["Auto-tagging", AUTO_TAG_CONFIG , []])


def at_identify(at_config):
    return md5_hex(at_config.match_tag,
                   at_config.tagger,
                   at_config.trainer)[:12]


def autotag_configs(config):
    done = []
    for at_config in config.prefs.autotag:
        yield at_config
        done.append(at_config.match_tag)

    taggers = [k for k in TAGGERS.keys() if k != '_default']
예제 #12
0
파일: tags.py 프로젝트: kitsuta/Mailpile
_plugins.register_config_section(
    "tags",
    [
        "Tags",
        {
            "name": ["Tag name", "str", ""],
            "slug": ["URL slug", "slashslug", ""],
            # Functional attributes
            "type": [
                "Tag type",
                [
                    "tag",
                    "group",
                    "attribute",
                    "unread",
                    "inbox",
                    # Maybe TODO: 'folder', 'shadow',
                    "profile",
                    "mailbox",  # Accounts, Mailboxes
                    "drafts",
                    "blank",
                    "outbox",
                    "sent",  # composing and sending
                    "replied",
                    "fwded",
                    "tagged",
                    "read",
                    "ham",  # behavior tracking tags
                    "trash",
                    "spam",  # junk mail tags
                ],
                "tag",
            ],
            "flag_hides": ["Hide tagged messages from searches?", "bool", False],
            "flag_editable": ["Mark tagged messages as editable?", "bool", False],
            "flag_msg_only": ["Never apply to entire conversations", "bool", False],
            # Tag display attributes for /in/tag or searching in:tag
            "template": ["Default tag display template", "str", "index"],
            "search_terms": ["Terms to search for on /in/tag/", "str", "in:%(slug)s"],
            "search_order": ["Default search order for /in/tag/", "str", ""],
            "magic_terms": ["Extra terms to search for", "str", ""],
            # Tag display attributes for search results/lists/UI placement
            "icon": ["URL to default tag icon", "str", "icon-tag"],
            "label": ["Display as label in results", "bool", True],
            "label_color": ["Color to use in label", "str", "#4D4D4D"],
            "display": ["Display context in UI", ["priority", "tag", "subtag", "archive", "invisible"], "tag"],
            "display_order": ["Order in lists", "float", 0],
            "parent": ["ID of parent tag, if any", "str", ""],
        },
        {},
    ],
)
예제 #13
0
파일: oauth.py 프로젝트: mailpile/Mailpile
_ = lambda s: s
_plugins = PluginManager(builtin=__file__)


##[ Configuration ]###########################################################

_plugins.register_config_section(
    'oauth', ['OAuth configuration and state', False, {
        'providers': ('Known OAuth providers', {
            'protocol':      ('OAuth* protocol', str, ''),
            'server_re':     ('Regular expression to match servers', str, ''),
            'client_id':     ('The OAuth Client ID', str, ''),
            'client_secret': ('The OAuth token itself', str, ''),
            'redirect_re':   ('Regexp of URLs we can redirect to', str, ''),
            'token_url':     ('The OAuth token endpoint', str, ''),
            'oauth_url':     ('The OAuth authentication endpoint', str, ''),
        }, {}),

        'tokens': ('Current OAuth tokens', {
            'provider':      ('Provider ID', str, ''),
            'access_token':  ('Access token', str, ''),
            'token_type':    ('Access token type', str, ''),
            'expires_at':    ('Access token expiration time', int, 0),
            'refresh_token': ('Refresh token', str, '')
        }, {})
    }])


##[ Commands ]################################################################

class OAuth2(TestableWebbable):
    SYNOPSIS = (None, None, 'setup/oauth2', None)