Ejemplo n.º 1
0
def setMsg(id, topic, user, fn, photo, private, auth, anon, mode):
    return pb.ClientMsg(set=pb.ClientSet(
        id=str(id),
        topic=topic,
        query=pb.SetQuery(desc=pb.SetDesc(default_acs=pb.DefaultAcsMode(
            auth=auth, anon=anon),
                                          public=make_vcard(fn, photo),
                                          private=private),
                          sub=pb.SetSub(user_id=user, mode=mode))))
Ejemplo n.º 2
0
def accMsg(id, user, scheme, secret, uname, password, do_login, tags, fn, photo, private, auth, anon):
    if secret == None and uname != None:
        if password == None:
            password = ''
        secret = str(uname) + ":" + str(password)
    return pb.ClientMsg(acc=pb.ClientAcc(id=str(id), user_id=user,
        scheme=scheme, secret=secret, login=do_login, tags=tags.split(",") if tags else None,
        desc=pb.SetDesc(default_acs=pb.DefaultAcsMode(auth=auth, anon=anon),
        public=make_vcard(fn, photo), private=private)))
Ejemplo n.º 3
0
def subMsg(id, topic, fn, photo, private, auth, anon, mode, tags, get_query):
    if get_query:
        get_query = pb.GetQuery(what=get_query.split(",").join(" "))
    public = encode_to_bytes(make_vcard(fn, photo))
    private = encode_to_bytes(private)
    return pb.ClientMsg(sub=pb.ClientSub(id=str(id), topic=topic,
        set_query=pb.SetQuery(
            desc=pb.SetDesc(public=public, private=private, default_acs=pb.DefaultAcsMode(auth=auth, anon=anon)),
            sub=pb.SetSub(mode=mode),
            tags=tags.split(",") if tags else None), get_query=get_query))
Ejemplo n.º 4
0
def setMsg(id, topic, user, fn, photo, public, private, auth, anon, mode, tags):
    if public == None:
        public = encode_to_bytes(make_vcard(fn, photo))
    else:
        public = encode_to_bytes(public)
    private = encode_to_bytes(private)
    return pb.ClientMsg(set=pb.ClientSet(id=str(id), topic=topic,
        query=pb.SetQuery(
            desc=pb.SetDesc(default_acs=pb.DefaultAcsMode(auth=auth, anon=anon),
                public=public, private=private),
        sub=pb.SetSub(user_id=user, mode=mode),
        tags=tags)))
Ejemplo n.º 5
0
def accMsg(id, user, scheme, secret, uname, password, do_login, fn, photo, private, auth, anon, tags, cred):
    if secret == None and uname != None:
        if password == None:
            password = ''
        secret = str(uname) + ":" + str(password)
    if secret != None:
        secret=secret.encode('utf-8')
    public = encode_to_bytes(make_vcard(fn, photo))
    private = encode_to_bytes(private)
    return pb.ClientMsg(acc=pb.ClientAcc(id=str(id), user_id=user,
        scheme=scheme, secret=secret, login=do_login, tags=tags.split(",") if tags else None,
        desc=pb.SetDesc(default_acs=pb.DefaultAcsMode(auth=auth, anon=anon),
        public=public, private=private, cred=parse_cred(cred))))