Ejemplo n.º 1
0
def accept(userid, otherid):
    if check(userid, otherid):
        raise WeasylError("Unexpected")

    d.execute("UPDATE frienduser SET settings = REPLACE(settings, 'p', '')"
              " WHERE (userid, otherid) = (%i, %i)", [otherid, userid])
    welcome.frienduseraccept_insert(userid, otherid)
    welcome.frienduserrequest_remove(userid, otherid)
Ejemplo n.º 2
0
def accept(userid, otherid):
    if check(userid, otherid):
        raise WeasylError("Unexpected")

    d.execute("UPDATE frienduser SET settings = REPLACE(settings, 'p', '')"
              " WHERE (userid, otherid) = (%i, %i)", [otherid, userid])
    welcome.frienduseraccept_insert(userid, otherid)
    welcome.frienduserrequest_remove(userid, otherid)
Ejemplo n.º 3
0
def request(userid, otherid):
    if ignoreuser.check(otherid, userid):
        raise WeasylError("IgnoredYou")
    elif ignoreuser.check(userid, otherid):
        raise WeasylError("YouIgnored")

    if already_pending(otherid, userid):
        d.execute("UPDATE frienduser SET settings = REPLACE(settings, 'p', '') WHERE (userid, otherid) = (%i, %i)",
                  [otherid, userid])

        welcome.frienduseraccept_insert(userid, otherid)
        welcome.frienduserrequest_remove(userid, otherid)
    elif not already_pending(userid, otherid):
        d.execute("INSERT INTO frienduser VALUES (%i, %i)", [userid, otherid])

        welcome.frienduserrequest_remove(userid, otherid)
        welcome.frienduserrequest_insert(userid, otherid)
Ejemplo n.º 4
0
def request(userid, otherid):
    if ignoreuser.check(otherid, userid):
        raise WeasylError("IgnoredYou")
    elif ignoreuser.check(userid, otherid):
        raise WeasylError("YouIgnored")

    if d.execute("SELECT EXISTS (SELECT 0 FROM frienduser WHERE (userid, otherid) = (%i, %i) AND settings ~ 'p')",
                 [otherid, userid], options="bool"):
        d.execute("UPDATE frienduser SET settings = REPLACE(settings, 'p', '') WHERE (userid, otherid) = (%i, %i)",
                  [otherid, userid])

        welcome.frienduseraccept_insert(userid, otherid)
        welcome.frienduserrequest_remove(userid, otherid)
    elif not d.execute("SELECT EXISTS (SELECT 0 FROM frienduser WHERE (userid, otherid) = (%i, %i) AND settings ~ 'p')",
                       [userid, otherid], options="bool"):
        d.execute("INSERT INTO frienduser VALUES (%i, %i)", [userid, otherid])

        welcome.frienduserrequest_remove(userid, otherid)
        welcome.frienduserrequest_insert(userid, otherid)
Ejemplo n.º 5
0
def request(userid, otherid):
    if ignoreuser.check(otherid, userid):
        raise WeasylError("IgnoredYou")
    elif ignoreuser.check(userid, otherid):
        raise WeasylError("YouIgnored")

    if d.execute(
            "SELECT EXISTS (SELECT 0 FROM frienduser WHERE (userid, otherid) = (%i, %i) AND settings ~ 'p')",
        [otherid, userid],
            options="bool"):
        d.execute(
            "UPDATE frienduser SET settings = REPLACE(settings, 'p', '') WHERE (userid, otherid) = (%i, %i)",
            [otherid, userid])

        welcome.frienduseraccept_insert(userid, otherid)
        welcome.frienduserrequest_remove(userid, otherid)
    elif not d.execute(
            "SELECT EXISTS (SELECT 0 FROM frienduser WHERE (userid, otherid) = (%i, %i) AND settings ~ 'p')",
        [userid, otherid],
            options="bool"):
        d.execute("INSERT INTO frienduser VALUES (%i, %i)", [userid, otherid])

        welcome.frienduserrequest_remove(userid, otherid)
        welcome.frienduserrequest_insert(userid, otherid)