コード例 #1
0
ファイル: users.py プロジェクト: KobeCena/SMSRoulette
def connect(number):
    """Add @number to the set of waiting callers."""
    r.sadd('waiting', number)
    ok = linkup()
    if not ok:
        return build_sms("Please wait, you will be connected to a random person...")
    return ""
コード例 #2
0
ファイル: users.py プロジェクト: KobeCena/SMSRoulette
def call(number):
    """@number wishes to share the number with the other person."""
    if not r.exists(number):
        return build_sms("Error: You haven't connected to anyone yet.")
    peer_number = r.get(number)
    send_sms(peer_number, "The other person has shared their number: %s" % (number))
    return ""
コード例 #3
0
ファイル: users.py プロジェクト: jvimal/SMSRoulette
def call(number):
    """@number wishes to share the number with the other person."""
    if not r.exists(number):
        return build_sms("Error: You haven't connected to anyone yet.")
    peer_number = r.get(number)
    send_sms(peer_number,
             "The other person has shared their number: %s" % (number))
    return ""
コード例 #4
0
ファイル: users.py プロジェクト: jvimal/SMSRoulette
def connect(number):
    """Add @number to the set of waiting callers."""
    r.sadd('waiting', number)
    ok = linkup()
    if not ok:
        return build_sms(
            "Please wait, you will be connected to a random person...")
    return ""
コード例 #5
0
ファイル: users.py プロジェクト: KobeCena/SMSRoulette
def disconnect(number):
    """Remove @number from the set of waiting callers."""
    r.srem('waiting', number)
    peer = r.get(number)
    r.delete(number)
    if peer:
        r.delete(peer)
        send_sms(peer, "Your peer disconnected.")
    return build_sms("You've been disconnected and will no longer receive messages.")
コード例 #6
0
ファイル: users.py プロジェクト: jvimal/SMSRoulette
def disconnect(number):
    """Remove @number from the set of waiting callers."""
    r.srem('waiting', number)
    peer = r.get(number)
    r.delete(number)
    if peer:
        r.delete(peer)
        send_sms(peer, "Your peer disconnected.")
    return build_sms(
        "You've been disconnected and will no longer receive messages.")
コード例 #7
0
ファイル: app.py プロジェクト: jvimal/SMSRoulette
def make_sms_response(text):
    response = make_response(build_sms(text))
    response.headers['Content-Type'] = 'text/xml'
    return response