コード例 #1
0
def proto_update_types():
    global protocols
    global improtocols
    global emailprotocols
    global socialprotocols
    improtocols.update(     protos_of_type('im')     )
    emailprotocols.update(  protos_of_type('email')  )
    socialprotocols.update( protos_of_type('social') )

    improtocols.pop('digsby', None) #incase updates do something funny.

    popularity_key = lambda d: d.get('popularity') #default None

    improtocols.sort_values(key=popularity_key, reverse=True)
    emailprotocols.sort_values(key=popularity_key, reverse=True)
    socialprotocols.sort_values(key=popularity_key, reverse=True)

    global fix_shortname
    fix_shortname = dict((v.name_truncated, k) for k,v in protocols.items())

    # make sure protos can talk to themselves
    for name, proto in protocols.items():
        proto['compatible'] = set(proto.setdefault('compatible', ()))
        proto['compatible'].add(name)

    # given a service, which services can we talk to?
    global SERVICE_MAP
    SERVICE_MAP = dict((k, sorted(protocols[k].get('compatible', []), key=(lambda x: x!=k))) for k in protocols)

    # given a buddy service, which protocols can talk to it
    global REVERSE_SERVICE_MAP
    REVERSE_SERVICE_MAP = RSM = dict()
    for k in SERVICE_MAP.keys():

        for i in SERVICE_MAP[k]:
            if i not in RSM:
                RSM[i] = []
            if k not in RSM[i]:
                RSM[i].append(k)
コード例 #2
0
def compatible(*protos):
    for p1 in protos:
        for p2 in protos:
            compat = protocols[p1].setdefault('compatible', set())
            compat.add(p2)
コード例 #3
0
        smtp_server = '',
        smtp_username = '',
        smtp_password = u'',
        email_address = '',
)

pop_defaults = dict(popport     = 110,
                    popport_ssl = 995,
                    require_ssl = False)

imap_defaults = dict(imapport         = 143,
                     imapport_ssl     = 993,
                     default_ssl_port = 993, #TODO: replace uses of this with the more standardly named imapport_ssl
                     require_ssl      = False)

update_mixin_opts   = set(['enabled', 'updatefreq', 'alias'])
email_accounts_opts = update_mixin_opts
smtp_acct_opts      = email_accounts_opts | set('smtp_server smtp_port smtp_require_ssl smtp_username email_address'.split())
imap_acct_opts      = smtp_acct_opts | set('imapserver imapport require_ssl'.split())
social_net_opts     = update_mixin_opts - set(['updatefreq'])

protocols = oS()

protocols.digsby = S(
      service_provider = 'dotsyntax',
      name = 'Digsby',
      name_truncated = 'digs',
      path = 'digsby.protocol',
      username_desc = 'Digsby ID',
      newuser_url = 'http://www.digsby.com',
      password_url = 'http://www.digsby.com',