/*
 * playerlist.h
 * 
 * Copyright (C) 2006  Josef Kufner <jk@myserver.cz>
 * 
 * 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.
 *
 */
#ifndef JK_PLAYERLIST_H
#define JK_PLAYERLIST_H


typedef enum {
	PL_NONE,	/* undefined state */
	PL_OFFLINE,	/* player is offline */
	PL_ONLINE,	/* player is online */
	PL_READY,	/* player is online and had pressed the start button */
	PL_MAX	
} PL_STATUS;

typedef void (*PL_UPDATE_CALLBACK)(void);

void playerlist_init(void);
void playerlist_set_update_callback(PL_UPDATE_CALLBACK callback);
int playerlist_add(const char *address);
int playerlist_update(const char *address, const char *nick, const char *role, const char *score, const char *conn_stat);
int playerlist_update_ack(const char *address, int ack);
int playerlist_remove(const char *address);
int playerlist_remove_all(void);
int playerlist_get(const char *address, char **nick, char **role, char **score, char **conn_stat, int *ack);
int playerlist_list(int *iter, char **address, char **nick, char **role, char **score, char **conn_stat, int *ack);
void playerlist_clear_ack(void);
int playerlist_have_all_acks(int ack);

#endif

