// Emacs style mode select -*- C++ -*-
//------------------------------------------------------------------------
//
// Copyright(c) 2001, 2002 Simon Howard
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//--------------------------------------------------------------------------
//
// Abstracted UI Interface
//
// In Text Mode this just dumps the users found to stdout
// In Gtk this will update the trees etc
//
//--------------------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include "parse.h"
#include "scan.h"
#include "ui.h"

// this doesnt belong here but.... well pfft

void add_user(machine_t *machine, user_t *user)
{
        // add user to list
        
        if(machine->users)
                machine->users 
                        = realloc(machine->users, 
                                  sizeof(*machine->users) *
                                  (machine->num_users + 1));
        else
                machine->users
                        = malloc(sizeof(*machine->users));
        
        machine->users[machine->num_users++] = user;
        
        // add to gui
        
        ui_add_user(machine, user);
}

// set a machine as being down

void set_status(machine_t *machine, machinestatus_t status)
{
        machine->status = status;

        ui_set_status(machine, status);
}
