--- pvpgn-1.7.4/src/bnetd/command.c 2006/06/06 03:41:37 1.1 +++ pvpgn-1.7.4/src/bnetd/command.c 2006/06/24 09:19:06 1.2 @@ -107,6 +107,9 @@ #include "clan.h" #include "common/setup_after.h" +#ifndef CHAR_STATUS_DUMP_FILE +# define CHAR_STATUS_DUMP_FILE "/tmp/d2charstatus.dat" +#endif static char const * bnclass_get_str(unsigned int class); static void do_whisper(t_connection * user_c, char const * dest, char const * text); @@ -337,6 +340,7 @@ static int _handle_unwatchall_command(t_ static int _handle_lusers_command(t_connection * c, char const * text); static int _handle_news_command(t_connection * c, char const * text); static int _handle_games_command(t_connection * c, char const * text); +static int _handle_games_ext_command(t_connection * c, char const * text); static int _handle_channels_command(t_connection * c, char const * text); static int _handle_addacct_command(t_connection * c, char const * text); static int _handle_chpass_command(t_connection * c, char const * text); @@ -369,6 +373,7 @@ static int _handle_commandgroups_command static int _handle_topic_command(t_connection * c, char const * text); static int _handle_moderate_command(t_connection * c, char const * text); static int _handle_clearstats_command(t_connection * c, char const * text); +static int _handle_char_status_command(t_connection * c, char const *text); static const t_command_table_row standard_command_table[] = { @@ -414,6 +419,7 @@ static const t_command_table_row standar { "/kick" , _handle_kick_command }, { "/ban" , _handle_ban_command }, { "/unban" , _handle_unban_command }, + { "/charstatus" , _handle_char_status_command }, { NULL , NULL } @@ -432,6 +438,7 @@ static const t_command_table_row extende { "/lusers" , _handle_lusers_command }, { "/news" , _handle_news_command }, { "/games" , _handle_games_command }, + { "/games_ext" , _handle_games_ext_command }, { "/channels" , _handle_channels_command }, { "/chs" , _handle_channels_command }, { "/addacct" , _handle_addacct_command }, @@ -2747,6 +2754,10 @@ static int _glist_cb(t_game *game, void { struct glist_cb_struct *cbdata = (struct glist_cb_struct*)data; + // Skip void game + if (game_get_ref(game) == 0) + return 0; + if ((!cbdata->tag || !prefs_get_hide_pass_games() || game_get_flag(game) != game_flag_private) && (!cbdata->tag || game_get_clienttag(game)==cbdata->tag) && (cbdata->diff==game_difficulty_none || game_get_difficulty(game)==cbdata->diff)) @@ -4639,3 +4650,129 @@ static int _handle_clearstats_command(t_ return 0; } + +static int _glist_cb_ext(t_game *game, void *data) +{ + t_connection * owner_conn = NULL; + t_account * owner_account = NULL; + const char * owner_email = NULL; + + struct glist_cb_struct *cbdata = (struct glist_cb_struct*)data; + + // Skip void game + if (game_get_ref(game) == 0) + return 0; + + if (owner_conn = game_get_owner(game)) { + if (owner_account = conn_get_account(owner_conn)) { + owner_email = account_get_email(owner_account); + } + } + + sprintf(msgtemp," %-16.16s %-16.16s %1.1s %-8.8s %-21.21s %5u %-16.16s %-25.25s", + game_get_name(game), + game_get_pass(game), + game_get_flag(game) != game_flag_private ? "n":"y", + game_status_get_str(game_get_status(game)), + game_type_get_str(game_get_type(game)), + game_get_ref(game), + account_get_name(owner_account), + owner_email ? owner_email : "Unknown"); + + if (!cbdata->tag) + { + + strcat(msgtemp,clienttag_uint_to_str(game_get_clienttag(game))); + strcat(msgtemp," "); + } + + strcat(msgtemp, addr_num_to_addr_str(game_get_addr(game),game_get_port(game))); + strcat(msgtemp, " "); + strcat(msgtemp, owner_email ? owner_email : "Unknown"); + + message_send_text(cbdata->c,message_type_info,cbdata->c,msgtemp); + + return 0; +} + +static int _handle_games_ext_command(t_connection * c, char const *text) +{ + unsigned int i; + unsigned int j; + char clienttag_str[5]; + char dest[5]; + struct glist_cb_struct cbdata; + + for (i=0; text[i]!=' ' && text[i]!='\0'; i++); /* skip command */ + for (; text[i]==' '; i++); + for (j=0; text[i]!=' ' && text[i]!='\0'; i++) /* get dest */ + if (j