diff --git a/src/players.c b/src/players.c index dc5eaa2..1e98a83 100644 --- a/src/players.c +++ b/src/players.c @@ -59,6 +59,23 @@ wmud_player_exists(gchar *player_name) } +wmudPlayer * +wmud_player_dup(wmudPlayer *player) +{ + wmudPlayer *new_player; + + if (!player) + return NULL; + + new_player = g_new0(wmudPlayer, 1); + new_player->id = player->id; + new_player->player_name = g_strdup(player->player_name); + new_player->cpassword = g_strdup(player->cpassword); + new_player->email = g_strdup(player->email); + + return new_player; +} + void wmud_player_free(wmudPlayer **player) { diff --git a/src/players.h b/src/players.h index a9cdbb9..b3373bc 100644 --- a/src/players.h +++ b/src/players.h @@ -28,5 +28,6 @@ extern GSList *players; gboolean wmud_player_auth(wmudClient *client); wmudPlayer *wmud_player_exists(gchar *player_name); void wmud_player_free(wmudPlayer **player); +wmudPlayer *wmud_player_dup(wmudPlayer *player); #endif /* __WMUD_PLAYERS_H__ */