def get_client_actions(request, caller_context, container_user):
    actions = {}
    
    #make sure we have a character
    if not container_user.character:
        actions['promptForCharacter'] = container_user.display_name
        return json_response(caller_context, container_user, actions, False)

    # check for daily gold bonus
    characterController = CharacterController()
    daily_gold = characterController.check_daily_reward(container_user)
    if daily_gold > 0:
        actions['dailyGold'] = daily_gold

    # get invites
    pyramidController = PyramidController()
    invited_pyramid_ids, invites = pyramidController.get_invited_pyramid_ids(container_user, True)
    if invites:
        actions['invites'] = {}
        for invite in invites:
            actions['invites'][invite.key().name()] = { "character_name" : invite.inviter_character.character_name, 
                                                        "inviterUrl" : invite.inviter_character.image_url }
            #startupJs += 'addToInviteQueue("%s", "%s", "%s");\n' % (invite.key().name(), invite.inviter_character.character_name, invite.inviter_character.image_url)
            
    # check for messages to player
    popup_messages = characterController.get_messages(container_user.character, 20, popup=True, unread=True)
    if popup_messages:
        actions['messages'] = {}
        for message in popup_messages:
            actions['messages'][message.key().name()] = { "title": message.title, 
                                                          "body" : message.body}
    characterController.mark_messages_read(popup_messages) # messages may not have actually been read, this would be better if confirmed via ajax callback
    
    if container_user.character.tutorial_on:
        actions["showTutorial"] = True

    include_experience_data = True
    return json_response(caller_context, container_user, actions, include_experience_data)
def messages(request, caller_context, container_user, page=1):
    characterController = CharacterController()
    messages = characterController.get_messages(container_user.character, 30)
    return render_to_response('messages.html', locals())