/*
 * playerlist.h
 * 
 * Copyright (C) 2006-2007  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 NETBOARD_PLAYERLIST_H
#define NETBOARD_PLAYERLIST_H


typedef void (*PL_UPDATE_CALLBACK)(void);

void playerlist_init(void);
void playerlist_set_update_callback(PL_UPDATE_CALLBACK callback);
void playerlist_set_keep_roles(int keep);

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_state(const char *address, int state, const char *description);
int playerlist_update_connected(const char *address, int state);
int playerlist_update_connected_all(int state);

int playerlist_remove(const char *address);
int playerlist_remove_all(void);
int playerlist_clean(int not_connected_only, int no_role_only);

int playerlist_get(const char *address, char **nick, char **role, char **score, char **conn_stat, int *state, char **description, int *connected);
const char *playerlist_get_nick(const char *address);
int playerlist_list(int *iter, char **address, char **nick, char **role, char **score, char **conn_stat, int *state, char **description, int *connected);

void playerlist_clear_state(void);
void playerlist_clear_game_info(void);
int playerlist_have_all_states(const int *state_mask, int state_mask_len);

#endif

