예제 #1
0
파일: channel.py 프로젝트: paddycarey/mmotd
def relay_view(request):
    """
    Simply relays a message via the channel API to the given client
    """

    # get message details from post data
    token = request.POST['token']
    message = request.POST['message']
    # send channel message
    send_message(token, message)
    return HttpResponse('channel messages relayed')
예제 #2
0
파일: channel.py 프로젝트: paddycarey/mmotd
def game_relay_view(request, game_id):
    """
    Simple POST handler for relaying a message to all players in a game
    """

    game = Game.get_or_404(game_id)
    # ensure player sending message is in game
    if not request.user.user_id() in game.players:
        raise Http403
    # relay the message to everyone in the game
    send_message(game.players, request.body)
    return {'success': 'messages relayed'}
예제 #3
0
파일: channel.py 프로젝트: paddycarey/mmotd
def game_relay_view(request, game_id):
    """
    Simple POST handler for relaying a message to all players in a game
    """

    game = Game.get_or_404(game_id)
    # ensure player sending message is in game
    if not request.user.user_id() in game.players:
        raise Http403
    # relay the message to everyone in the game
    send_message(game.players, request.body)
    return {'success': 'messages relayed'}
예제 #4
0
파일: channel.py 프로젝트: paddycarey/mmotd
def relay_view(request):

    """
    Simply relays a message via the channel API to the given client
    """

    # get message details from post data
    token = request.POST['token']
    message = request.POST['message']
    # send channel message
    send_message(token, message)
    return HttpResponse('channel messages relayed')